r/PokemonROMhacks • u/VagabondTruffle • 1h ago
Resource Protect ROMhacks from genAI decompilers! O-MVLL Obfuscating Compiler
TL;DR for non-technical users: this is a new modern compiler based on "the other guy" LLVM that no one uses (yet) but now lets developers protect their games from the decompilers using ChatGPT to datamine hacks, if they choose to use it
I've been working on this for a while and can finally say it's totally out! I was able to port a number of obfuscation techniques from O-MVLL:
- Local string encoding: users can't dump the text of your game, plotline, and new items/features using the laziest techniques such as running
strings(but a motivated dataminer can still use the local decoder, good luck you'll need a Ph.D LMAO) - Opaque boolean constants: various configurations and values are obscured from users trying to write mod-specific cheats
- Arithmetic rewriting: your game's logic in turns, menus, and scripts is impossible to dump in a meaningful way without similar counter-mitigations that are expensive and not worth it for a GBA ROMhack
- Basic block splitting: I set it to 20% which is stable on GBA in my tests; this makes it hard for decomplilers to navigate your control flow when reversing large functions similar to Arthimetic rewriting in a way
Actual "CFG flattening" is a bit beyond my skills right now but on the roadmap as I learn more. I had to teach myself more obfuscating compiler theory to make this happen. I sometimes work with others who decompile big retail Windows games, and by applying their wisdom to these tiny ROMhacks I think we've effectively protected the scene from reverse engineering for a little while.
I hope that in the wake of people decompiling things like Quetzal+ today we can see a return of truly secret ROMhacks we can explore and enjoy like the old days back when we had GameFAQs ... and they were GARBAGE half the time 😆 you had to learn the game for yourself, no cheats!
With regards to AI: I used a local model to port o-mvll from iOS/Android to GBA for this. No game code itself had to be modified, only makefiles and toolchain things. Full scope: the biggest problem it solved was fixing up iOS/Android-specific logic around the edges to backport to GBA and getting LLVM from upstream bootstrapped on picolibc (which does accept AI contributions, unlike GCC and AGBCC) so that I could re-use the optimizations from "RoseSilicon" who has dramatically improved LLVM performance on GBA specifically with picolibc to keep the runtime cost way down over arm-none-eabi-gcc (nanolib) and devkitARM (newlib) and other contributors upstream of me may have had agentic assistance (you'd have to ask her to start, not me). These are all technologies I've explored with LLMs since 2024 when I first worked on the "Eden Toolchain" and unofficial ports of Wonderful Toolchain for NDS and GBA, as well as meson-gba in Apotris.
Repos you can use today as a ROM hacker:
- https://github.com/ploppoke/gba-omvll
- https://github.com/ploppoke/o-mvll
- https://github.com/ploppoke/picolibc
- https://github.com/ploppoke/pokeemerald-fufufu
Full documentation in [OBFUSCATION.md]