Thanks!
The beta 15 'backend' is not really one per se, but I guess it could be one... I could describe it in few words as "tacking a large code cache that keeps track of code in GBA RAM even after it gets overwritten with new code".
It worked like this:
- gpSP allocates a Large Code Cache, 2 MiB, with a hashtable pointing into it.
- Game writes into Internal Work RAM or something, a 256-byte block.
- Game issues a branch into what it just wrote.
- gpSP makes MIPS code for as much of the target code as possible (slow), calculates a quick checksum for the GBA code, places a code reuse header into the Large Code Cache and makes a reference to it in the hashtable from [1].
- MIPS processor executes the code.
- Game returns into ROM to write different code into Internal Work RAM, then branches to it.
- gpSP consults the Large Code Cache after quickly calculating the checksum and finds that the newly-written code has not been seen yet. gpSP makes MIPS code for as much of the target as possible (slow) and updates the hashtable.
- Later, the game returns into ROM to write the same code as in [2].
- gpSP consults the Large Code Cache and, after quickly calculating the checksum, finds that the code written in [8] is the same as in [2], so it gives the MIPS processor the old code to execute, returning immediately.
And somehow step 9 is crashing.
My goal is not to
add to game_config.txt (automatic by ID), it's to
remove from it, if possible. Similarly, my goal is not to
add backends into the .plg, it's to make the current one as small and efficient as possible while being correct. Having a recompiler that crashes without explanation is no option to me, even if it makes some games run blazing fast. So I want one recompiler that runs correctly above all (which is why I reverted to beta 14), but then optimise it in a way that doesn't make games crash. Perhaps the Golden Suns won't be as fast as in beta 15 in a stabler recompiler, but the difference would be negligible, you could enjoy the Golden Suns and the other games wouldn't crash.
I've asked the Supercard Team for something to help me debug the Guru Meditation screens in the beta 15, but in parallel I'll be doing the above.
In layman's terms, the foundations are crumbling, and before I build something huge on top of it, I need to make sure the foundations are made to stop crumbling, and to be as light but robust as possible. Asking the occupants of the house to walk carefully when they're in one corner of the house is no option!