(03-06-2022, 05:15 AM)Modception Wrote: This is a crazy question, but what happens if you branch back to the first instruction the game is at when it loads (pause on start).
It seems to work! This code is working for the USA version of Wave Race:
Code:
// patch 480i mode
2834142e 00000280 // if 8034142e = 0280 (640 viWidth)
0634142e 00000002 // write 2 bytes to 8034142e:
02c00000 00000000 // 02c0 (704 viWidth)
// patch 480p mode
2834146a 00000280 // if 8034146a = 0280 (640 viWidth)
0634146a 00000002 // write 2 bytes to 8034146a:
02c00000 00000000 // 02c0 (704 viWidth)
// reset system
C0000000 00000002 // do 2 lines of ASM:
48000DA0 60000000 // branch ahead dA0 bytes to 80003100 (game's entry point)
4E800020 00000000 // "return" required by gecko
However the code assumes gecko will insert the ASM at da0 bytes before the game's entry point -- will this be true on all systems?
(03-06-2022, 05:15 AM)Modception Wrote: Also, I think the correct way to do a code branch (if there even is one) is to do a normal branch over a blr command, then the next blr should send you to the location the replaced blr pointed to.
Unless the game does a bl in between & the next blr will go there instead!
Perhaps we need to insert an address into the call stack with something like:
Code:
stwu sp, -0x0080 (sp)
I did manage to patch a function so that when it did its final blr, the call stack according to Dolphin was identical to no patches, but it still ended up in some weird memory section where it was doing an infinite loop of nops.
(03-06-2022, 05:15 AM)Modception Wrote: I feel like the people who do aspect ratio fixes should know how to do this.
Yeah I'm looking at Mario Sunshine's 16:9 code and it does contain a few branches, but I think it may only be branching within the function being patched. Branching outside to other functions may be a different ballgame.
Thanks again for the reset tip -- this should come in handy for other games as well.