From 546f593cf599dfca8177add55f98aec7d56481b4 Mon Sep 17 00:00:00 2001 From: SuperSamus <40663462+SuperSamus@users.noreply.github.com> Date: Sat, 12 Oct 2024 14:45:05 +0200 Subject: [PATCH] [Skylanders] Fix infinite fall softlock at high FPS (#639) Thanks to @SuperSamus (and Winner Nombre)! --- .../Mods/FPS/patch_FixInfiniteFall.asm | 51 +++++++++++++++++++ .../Mods/FPS/rules.txt | 4 +- .../Mods/FPS/patch_FixInfiniteFall.asm | 21 ++++++++ src/SkylandersSwapForce/Mods/FPS/rules.txt | 2 +- 4 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 src/SkylandersSuperChargers/Mods/FPS/patch_FixInfiniteFall.asm create mode 100644 src/SkylandersSwapForce/Mods/FPS/patch_FixInfiniteFall.asm diff --git a/src/SkylandersSuperChargers/Mods/FPS/patch_FixInfiniteFall.asm b/src/SkylandersSuperChargers/Mods/FPS/patch_FixInfiniteFall.asm new file mode 100644 index 00000000..f9285942 --- /dev/null +++ b/src/SkylandersSuperChargers/Mods/FPS/patch_FixInfiniteFall.asm @@ -0,0 +1,51 @@ +[SSC_FixInfiniteFall] +moduleMatches = 0xccf357b3, 0x1407432e, 0x3a1208f7, 0x21fc6048, 0x3e598867, 0xcf77bcd5, 0x25a11655 +.origin = codecave + +const_stuckFallingDistanceThreshold: +.float 20*30/$targetFPS + +_getStuckFallingDistanceThreshold_f13: + lis r0, const_stuckFallingDistanceThreshold@ha + lfs f13, const_stuckFallingDistanceThreshold@l(r0) +blr + +_getStuckFallingDistanceThreshold_f0: + lis r0, const_stuckFallingDistanceThreshold@ha + lfs f0, const_stuckFallingDistanceThreshold@l(r0) +blr + +[SSC_FixInfiniteFall_V1] +moduleMatches = 0xccf357b3 ; v1 + +0x0220e028 = bla _getStuckFallingDistanceThreshold_f0 + +[SSC_FixInfiniteFall_V16] +moduleMatches = 0x1407432e ; 1.1.0 + +0x0220c35c = bla _getStuckFallingDistanceThreshold_f13 + +[SSC_FixInfiniteFall_V32] +moduleMatches = 0x3a1208f7 ; 1.2.0 + +0x0220d958 = bla _getStuckFallingDistanceThreshold_f13 + +[SSC_FixInfiniteFall_V48] +moduleMatches = 0x21fc6048 ; 1.3.0 + +0x0220f940 = bla _getStuckFallingDistanceThreshold_f13 + +[SSC_FixInfiniteFall_V64] +moduleMatches = 0x3e598867 ; 1.4.0 + +0x02210e78 = bla _getStuckFallingDistanceThreshold_f13 + +[SSC_FixInfiniteFall_V80] +moduleMatches = 0xcf77bcd5 ; 1.5.0 + +0x02212da8 = bla _getStuckFallingDistanceThreshold_f13 + +[SSC_FixInfiniteFall_V96_V97] +moduleMatches = 0x25a11655 ; 1.6.1 (v96 in US, v97 in EU) + +0x02212da8 = bla _getStuckFallingDistanceThreshold_f13 diff --git a/src/SkylandersSuperChargers/Mods/FPS/rules.txt b/src/SkylandersSuperChargers/Mods/FPS/rules.txt index 88d1b741..de5e35c6 100644 --- a/src/SkylandersSuperChargers/Mods/FPS/rules.txt +++ b/src/SkylandersSuperChargers/Mods/FPS/rules.txt @@ -2,8 +2,8 @@ titleIds = 00050000101BFC00,00050000101B8500 name = FPS path = "Skylanders: Superchargers/Mods/FPS" -description = Changes the game's FPS limit.|Running the game with a high FPS limit can result in glitches.||Made by Mew00, Winner Nombre and DigitNetics. -version = 7 +description = Changes the game's FPS limit.|Running the game with a high FPS limit can result in glitches.||Made by Mew00, and DigitNetics. Infinite fall fix by SuperSamus and Winner Nombre. +version = 6 [Default] $targetFPS:int = 30 diff --git a/src/SkylandersSwapForce/Mods/FPS/patch_FixInfiniteFall.asm b/src/SkylandersSwapForce/Mods/FPS/patch_FixInfiniteFall.asm new file mode 100644 index 00000000..6e5d67c2 --- /dev/null +++ b/src/SkylandersSwapForce/Mods/FPS/patch_FixInfiniteFall.asm @@ -0,0 +1,21 @@ +[SSF_FixInfiniteFall] +moduleMatches = 0xa0b35374, 0xb1f102ec ; v16, v0 +.origin = codecave + +const_stuckFallingDistanceThreshold: +.float 20*30/$targetFPS + +_getStuckFallingDistanceThreshold: + lis r0, const_stuckFallingDistanceThreshold@ha + lfs f0, const_stuckFallingDistanceThreshold@l(r0) +blr + +[SSF_FixInfiniteFall_V16] +moduleMatches = 0xa0b35374 ; v16 + +0x0242729c = bla _getStuckFallingDistanceThreshold + +[SSF_FixInfiniteFall_V0] +moduleMatches = 0xb1f102ec ; v0 + +0x02427214 = bla _getStuckFallingDistanceThreshold diff --git a/src/SkylandersSwapForce/Mods/FPS/rules.txt b/src/SkylandersSwapForce/Mods/FPS/rules.txt index 5022021e..6ff0e707 100644 --- a/src/SkylandersSwapForce/Mods/FPS/rules.txt +++ b/src/SkylandersSwapForce/Mods/FPS/rules.txt @@ -2,7 +2,7 @@ titleIds = 0005000010139200,0005000010140400 name = FPS path = "Skylanders Swap Force/Mods/FPS" -description = Changes the game's dynamic FPS target. Might have bugs, especially when going above 120 FPS.||Made by Mew00 for Imaginators, added by TheSkyDude134 for Swap Force. +description = Changes the game's dynamic FPS target. Might have bugs, especially when going above 120 FPS.||Made by Mew00 for Imaginators, added by TheSkyDude134 for Swap Force. Infinite fall fix by SuperSamus and Winner Nombre. version = 6 [Default]