Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPS drastically falls down if i use cheat code with dynamic recompiler option enabled. #369

Open
GhostBelmont opened this issue Sep 5, 2020 · 3 comments

Comments

@GhostBelmont
Copy link

Hi,

i'm having a issue with the emulator, when i use some cheats from DeSmuME database and have the option dynamic recompiler enabled, the fps on the games drastically falls, as example, i was playing Castelvania Order of Ecclesia and when i enable infinite double jumps or infinite jumps, or other codes that alter in game option, the fps falls making the game unplayable. The same happens with Castlevania Portrait of Ruin, when i toggle the cheat infinite luck and try to change the equipment, the game almost freeze. If i turn the dynamic recompiler option off, this issue doesn't happens, but i can't play any DS roms on full fps.

I'm sending a image to exemplify the issue.
Thanks for the attention.

Beste regards.
Example

@zeromus
Copy link
Contributor

zeromus commented Sep 6, 2020

This is caused by the cheat writing to executable memory, causing the JIT to completely flush itself and regenerate--each frame.

The situation is discussed here: http://forums.desmume.org/viewtopic.php?pid=28538

It could be fixed by invalidating every basic block backwards from the patch address, up to "jit_max_block_size" rather than flushing the jit entirely. The thing is, this should have been easy, because the jit needs to do it internally for self-modifying code. However, it doesnt appear to be functioning properly. For instance if you look at the end of _MMU_ARM9_write32() you will see that only two instruction slots are cleared when the memory is written to. Shouldn't it "invalidate every basic block backwards from" the address? This makes me doubt some of the fundamental internal integrity of the JIT. Now, since it's slow, the cheats WORK, even if they're slow. If I try to make it work properly and the foundations are wrong, then I will fail to make it work properly.

This needs attention from someone who cares about jits. I do not want to take custody of maintaining desmume's JIT.

@Sirius-Black4
Copy link

How do you use cheats on the linux version? I just switched versions and the cheats Action Replay button isnt there. How do you enter the cheat code itself?

@zeromus
Copy link
Contributor

zeromus commented Sep 29, 2021

see #209 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants