adding safe back to not open multiple games, plus more info into the tip

This commit is contained in:
Dmugetsu 2025-07-11 06:46:08 -06:00
parent 903400328c
commit 50aa8ec6bb
2 changed files with 18 additions and 5 deletions

View File

@ -3,7 +3,7 @@
#include "layer.h" #include "layer.h"
#include <imgui.h> #include "SDL3/SDL_events.h"
#include "SDL3/SDL_log.h" #include "SDL3/SDL_log.h"
#include "common/config.h" #include "common/config.h"
@ -30,7 +30,7 @@ static bool show_simple_fps = false;
static bool visibility_toggled = false; static bool visibility_toggled = false;
static bool show_fullscreen_tip = true; static bool show_fullscreen_tip = true;
static float fullscreen_tip_timer = 5.0f; static float fullscreen_tip_timer = 8.0f;
static float fps_scale = 1.0f; static float fps_scale = 1.0f;
static int dump_frame_count = 1; static int dump_frame_count = 1;
@ -362,6 +362,11 @@ void L::SetupSettings() {
void L::Draw() { void L::Draw() {
const auto io = GetIO(); const auto io = GetIO();
PushID("DevtoolsLayer"); PushID("DevtoolsLayer");
if (IsKeyPressed(ImGuiKey_F4, false)) {
SDL_Event quitEvent;
quitEvent.type = SDL_EVENT_QUIT;
SDL_PushEvent(&quitEvent);
}
if (show_fullscreen_tip) { if (show_fullscreen_tip) {
fullscreen_tip_timer -= io.DeltaTime; fullscreen_tip_timer -= io.DeltaTime;
@ -371,8 +376,10 @@ void L::Draw() {
// Display the fullscreen tip near the top-left corner, below pause message if needed // Display the fullscreen tip near the top-left corner, below pause message if needed
ImVec2 pos(10, 30); // adjust Y so it doesn't overlap pause text at y=10 ImVec2 pos(10, 30); // adjust Y so it doesn't overlap pause text at y=10
ImU32 color = IM_COL32(255, 255, 255, 255); ImU32 color = IM_COL32(255, 255, 255, 255);
ImGui::GetForegroundDrawList()->AddText( ImGui::GetForegroundDrawList()->AddText(pos, color,
pos, color, "Press F11 to toggle FullScreen and F9 to Pause Emulation"); "Press F11 to toggle FullScreen\n"
"F9 to Pause Emulation\n"
"F4 to Stop Game");
} }
} }
if (!DebugState.IsGuestThreadsPaused()) { if (!DebugState.IsGuestThreadsPaused()) {
@ -452,4 +459,4 @@ void L::Draw() {
} }
PopID(); PopID();
} }

View File

@ -801,6 +801,12 @@ void MainWindow::CreateConnects() {
} }
void MainWindow::StartGame() { void MainWindow::StartGame() {
if (isGameRunning) {
QMessageBox::critical(nullptr, tr("Run Game"), tr("Game is already running!"));
return;
}
isGameRunning = false;
BackgroundMusicPlayer::getInstance().stopMusic(); BackgroundMusicPlayer::getInstance().stopMusic();
QString gamePath = ""; QString gamePath = "";
int table_mode = m_gui_settings->GetValue(gui::gl_mode).toInt(); int table_mode = m_gui_settings->GetValue(gui::gl_mode).toInt();