diff --git a/CHANGES b/CHANGES index 969e56742..8e317b991 100644 --- a/CHANGES +++ b/CHANGES @@ -60,6 +60,7 @@ Misc: - Qt: Add QOpenGLWidget cross-thread codepath for macOS (fixes mgba.io/i/1754) - Qt: Enable -b for Boot BIOS menu option (fixes mgba.io/i/2074) - Qt: Add tile range selection to tile viewer (closes mgba.io/i/2455) + - Qt: Show warning if XQ audio is toggled while loaded (fixes mgba.io/i/2295) - Windows: Attach to console if present - Vita: Add bilinear filtering option (closes mgba.io/i/344) diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index 4af948d4b..65204df4b 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -483,7 +483,6 @@ void SettingsView::updateConfig() { saveSetting("logToStdout", m_ui.logToStdout); saveSetting("logFile", m_ui.logFile); saveSetting("useDiscordPresence", m_ui.useDiscordPresence); - saveSetting("gba.audioHle", m_ui.audioHle); saveSetting("dynamicTitle", m_ui.dynamicTitle); saveSetting("videoScale", m_ui.videoScale); saveSetting("gba.forceGbp", m_ui.forceGbp); @@ -577,6 +576,12 @@ void SettingsView::updateConfig() { emit languageChanged(); } + bool oldAudioHle = m_controller->getOption("gba.audioHle", "0") != "0"; + if (oldAudioHle != m_ui.audioHle->isChecked()) { + saveSetting("gba.audioHle", m_ui.audioHle); + emit audioHleChanged(); + } + if (m_ui.multiplayerAudioAll->isChecked()) { m_controller->setQtOption("multiplayerAudio", "all"); } else if (m_ui.multiplayerAudio1->isChecked()) { diff --git a/src/platform/qt/SettingsView.h b/src/platform/qt/SettingsView.h index d6ab1431b..1792c8f4b 100644 --- a/src/platform/qt/SettingsView.h +++ b/src/platform/qt/SettingsView.h @@ -62,6 +62,7 @@ signals: void pathsChanged(); void languageChanged(); void libraryCleared(); + void audioHleChanged(); public slots: void selectPage(Page); diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 76bcacebc..523b518d7 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -156,6 +156,8 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi m_focusCheck.setInterval(200); m_mustRestart.setInterval(MUST_RESTART_TIMEOUT); m_mustRestart.setSingleShot(true); + m_mustReset.setInterval(MUST_RESTART_TIMEOUT); + m_mustReset.setSingleShot(true); m_shortcutController->setConfigController(m_config); m_shortcutController->setActionMapper(&m_actions); @@ -534,11 +536,20 @@ void Window::openSettingsWindow(SettingsView::Page page) { #endif connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::reloadDisplayDriver); connect(settingsWindow, &SettingsView::audioDriverChanged, this, &Window::reloadAudioDriver); - connect(settingsWindow, &SettingsView::cameraDriverChanged, this, &Window::mustRestart); + connect(settingsWindow, &SettingsView::cameraDriverChanged, this, &Window::mustReset); connect(settingsWindow, &SettingsView::cameraChanged, &m_inputController, &InputController::setCamera); connect(settingsWindow, &SettingsView::videoRendererChanged, this, &Window::changeRenderer); connect(settingsWindow, &SettingsView::languageChanged, this, &Window::mustRestart); connect(settingsWindow, &SettingsView::pathsChanged, this, &Window::reloadConfig); + connect(settingsWindow, &SettingsView::audioHleChanged, this, [this]() { + if (!m_controller) { + return; + } + if (m_controller->platform() != mPLATFORM_GBA) { + return; + } + mustReset(); + }); #ifdef USE_SQLITE3 connect(settingsWindow, &SettingsView::libraryCleared, m_libraryView, &LibraryController::clear); #endif @@ -1082,6 +1093,18 @@ void Window::mustRestart() { dialog->show(); } +void Window::mustReset() { + if (m_mustReset.isActive() || !m_controller) { + return; + } + m_mustReset.start(); + QMessageBox* dialog = new QMessageBox(QMessageBox::Warning, tr("Reset needed"), + tr("Some changes will not take effect until the game is reset."), + QMessageBox::Ok, this, Qt::Sheet); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); +} + void Window::recordFrame() { m_frameList.append(m_frameTimer.nsecsElapsed()); m_frameTimer.restart(); diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index 9fdf564ca..4a76a5d2e 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -142,6 +142,7 @@ private slots: void tryMakePortable(); void mustRestart(); + void mustReset(); void recordFrame(); void showFPS(); @@ -215,6 +216,7 @@ private: QElapsedTimer m_frameTimer; QTimer m_fpsTimer; QTimer m_mustRestart; + QTimer m_mustReset; QList m_mruFiles; ShortcutController* m_shortcutController; #if defined(BUILD_GL) || defined(BUILD_GLES2)