mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Fix quit message not blocking advertise movie (#127)
This commit is contained in:
parent
e7919da1bd
commit
cdd801dcec
13 changed files with 113 additions and 14 deletions
|
|
@ -154,7 +154,8 @@ set(SWA_PATCHES_CXX_SOURCES
|
|||
"patches/ui/frontend_listener.cpp"
|
||||
"patches/aspect_ratio_patches.cpp"
|
||||
"patches/audio_patches.cpp"
|
||||
"patches/camera_patches.cpp"
|
||||
"patches/camera_patches.cpp"
|
||||
"patches/CGameModeStageTitle_patches.cpp"
|
||||
"patches/fps_patches.cpp"
|
||||
"patches/inspire_patches.cpp"
|
||||
"patches/misc_patches.cpp"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
#include <Hedgehog/Base/hhObject.h>
|
||||
#include <Hedgehog/Universe/Engine/hhMessageProcess.h>
|
||||
#include <Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h>
|
||||
|
||||
namespace Hedgehog::Universe
|
||||
{
|
||||
class CStateMachineBase : public IStateMachineMessageReceiver, public Base::CObject
|
||||
{
|
||||
public:
|
||||
class CStateBase : public IMessageProcess
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x08);
|
||||
xpointer<void> m_pContext;
|
||||
xpointer<CStateMachineBase> m_pStateMachine;
|
||||
be<float> m_Time;
|
||||
SWA_INSERT_PADDING(0x4C);
|
||||
|
||||
void* GetContextBase() const;
|
||||
|
||||
template<typename T>
|
||||
T* GetContextBase() const;
|
||||
};
|
||||
|
||||
SWA_INSERT_PADDING(0x60);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Hedgehog/Universe/Engine/hhStateMachineBase.inl>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
namespace Hedgehog::Universe
|
||||
{
|
||||
inline void* CStateMachineBase::CStateBase::GetContextBase() const
|
||||
{
|
||||
return m_pContext;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* CStateMachineBase::CStateBase::GetContextBase() const
|
||||
{
|
||||
return (T*)m_pContext.get();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace Hedgehog::Universe
|
||||
{
|
||||
class IStateMachineMessageReceiver
|
||||
{
|
||||
public:
|
||||
IStateMachineMessageReceiver(const swa_null_ctor&) {}
|
||||
};
|
||||
}
|
||||
|
|
@ -47,6 +47,8 @@
|
|||
#include "Hedgehog/Sparkle/hhParticleMaterial.h"
|
||||
#include "Hedgehog/Universe/Engine/hhMessageActor.h"
|
||||
#include "Hedgehog/Universe/Engine/hhMessageProcess.h"
|
||||
#include "Hedgehog/Universe/Engine/hhStateMachineBase.h"
|
||||
#include "Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h"
|
||||
#include "Hedgehog/Universe/Engine/hhUpdateInfo.h"
|
||||
#include "Hedgehog/Universe/Engine/hhUpdateUnit.h"
|
||||
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
|
||||
|
|
@ -91,8 +93,10 @@
|
|||
#include "SWA/System/GameMode/GameMode.h"
|
||||
#include "SWA/System/GameMode/GameModeStage.h"
|
||||
#include "SWA/System/GameMode/GameModeStageMovie.h"
|
||||
#include "SWA/System/GameMode/GameModeStageTitle.h"
|
||||
#include "SWA/System/GameMode/Title/TitleMenu.h"
|
||||
#include "SWA/System/GameMode/Title/TitleStateBase.h"
|
||||
#include "SWA/System/GameMode/Title/TitleStateIntro.h"
|
||||
#include "SWA/System/GameObject.h"
|
||||
#include "SWA/System/GameParameter.h"
|
||||
#include "SWA/System/GammaController.h"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
namespace SWA
|
||||
{
|
||||
class CGameMode // : Hedgehog::Universe::TStateMachine<SWA::CGame>::TState
|
||||
class CGameMode : public Hedgehog::Universe::CStateMachineBase::CStateBase
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x60); // base
|
||||
SWA_INSERT_PADDING(0x08);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
14
UnleashedRecomp/api/SWA/System/GameMode/GameModeStageTitle.h
Normal file
14
UnleashedRecomp/api/SWA/System/GameMode/GameModeStageTitle.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace SWA
|
||||
{
|
||||
class CGameModeStageTitle : public CGameModeStage
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x0E);
|
||||
bool m_IsPlayingAdvertiseMovie;
|
||||
be<float> m_AdvertiseMovieWaitTime;
|
||||
};
|
||||
}
|
||||
|
|
@ -4,19 +4,14 @@
|
|||
|
||||
namespace SWA
|
||||
{
|
||||
class CTitleStateBase // : Hedgehog::Universe::TStateMachine<SWA::CTitleManager>::TState
|
||||
class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase
|
||||
{
|
||||
public:
|
||||
class CMember
|
||||
class CTitleStateContext
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x1E8);
|
||||
xpointer<CTitleMenu> m_pTitleMenu;
|
||||
};
|
||||
|
||||
SWA_INSERT_PADDING(0x08);
|
||||
xpointer<CMember> m_pMember;
|
||||
SWA_INSERT_PADDING(0x5C);
|
||||
be<uint32_t> m_State;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace SWA
|
||||
{
|
||||
class CTitleStateIntro : public CTitleStateBase {};
|
||||
}
|
||||
14
UnleashedRecomp/patches/CGameModeStageTitle_patches.cpp
Normal file
14
UnleashedRecomp/patches/CGameModeStageTitle_patches.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include <api/SWA.h>
|
||||
#include <patches/ui/CTitleStateIntro_patches.h>
|
||||
|
||||
// SWA::CGameModeStageTitle::Update
|
||||
PPC_FUNC_IMPL(__imp__sub_825518B8);
|
||||
PPC_FUNC(sub_825518B8)
|
||||
{
|
||||
auto pGameModeStageTitle = (SWA::CGameModeStageTitle*)g_memory.Translate(ctx.r3.u32);
|
||||
|
||||
__imp__sub_825518B8(ctx, base);
|
||||
|
||||
if (g_quitMessageOpen)
|
||||
pGameModeStageTitle->m_AdvertiseMovieWaitTime = 0;
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#include "CTitleStateIntro_patches.h"
|
||||
#include <api/SWA.h>
|
||||
#include <locale/locale.h>
|
||||
#include <ui/fader.h>
|
||||
|
|
|
|||
3
UnleashedRecomp/patches/ui/CTitleStateIntro_patches.h
Normal file
3
UnleashedRecomp/patches/ui/CTitleStateIntro_patches.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
extern bool g_quitMessageOpen;
|
||||
|
|
@ -50,15 +50,18 @@ PPC_FUNC_IMPL(__imp__sub_825882B8);
|
|||
PPC_FUNC(sub_825882B8)
|
||||
{
|
||||
auto pTitleState = (SWA::CTitleStateBase*)g_memory.Translate(ctx.r3.u32);
|
||||
|
||||
auto pInputState = SWA::CInputState::GetInstance();
|
||||
auto& pPadState = pInputState->GetPadState();
|
||||
auto isAccepted = pPadState.IsTapped(SWA::eKeyState_A) || pPadState.IsTapped(SWA::eKeyState_Start);
|
||||
auto isOptionsIndex = pTitleState->m_pMember->m_pTitleMenu->m_CursorIndex == 2;
|
||||
auto isInstallIndex = pTitleState->m_pMember->m_pTitleMenu->m_CursorIndex == 3;
|
||||
|
||||
auto pContext = pTitleState->GetContextBase<SWA::CTitleStateBase::CTitleStateContext>();
|
||||
auto isOptionsIndex = pContext->m_pTitleMenu->m_CursorIndex == 2;
|
||||
auto isInstallIndex = pContext->m_pTitleMenu->m_CursorIndex == 3;
|
||||
|
||||
// Always default to New Game with corrupted save data.
|
||||
if (App::s_isSaveDataCorrupt && pTitleState->m_pMember->m_pTitleMenu->m_CursorIndex == 1)
|
||||
pTitleState->m_pMember->m_pTitleMenu->m_CursorIndex = 0;
|
||||
if (App::s_isSaveDataCorrupt && pContext->m_pTitleMenu->m_CursorIndex == 1)
|
||||
pContext->m_pTitleMenu->m_CursorIndex = 0;
|
||||
|
||||
if (!OptionsMenu::s_isVisible && isOptionsIndex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue