Add quit confirmation to main menu

Implement a quit confirmation dialog that appears when the QUIT button is selected on the main menu. The dialog displays 'EXIT GAME?' with YES/NO options. YES sends a coAction quit request to the plugin, which hides the overlay, disconnects any active server session, and sets RE::Main::quitGame to exit the game. NO returns to the main menu. Includes full keyboard (arrow keys, Enter, Escape), gamepad (dpad, A/B buttons), and mouse support. Default selection is NO.
This commit is contained in:
2026-07-07 22:33:33 +12:00
parent 549c117818
commit 2a3e614a47
7 changed files with 379 additions and 7 deletions
+26 -1
View File
@@ -60,6 +60,7 @@ namespace F4T::PrismaUI
// several functions call each other out of definition order).
void HideMainMenuInternal();
void ShowMainMenuInternal();
void RequestQuitFromMainMenu();
void HideServerBrowserInternal();
void ShowServerBrowserInternal();
void CreateMainMenuView();
@@ -619,6 +620,30 @@ namespace F4T::PrismaUI
RequestNativeCursorRestore();
}
void RequestQuitFromMainMenu()
{
LogInfo("Quit requested from main menu.");
HideMainMenuInternal();
F4T::Networking::DisconnectFromLocalServer();
const auto* taskInterface = F4SE::GetTaskInterface();
if (!taskInterface) {
LogWarning("Game task interface unavailable; cannot queue quit.");
return;
}
taskInterface->AddTask([]() {
auto* main = RE::Main::GetSingleton();
if (!main) {
REX::WARN("{} Main singleton unavailable; cannot quit game.", GetLogPrefix());
return;
}
main->quitGame = true;
});
}
void OnMainMenuDomReady(PrismaView a_view)
{
g_mainMenuDomReady = true;
@@ -674,7 +699,7 @@ namespace F4T::PrismaUI
F4T::MainMenuVanillaSettings::OpenGameSettings();
return;
} else if (actionName == "quit") {
LogInfo("quit requested from main menu (not yet implemented).");
RequestQuitFromMainMenu();
return;
}