From f31973030e0f6b4778c0fdba4152ade0cc4d743e Mon Sep 17 00:00:00 2001 From: Dmugetsu Date: Tue, 25 Mar 2025 22:53:57 -0600 Subject: [PATCH] Adding all Daniel Suggestions and fixed F9 not working with debug menu open. --- src/core/devtools/layer.cpp | 22 +++++----------------- src/qt_gui/main_window.cpp | 16 +++++++++++++--- src/qt_gui/main_window_themes.cpp | 25 ++++++++++++++----------- src/sdl_window.cpp | 6 ++++++ 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index e3956157b..94b39e801 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -118,22 +118,6 @@ void L::DrawMenuBar() { EndMainMenuBar(); } - - if (IsKeyPressed(ImGuiKey_F9, false)) { - if (io.KeyCtrl && io.KeyAlt) { - if (!DebugState.ShouldPauseInSubmit()) { - DebugState.RequestFrameDump(dump_frame_count); - } - } - if (!io.KeyCtrl && !io.KeyAlt) { - if (isSystemPaused) { - DebugState.ResumeGuestThreads(); - } else { - DebugState.PauseGuestThreads(); - } - } - } - if (open_popup_options) { OpenPopup("GPU Tools Options"); just_opened_options = true; @@ -383,7 +367,11 @@ void L::Draw() { } if (IsKeyPressed(ImGuiKey_F9, false)) { - if (!io.KeyCtrl && !io.KeyAlt) { + if (io.KeyCtrl && io.KeyAlt) { + if (!DebugState.ShouldPauseInSubmit()) { + DebugState.RequestFrameDump(dump_frame_count); + } + } else { if (DebugState.IsGuestThreadsPaused()) { DebugState.ResumeGuestThreads(); SDL_Log("Game resumed from Keyboard"); diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index a0ebb6cbe..a782f5e5a 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -197,8 +197,6 @@ void MainWindow::AddUiWidgets() { ui->toolBar->clear(); ui->toolBar->addWidget(createSpacer(this)); - ui->toolBar->addWidget( - createButtonWithLabel(ui->refreshButton, tr("Refresh List"), showLabels)); ui->toolBar->addWidget(createButtonWithLabel(ui->playButton, tr("Play"), showLabels)); ui->toolBar->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause"), showLabels)); ui->toolBar->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop"), showLabels)); @@ -212,7 +210,15 @@ void MainWindow::AddUiWidgets() { createButtonWithLabel(ui->controllerButton, tr("Controllers"), showLabels)); ui->toolBar->addWidget(createButtonWithLabel(ui->keyboardButton, tr("Keyboard"), showLabels)); ui->toolBar->addWidget(createSpacer(this)); - + ui->toolBar->addWidget( + createButtonWithLabel(ui->refreshButton, tr("Refresh List"), showLabels)); + ui->toolBar->addWidget(createSpacer(this)); + QFrame* line = new QFrame(this); + line->setFrameShape(QFrame::VLine); + line->setFrameShadow(QFrame::Sunken); + line->setMinimumWidth(2); + ui->toolBar->addWidget(line); + ui->toolBar->addWidget(createSpacer(this)); if (showLabels) { QLabel* pauseButtonLabel = ui->pauseButton->parentWidget()->findChild(); if (pauseButtonLabel) { @@ -1473,6 +1479,10 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* event) { } void MainWindow::StartEmulator(std::filesystem::path path) { + if (isGameRunning) { + QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Game is already running!"))); + return; + } isGameRunning = true; #ifdef __APPLE__ // SDL on macOS requires main thread. diff --git a/src/qt_gui/main_window_themes.cpp b/src/qt_gui/main_window_themes.cpp index 5094c9224..25ca0921d 100644 --- a/src/qt_gui/main_window_themes.cpp +++ b/src/qt_gui/main_window_themes.cpp @@ -170,25 +170,28 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { qApp->setPalette(themePalette); break; case Theme::Oled: - mw_searchbar->setStyleSheet( - "QLineEdit {" - "background-color: #000000; color: #ffffff; border: 1px solid #a0a0a0; " - "border-radius: 4px; padding: 5px; }" - "border: 1px solid #808080; border-radius: 4px; }"); - themePalette.setColor(QPalette::Window, Qt::black); + mw_searchbar->setStyleSheet("QLineEdit:focus {" + "border: 1px solid #2A82DA; }"); + themePalette.setColor(QPalette::Window, QColor(0, 0, 0, 0)); themePalette.setColor(QPalette::WindowText, Qt::white); - themePalette.setColor(QPalette::Base, Qt::black); - themePalette.setColor(QPalette::AlternateBase, Qt::black); - themePalette.setColor(QPalette::ToolTipBase, Qt::black); + themePalette.setColor(QPalette::Base, QColor(0, 0, 0, 0)); + themePalette.setColor(QPalette::AlternateBase, QColor(0, 0, 0, 0)); + themePalette.setColor(QPalette::ToolTipBase, QColor(0, 0, 0, 0)); themePalette.setColor(QPalette::ToolTipText, Qt::white); themePalette.setColor(QPalette::Text, Qt::white); - themePalette.setColor(QPalette::Button, QColor(5, 5, 5)); + themePalette.setColor(QPalette::Button, QColor(0, 0, 0, 0)); themePalette.setColor(QPalette::ButtonText, Qt::white); themePalette.setColor(QPalette::BrightText, Qt::red); themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); - themePalette.setColor(QPalette::HighlightedText, Qt::white); + themePalette.setColor(QPalette::HighlightedText, QColor(0, 0, 0, 0)); qApp->setPalette(themePalette); + qApp->setStyleSheet("QLineEdit {" + "background-color: QColor(0, 0, 0, 0); color: QColor(0, 0, 0, 0); border: 1px solid #a0a0a0; " + "border-radius: 4px; padding: 5px; }" + + "QCheckBox::indicator:unchecked {" + "border: 1px solid #808080; border-radius: 4px; }"); break; } } \ No newline at end of file diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 142a56830..fcdde7240 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -334,6 +334,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_ WindowSDL::~WindowSDL() = default; void WindowSDL::WaitEvent() { + // Called on main thread SDL_Event event; if (!SDL_WaitEvent(&event)) { @@ -343,6 +344,7 @@ void WindowSDL::WaitEvent() { if (ImGui::Core::ProcessEvent(&event)) { return; } + switch (event.type) { case SDL_EVENT_WINDOW_RESIZED: case SDL_EVENT_WINDOW_MAXIMIZED: @@ -378,6 +380,8 @@ void WindowSDL::WaitEvent() { case SDL_EVENT_GAMEPAD_AXIS_MOTION: OnGamepadEvent(&event); break; + // i really would have appreciated ANY KIND OF DOCUMENTATION ON THIS + // AND IT DOESN'T EVEN USE PROPER ENUMS case SDL_EVENT_GAMEPAD_SENSOR_UPDATE: switch ((SDL_SensorType)event.gsensor.sensor) { case SDL_SENSOR_GYRO: @@ -412,6 +416,8 @@ void WindowSDL::WaitEvent() { DebugState.PauseGuestThreads(); } break; + default: + break; } }