Re:Fined Development - Implementing Version Agnosticism.
Added 2025-07-24 23:43:42 +0000 UTCAight, this is going to be a long one folks!
If you have ever played a build of Re:Fined up to the current latest of v4.00, you will know that Re:Fined has to be made, catered, and built for every version of the game separately. This means that every version of every platform needs their own attention to get things done. Sadly, this gets exhausting, fast, and hinders development significantly.
"Now Topaz", you may ask, "Why do you NEED to do this thing? Can't you just use the same code for everything?"
Well I am getting to that but for the sake of the post let's assume I am in the past.
Well, sadly, no. This boils down to two very specific reasons:
Platform-Specific Code. Both Steam and EGS has their own set of instructions to handle platform specific aspects, and libraries to call for those aspects. For example, Steam needs to reference steam_api64.dll to handle Save Checksum, Achievements, DRM Verification, and the like. And EGS needs to reference EOSSDK-Win64-Shipping.dll (jeez, what a name). So I would need to build specific patches for those regardless.
Memory Differences. As usual, some aspects of versions and platforms differ, so the memory map for everything is always different from one another. This requires me to fetch and forge a new map for every new version, which slows things down a lot.
For instance, this is a snippet from Kingdom Hearts II - Re:Fined v4.00, showing what exactly goes on for the addresses we need to use.
Do keep in mind, this is just a snippet of the addresses. There is like, 3x the amount of the code shown here. So, not ideal at all.
Which brings us to the question: "Well, this is dumb! How do we account for this?"
Well, after much discussion with some people a bit smarter than I am, we basically boiled it down to 3 possibilities:
Pattern Scanning for Addresses: Pretty code, terrible execution. I would basically have to freeze the game to search for the addresses within the memory using predictive patterning. Can be done but would be extremely slow. If I wanted speed and accuracy, I could implement AI to do this. Y'all know how I feel about that so, uh, no.
External Cheat File: Does not actually solve anything at all. Makes code easy to read and allows me to modify addresses without recompiling. But again, does not fix the root issue.
Function Anchoring: Signature scan for core functions that contain references or pointers to the needed addresses (Ideally, none of these functions should EVER change.) Has the side effect of less-than-pretty code, but anything is better than the monstrosity you have seen above.
So, after much thinking, I decided to go with the third option. Re:Fined already implemented Signature Scanning in v3.00 for functions that are called by KH2-FML, so this would be easy to implement.
And it was! Below you can see how the addresses are parsed for the upcoming Kingdom Hearts I version of Re:Fined:
Basically, it boils down to these steps:
Using an external debugger like Cheat Engine, find any function that is short, unique enough to be signature scanned, and contains either a direct reference to the address we need or a pointer to it. (For an example, the screenshot posted below is a function that checks the Game Scene, and the Game Scene reference is highlighted.)

Calculate the start of the function to the instruction that has the reference and read the offset from it, then add the current offset in which the instruction ends and you have the address. (In the example above, it would be Read(FUNCTION + 0x78) + (FUNCTION + 0x7E) [0xF308, the location of the instruction - 0xF290, the start of the function, is 0x78. 0x78 + 0x06, the length of the instruction, is 0x7E.]
From here, we can refence the address in any way we want!
And, lo' and behold: It works! The latest KH1 BETA has been confirmed to work in 1.0.0.0 EGS all the way to the latest releases (In both WW and JP releases!) This truly lifts so much weight from my shoulders, but adds a new one:
WELL, WHAT ABOUT KINGDOM HEARTS II?
Heh. Heheh. Kingdom Hearts II. Right.
Kingdom Hearts I was not an issue to make this way, since I was just starting and it was a breeze to pick it up. However, Kingdom Hearts II is feature complete in my eyes and that means there are a lot, and I mean A LOT of addresses and pointers to account for. How many of them exactly?
Oh, just 81 of them. Not a lot, right? Well, these will add up!
If I am lucky, some functions will overlap and I will be able to just daisy-chain accordingly. But at the OWRST case scenario, that is 81 functions to meticulously search for, analyze, signaturize, and then implement.
Not. Fun.
As such, I have made a page on my notebook and I am slowly but surely going through EVERY. SINGLE. ADDRESS. to move them to this format. Conclusion? I want to die.
Yeah, not even close to being halfway done. But eh, I will only have to do this ONCE and I am done.
So basically, this is the way that I will be able to make Re:Fined work with everything and anything that is out there. Which is very, VERY cool. It will take me time to make it done, but that is something I am willing to work on.
In the next blog post, I will delve deeper into some of the struggles Kingdom Hearts II gave me with it's Magic System. So stick around for that, and thanks for reading my first blog on this! I do hope it was entertaining, I suck at writing these.
Until we meet again!