CTitleStateIntro_patches: delay quit input to allow update function to run once

This commit is contained in:
Hyper 2025-02-09 17:00:54 +00:00
parent ed6f8f082b
commit 073065c6a6
5 changed files with 25 additions and 16 deletions

View file

@ -9,6 +9,9 @@ namespace SWA
// ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示 // ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示
static inline bool* ms_DrawLightFieldSamplingPoint; static inline bool* ms_DrawLightFieldSamplingPoint;
// N/A
static inline bool* ms_IsAutoSaveWarningShown;
// ms_IgnoreLightFieldData: データを無視する // ms_IgnoreLightFieldData: データを無視する
static inline bool* ms_IgnoreLightFieldData; static inline bool* ms_IgnoreLightFieldData;
@ -39,6 +42,9 @@ namespace SWA
// ms_IsRenderHudPause: ポーズメニュー 描画 // ms_IsRenderHudPause: ポーズメニュー 描画
static inline bool* ms_IsRenderHudPause; static inline bool* ms_IsRenderHudPause;
// N/A
static inline bool* ms_IsTitleStateMenu;
// IsTriggerRender // IsTriggerRender
static inline bool* ms_IsTriggerRender; static inline bool* ms_IsTriggerRender;
@ -52,6 +58,7 @@ namespace SWA
{ {
ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE); ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE);
ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF); ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF);
ms_IsAutoSaveWarningShown = (bool*)MmGetHostAddress(0x83367BC1);
ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6); ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6);
ms_IsLoading = (bool*)MmGetHostAddress(0x83367A4C); ms_IsLoading = (bool*)MmGetHostAddress(0x83367A4C);
ms_IsObjectCollisionRender = (bool*)MmGetHostAddress(0x83367905); ms_IsObjectCollisionRender = (bool*)MmGetHostAddress(0x83367905);
@ -61,6 +68,7 @@ namespace SWA
ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27); ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27);
ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26); ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26);
ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28); ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28);
ms_IsTitleStateMenu = (bool*)MmGetHostAddress(0x83367BC0);
ms_IsTriggerRender = (bool*)MmGetHostAddress(0x83367904); ms_IsTriggerRender = (bool*)MmGetHostAddress(0x83367904);
ms_LightFieldDebug = (bool*)MmGetHostAddress(0x83367BCD); ms_LightFieldDebug = (bool*)MmGetHostAddress(0x83367BCD);
ms_VisualizeLoadedLevel = (bool*)MmGetHostAddress(0x833678C1); ms_VisualizeLoadedLevel = (bool*)MmGetHostAddress(0x833678C1);

View file

@ -4,14 +4,5 @@
namespace SWA namespace SWA
{ {
class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {};
{
public:
class CTitleStateContext
{
public:
SWA_INSERT_PADDING(0x1E8);
xpointer<CTitleMenu> m_pTitleMenu;
};
};
} }

View file

@ -4,5 +4,14 @@
namespace SWA namespace SWA
{ {
class CTitleStateMenu : public CTitleStateBase {}; class CTitleStateMenu : public CTitleStateBase
{
public:
class CTitleStateMenuContext
{
public:
SWA_INSERT_PADDING(0x1E8);
xpointer<CTitleMenu> m_pTitleMenu;
};
};
} }

View file

@ -148,9 +148,10 @@ void PressStartSaveLoadThreadMidAsmHook()
PPC_FUNC_IMPL(__imp__sub_82587E50); PPC_FUNC_IMPL(__imp__sub_82587E50);
PPC_FUNC(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<float>*)((uint8_t*)pTitleStateIntro->GetContextBase() + 0x10C);
if (isAutoSaveWarningShown) if (*SWA::SGlobals::ms_IsAutoSaveWarningShown)
{ {
__imp__sub_82587E50(ctx, base); __imp__sub_82587E50(ctx, base);
} }
@ -158,7 +159,7 @@ PPC_FUNC(sub_82587E50)
{ {
if (auto pInputState = SWA::CInputState::GetInstance()) 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; g_quitMessageOpen = true;
} }

View file

@ -52,14 +52,14 @@ static bool ProcessInstallMessage()
PPC_FUNC_IMPL(__imp__sub_825882B8); PPC_FUNC_IMPL(__imp__sub_825882B8);
PPC_FUNC(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 pGameDocument = SWA::CGameDocument::GetInstance();
auto pInputState = SWA::CInputState::GetInstance(); auto pInputState = SWA::CInputState::GetInstance();
auto& pPadState = pInputState->GetPadState(); auto& pPadState = pInputState->GetPadState();
auto isAccepted = pPadState.IsTapped(SWA::eKeyState_A) || pPadState.IsTapped(SWA::eKeyState_Start); auto isAccepted = pPadState.IsTapped(SWA::eKeyState_A) || pPadState.IsTapped(SWA::eKeyState_Start);
auto pContext = pTitleState->GetContextBase<SWA::CTitleStateBase::CTitleStateContext>(); auto pContext = pTitleStateMenu->GetContextBase<SWA::CTitleStateMenu::CTitleStateMenuContext>();
auto isNewGameIndex = pContext->m_pTitleMenu->m_CursorIndex == 0; auto isNewGameIndex = pContext->m_pTitleMenu->m_CursorIndex == 0;
auto isOptionsIndex = pContext->m_pTitleMenu->m_CursorIndex == 2; auto isOptionsIndex = pContext->m_pTitleMenu->m_CursorIndex == 2;
auto isInstallIndex = pContext->m_pTitleMenu->m_CursorIndex == 3; auto isInstallIndex = pContext->m_pTitleMenu->m_CursorIndex == 3;