XXX4Fans
TopazTK from patreon
TopazTK

patreon


Re:Fined Development - Implementing Version Agnosticism.

Aight, 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:

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:

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:

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!


Related Creators