From 71da0f2d24f5233c643347a72ed695f72cd68489 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 08:40:43 +0200 Subject: [PATCH 1/9] DolphinNoGUI: Replace deprecated `signal.h` header --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 2d677aa7ba..f25f20eef4 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -4,10 +4,10 @@ #include "DolphinNoGUI/Platform.h" #include +#include #include #include #include -#include #include #include @@ -307,8 +307,8 @@ int main(int argc, char* argv[]) }); #ifdef _WIN32 - signal(SIGINT, signal_handler); - signal(SIGTERM, signal_handler); + std::signal(SIGINT, signal_handler); + std::signal(SIGTERM, signal_handler); #else // Shut down cleanly on SIGINT and SIGTERM struct sigaction sa; From e3df00b7f41c271bef5413a12247e8c056e2ae71 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 09:10:36 +0200 Subject: [PATCH 2/9] DolphinNoGUI: Make variables constexpr --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 2 +- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index f25f20eef4..f41f50dbe2 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -40,7 +40,7 @@ static std::unique_ptr s_platform; static void signal_handler(int) { - const char message[] = "A signal was received. A second signal will force Dolphin to stop.\n"; + constexpr char message[] = "A signal was received. A second signal will force Dolphin to stop.\n"; #ifdef _WIN32 puts(message); #else diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index c78c563d5d..b1bdfa022c 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -185,7 +185,7 @@ LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam if (hwnd) { // Remove rounded corners from the render window on Windows 11 - const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; + constexpr DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference, sizeof(corner_preference)); } From 135b6840e57424d56424f1704235c4ee919e20f5 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 09:39:12 +0200 Subject: [PATCH 3/9] DolphinNoGUI: Remove unused include directives --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 4 ---- Source/Core/DolphinNoGUI/Platform.cpp | 1 - Source/Core/DolphinNoGUI/PlatformWin32.cpp | 3 --- 3 files changed, 8 deletions(-) diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index f41f50dbe2..23f349086e 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -5,9 +5,7 @@ #include #include -#include #include -#include #include #include @@ -32,8 +30,6 @@ #endif #include "UICommon/UICommon.h" -#include "InputCommon/GCAdapter.h" - #include "VideoCommon/VideoBackendBase.h" static std::unique_ptr s_platform; diff --git a/Source/Core/DolphinNoGUI/Platform.cpp b/Source/Core/DolphinNoGUI/Platform.cpp index d057678788..b542f50e8c 100644 --- a/Source/Core/DolphinNoGUI/Platform.cpp +++ b/Source/Core/DolphinNoGUI/Platform.cpp @@ -6,7 +6,6 @@ #include "Core/HW/ProcessorInterface.h" #include "Core/IOS/IOS.h" #include "Core/IOS/STM/STM.h" -#include "Core/State.h" #include "Core/System.h" Platform::~Platform() = default; diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index b1bdfa022c..a6a0392fa2 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -3,16 +3,13 @@ #include "DolphinNoGUI/Platform.h" -#include "Common/MsgHandler.h" #include "Core/Config/MainSettings.h" #include "Core/ConfigManager.h" #include "Core/Core.h" -#include "Core/State.h" #include "Core/System.h" #include #include -#include #include #include "VideoCommon/Present.h" From 23af1e025b948f74fa9a170ba714dfb09f34a0a2 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 17:53:40 +0200 Subject: [PATCH 4/9] DolphinNoGUI: Make function static --- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index a6a0392fa2..01575ecca5 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -33,7 +33,7 @@ private: static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - bool RegisterRenderWindowClass(); + static bool RegisterRenderWindowClass(); bool CreateRenderWindow(); void UpdateWindowPosition(); void ProcessEvents(); From c37933932da31f2cde9844135b7c1adf2e9462eb Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 18:02:28 +0200 Subject: [PATCH 5/9] DolphinNoGUI: Make variables constant --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 3 ++- Source/Core/DolphinNoGUI/Platform.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 23f349086e..8598803afd 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -201,7 +201,8 @@ int main(int argc, char* argv[]) { Core::DeclareAsHostThread(); - auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::OmitGUIOptions); + const auto parser = + CommandLineParse::CreateParser(CommandLineParse::ParserOptions::OmitGUIOptions); parser->add_option("-p", "--platform") .action("store") .help("Window platform to use [%choices]") diff --git a/Source/Core/DolphinNoGUI/Platform.cpp b/Source/Core/DolphinNoGUI/Platform.cpp index b542f50e8c..fabb8bb924 100644 --- a/Source/Core/DolphinNoGUI/Platform.cpp +++ b/Source/Core/DolphinNoGUI/Platform.cpp @@ -23,7 +23,7 @@ void Platform::UpdateRunningFlag() { if (m_shutdown_requested.TestAndClear()) { - auto& system = Core::System::GetInstance(); + const auto& system = Core::System::GetInstance(); const auto ios = system.GetIOS(); const auto stm = ios ? ios->GetDeviceByName("/dev/stm/eventhook") : nullptr; if (!m_tried_graceful_shutdown.IsSet() && stm && From ec1d6593637ae7ae41c49cb66469df387a7ab150 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 18:03:57 +0200 Subject: [PATCH 6/9] DolphinNoGUI: Make classes final --- Source/Core/DolphinNoGUI/PlatformHeadless.cpp | 2 +- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinNoGUI/PlatformHeadless.cpp b/Source/Core/DolphinNoGUI/PlatformHeadless.cpp index 2f6ea2e7ac..9bf3383032 100644 --- a/Source/Core/DolphinNoGUI/PlatformHeadless.cpp +++ b/Source/Core/DolphinNoGUI/PlatformHeadless.cpp @@ -10,7 +10,7 @@ namespace { -class PlatformHeadless : public Platform +class PlatformHeadless final : public Platform { public: void SetTitle(const std::string& title) override; diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index 01575ecca5..5ba9afb5e1 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -17,7 +17,7 @@ namespace { -class PlatformWin32 : public Platform +class PlatformWin32 final : public Platform { public: ~PlatformWin32() override; From f04f659710bf50cd71e0516d67601d9019ed6400 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 18:08:43 +0200 Subject: [PATCH 7/9] DolphinNoGUI: Replace C-style cast with `reinterpret_cast` --- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index 5ba9afb5e1..28244829cc 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -63,7 +63,7 @@ bool PlatformWin32::RegisterRenderWindowClass() wc.hInstance = GetModuleHandle(nullptr); wc.hIcon = LoadIcon(nullptr, IDI_ICON1); wc.hCursor = LoadCursor(nullptr, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wc.hbrBackground = reinterpret_cast(COLOR_WINDOW + 1); wc.lpszMenuName = nullptr; wc.lpszClassName = WINDOW_CLASS_NAME; wc.hIconSm = LoadIcon(nullptr, IDI_ICON1); From 2ae928ca79ed99ce18bcf87841dbf167e611f5e8 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 18:13:14 +0200 Subject: [PATCH 8/9] DolphinNoGUI: Make parameters constant --- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 6 +++--- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 8598803afd..81051adb78 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -71,7 +71,7 @@ bool Host_UIBlocksControllerState() } static Common::Event s_update_main_frame_event; -void Host_Message(HostMessageID id) +void Host_Message(const HostMessageID id) { if (id == HostMessageID::WMUserStop) s_platform->Stop(); @@ -197,7 +197,7 @@ static std::unique_ptr GetPlatform(const optparse::Values& options) #define main app_main #endif -int main(int argc, char* argv[]) +int main(const int argc, char* argv[]) { Core::DeclareAsHostThread(); @@ -298,7 +298,7 @@ int main(int argc, char* argv[]) return 1; } - Core::AddOnStateChangedCallback([](Core::State state) { + Core::AddOnStateChangedCallback([](const Core::State state) { if (state == Core::State::Uninitialized) s_platform->Stop(); }); diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index 28244829cc..39daae400a 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -165,7 +165,8 @@ void PlatformWin32::ProcessEvents() } } -LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT PlatformWin32::WndProc(const HWND hwnd, const UINT msg, const WPARAM wParam, + const LPARAM lParam) { PlatformWin32* platform = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); switch (msg) From bae0e5f67ae00684d5e3e4e0102d0a593c412d71 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 20 Apr 2025 18:29:46 +0200 Subject: [PATCH 9/9] DolphinNoGUI: Make override explicit --- Source/Core/DolphinNoGUI/PlatformWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinNoGUI/PlatformWin32.cpp b/Source/Core/DolphinNoGUI/PlatformWin32.cpp index 39daae400a..7304332682 100644 --- a/Source/Core/DolphinNoGUI/PlatformWin32.cpp +++ b/Source/Core/DolphinNoGUI/PlatformWin32.cpp @@ -26,7 +26,7 @@ public: void SetTitle(const std::string& string) override; void MainLoop() override; - WindowSystemInfo GetWindowSystemInfo() const; + WindowSystemInfo GetWindowSystemInfo() const override; private: static constexpr TCHAR WINDOW_CLASS_NAME[] = _T("DolphinNoGUI");