diff --git a/UnleashedRecomp/api/SWA/Globals.h b/UnleashedRecomp/api/SWA/Globals.h index 34dc697..ddd6acc 100644 --- a/UnleashedRecomp/api/SWA/Globals.h +++ b/UnleashedRecomp/api/SWA/Globals.h @@ -9,6 +9,9 @@ namespace SWA // ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示 static inline bool* ms_DrawLightFieldSamplingPoint; + // N/A + static inline bool* ms_IsAutoSaveWarningShown; + // ms_IgnoreLightFieldData: データを無視する static inline bool* ms_IgnoreLightFieldData; @@ -39,6 +42,9 @@ namespace SWA // ms_IsRenderHudPause: ポーズメニュー 描画 static inline bool* ms_IsRenderHudPause; + // N/A + static inline bool* ms_IsTitleStateMenu; + // IsTriggerRender static inline bool* ms_IsTriggerRender; @@ -52,6 +58,7 @@ namespace SWA { ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE); ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF); + ms_IsAutoSaveWarningShown = (bool*)MmGetHostAddress(0x83367BC1); ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6); ms_IsLoading = (bool*)MmGetHostAddress(0x83367A4C); ms_IsObjectCollisionRender = (bool*)MmGetHostAddress(0x83367905); @@ -61,6 +68,7 @@ namespace SWA ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27); ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26); ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28); + ms_IsTitleStateMenu = (bool*)MmGetHostAddress(0x83367BC0); ms_IsTriggerRender = (bool*)MmGetHostAddress(0x83367904); ms_LightFieldDebug = (bool*)MmGetHostAddress(0x83367BCD); ms_VisualizeLoadedLevel = (bool*)MmGetHostAddress(0x833678C1); diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h index da38b6c..b14bceb 100644 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h +++ b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h @@ -4,14 +4,5 @@ namespace SWA { - class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase - { - public: - class CTitleStateContext - { - public: - SWA_INSERT_PADDING(0x1E8); - xpointer m_pTitleMenu; - }; - }; + class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {}; } diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h index 567ef59..b79a49e 100644 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h +++ b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h @@ -4,5 +4,14 @@ namespace SWA { - class CTitleStateMenu : public CTitleStateBase {}; + class CTitleStateMenu : public CTitleStateBase + { + public: + class CTitleStateMenuContext + { + public: + SWA_INSERT_PADDING(0x1E8); + xpointer m_pTitleMenu; + }; + }; } diff --git a/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp b/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp index ac240df..d4a05fc 100644 --- a/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp +++ b/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp @@ -148,9 +148,10 @@ void PressStartSaveLoadThreadMidAsmHook() PPC_FUNC_IMPL(__imp__sub_82587E50); PPC_FUNC(sub_82587E50) { - auto isAutoSaveWarningShown = *(bool*)g_memory.Translate(0x83367BC1); + auto pTitleStateIntro = (SWA::CTitleStateIntro*)g_memory.Translate(ctx.r3.u32); + auto pTime = (be*)((uint8_t*)pTitleStateIntro->GetContextBase() + 0x10C); - if (isAutoSaveWarningShown) + if (*SWA::SGlobals::ms_IsAutoSaveWarningShown) { __imp__sub_82587E50(ctx, base); } @@ -158,7 +159,7 @@ PPC_FUNC(sub_82587E50) { if (auto pInputState = SWA::CInputState::GetInstance()) { - if (pInputState->GetPadState().IsTapped(SWA::eKeyState_B)) + if (pInputState->GetPadState().IsTapped(SWA::eKeyState_B) && *pTime > 0.5f) g_quitMessageOpen = true; } diff --git a/UnleashedRecomp/patches/CTitleStateMenu_patches.cpp b/UnleashedRecomp/patches/CTitleStateMenu_patches.cpp index 1012a99..b3ae458 100644 --- a/UnleashedRecomp/patches/CTitleStateMenu_patches.cpp +++ b/UnleashedRecomp/patches/CTitleStateMenu_patches.cpp @@ -52,14 +52,14 @@ static bool ProcessInstallMessage() PPC_FUNC_IMPL(__imp__sub_825882B8); PPC_FUNC(sub_825882B8) { - auto pTitleState = (SWA::CTitleStateBase*)g_memory.Translate(ctx.r3.u32); + auto pTitleStateMenu = (SWA::CTitleStateMenu*)g_memory.Translate(ctx.r3.u32); auto pGameDocument = SWA::CGameDocument::GetInstance(); auto pInputState = SWA::CInputState::GetInstance(); auto& pPadState = pInputState->GetPadState(); auto isAccepted = pPadState.IsTapped(SWA::eKeyState_A) || pPadState.IsTapped(SWA::eKeyState_Start); - auto pContext = pTitleState->GetContextBase(); + auto pContext = pTitleStateMenu->GetContextBase(); auto isNewGameIndex = pContext->m_pTitleMenu->m_CursorIndex == 0; auto isOptionsIndex = pContext->m_pTitleMenu->m_CursorIndex == 2; auto isInstallIndex = pContext->m_pTitleMenu->m_CursorIndex == 3;