mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Implemented quit input on title screen
This commit is contained in:
parent
3b48043e59
commit
6d81e46608
4 changed files with 68 additions and 1 deletions
|
|
@ -97,6 +97,7 @@ set(SWA_HID_CXX_SOURCES
|
|||
|
||||
set(SWA_PATCHES_CXX_SOURCES
|
||||
"patches/ui/CHudPause_patches.cpp"
|
||||
"patches/ui/CTitleStateIntro_patches.cpp"
|
||||
"patches/ui/CTitleStateMenu_patches.cpp"
|
||||
"patches/ui/frontend_listener.cpp"
|
||||
"patches/audio_patches.cpp"
|
||||
|
|
|
|||
|
|
@ -238,6 +238,12 @@ inline static std::unordered_map<std::string, std::unordered_map<ELanguage, std:
|
|||
{ ELanguage::English, "This restarts the game to\nallow you to install any DLC\nthat you may be missing.\n\nYou are not currently\nmissing any DLC.\n\nWould you like to proceed\nanyway?" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Title_Message_Quit",
|
||||
{
|
||||
{ ELanguage::English, "Are you sure you want to quit?" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Yes",
|
||||
{
|
||||
|
|
|
|||
60
UnleashedRecomp/patches/ui/CTitleStateIntro_patches.cpp
Normal file
60
UnleashedRecomp/patches/ui/CTitleStateIntro_patches.cpp
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#include <cpu/guest_code.h>
|
||||
#include <api/SWA.h>
|
||||
#include <locale/locale.h>
|
||||
#include <ui/fader.h>
|
||||
#include <ui/message_window.h>
|
||||
|
||||
static bool g_quitMessageOpen = false;
|
||||
static bool g_quitMessageFaderBegun = false;
|
||||
static int g_quitMessageResult = -1;
|
||||
|
||||
static bool ProcessQuitMessage()
|
||||
{
|
||||
if (!g_quitMessageOpen)
|
||||
return false;
|
||||
|
||||
if (g_quitMessageFaderBegun)
|
||||
return true;
|
||||
|
||||
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)
|
||||
{
|
||||
switch (g_quitMessageResult)
|
||||
{
|
||||
case 0:
|
||||
Fader::FadeOut(1, []() { ExitProcess(0); });
|
||||
g_quitMessageFaderBegun = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
g_quitMessageOpen = false;
|
||||
g_quitMessageResult = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// SWA::CTitleStateIntro::Update
|
||||
PPC_FUNC_IMPL(__imp__sub_82587E50);
|
||||
PPC_FUNC(sub_82587E50)
|
||||
{
|
||||
auto isAutoSaveWarningShown = *(bool*)g_memory.Translate(0x83367BC1);
|
||||
|
||||
if (isAutoSaveWarningShown)
|
||||
{
|
||||
__imp__sub_82587E50(ctx, base);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pInputState = SWA::CInputState::GetInstance();
|
||||
|
||||
if (pInputState && pInputState->GetPadState().IsTapped(SWA::eKeyState_B))
|
||||
g_quitMessageOpen = true;
|
||||
|
||||
if (!ProcessQuitMessage())
|
||||
__imp__sub_82587E50(ctx, base);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#include <app.h>
|
||||
#include <exports.h>
|
||||
|
||||
static bool g_installMessageFaderBegun = false;
|
||||
static bool g_installMessageOpen = false;
|
||||
static bool g_installMessageFaderBegun = false;
|
||||
static int g_installMessageResult = -1;
|
||||
|
||||
static bool ProcessInstallMessage()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue