mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-04-28 21:37:58 +03:00
CTitleStateIntro_patches: fixed message inconsistencies (#259)
This commit is contained in:
parent
9d98d507b0
commit
3497d9b34b
4 changed files with 34 additions and 44 deletions
|
@ -8,7 +8,7 @@
|
||||||
#include <user/paths.h>
|
#include <user/paths.h>
|
||||||
#include <app.h>
|
#include <app.h>
|
||||||
|
|
||||||
static bool g_faderBegun = false;
|
static std::atomic<bool> g_faderBegun = false;
|
||||||
|
|
||||||
bool g_quitMessageOpen = false;
|
bool g_quitMessageOpen = false;
|
||||||
static int g_quitMessageResult = -1;
|
static int g_quitMessageResult = -1;
|
||||||
|
@ -16,39 +16,29 @@ static int g_quitMessageResult = -1;
|
||||||
static std::atomic<bool> g_corruptSaveMessageOpen = false;
|
static std::atomic<bool> g_corruptSaveMessageOpen = false;
|
||||||
static int g_corruptSaveMessageResult = -1;
|
static int g_corruptSaveMessageResult = -1;
|
||||||
|
|
||||||
static bool g_corruptAchievementsMessageOpen = false;
|
static std::atomic<bool> g_corruptAchievementsMessageOpen = false;
|
||||||
static int g_corruptAchievementsMessageResult = -1;
|
static int g_corruptAchievementsMessageResult = -1;
|
||||||
|
|
||||||
static bool g_updateAvailableMessageOpen = false;
|
static std::atomic<bool> g_updateAvailableMessageOpen = false;
|
||||||
static int g_updateAvailableMessageResult = -1;
|
static int g_updateAvailableMessageResult = -1;
|
||||||
|
|
||||||
static bool ProcessQuitMessage()
|
static bool ProcessQuitMessage()
|
||||||
{
|
{
|
||||||
if (g_corruptSaveMessageOpen)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!g_quitMessageOpen)
|
if (!g_quitMessageOpen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g_faderBegun)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
std::array<std::string, 2> options = { Localise("Common_Yes"), Localise("Common_No") };
|
std::array<std::string, 2> options = { Localise("Common_Yes"), Localise("Common_No") };
|
||||||
|
|
||||||
if (MessageWindow::Open(Localise("Title_Message_Quit"), &g_quitMessageResult, options, 1) == MSG_CLOSED)
|
if (MessageWindow::Open(Localise("Title_Message_Quit"), &g_quitMessageResult, options, 1) == MSG_CLOSED)
|
||||||
{
|
{
|
||||||
switch (g_quitMessageResult)
|
if (!g_quitMessageResult)
|
||||||
{
|
{
|
||||||
case 0:
|
Fader::FadeOut(1, []() { App::Exit(); });
|
||||||
Fader::FadeOut(1, []() { App::Exit(); });
|
g_faderBegun = true;
|
||||||
g_faderBegun = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
g_quitMessageOpen = false;
|
|
||||||
g_quitMessageResult = -1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_quitMessageOpen = false;
|
||||||
|
g_quitMessageResult = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -86,6 +76,7 @@ static bool ProcessCorruptAchievementsMessage()
|
||||||
AchievementManager::Save(true);
|
AchievementManager::Save(true);
|
||||||
|
|
||||||
g_corruptAchievementsMessageOpen = false;
|
g_corruptAchievementsMessageOpen = false;
|
||||||
|
g_corruptAchievementsMessageOpen.notify_one();
|
||||||
g_corruptAchievementsMessageResult = -1;
|
g_corruptAchievementsMessageResult = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,9 +88,6 @@ static bool ProcessUpdateAvailableMessage()
|
||||||
if (!g_updateAvailableMessageOpen)
|
if (!g_updateAvailableMessageOpen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g_faderBegun)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
std::array<std::string, 2> options = { Localise("Common_Yes"), Localise("Common_No") };
|
std::array<std::string, 2> options = { Localise("Common_Yes"), Localise("Common_No") };
|
||||||
|
|
||||||
if (MessageWindow::Open(Localise("Title_Message_UpdateAvailable"), &g_updateAvailableMessageResult, options) == MSG_CLOSED)
|
if (MessageWindow::Open(Localise("Title_Message_UpdateAvailable"), &g_updateAvailableMessageResult, options) == MSG_CLOSED)
|
||||||
|
@ -119,6 +107,7 @@ static bool ProcessUpdateAvailableMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
g_updateAvailableMessageOpen = false;
|
g_updateAvailableMessageOpen = false;
|
||||||
|
g_updateAvailableMessageOpen.notify_one();
|
||||||
g_updateAvailableMessageResult = -1;
|
g_updateAvailableMessageResult = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +126,24 @@ PPC_FUNC(sub_822C55B0)
|
||||||
ctx.r3.u32 = 0;
|
ctx.r3.u32 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PressStartSaveLoadThreadMidAsmHook()
|
||||||
|
{
|
||||||
|
if (UpdateChecker::check() == UpdateChecker::Result::UpdateAvailable)
|
||||||
|
{
|
||||||
|
g_updateAvailableMessageOpen = true;
|
||||||
|
g_updateAvailableMessageOpen.wait(true);
|
||||||
|
g_faderBegun.wait(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
AchievementManager::Load();
|
||||||
|
|
||||||
|
if (AchievementManager::Status != EAchStatus::Success)
|
||||||
|
{
|
||||||
|
g_corruptAchievementsMessageOpen = true;
|
||||||
|
g_corruptAchievementsMessageOpen.wait(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SWA::CTitleStateIntro::Update
|
// SWA::CTitleStateIntro::Update
|
||||||
PPC_FUNC_IMPL(__imp__sub_82587E50);
|
PPC_FUNC_IMPL(__imp__sub_82587E50);
|
||||||
PPC_FUNC(sub_82587E50)
|
PPC_FUNC(sub_82587E50)
|
||||||
|
@ -151,21 +158,7 @@ PPC_FUNC(sub_82587E50)
|
||||||
{
|
{
|
||||||
if (auto pInputState = SWA::CInputState::GetInstance())
|
if (auto pInputState = SWA::CInputState::GetInstance())
|
||||||
{
|
{
|
||||||
auto& rPadState = pInputState->GetPadState();
|
if (pInputState->GetPadState().IsTapped(SWA::eKeyState_B))
|
||||||
auto isAccepted = rPadState.IsTapped(SWA::eKeyState_A) || rPadState.IsTapped(SWA::eKeyState_Start);
|
|
||||||
auto isDeclined = rPadState.IsTapped(SWA::eKeyState_B);
|
|
||||||
|
|
||||||
if (isAccepted)
|
|
||||||
{
|
|
||||||
g_updateAvailableMessageOpen = UpdateChecker::check() == UpdateChecker::Result::UpdateAvailable;
|
|
||||||
|
|
||||||
AchievementManager::Load();
|
|
||||||
|
|
||||||
if (AchievementManager::Status != EAchStatus::Success)
|
|
||||||
g_corruptAchievementsMessageOpen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDeclined)
|
|
||||||
g_quitMessageOpen = true;
|
g_quitMessageOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include <os/process.h>
|
#include <os/process.h>
|
||||||
#include <os/registry.h>
|
#include <os/registry.h>
|
||||||
#include <user/config.h>
|
|
||||||
|
|
||||||
void Registry::Load()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Registry::Save()
|
void Registry::Save()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,5 @@
|
||||||
class Registry
|
class Registry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Load();
|
|
||||||
static void Save();
|
static void Save();
|
||||||
};
|
};
|
||||||
|
|
|
@ -914,3 +914,7 @@ jump_address = 0x82AE2774
|
||||||
name = "ApplicationFrameLimiterMidAsmHook"
|
name = "ApplicationFrameLimiterMidAsmHook"
|
||||||
address = 0x822C1064
|
address = 0x822C1064
|
||||||
jump_address = 0x822C111C
|
jump_address = 0x822C111C
|
||||||
|
|
||||||
|
[[midasm_hook]]
|
||||||
|
name = "PressStartSaveLoadThreadMidAsmHook"
|
||||||
|
address = 0x822C4358
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue