From c311cb9fdfdbed1d2a9691161195ad5032025831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 28 Jun 2025 14:02:12 +0200 Subject: [PATCH] Delete WindowsHost.cpp/h --- CMakeLists.txt | 2 - Windows/EmuThread.cpp | 1 - Windows/PPSSPP.vcxproj | 2 - Windows/PPSSPP.vcxproj.filters | 6 --- Windows/RawInput.cpp | 1 - Windows/WindowsHost.cpp | 71 ---------------------------------- Windows/WindowsHost.h | 36 ----------------- Windows/main.cpp | 51 +++++++++++++++++------- 8 files changed, 36 insertions(+), 134 deletions(-) delete mode 100644 Windows/WindowsHost.cpp delete mode 100644 Windows/WindowsHost.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 24ba6fd026..19a2ab8893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2699,8 +2699,6 @@ set(WindowsFiles Windows/W32Util/DarkMode.cpp Windows/W32Util/UAHMenuBar.h Windows/W32Util/UAHMenuBar.cpp - Windows/WindowsHost.cpp - Windows/WindowsHost.h Windows/MainWindow.cpp Windows/MainWindow.h Windows/MainWindowMenu.cpp diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 00901a3ba8..d5b6ec23fb 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -18,7 +18,6 @@ #include "Windows/W32Util/Misc.h" #include "Windows/MainWindow.h" #include "Windows/resource.h" -#include "Windows/WindowsHost.h" #include "Core/Reporting.h" #include "Core/MemMap.h" #include "Core/Core.h" diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index c52a62c76e..d39a9ea087 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -720,7 +720,6 @@ - Create @@ -1168,7 +1167,6 @@ - diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters index 10cd3c39bc..7618b385c0 100644 --- a/Windows/PPSSPP.vcxproj.filters +++ b/Windows/PPSSPP.vcxproj.filters @@ -94,9 +94,6 @@ Windows\UI - - Windows\System - Windows\Debugger @@ -303,9 +300,6 @@ Windows\UI - - Windows\System - diff --git a/Windows/RawInput.cpp b/Windows/RawInput.cpp index 6872129716..028155438c 100644 --- a/Windows/RawInput.cpp +++ b/Windows/RawInput.cpp @@ -25,7 +25,6 @@ #include "Common/Log.h" #include "Windows/RawInput.h" #include "Windows/MainWindow.h" -#include "Windows/WindowsHost.h" #include "Common/CommonFuncs.h" #include "Common/SysError.h" #include "Core/Config.h" diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp deleted file mode 100644 index 321c54fc9e..0000000000 --- a/Windows/WindowsHost.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2012- PPSSPP Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official git repository and contact information can be found at -// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. - -#include "ppsspp_config.h" - -#include - -// native stuff -#include "Common/System/Display.h" -#include "Common/System/NativeApp.h" -#include "Common/Input/InputState.h" -#include "Common/Input/KeyCodes.h" -#include "Common/StringUtils.h" - -#include "Core/Core.h" -#include "Core/Config.h" -#include "Core/ConfigValues.h" -#include "Core/CoreParameter.h" -#include "Core/HLE/Plugins.h" -#include "Core/System.h" -#include "Core/Debugger/SymbolMap.h" -#include "Core/Instance.h" - -#include "UI/OnScreenDisplay.h" - -#include "Windows/EmuThread.h" -#include "Windows/WindowsHost.h" -#include "Windows/MainWindow.h" - -#include "Windows/DinputDevice.h" -#include "Windows/XinputDevice.h" - -#include "Windows/main.h" - -void WindowsInputManager::Init() { - //add first XInput device to respond - input.push_back(std::make_unique()); - input.push_back(std::make_unique()); -} - -void WindowsInputManager::PollControllers() { - for (const auto &device : input) { - if (device->UpdateState() == InputDevice::UPDATESTATE_SKIP_PAD) - break; - } - - // Disabled by default, needs a workaround to map to psp keys. - if (g_Config.bMouseControl) { - NativeMouseDelta(mouseDeltaX_, mouseDeltaY_); - } - - mouseDeltaX_ *= g_Config.fMouseSmoothing; - mouseDeltaY_ *= g_Config.fMouseSmoothing; - - HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_X] = mouseDeltaX_; - HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_Y] = mouseDeltaY_; -} diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h deleted file mode 100644 index bbe7d50941..0000000000 --- a/Windows/WindowsHost.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2012- PPSSPP Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official git repository and contact information can be found at -// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. - -#include -#include - -#include "Common/CommonWindows.h" -#include "Windows/InputDevice.h" - -class WindowsInputManager { -public: - void Init(); - void PollControllers(); - -private: - std::list> input; - - float mouseDeltaX_ = 0; - float mouseDeltaY_ = 0; -}; - -extern WindowsInputManager g_inputManager; diff --git a/Windows/main.cpp b/Windows/main.cpp index 19e6ee35e6..02a8a6e3e8 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -23,23 +23,22 @@ #include #include -#include "Common/CommonWindows.h" -#include "Common/File/FileUtil.h" -#include "Common/OSVersion.h" -#include "Common/GPU/Vulkan/VulkanLoader.h" -#include "ppsspp_config.h" - #include #include #include #include #include +#include "Common/CommonWindows.h" +#include "Common/File/FileUtil.h" +#include "Common/OSVersion.h" +#include "Common/GPU/Vulkan/VulkanLoader.h" +#include "ppsspp_config.h" + #include "Common/System/Display.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" #include "Common/System/Request.h" -#include "Common/File/FileUtil.h" #include "Common/File/VFS/VFS.h" #include "Common/File/VFS/DirectoryReader.h" #include "Common/Data/Text/I18n.h" @@ -55,6 +54,7 @@ #include "Core/ConfigValues.h" #include "Core/SaveState.h" #include "Core/Instance.h" +#include "Core/HLE/Plugins.h" #include "Windows/EmuThread.h" #include "Windows/WindowsAudio.h" #include "ext/disarm.h" @@ -67,7 +67,8 @@ #include "UI/GameInfoCache.h" #include "Windows/resource.h" - +#include "Windows/DinputDevice.h" +#include "Windows/XinputDevice.h" #include "Windows/MainWindow.h" #include "Windows/Debugger/Debugger_Disasm.h" #include "Windows/Debugger/Debugger_MemoryDlg.h" @@ -84,8 +85,6 @@ #include "Windows/Debugger/CtrlRegisterList.h" #include "Windows/Debugger/DebuggerShared.h" #include "Windows/InputBox.h" - -#include "Windows/WindowsHost.h" #include "Windows/main.h" #ifdef _MSC_VER @@ -121,11 +120,13 @@ static std::string gpuDriverVersion; static std::string restartArgs; int g_activeWindow = 0; - -WindowsInputManager g_inputManager; - int g_lastNumInstances = 0; +std::list> g_inputDevices; + +float mouseDeltaX_ = 0; +float mouseDeltaY_ = 0; + static double g_lastActivity = 0.0; static double g_lastKeepAwake = 0.0; // Time until we stop considering the core active without user input. @@ -150,6 +151,24 @@ static void AddDebugRestartArgs() { restartArgs += " -l"; } +static void PollControllers() { + for (const auto &device : g_inputDevices) { + if (device->UpdateState() == InputDevice::UPDATESTATE_SKIP_PAD) + break; + } + + // Disabled by default, needs a workaround to map to psp keys. + if (g_Config.bMouseControl) { + NativeMouseDelta(mouseDeltaX_, mouseDeltaY_); + } + + mouseDeltaX_ *= g_Config.fMouseSmoothing; + mouseDeltaY_ *= g_Config.fMouseSmoothing; + + HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_X] = mouseDeltaX_; + HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_Y] = mouseDeltaY_; +} + // Adapted mostly as-is from http://www.gamedev.net/topic/495075-how-to-retrieve-info-about-videocard/?view=findpost&p=4229170 // so credit goes to that post's author, and in turn, the author of the site mentioned in that post (which seems to be down?). std::string GetVideoCardDriverVersion() { @@ -488,7 +507,7 @@ void System_Notify(SystemNotification notification) { break; case SystemNotification::POLL_CONTROLLERS: - g_inputManager.PollControllers(); + PollControllers(); // Also poll the audio backend for changes. break; @@ -1117,7 +1136,9 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin MainWindow::Minimize(); } - g_inputManager.Init(); + //add first XInput device to respond + g_inputDevices.push_back(std::make_unique()); + g_inputDevices.push_back(std::make_unique()); // Emu thread (and render thread, if any) is always running! // Only OpenGL uses an externally managed render thread (due to GL's single-threaded context design). Vulkan