2020 May and June Progress Report
Thanks to Goldensunboy's great contribution,
the new patch feature coming out with our newest
beta-10 official build released in Github. for a long time, our dev branch cannot be PR to the
master main branch since the patch feature code, the hardest part, cannot be done and make the editor stable, but now it is finally finished and function much better than we thought at first. I would like to show some detials about it.
Normally, when we want to manually apply some asm hack to a gba rom, we need to reverse engeneer the rom first, and find the part of the code we want to modified. Then if the new functionality we want the game engine have can be directly modified on the original code, we only need to modify several bytes of asm in the rom, if it is not like that, and we want some completely new things happen in the game, and the space which the original code occupies cannot hold the new code, then we have to inject a long jump in that part, to jump out from the original code part, to some new address of free big spaces, and we write our new code there. so gba will jump out from that place to the new address, and run our new code, then jump back to run the following original game code. in this way, we can modify some game code we want but keep the other things same as usual.
The most headache part of making an asm hack is you have to write asm by yourself, which is really ineffective, and everytime, if your code cannot run well, you have to modified your asm code, which makes the whole thing more headache. And because of the ineffective, it it almost impossible to program some big things like overhaul a sprites AI, or make a boss which is completely new in the future. So goldensunboy came up with this idea to make an auto-patcher for the editor, to make it possible to let people write code in C (you can still use asm) and auto-patch your code into the rom somewhere. to use this new feature, you need to download the
GNU Embedded Toolchain for Arm by yourself.
During the time he implementing the new functionality, we feel it will be better to let users to customize the hook part, which will be injected into the original code to help jump out from the source code to excute the new code written by ourselves, so the size of the hook part can be size-flexible and you can do stack balancing and other things all by yourselves, and it can be used in multiple cases. We decided the format of the hook be one part of some hex which you need to hardcode by yourselves and can be different in different patches, then a pointer which the editor will generate when applying the patch, the third part is another part of some hex. You always need to input a Hook String for all of them, the pointer should be written with an escape character
P. Also, the first part and the third part of the hook even the
P can be non-necessary. So you can do something like replacing a pointer from a function pointer table, or apply several bytes of changes to the rom without jumping out to excute new code. You can even use some inline asm in your C code to get or set regesters and stacks, but this is compiler specified. Btw, all the patch address should be on the source code part, so you cannot apply a patch on another patch. And goldensunboy add identifiers check in the code file when loading them, so all the params in the dialog can be auto-loaded if there are some identifiers in the comment in the C code file. To use patches made by others, you even don't need to understand the detials of their code, and don't need to read their code file, you can directly apply it using the editor to some degree (if there is no conflict between patches).
Goldensunboy made it that all the patches you use the editor to inject into the rom removable. so it is flexible enough that you don't need to always develop the patch first, and apply them into the rom with hardcode address, then use the editor to edit other staff, so any corruption to the patch will currupt the rom. We don't have these problem. if you don't want some pathces anymore, you can remove it anytime you want.
It's a really exciting news that this finally came out, now we can dream about the future of wl4 hacks with all kinds of customized things, we reached a new stage in our community.
P.S. Goldensunboy said he will going to make some tutorials to help people making hacks and understand this feature soon, i think if you want to make your own patch, you still need to understand the reversen engeneering work on the rom we have done, and you need to be able to understand arm7 code and C programming language.