diff --git a/UnleashedRecomp/game.cpp b/UnleashedRecomp/game.cpp index 495d15b..c96d975 100644 --- a/UnleashedRecomp/game.cpp +++ b/UnleashedRecomp/game.cpp @@ -4,6 +4,8 @@ constexpr float m_baseAspectRatio = 16.0f / 9.0f; +const char* m_pStageID; + uint32_t m_lastCheckpointScore = 0; #pragma region Aspect Ratio Hooks @@ -130,6 +132,14 @@ PPC_FUNC(sub_824DCF38) ctx.r4.u32 = 4; } + if (m_pStageID) + { + /* Fix restarting Eggmanland as the Werehog + erroneously using the Theatre Mode transition. */ + if (!strcmp(m_pStageID, "Act_EggmanLand")) + ctx.r4.u32 = 5; + } + __imp__sub_824DCF38(ctx, base); } @@ -172,4 +182,9 @@ void HighFrameRateDeltaTimeFixMidAsmHook(PPCRegister& f1) f1.f64 = threshold; } +void GetStageIDMidAsmHook(PPCRegister& r5) +{ + m_pStageID = *(xpointer*)g_memory.Translate(r5.u32); +} + #pragma endregion diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 5aee152..470a4a3 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -188,3 +188,8 @@ registers = ["f1"] name = "HighFrameRateDeltaTimeFixMidAsmHook" address = 0x823458A0 registers = ["f1"] + +[[midasm_hook]] +name = "GetStageIDMidAsmHook" +address = 0x82528198 +registers = ["r5"] \ No newline at end of file