GeckoCode: Use named constants in ICache flush hack

Turns out one of the magic numbers was very magic. The gameid is
an ad-hoc comm protocol with HLE_Misc to control the number of times
the ICache is reset.
This commit is contained in:
EmptyChaos
2016-09-23 12:58:40 +00:00
parent 4fef9d8d64
commit 541a42a7e3
4 changed files with 26 additions and 11 deletions

View File

@ -33,6 +33,20 @@ public:
bool Exist(u32 address, u32 data) const;
};
// Installation address for codehandler.bin in the Game's RAM
constexpr u32 INSTALLER_BASE_ADDRESS = 0x80001800;
constexpr u32 ENTRY_POINT = 0x800018A8;
// This forms part of a communication protocol with HLE_Misc::HLEGeckoCodehandler.
// Basically, codehandleronly.s doesn't use ICBI like it's supposed to when patching the
// game's code. This results in the JIT happily ignoring all code patches for blocks that
// are already compiled. The hack for getting around that is that the first 5 frames after
// the handler is installed (0xD01F1BAD -> +5 -> 0xD01F1BB2) cause full ICache resets.
//
// HLEGeckoCodehandler will increment this value 5 times then cease flushing the ICache to
// preserve the emulation performance.
constexpr u32 MAGIC_GAMEID = 0xD01F1BAD;
void SetActiveCodes(const std::vector<GeckoCode>& gcodes);
void RunCodeHandler();