UIScene_MainMenu: Enable the Exit Game Button Behaviour

i noticed that the exit game button on the menu screen wasn't working,
so i went ahead and enabled it and added the behavior to close the game.
i added a Close method in the 4J_Render class and made a tweak to the _xbox check.
the catch is that it uses the xbox text for the confirmation button,
so i’m not sure if it’s the best approach, but it does work fine for me

Signed-off-by: ViniciusCruzMoura <contato.cruz.moura@gmail.com>
This commit is contained in:
ViniciusCruzMoura 2026-03-17 02:08:16 -04:00
parent 20a5835e48
commit 580b947c6e
7 changed files with 21 additions and 5 deletions

View file

@ -311,6 +311,8 @@ void C4JRender::SetFullscreen(bool fs) { s_fullscreen = fs; }
bool C4JRender::ShouldClose() { return !s_window || s_shouldClose; }
void C4JRender::Close() { s_window = nullptr; }
void C4JRender::Shutdown() {
// Destroy the main window and clean up SDL resources so that
// destructors running after the game loop don't touch a dead context.

View file

@ -227,6 +227,7 @@ public:
// Linux window management
bool ShouldClose();
void Close();
void Shutdown();
};

View file

@ -342,6 +342,7 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
// Frontend
case eUIScene_TrialExitUpsell:
newScene = new UIScene_TrialExitUpsell(iPad, initData, this);
app.DebugPrintf("UILayer::NavigateToScene AFTER UIScene_TrialExitUpsell CALL\n");
break;
case eUIScene_Intro:
newScene = new UIScene_Intro(iPad, initData, this);

View file

@ -226,9 +226,12 @@ void UIScene::setSafeZone(S32 safeTop, S32 safeBottom, S32 safeLeft, S32 safeRig
void UIScene::initialiseMovie()
{
loadMovie();
mapElementsAndNames();
app.DebugPrintf("UIScene::initialiseMovie AFTER loadMovie CALL\n");
mapElementsAndNames();
app.DebugPrintf("UIScene::initialiseMovie AFTER mapElementsAndNames CALL\n");
updateSafeZone();
app.DebugPrintf("UIScene::initialiseMovie AFTER updateSafeZone CALL\n");
m_bUpdateOpacity = true;
}
@ -1283,4 +1286,4 @@ int UIScene::parseSlotId(const char16_t *s) {
}
return id;
}
}

View file

@ -301,7 +301,9 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
ui.PlayUISFX(eSFX_Press);
signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned;
app.DebugPrintf("UIScene_MainMenu::handlePress AFTER &UIScene_MainMenu::CreateLoad_SignInReturned\n");
#endif
app.DebugPrintf("UIScene_MainMenu::handlePress FINISH eControl_PlayGame \n");
break;
case eControl_Leaderboards:
//CD - Added for audio
@ -334,7 +336,6 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
m_eAction=eAction_RunUnlockOrDLC;
signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned;
break;
#if defined _XBOX
case eControl_Exit:
if( ProfileManager.IsFullVersion() )
{
@ -342,16 +343,19 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
uiIDA[0]=IDS_CANCEL;
uiIDA[1]=IDS_OK;
ui.RequestMessageBox(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this);
app.DebugPrintf("UIScene_MainMenu::handlePress AFTER ui.RequestMessageBox(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this) CALL\n");
}
#if defined _XBOX //|| _ENABLEIGGY
else
{
#ifdef _XBOX_ONE
ui.ShowPlayerDisplayname(true);
#endif
ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell);
app.DebugPrintf("UIScene_MainMenu::handlePress AFTER ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell) CALL\n");
}
break;
#endif
break;
#ifdef _DURANGO
case eControl_XboxHelp:
@ -1034,6 +1038,7 @@ int UIScene_MainMenu::ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessag
{
//XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0);
app.ExitGame();
app.DebugPrintf("UIScene_MainMenu::ExitGameReturned AFTER app.ExitGame() CALL\n");
}
return 0;

View file

@ -6,6 +6,7 @@
UIScene_TrialExitUpsell::UIScene_TrialExitUpsell(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
app.DebugPrintf("UIScene_TrialExitUpsell::UIScene_TrialExitUpsell BEFORE initialiseMovie CALL\n");
initialiseMovie();
}

View file

@ -23,7 +23,10 @@ void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) {
}
void CConsoleMinecraftApp::StoreLaunchData() {}
void CConsoleMinecraftApp::ExitGame() {}
void CConsoleMinecraftApp::ExitGame() {
app.DebugPrintf("Linux_App CConsoleMinecraftApp::ExitGame AFTER START\n");
RenderManager.Close();
}
void CConsoleMinecraftApp::FatalLoadError() {
app.DebugPrintf(
"CConsoleMinecraftApp::FatalLoadError - asserting 0 and dying...\n");