[BotW] Fix weather pack for legacy code patching

This uses a workaround for Cemu's legacy patching (so the backwards compatibility that Cemu provides for patches.txt file, and now defaults too even if Cemuhook is found) not allowing one to have symbols that refer to a memory address that's outside of the game's own executable memory.
This commit is contained in:
Crementif 2020-09-19 11:09:59 +02:00 committed by GitHub
parent d436a89494
commit 437a249be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,14 +6,14 @@ codeCaveSize = 0x20
# Constants
0x0000000 = .byte $weatherByte ; This address holds the value set by the presets
_weatherConst = 0x0000000 ; Makes a symbol of the value above
_weatherAddress = 0x3FF7DB24 ; This symbol points to the weather address
_weatherAddress = 0x1000DB24 ; This symbol points to the weather address
# Code that changes the weather address value.
# This code is executed each frame since there's too many addresses that mess with the original one, and changing those caused crashes. Shouldn't affect performance regardless.
_changeWeather = 0x00000004
0x0000004 = lis r6, _weatherConst@ha ; Load first half of the address to the "weather value"
0x0000008 = lbz r6, _weatherConst@l(r6) ; Use the first half of the "weather value" address to load the full value set by the current preset
0x000000C = lis r5, _weatherAddress@ha ; Load first half of the actual "weather address"
0x000000C = lis r5, 0x3FF7 ; Load first half of the actual "weather address"
0x0000010 = stb r6, _weatherAddress@l(r5) ; Store the "weather value" byte into the "weather address", using the first half of that address
0x0000014 = addi r6, r1, 0x18 ; Do the original instruction that got replaced by the code jump
0x0000018 = blr ; Return to the code before the code jump
@ -31,4 +31,4 @@ _changeWeather = 0x00000004
# .text:03668FEC stb r26, 0x18(r30)
# 2. Fast travel into an area where the weather isn't constant
# 3. After it hits the breakpoint, look at the register view and find the value after R30.
# 4. Use a hex calculator to add 0x18 to that address and you'll have the address.
# 4. Use a hex calculator to add 0x18 to that address and you'll have the address.