Emulator Issues #8068


Invalidate JIT blocks that are modified by cheats

Added by CryZe92 almost 9 years ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


Game Name?
All Games (tested with The Legend of Zelda: The Wind Waker)

Game ID?

What's the problem? Describe what went wrong in few words.
JIT Blocks are usually not invalidated if they are changed by cheats, so cheats that modify already recompiled code won't work at all.

What did you expect to happen instead?
The cheats should invalidate JIT blocks that are modified by the cheats.

What steps will reproduce the problem?

  1. Write a simple cheat that modifies parts of the game loop based on some condition (controller input)
  2. Use the cheat to conditionally modify the game loop

Dolphin 3.5 and 3.5-367 are old versions of Dolphin that have
known issues and bugs, so don't report issues about them and test the
latest Dolphin version first.
Which versions of Dolphin did you test on?

Does using an older version of Dolphin solve your issue? If yes, which
versions of Dolphin used to work?
I don't think so

What are your PC specifications? (including, but not limited to: Operating
System, CPU and GPU)
Shouldn't matter

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)

Actions #1

Updated by magumagu9 almost 9 years ago

  • Status changed from New to Accepted
  • Easy set to Yes

It would be nice if you could provide an example cheat which demonstrates this issue.

This is probably a good first patch for someone looking to help improve Dolphin. The relevant code is in PatchEngine.cpp and ActionReplay.cpp; the code needs to call JitInterface::InvalidateICache whenever it writes to memory.

Actions #2

Updated by benrain almost 9 years ago

Hi, I've been looking to get helping out Dolphin for awhile now.

I'll go ahead and give this a look. I have a local dump of the game I can use.

Reproducible steps would be appreciated but I can go ahead and get started.

Actions #3

Updated by dantarion almost 9 years ago

I believe this may fix Project M as well.

Actions #4

Updated by benrain almost 9 years ago

I wrote the expected code yesterday for both scenarios; but I am still awaiting some reproducible steps. Not sure how to write or where to obtain cheats to test with.

Actions #5

Updated by CryZe92 almost 9 years ago

This one is one of them for Wind Waker NTSC-U (GZLE01)

hold A to walk through walls/sail through islands [wiiztec]
040A38D0 4BFFF86D
040A38E8 4BFFD9BD
283ED84A FEFF0100
040A38D0 60000000
040A38E8 60000000
E0000000 80008000

the 04 codes write into code area, so the cheat restores the original code in the first two lines and then conditionally overwrites it with NOPs in the fourth and fifth line.

Actions #6

Updated by benrain almost 9 years ago

Thanks, I'll test it out now!

Actions #7

Updated by JMC4789 almost 9 years ago

I have Project M to test if you do come up with a patch. Thanks.

Actions #8

Updated by magumagu9 almost 9 years ago

To clarify, this issue is about ActionReplay etc. codes... patched ISOs with invalidation issues are issue 7288.

Actions #9

Updated by benrain almost 9 years ago

Sorry for the lack of update; I was able to put forth the proposed solution invalidating the ICache; did not have any luck with it.

Actions #10

Updated by dantarion almost 9 years ago

The hilarious thing is that this code is made by the same person that made the codes in Project M that don't work in Dolphin! Ill take a stab at this this weekend

Actions #11

Updated by JMC4789 over 8 years ago

Anythign come of this? It sucks that Project M's codes don't work either, but at least we could fix our loader for people using Action Replay/Gecko Codes through dolphin.

Actions #12

Updated by CryZe92 over 8 years ago

Not yet, I'll work on this now I guess.

Actions #13

Updated by CryZe92 over 8 years ago

I got it to somewhat work, but there's still a slight delay :(
It looks like Invalidating the ICache only actually forces it to recompile every ~5 seconds. Any ideas?


Also available in: Atom PDF