From 7dd4152d6711db76fbe2a2acffcc208a524bb25d Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Fri, 26 Jan 2024 13:06:32 +0100 Subject: [PATCH 1/2] Add MaxFPS setting --- src/frontend/qt_sdl/Config.cpp | 2 + src/frontend/qt_sdl/Config.h | 1 + src/frontend/qt_sdl/EmuThread.cpp | 2 +- .../qt_sdl/InterfaceSettingsDialog.cpp | 2 + .../qt_sdl/InterfaceSettingsDialog.ui | 120 +++++++++++++----- 5 files changed, 92 insertions(+), 35 deletions(-) diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index b6fca7d6..02f43de7 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -61,6 +61,7 @@ int GL_ScaleFactor; bool GL_BetterPolygons; bool LimitFPS; +int MaxFPS; bool AudioSync; bool ShowOSD; @@ -251,6 +252,7 @@ ConfigEntry ConfigFile[] = {"GL_BetterPolygons", 1, &GL_BetterPolygons, false, false}, {"LimitFPS", 1, &LimitFPS, true, false}, + {"MaxFPS", 0, &MaxFPS, 1000, false}, {"AudioSync", 1, &AudioSync, false}, {"ShowOSD", 1, &ShowOSD, true, false}, diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h index 5e3db823..11644dc2 100644 --- a/src/frontend/qt_sdl/Config.h +++ b/src/frontend/qt_sdl/Config.h @@ -105,6 +105,7 @@ extern int GL_ScaleFactor; extern bool GL_BetterPolygons; extern bool LimitFPS; +extern int MaxFPS; extern bool AudioSync; extern bool ShowOSD; diff --git a/src/frontend/qt_sdl/EmuThread.cpp b/src/frontend/qt_sdl/EmuThread.cpp index 01431a1c..0728a085 100644 --- a/src/frontend/qt_sdl/EmuThread.cpp +++ b/src/frontend/qt_sdl/EmuThread.cpp @@ -576,7 +576,7 @@ void EmuThread::run() { bool limitfps = Config::LimitFPS && !fastforward; - double practicalFramelimit = limitfps ? frametimeStep : 1.0 / 1000.0; + double practicalFramelimit = limitfps ? frametimeStep : 1.0 / Config::MaxFPS; double curtime = SDL_GetPerformanceCounter() * perfCountsSec; diff --git a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp index 2f7417f6..75497bc3 100644 --- a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp +++ b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp @@ -34,6 +34,7 @@ InterfaceSettingsDialog::InterfaceSettingsDialog(QWidget* parent) : QDialog(pare ui->spinMouseHideSeconds->setEnabled(Config::MouseHide != 0); ui->spinMouseHideSeconds->setValue(Config::MouseHideSeconds); ui->cbPauseLostFocus->setChecked(Config::PauseLostFocus != 0); + ui->spinMaxFPS->setValue(Config::MaxFPS); } InterfaceSettingsDialog::~InterfaceSettingsDialog() @@ -60,6 +61,7 @@ void InterfaceSettingsDialog::done(int r) Config::MouseHide = ui->cbMouseHide->isChecked() ? 1:0; Config::MouseHideSeconds = ui->spinMouseHideSeconds->value(); Config::PauseLostFocus = ui->cbPauseLostFocus->isChecked() ? 1:0; + Config::MaxFPS = ui->spinMaxFPS->value(); Config::Save(); diff --git a/src/frontend/qt_sdl/InterfaceSettingsDialog.ui b/src/frontend/qt_sdl/InterfaceSettingsDialog.ui index 8ee9feda..01ba4a46 100644 --- a/src/frontend/qt_sdl/InterfaceSettingsDialog.ui +++ b/src/frontend/qt_sdl/InterfaceSettingsDialog.ui @@ -6,8 +6,8 @@ 0 0 - 262 - 113 + 337 + 233 @@ -19,32 +19,96 @@ Interface settings - melonDS - - - - - Hide after + + + + + Main window + + + + + Hide mouse after inactivity + + + + + + + 18 + + + + + After + + + spinMouseHideSeconds + + + + + + + + + + seconds + + + spinMouseHideSeconds + + + + + + + + + Pause emulation when window is not in focus + + + + - - - - Pause emulation when window is not in focus + + + + Framerate + + + + + Fast-forward limit + + + spinMaxFPS + + + + + + + FPS + + + 60 + + + 1000 + + + 1000 + + + + - - - - Hide mouse after inactivity - - - - - - - + Qt::Horizontal @@ -54,20 +118,8 @@ - - - - seconds of inactivity - - - - - cbMouseHide - spinMouseHideSeconds - cbPauseLostFocus - From d48e5f2da0439c7109c7ed5c003fa00d58dadbe9 Mon Sep 17 00:00:00 2001 From: Jesse Talavera Date: Thu, 1 Feb 2024 08:36:35 -0500 Subject: [PATCH 2/2] Fix DSiWare detection (#1969) - According to GBATek, all DSiWare games have a high title ID of 0x00030004 - Some homebrew apps set the Unitcode bits to DSi mode to enable support of DSi features --- src/NDS_Header.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/NDS_Header.h b/src/NDS_Header.h index de75f7c7..77a5baca 100644 --- a/src/NDS_Header.h +++ b/src/NDS_Header.h @@ -39,6 +39,8 @@ enum RegionMask : u32 RegionFree = 0xFFFFFFFF, }; +constexpr u32 DSiWareTitleIDHigh = 0x00030004; + // Consult GBATEK for info on what these are struct NDSHeader { @@ -198,8 +200,9 @@ struct NDSHeader u8 HeaderSignature[128]; // RSA-SHA1 across 0x000..0xDFF - /// @return \c true if this header represents a DSi title - /// (either a physical cartridge or a DSiWare title). + /// @return \c true if this header represents a title + /// that is DSi-exclusive (including DSiWare) + /// or DSi-enhanced (including cartridges). [[nodiscard]] bool IsDSi() const { return (UnitCode & 0x02) != 0; } [[nodiscard]] u32 GameCodeAsU32() const { return (u32)GameCode[3] << 24 | @@ -213,7 +216,7 @@ struct NDSHeader } /// @return \c true if this header represents a DSiWare title. - [[nodiscard]] bool IsDSiWare() const { return IsDSi() && DSiRegionStart == 0; } + [[nodiscard]] bool IsDSiWare() const { return IsDSi() && DSiTitleIDHigh == DSiWareTitleIDHigh; } }; static_assert(sizeof(NDSHeader) == 4096, "NDSHeader is not 4096 bytes!");