diff --git a/Mods/BreathOfTheWild_Weather/patches.txt b/Mods/BreathOfTheWild_Weather/patches.txt index f38d7ae7..3799c380 100644 --- a/Mods/BreathOfTheWild_Weather/patches.txt +++ b/Mods/BreathOfTheWild_Weather/patches.txt @@ -1,23 +1,34 @@ [BotwV208] moduleMatches = 0x6267BFD0 -codeCaveSize = 0x14 +codeCaveSize = 0x20 # Constants -0x00000000 = .byte $weatherByte -_weatherConst = 0x00000000 +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 -# Code that changes the weather to our constant +# 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 -0x00000004 = lis r26, _weatherConst@ha -0x00000008 = lbz r26, _weatherConst@l(r26) -0x0000000C = stb r26, 0x18(r30) -0x00000010 = blr +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" +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 -0x3668FEC = bla _changeWeather +0x31FACD4 = bla _changeWeather -# Original Instructions -# .text:03668FE4 stfs f28, 0x14(r30) +# Disable original instructions that write the weather value, just because +0x3668FE8 = nop +0x3668FEC = nop + + +# How to find the memory address where the weather is stored (if it needs to be updated): +# 1. Make 1 breakpoint on one of the following instructions using Cemu's PPC debugger: # .text:03668FE8 stb r0, 0x19(r30) -# .text:03668FEC stb r26, 0x18(r30) # Here we jump to our code cave since it originally sets the weather byte in the game. -# .text:03668FF0 b loc_3669434 \ No newline at end of file +# .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. \ No newline at end of file diff --git a/Mods/BreathOfTheWild_Weather/rules.txt b/Mods/BreathOfTheWild_Weather/rules.txt index 790e5018..a7061d27 100644 --- a/Mods/BreathOfTheWild_Weather/rules.txt +++ b/Mods/BreathOfTheWild_Weather/rules.txt @@ -18,15 +18,15 @@ name = Raining (dark clouds and winds blowing) $weatherByte:int = 3 [Preset] -name = Clear weather (distant thunder) +name = Gray weather (no rain and dark clouds) $weatherByte:int = 6 [Preset] -name = Raining (thundering clouds) +name = Storm with thunder $weatherByte:int = 7 [Preset] -name = Raining (fog) +name = Fog and rain $weatherByte:int = 8 # If anyone finds accurate names for these, feel free to fill them in.