Skip to content

Commit 8abb9a5

Browse files
RestoreChainJumpFlips (#148)
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
1 parent cb80268 commit 8abb9a5

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

MarathonRecomp/patches/player_patches.cpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,68 @@ bool ControllableSpinkick()
184184
return Config::ControllableSpinkick;
185185
}
186186

187+
bool RestoreChainJumpFlips1(PPCRegister& f3, PPCRegister& r1)
188+
{
189+
if (Config::RestoreChainJumpFlips)
190+
{
191+
auto base = g_memory.base;
192+
193+
PPCRegister temp{};
194+
temp.u32 = PPC_LOAD_U32(r1.u32 + 0x7C);
195+
f3.f64 = double(temp.f32);
196+
197+
return true;
198+
}
199+
200+
return false;
201+
}
202+
203+
bool RestoreChainJumpFlips2(PPCRegister& r10, PPCRegister& r11)
204+
{
205+
if (Config::RestoreChainJumpFlips)
206+
{
207+
auto base = g_memory.base;
208+
209+
PPC_STORE_U32(r10.u32 + 0x44, r11.u32);
210+
211+
return true;
212+
}
213+
214+
return false;
215+
}
216+
217+
bool RestoreChainJumpFlips3(PPCRegister& f31, PPCRegister& r11)
218+
{
219+
if (Config::RestoreChainJumpFlips)
220+
{
221+
auto base = g_memory.base;
222+
223+
PPCRegister temp{};
224+
temp.f32 = float(f31.f64);
225+
PPC_STORE_U32(r11.u32 + 0x44, temp.u32);
226+
227+
return true;
228+
}
229+
230+
return false;
231+
}
232+
233+
bool RestoreChainJumpFlips4(PPCRegister& f0, PPCRegister& r11)
234+
{
235+
if (Config::RestoreChainJumpFlips)
236+
{
237+
auto base = g_memory.base;
238+
239+
PPCRegister temp{};
240+
temp.f32 = float(f0.f64);
241+
PPC_STORE_U32(r11.u32 + 0x44, temp.u32);
242+
243+
return true;
244+
}
245+
246+
return false;
247+
}
248+
187249
bool DisablePushState()
188250
{
189251
return Config::DisablePushState;

MarathonRecomp/user/config_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, FixPowerUpJingleDuration, false);
8484
CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false);
8585
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableLowResolutionFontOnCustomUI, false);
8686
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreContextualHUDColours, false);
87+
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChainJumpFlips, false);
8788
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableEdgeGrabLeftover, false);
8889
CONFIG_DEFINE_HIDDEN("Codes", bool, TailsGauge, false);
8990
CONFIG_DEFINE_HIDDEN("Codes", bool, PlayerDebugMode, false);

MarathonRecompLib/config/Marathon.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,30 @@ name = "NOP"
338338
address = 0x8258E600
339339
jump_address = 0x8258E604
340340

341+
[[midasm_hook]]
342+
name = "RestoreChainJumpFlips1"
343+
address = 0x82199650
344+
registers = ["f3", "r1"]
345+
jump_address_on_true = 0x82199654
346+
347+
[[midasm_hook]]
348+
name = "RestoreChainJumpFlips2"
349+
address = 0x82209B74
350+
registers = ["r10", "r11"]
351+
jump_address_on_true = 0x82209B78
352+
353+
[[midasm_hook]]
354+
name = "RestoreChainJumpFlips3"
355+
address = 0x8220C0BC
356+
registers = ["f31", "r11"]
357+
jump_address_on_true = 0x8220C0C0
358+
359+
[[midasm_hook]]
360+
name = "RestoreChainJumpFlips4"
361+
address = 0x822106BC
362+
registers = ["f0", "r11"]
363+
jump_address_on_true = 0x822106C0
364+
341365
[[midasm_hook]]
342366
name = "DisablePushState"
343367
address = 0x821A03F0

0 commit comments

Comments
 (0)