Skip to content

Commit cd3a4b9

Browse files
committed
Clean-up
1 parent 260e230 commit cd3a4b9

2 files changed

Lines changed: 43 additions & 69 deletions

File tree

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <api/Marathon.h>
22
#include <user/config.h>
3-
#include <app.h>
43

54
// Sonicteam::SoX::Physics::Havok::WorldHavok::Update
65
PPC_FUNC_IMPL(__imp__sub_82587AA8);
@@ -25,85 +24,60 @@ void SonicCamera_RotationSpeedFix(PPCRegister& f0, PPCRegister& deltaTime, PPCRe
2524
f0.f64 = float((f0.f64 * (deltaTime.f64 * (1.0 / (deltaTime.f64 * 60.0)))) + f13.f64);
2625
}
2726

28-
29-
bool FixTPJRopeHFR2BNE(PPCRegister& r30)
30-
{
31-
if (Config::FPS > 60.0)
32-
return r30.f64 >= 0;
33-
else
34-
return false; // original
35-
}
36-
37-
void FixTPJRopeHFR3LFS(PPCRegister& r_value, PPCRegister& r_delta)
38-
{
39-
if (Config::FPS <= 60.0)
40-
return;
41-
42-
r_value.f64 = r_delta.f64;
43-
}
44-
//Not finished
45-
void FixTPJRopeHFR4LFS(PPCRegister& r_value, PPCRegister& r_delta)
27+
bool ObjTarzan_VolatileBranch(PPCRegister& r30)
4628
{
47-
if (Config::FPS <= 60.0)
48-
return;
29+
if (Config::FPS <= 60.0f)
30+
return false;
4931

50-
r_value.f64 = r_delta.f64;
32+
return r30.f64 >= 0;
5133
}
52-
void FixTPJRopeHFR5LFS(PPCRegister& r_value, PPCRegister& r_delta)
53-
{
54-
if (Config::FPS <= 60.0)
55-
return;
5634

57-
r_value.f64 = r_delta.f64;
58-
}
59-
void FixTPJRopeHFR6LFS(PPCRegister& r_value, PPCRegister& r_delta)
35+
void ObjTarzan_PatchStaticDeltaTime(PPCRegister& value, PPCRegister& delta)
6036
{
61-
if (Config::FPS <= 60.0)
37+
if (Config::FPS <= 60.0f)
6238
return;
6339

64-
r_value.f64 = r_delta.f64;
40+
value.f64 = delta.f64;
6541
}
6642

67-
//force to save
68-
void FixTPJRopeHFR7EXTRA(PPCRegister& r_value, PPCRegister& r_value2, PPCRegister& r_stack)
43+
void ObjTarzan_PatchDeltaTimeArgument(PPCRegister& value, PPCRegister& value2, PPCRegister& stack)
6944
{
70-
if (Config::FPS <= 60.0)
45+
if (Config::FPS <= 60.0f)
7146
return;
7247

73-
auto deltaTime = *(be<double>*)g_memory.Translate(r_stack.u32 + 0x90 + 0x420 - 0x88);
74-
r_value.f64 = deltaTime;
75-
r_value2.f64 = deltaTime;
76-
}
77-
78-
//no Tarzan Class implementation, because Fixture in gauge patch o-o
79-
struct TPJ_POINT
80-
{
81-
MARATHON_INSERT_PADDING(0x4C);
82-
be<float> m_Time;
83-
MARATHON_INSERT_PADDING(0xB0);
48+
auto deltaTime = *(be<double>*)g_memory.Translate(stack.u32 + 0x90 + 0x420 - 0x88);
8449

85-
};
50+
value.f64 = deltaTime;
51+
value2.f64 = deltaTime;
52+
}
8653

87-
// SonicTeam::TPJ
54+
// Sonicteam::ObjTarzan::UpdatePoint (speculatory)
8855
PPC_FUNC_IMPL(__imp__sub_8232D770);
8956
PPC_FUNC(sub_8232D770)
9057
{
91-
if (Config::FPS <= 60.0)
58+
if (Config::FPS <= 60.0f)
9259
{
9360
__imp__sub_8232D770(ctx, base);
9461
return;
9562
}
9663

97-
auto pTPJ = (TPJ_POINT*)(base + ctx.r3.u32);
98-
auto delta = ctx.f1.f64;
99-
PPCRegister _r4 = ctx.f1;
64+
struct TarzanPoint
65+
{
66+
MARATHON_INSERT_PADDING(0x4C);
67+
be<float> m_Time;
68+
MARATHON_INSERT_PADDING(0xB0);
69+
};
70+
71+
auto pTarzanPoint = (TarzanPoint*)(base + ctx.r3.u32);
72+
auto deltaTime = ctx.f1.f64;
73+
74+
if (deltaTime > 1.0)
75+
deltaTime = 1.0;
10076

101-
if (delta > 1.0)
102-
delta = 1.0;
10377
do
10478
{
105-
//f1,f2,f3
106-
GuestToHostFunction<void>(sub_8232D288, pTPJ, _r4.u64,delta,delta,delta);
107-
pTPJ->m_Time = pTPJ->m_Time - delta;
108-
} while (pTPJ->m_Time >= delta);
79+
GuestToHostFunction<void>(sub_8232D288, pTarzanPoint, ctx.f1.u64, deltaTime, deltaTime, deltaTime);
80+
pTarzanPoint->m_Time = pTarzanPoint->m_Time - deltaTime;
81+
}
82+
while (pTarzanPoint->m_Time >= deltaTime);
10983
}

MarathonRecompLib/config/Marathon.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -400,37 +400,37 @@ address = 0x821A03F0
400400
jump_address_on_true = 0x821A03FC
401401

402402
[[midasm_hook]]
403-
name = "FixTPJRopeHFR2BNE"
403+
name = "ObjTarzan_VolatileBranch"
404404
address = 0x8232D3E0
405-
jump_address_on_true = 0x8232D3E4
406405
registers = ["r30"]
406+
jump_address_on_true = 0x8232D3E4
407407

408408
[[midasm_hook]]
409-
name = "FixTPJRopeHFR3LFS"
409+
name = "ObjTarzan_PatchStaticDeltaTime"
410410
address = 0x8232D3E4
411-
registers = ["f0","r30"]
411+
registers = ["f0", "r30"]
412412
after_instruction = true
413413

414414
[[midasm_hook]]
415-
name = "FixTPJRopeHFR4LFS"
415+
name = "ObjTarzan_PatchStaticDeltaTime"
416416
address = 0x8232D49C
417-
registers = ["f1","f3"]
417+
registers = ["f1", "f3"]
418418
after_instruction = true
419419

420420
[[midasm_hook]]
421-
name = "FixTPJRopeHFR5LFS"
421+
name = "ObjTarzan_PatchStaticDeltaTime"
422422
address = 0x8232D530
423-
registers = ["f1","f3"]
423+
registers = ["f1", "f3"]
424424
after_instruction = true
425425

426426
[[midasm_hook]]
427-
name = "FixTPJRopeHFR6LFS"
427+
name = "ObjTarzan_PatchStaticDeltaTime"
428428
address = 0x8232D57C
429-
registers = ["f0","f3"]
429+
registers = ["f0", "f3"]
430430
after_instruction = true
431431

432432
[[midasm_hook]]
433-
name = "FixTPJRopeHFR7EXTRA"
433+
name = "ObjTarzan_PatchDeltaTimeArgument"
434434
address = 0x8232D818
435-
registers = ["f3","r4","r1"]
435+
registers = ["f3", "r4", "r1"]
436436

0 commit comments

Comments
 (0)