cemu_graphic_packs/Mods/BreathOfTheWild_FPS++/patches.txt
Crementif c849e253e4 [BotW] Port arrow fix to FPS++
Based on epigramx's fixes, see https://www.youtube.com/watch?v=ILdMW9bgBM8 for a comparison.

Also, the arrow fix is only ported for the latest game update.
2018-12-09 03:35:30 +01:00

428 lines
11 KiB
Plaintext

[BotwFPSV208]
moduleMatches = 0x6267BFD0
#rodata constants
_float1 = 0x10000670
_float30 = 0x101E7964
_convSub = 0x10000BB0
_arrowsDiv = 0x1001CCAC
_arrowsDer = 0x1001CB18
#TestCave
codeCaveSize = 0xCC
_fpsCalc = 0x00000018
0x00000000 = .float 3 ; Don't edit me!
_lowlimit = 0x00000000
0x00000004 = .float 62156250
_busSpeed = 0x00000004
_currentFPS = 0x00000008
_speedDiv = 0x0000000C
#Precalculate values for later division for the arrow fix
0x00000010 = .float (0.5/30)
_arrowMultiplier = 0x00000010
0x00000014 = .float (30*30)
_arrowDivisor = 0x00000014
0x00000018 = stw r0, 0x78(r30)
0x0000001C = xoris r12, r12, 0x8000
0x00000020 = stw r12, 0x12C(r30)
0x00000024 = lis r12, 0x4330
0x00000028 = stw r12, 0x128(r30)
0x0000002C = lfd f10, 0x128(r30)
0x00000030 = lis r12, _convSub@ha
0x00000034 = lfd f12, _convSub@l(r12)
0x00000038 = fsub f10, f10, f12
0x0000003C = frsp f10, f10
0x00000040 = lis r12, _float1@ha
0x00000044 = lfs f12, _float1@l(r12)
0x00000048 = fdivs f10, f12, f10
0x0000004C = lis r12, _busSpeed@ha
0x00000050 = lfs f12, _busSpeed@l(r12)
0x00000054 = fmuls f10, f12, f10
0x00000058 = lis r12, _currentFPS@ha
0x0000005C = stfs f10, _currentFPS@l(r12)
#Arrow fix
#Calculates 30*(30/currentFPS)
0x00000060 = lis r12, _arrowDivisor@ha
0x00000064 = lfs f12, _arrowDivisor@l(r12)
0x00000068 = fdivs f12, f12, f10
0x0000006C = lis r12, _arrowsDiv@ha
0x00000070 = stfs f12, _arrowsDiv@l(r12)
#Calculates 0.5/(30/$targetFPS)
0x00000074 = lis r12, _arrowMultiplier@ha
0x00000078 = lfs f12, _arrowMultiplier@l(r12)
0x0000007C = fmuls f12, f12, f10
0x00000080 = lis r12, _arrowsDer@ha
0x00000084 = stfs f12, _arrowsDer@l(r12)
0x00000088 = lis r12, _float30@ha
0x0000008C = lfs f12, _float30@l(r12)
0x00000090 = fdivs f7, f12, f10
0x00000094 = lis r12, _lowlimit@ha
0x00000098 = lfs f12, _lowlimit@l(r12)
0x0000009C = lis r12, _speedDiv@ha
0x000000A0 = fcmpu cr0, f7, f12
0x000000A4 = bge .+0x0C
0x000000A8 = stfs f7, _speedDiv@l(r12)
0x000000AC = blr
0x000000B0 = stfs f12, _speedDiv@l(r12)
0x000000B4 = blr
_fenceNeg1 = 0x000000B8
0x000000B8 = add r6, r12, r0 #orig instruction we are replacing
0x000000BC = cmpwi r6, 500 #check if less than 500 (full sync on those first frames to prevent milk water)
0x000000C0 = blt .+0x08 #skip subtract if less than
0x000000C4 = subi r6, r6, 1 #do the subtract
0x000000C8 = blr #return
#codeChanges
0x031FA97C = bla _fpsCalc
0x03793328 = nop
0x03793334 = nop
0x03793378 = lis r29, _speedDiv@ha
0x03793380 = lfs f0, _speedDiv@L(r29)
0x0379338C = nop
0x03415C1C = lis r12, _speedDiv@ha
0x03415C24 = lfs f0, _speedDiv@l(r12)
0x03415C2C = nop
0x02D90D2C = lis r10, _currentFPS@ha
0x02D90D30 = lfs f11, _currentFPS@l(r10)
0x02D90D88 = lis r10, _currentFPS@ha
0x02D90D8C = lfs f11, _currentFPS@l(r10)
#break all forms of frame limiting
0x031FAAFC = bla _fenceNeg1 ;Best fence (make sure GPU is never more than 1 frame ahead)
;0x031FAAE8 = li r0, 1 ;Better fence (make sure GPU is never more than 1 second? ahead)
;0x031FAB00 = nop ; skip fence (no waiting on GPU)
0x031FACD0 = nop ; disable vsync
0x031FACF4 = nop ; disable vsync loop
#Cheats
;0x02D90CC0 = fmr f29, f1 ;inf stamina
;0x02D452A4 = nop ;inf hearts
;0x02EB6758 = nop ;inf arrows
[BotwFPSv176V192]
moduleMatches = 0xFD091F9F,0xD472D8A5
#rodata constants
_float1 = 0x10000670
_float30 = 0x101E78F4
_convSub = 0x10000BB0
#TestCave
codeCaveSize = 0x9C
_fpsCalc = 0x00000010
0x00000000 = .float 3 ; Don't edit me!
_lowlimit = 0x00000000
0x00000004 = .float 62156250
_busSpeed = 0x00000004
_currentFPS = 0x00000008
_speedDiv = 0x0000000C
0x00000010 = stw r0, 0x78(r30)
0x00000014 = xoris r12, r12, 0x8000
0x00000018 = stw r12, 0x12C(r30)
0x0000001C = lis r12, 0x4330
0x00000020 = stw r12, 0x128(r30)
0x00000024 = lfd f10, 0x128(r30)
0x00000028 = lis r12, _convSub@ha
0x0000002C = lfd f12, _convSub@l(r12)
0x00000030 = fsub f10, f10, f12
0x00000034 = frsp f10, f10
0x00000038 = lis r12, _float1@ha
0x0000003C = lfs f12, _float1@l(r12)
0x00000040 = fdivs f10, f12, f10
0x00000044 = lis r12, _busSpeed@ha
0x00000048 = lfs f12, _busSpeed@l(r12)
0x0000004C = fmuls f10, f12, f10
0x00000050 = lis r12, _currentFPS@ha
0x00000054 = stfs f10, _currentFPS@l(r12)
0x00000058 = lis r12, _float30@ha
0x0000005C = lfs f12, _float30@l(r12)
0x00000060 = fdivs f7, f12, f10
0x00000064 = lis r12, _lowlimit@ha
0x00000068 = lfs f12, _lowlimit@l(r12)
0x0000006C = lis r12, _speedDiv@ha
0x00000070 = fcmpu cr0, f7, f12
0x00000074 = bge .+0x0C
0x00000078 = stfs f7, _speedDiv@l(r12)
0x0000007C = blr
0x00000080 = stfs f12, _speedDiv@l(r12)
0x00000084 = blr
_fenceNeg1 = 0x00000084
0x00000088 = add r6, r12, r0 #orig instruction we are replacing
0x0000008C = cmpwi r6, 500 #check if less than 500 (full sync on those first frames to prevent milk water)
0x00000090 = blt .+0x08 #skip subtract if less than
0x00000094 = subi r6, r6, 1 #do the subtract
0x00000098 = blr #return
#codeChanges
0x031F9E80 = bla _fpsCalc
0x03792620 = nop
0x0379262C = nop
0x03792670 = lis r29, _speedDiv@ha
0x03792678 = lfs f0, _speedDiv@L(r29)
0x03792684 = nop
0x03414EF8 = lis r12, _speedDiv@ha
0x03414F00 = lfs f0, _speedDiv@l(r12)
0x03414F08 = nop
0x02D90790 = lis r10, _currentFPS@ha
0x02D90794 = lfs f11, _currentFPS@l(r10)
0x02D907EC = lis r10, _currentFPS@ha
0x02D907F0 = lfs f11, _currentFPS@l(r10)
#break all forms of frame limiting
0x031FA000 = bla _fenceNeg1 ;Best fence (make sure GPU is never more than 1 frame ahead)
;0x031F9FEC = li r0, 1 ;Better fence (make sure GPU is never more than 1 second? ahead)
;0x031FA004 = nop ; skip fence (no waiting on GPU)
0x031FA1D4 = nop ; disable vsync
0x031FA1F8 = nop ; disable vsync loop
#Cheats
;0x02D90724 = fmr f29, f1 ;inf stamina
;0x02D44D44 = nop ;inf hearts
;0x02EB61BC = nop ;inf arrows
[Botw60fpsv144]
moduleMatches = 0x9A2CA0C7
#rodata constants
_float1 = 0x1027AB80
_float3 = 0x100005DC
#TestCave
codeCaveSize = 0x9C
_fpsCalc = 0x00000008
0x00000000 = .float 3 ;edit me
_lowlimit = 0x00000000
0x00000004 = .float 6294724
_busSpeed = 0x00000004
0x00000008 = stw r0, 0x78(r30)
0x0000000C = xoris r12, r12, 0x8000
0x00000010 = stw r12, 0x12C(r30)
0x00000014 = lis r12, 0x4330
0x00000018 = stw r12, 0x128(r30)
0x0000001C = lfd f10, 0x128(r30)
0x00000020 = stw r12, 0x138(r30)
0x00000024 = lis r12, 0x8000
0x00000028 = stw r12, 0x13C(r30)
0x0000002C = lfd f12, 0x138(r30)
0x00000030 = fsub f10, f10, f12
0x00000034 = frsp f10, f10
0x00000038 = lis r12, _float1@ha
0x0000003C = lfs f12, _float1@l(r12)
0x00000040 = fdivs f10, f12, f10
0x00000048 = lis r12, _busSpeed@ha
0x0000004C = lfs f12, _busSpeed@l(r12)
0x00000050 = fmuls f10, f12, f10
0x00000054 = lis r12, _float3@ha
0x00000058 = lfs f12, _float3@l(r12)
0x0000005C = fdivs f7, f12, f10
0x00000060 = lis r12, _lowlimit@ha
0x00000064 = lfs f12, _lowlimit@l(r12)
0x00000068 = fcmpu cr0, f7, f12
0x0000006C = bge .+0x0C
0x00000070 = stfs f7, 0x130(r30)
0x00000074 = blr
0x00000078 = stfs f12, 0x130(r30)
0x0000007C = blr
_fullspeed = 0x00000080
0x00000080 = lis r3, 0x112A
0x00000084 = lis r12, 0xF634
0x00000088 = srawi r12, r12, 0x10
0x0000008c = xoris r12, r12, 0xFFFF
0x00000090 = or r3, r3, r12
0x00000094 = lfs f0, 0x0(r3)
0x00000098 = blr
#Branch
0x03102688 = bla _fpsCalc
0x03686FA0 = nop
0x03686FAC = nop
0x03686FF0 = bla _fullspeed
0x03313C4C = bla _fullspeed
#break all forms of frame limiting
0x03102808 = nop ;disables gx2 fence
0x031029DC = nop ;disables wait for vsync
0x03102A00 = nop ;same
0x03102E10 = li r0, 1;the original 60FPS hack
0x03102DCC = li r0, 1; same
#experimental
;0x02FAA8E4 = li r3, 0 ;sets swap interval to 0
;0x02FAA98C = li r3, 0 ;same
;0x02FB2E50 = li r7, 1 ;sets GX2SetTVBuffer to 1
;0x02FB30A0 = li r7, 1 ;same
[Botw60fpsv112]
moduleMatches = 0x6FD41A61
#rodata constants
_float1 = 0x1026E518
_float3 = 0x100005D4
#TestCave
codeCaveSize = 0x9C
_fpsCalc = 0x00000008
0x00000000 = .float 3 ;edit me
_lowlimit = 0x00000000
0x00000004 = .float 6294724
_busSpeed = 0x00000004
0x00000008 = stw r0, 0x78(r30)
0x0000000C = xoris r12, r12, 0x8000
0x00000010 = stw r12, 0x12C(r30)
0x00000014 = lis r12, 0x4330
0x00000018 = stw r12, 0x128(r30)
0x0000001C = lfd f10, 0x128(r30)
0x00000020 = stw r12, 0x138(r30)
0x00000024 = lis r12, 0x8000
0x00000028 = stw r12, 0x13C(r30)
0x0000002C = lfd f12, 0x138(r30)
0x00000030 = fsub f10, f10, f12
0x00000034 = frsp f10, f10
0x00000038 = lis r12, _float1@ha
0x0000003C = lfs f12, _float1@l(r12)
0x00000040 = fdivs f10, f12, f10
0x00000048 = lis r12, _busSpeed@ha
0x0000004C = lfs f12, _busSpeed@l(r12)
0x00000050 = fmuls f10, f12, f10
0x00000054 = lis r12, _float3@ha
0x00000058 = lfs f12, _float3@l(r12)
0x0000005C = fdivs f7, f12, f10
0x00000060 = lis r12, _lowlimit@ha
0x00000064 = lfs f12, _lowlimit@l(r12)
0x00000068 = fcmpu cr0, f7, f12
0x0000006C = bge .+0x0C
0x00000070 = stfs f7, 0x130(r30)
0x00000074 = blr
0x00000078 = stfs f12, 0x130(r30)
0x0000007C = blr
_fullspeed = 0x00000080
0x00000080 = lis r3, 0x1126
0x00000084 = lis r12, 0xB42C
0x00000088 = srawi r12, r12, 0x10
0x0000008c = xoris r12, r12, 0xFFFF
0x00000090 = or r3, r3, r12
0x00000094 = lfs f0, 0x0(r3)
0x00000098 = blr
#Branch
0x030D5080 = bla _fpsCalc
0x03653634 = nop
0x03653640 = nop
0x03653684 = bla _fullspeed
0x032E4130 = bla _fullspeed
#break all forms of frame limiting
0x030D5200 = nop ;comment out this line with ';' at the beginning to disable gpufenceskip
0x030D53D4 = nop
0x030D53f8 = nop
0x030D5808 = li r0, 1
0x030D57C4 = li r0, 1
#experimental
;0x02F7ECB8 = li r3, 0
;0x02F7ED60 = li r3, 0
;0x02F87224 = li r7, 1
;0x02F87474 = li r7, 1
[Botw60fpsv97]
moduleMatches = 0xD71D859D
#rodata constants
_float1 = 0x10000660
_float3 = 0x100031fC
#TestCave
codeCaveSize = 0x9C
_fpsCalc = 0x00000008
0x00000000 = .float 3 ;edit me
_lowlimit = 0x00000000
0x00000004 = .float 6294724
_busSpeed = 0x00000004
0x00000008 = stw r0, 0x78(r30)
0x0000000C = xoris r12, r12, 0x8000
0x00000010 = stw r12, 0x12C(r30)
0x00000014 = lis r12, 0x4330
0x00000018 = stw r12, 0x128(r30)
0x0000001C = lfd f10, 0x128(r30)
0x00000020 = stw r12, 0x138(r30)
0x00000024 = lis r12, 0x8000
0x00000028 = stw r12, 0x13C(r30)
0x0000002C = lfd f12, 0x138(r30)
0x00000030 = fsub f10, f10, f12
0x00000034 = frsp f10, f10
0x00000038 = lis r12, _float1@ha
0x0000003C = lfs f12, _float1@l(r12)
0x00000040 = fdivs f10, f12, f10
0x00000048 = lis r12, _busSpeed@ha
0x0000004C = lfs f12, _busSpeed@l(r12)
0x00000050 = fmuls f10, f12, f10
0x00000054 = lis r12, _float3@ha
0x00000058 = lfs f12, _float3@l(r12)
0x0000005C = fdivs f7, f12, f10
0x00000060 = lis r12, _lowlimit@ha
0x00000064 = lfs f12, _lowlimit@l(r12)
0x00000068 = fcmpu cr0, f7, f12
0x0000006C = bge .+0x0C
0x00000070 = stfs f7, 0x130(r30)
0x00000074 = blr
0x00000078 = stfs f12, 0x130(r30)
0x0000007C = blr
_fullspeed = 0x00000080
0x00000080 = lis r3, 0x1126
0x00000084 = lis r12, 0xA824
0x00000088 = srawi r12, r12, 0x10
0x0000008c = xoris r12, r12, 0xFFFF
0x00000090 = or r3, r3, r12
0x00000094 = lfs f0, 0x0(r3)
0x00000098 = blr
#Branch
0x030D4120 = bla _fpsCalc
0x03652620 = nop
0x0365262C = nop
0x03652670 = bla _fullspeed
0x032E31D0 = bla _fullspeed
#break all forms of frame limiting
0x030D42A0 = nop ;comment out this line with ';' at the beginning to disable gpufenceskip
0x030D4474 = nop
0x030D4498 = nop
0x030D48A8 = li r0, 1
0x030D4864 = li r0, 1
#experimental
;0x02F7DD58 = li r3, 0
;0x02F7DE00 = li r3, 0
;0x02F862C4 = li r7, 1
;0x02F86514 = li r7, 1