#include #include #include #include void AchievementManagerUnlockMidAsmHook(PPCRegister& id) { AchievementData::Unlock(id.u32); } bool DisableHintsMidAsmHook() { return !Config::Hints; } bool DisableControlTutorialMidAsmHook() { return !Config::ControlTutorial; } bool DisableEvilControlTutorialMidAsmHook(PPCRegister& r4, PPCRegister& r5) { if (Config::ControlTutorial) return true; // Only allow enemy QTE prompts to get through. return r4.u32 == 1 && r5.u32 == 1; } void ToggleSubtitlesMidAsmHook(PPCRegister& r27) { auto pApplicationDocument = (SWA::CApplicationDocument*)g_memory.Translate(r27.u32); pApplicationDocument->m_InspireSubtitles = Config::Subtitles; } void WerehogBattleMusicMidAsmHook(PPCRegister& r11) { if (Config::BattleTheme) return; // Swap CStateBattle for CStateNormal. if (r11.u8 == 4) r11.u8 = 3; } void StorageDevicePromptMidAsmHook() {} /* Hook function that gets the game region and force result to zero for Japanese to display the correct logos. */ PPC_FUNC_IMPL(__imp__sub_825197C0); PPC_FUNC(sub_825197C0) { if (Config::Language == ELanguage::Japanese) { ctx.r3.u64 = 0; return; } __imp__sub_825197C0(ctx, base); } // Logo skip PPC_FUNC_IMPL(__imp__sub_82547DF0); PPC_FUNC(sub_82547DF0) { if (Config::SkipIntroLogos) { ctx.r4.u64 = 0; ctx.r5.u64 = 0; ctx.r6.u64 = 1; ctx.r7.u64 = 0; sub_825517C8(ctx, base); } else { __imp__sub_82547DF0(ctx, base); } } /* Ignore xercesc::EmptyStackException to allow DLC stages with invalid XML to load. */ PPC_FUNC_IMPL(__imp__sub_8305D5B8); PPC_FUNC(sub_8305D5B8) { auto value = PPC_LOAD_U32(ctx.r3.u32 + 4); if (!value) return; __imp__sub_8305D5B8(ctx, base); }