diff --git a/pcsx2-qt/AutoUpdaterDialog.cpp b/pcsx2-qt/AutoUpdaterDialog.cpp index eb853587a9..c4bf21b1a6 100644 --- a/pcsx2-qt/AutoUpdaterDialog.cpp +++ b/pcsx2-qt/AutoUpdaterDialog.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -20,7 +20,7 @@ #include "QtHost.h" #include "QtUtils.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/SysForwardDefs.h" #include "svnrev.h" diff --git a/pcsx2-qt/CoverDownloadDialog.cpp b/pcsx2-qt/CoverDownloadDialog.cpp index 1b7e3ecda1..fe565933e0 100644 --- a/pcsx2-qt/CoverDownloadDialog.cpp +++ b/pcsx2-qt/CoverDownloadDialog.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,12 +15,12 @@ #include "PrecompiledHeader.h" -#include "common/Assertions.h" - -#include "pcsx2/Frontend/GameList.h" - #include "CoverDownloadDialog.h" +#include "pcsx2/GameList.h" + +#include "common/Assertions.h" + CoverDownloadDialog::CoverDownloadDialog(QWidget* parent /*= nullptr*/) : QDialog(parent) { diff --git a/pcsx2-qt/DisplayWidget.cpp b/pcsx2-qt/DisplayWidget.cpp index e4a2511352..45beeae512 100644 --- a/pcsx2-qt/DisplayWidget.cpp +++ b/pcsx2-qt/DisplayWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,16 +15,15 @@ #include "PrecompiledHeader.h" -#include "common/Assertions.h" - -#include "pcsx2/Frontend/ImGuiManager.h" - #include "DisplayWidget.h" #include "MainWindow.h" #include "QtHost.h" #include "QtUtils.h" #include "pcsx2/GS/GSIntrin.h" // _BitScanForward +#include "pcsx2/ImGui/ImGuiManager.h" + +#include "common/Assertions.h" #include #include diff --git a/pcsx2-qt/GameList/GameListModel.h b/pcsx2-qt/GameList/GameListModel.h index 6837ec78aa..eb1e06e87e 100644 --- a/pcsx2-qt/GameList/GameListModel.h +++ b/pcsx2-qt/GameList/GameListModel.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,8 +14,11 @@ */ #pragma once -#include "pcsx2/Frontend/GameList.h" + +#include "pcsx2/GameList.h" + #include "common/LRUCache.h" + #include #include #include diff --git a/pcsx2-qt/GameList/GameListRefreshThread.cpp b/pcsx2-qt/GameList/GameListRefreshThread.cpp index 89c809d066..521d2602dd 100644 --- a/pcsx2-qt/GameList/GameListRefreshThread.cpp +++ b/pcsx2-qt/GameList/GameListRefreshThread.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,11 +15,12 @@ #include "PrecompiledHeader.h" +#include "GameListRefreshThread.h" + +#include "pcsx2/GameList.h" + #include "common/ProgressCallback.h" #include "common/Timer.h" -#include "pcsx2/Frontend/GameList.h" - -#include "GameListRefreshThread.h" #include @@ -64,7 +65,9 @@ void AsyncRefreshProgressCallback::SetProgressValue(u32 value) fireUpdate(); } -void AsyncRefreshProgressCallback::SetTitle(const char* title) {} +void AsyncRefreshProgressCallback::SetTitle(const char* title) +{ +} void AsyncRefreshProgressCallback::DisplayError(const char* message) { diff --git a/pcsx2-qt/GameList/GameListWidget.cpp b/pcsx2-qt/GameList/GameListWidget.cpp index 12e9133674..f7d274dcb7 100644 --- a/pcsx2-qt/GameList/GameListWidget.cpp +++ b/pcsx2-qt/GameList/GameListWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,11 +15,19 @@ #include "PrecompiledHeader.h" +#include "GameListModel.h" +#include "GameListRefreshThread.h" +#include "GameListWidget.h" +#include "QtHost.h" +#include "QtUtils.h" + +#include "pcsx2/GameList.h" +#include "pcsx2/Host.h" + #include "common/Assertions.h" #include "common/StringUtil.h" -#include "pcsx2/Frontend/GameList.h" -#include "pcsx2/HostSettings.h" +#include "fmt/format.h" #include #include @@ -29,14 +37,6 @@ #include #include -#include "GameListModel.h" -#include "GameListRefreshThread.h" -#include "GameListWidget.h" -#include "QtHost.h" -#include "QtUtils.h" - -#include "fmt/format.h" - static const char* SUPPORTED_FORMATS_STRING = QT_TRANSLATE_NOOP(GameListWidget, ".bin/.iso (ISO Disc Images)\n" ".mdf (Media Descriptor File)\n" diff --git a/pcsx2-qt/GameList/GameListWidget.h b/pcsx2-qt/GameList/GameListWidget.h index 4e36353e16..dc06f41379 100644 --- a/pcsx2-qt/GameList/GameListWidget.h +++ b/pcsx2-qt/GameList/GameListWidget.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,9 +14,12 @@ */ #pragma once -#include "pcsx2/Frontend/GameList.h" + #include "ui_EmptyGameListWidget.h" #include "ui_GameListWidget.h" + +#include "pcsx2/GameList.h" + #include #include diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index a8b7b1dbd0..838c88b11d 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -15,31 +15,6 @@ #include "PrecompiledHeader.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common/Assertions.h" -#include "common/CocoaTools.h" -#include "common/FileSystem.h" - -#include "pcsx2/CDVD/CDVDcommon.h" -#include "pcsx2/CDVD/CDVDdiscReader.h" -#include "pcsx2/Frontend/GameList.h" -#include "pcsx2/Frontend/LogSink.h" -#include "pcsx2/GS.h" -#include "pcsx2/GS/GS.h" -#include "pcsx2/GSDumpReplayer.h" -#include "pcsx2/HostSettings.h" -#include "pcsx2/PerformanceMetrics.h" -#include "pcsx2/Recording/InputRecording.h" -#include "pcsx2/Recording/InputRecordingControls.h" - #include "AboutDialog.h" #include "AutoUpdaterDialog.h" #include "CoverDownloadDialog.h" @@ -49,23 +24,45 @@ #include "MainWindow.h" #include "QtHost.h" #include "QtUtils.h" +#include "SettingWidgetBinder.h" #include "Settings/ControllerSettingsDialog.h" #include "Settings/GameListSettingsWidget.h" #include "Settings/InterfaceSettingsWidget.h" -#include "SettingWidgetBinder.h" -#include "svnrev.h" #include "Tools/InputRecording/InputRecordingViewer.h" #include "Tools/InputRecording/NewInputRecordingDlg.h" +#include "svnrev.h" + +#include "pcsx2/Achievements.h" +#include "pcsx2/CDVD/CDVDcommon.h" +#include "pcsx2/CDVD/CDVDdiscReader.h" +#include "pcsx2/GS.h" +#include "pcsx2/GS/GS.h" +#include "pcsx2/GSDumpReplayer.h" +#include "pcsx2/GameList.h" +#include "pcsx2/Host.h" +#include "pcsx2/LogSink.h" +#include "pcsx2/PerformanceMetrics.h" +#include "pcsx2/Recording/InputRecording.h" +#include "pcsx2/Recording/InputRecordingControls.h" + +#include "common/Assertions.h" +#include "common/CocoaTools.h" +#include "common/FileSystem.h" + +#include +#include +#include +#include +#include +#include +#include +#include #ifdef _WIN32 #include "common/RedtapeWindows.h" #include #endif -#ifdef ENABLE_RAINTEGRATION -#include "pcsx2/Frontend/Achievements.h" -#endif - const char* MainWindow::OPEN_FILE_FILTER = QT_TRANSLATE_NOOP("MainWindow", "All File Types (*.bin *.iso *.cue *.mdf *.chd *.cso *.gz *.elf *.irx *.gs *.gs.xz *.gs.zst *.dump);;" "Single-Track Raw Images (*.bin *.iso);;" diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index 32d72ed303..f1b1202c43 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,8 +15,33 @@ #include "PrecompiledHeader.h" -#include -#include +#include "AutoUpdaterDialog.h" +#include "DisplayWidget.h" +#include "GameList/GameListWidget.h" +#include "MainWindow.h" +#include "QtHost.h" +#include "QtUtils.h" +#include "svnrev.h" + +#include "pcsx2/CDVD/CDVDcommon.h" +#include "pcsx2/CommonHost.h" +#include "pcsx2/Achievements.h" +#include "pcsx2/CDVD/CDVD.h" +#include "pcsx2/Counters.h" +#include "pcsx2/DebugTools/Debug.h" +#include "pcsx2/GS.h" +#include "pcsx2/GS/GS.h" +#include "pcsx2/GSDumpReplayer.h" +#include "pcsx2/GameList.h" +#include "pcsx2/Host.h" +#include "pcsx2/INISettingsInterface.h" +#include "pcsx2/ImGui/FullscreenUI.h" +#include "pcsx2/ImGui/ImGuiManager.h" +#include "pcsx2/Input/InputManager.h" +#include "pcsx2/LogSink.h" +#include "pcsx2/PAD/Host/PAD.h" +#include "pcsx2/PerformanceMetrics.h" +#include "pcsx2/VMManager.h" #include "common/Assertions.h" #include "common/Console.h" @@ -28,25 +53,6 @@ #include "common/StringUtil.h" #include "common/Timer.h" -#include "pcsx2/CDVD/CDVD.h" -#include "pcsx2/CDVD/CDVDcommon.h" -#include "pcsx2/Counters.h" -#include "pcsx2/DebugTools/Debug.h" -#include "pcsx2/Frontend/CommonHost.h" -#include "pcsx2/Frontend/FullscreenUI.h" -#include "pcsx2/Frontend/GameList.h" -#include "pcsx2/Frontend/InputManager.h" -#include "pcsx2/Frontend/ImGuiManager.h" -#include "pcsx2/Frontend/LogSink.h" -#include "pcsx2/GS.h" -#include "pcsx2/GS/GS.h" -#include "pcsx2/GSDumpReplayer.h" -#include "pcsx2/HostSettings.h" -#include "pcsx2/INISettingsInterface.h" -#include "pcsx2/PAD/Host/PAD.h" -#include "pcsx2/PerformanceMetrics.h" -#include "pcsx2/VMManager.h" - #include #include #include @@ -55,17 +61,8 @@ #include "fmt/core.h" -#include "AutoUpdaterDialog.h" -#include "DisplayWidget.h" -#include "GameList/GameListWidget.h" -#include "MainWindow.h" -#include "QtHost.h" -#include "QtUtils.h" -#include "svnrev.h" - -#ifdef ENABLE_ACHIEVEMENTS -#include "Frontend/Achievements.h" -#endif +#include +#include static constexpr u32 SETTINGS_SAVE_DELAY = 1000; diff --git a/pcsx2-qt/QtHost.h b/pcsx2-qt/QtHost.h index 2f5cb01e94..45676e40a6 100644 --- a/pcsx2-qt/QtHost.h +++ b/pcsx2-qt/QtHost.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -21,8 +21,7 @@ #include #include "pcsx2/Host.h" -#include "pcsx2/HostSettings.h" -#include "pcsx2/Frontend/InputManager.h" +#include "pcsx2/Input/InputManager.h" #include "pcsx2/VMManager.h" #include diff --git a/pcsx2-qt/QtKeyCodes.cpp b/pcsx2-qt/QtKeyCodes.cpp index f35eaf6535..384a560c99 100644 --- a/pcsx2-qt/QtKeyCodes.cpp +++ b/pcsx2-qt/QtKeyCodes.cpp @@ -17,7 +17,7 @@ #include "QtUtils.h" -#include "pcsx2/Frontend/InputManager.h" +#include "pcsx2/Input/InputManager.h" #include "common/StringUtil.h" diff --git a/pcsx2-qt/SettingWidgetBinder.h b/pcsx2-qt/SettingWidgetBinder.h index 21b5d313de..3d010a8ff6 100644 --- a/pcsx2-qt/SettingWidgetBinder.h +++ b/pcsx2-qt/SettingWidgetBinder.h @@ -35,7 +35,7 @@ #include "common/Path.h" #include "pcsx2/Config.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "QtHost.h" #include "QtUtils.h" diff --git a/pcsx2-qt/Settings/AchievementLoginDialog.cpp b/pcsx2-qt/Settings/AchievementLoginDialog.cpp index c985d74b88..85d387bd03 100644 --- a/pcsx2-qt/Settings/AchievementLoginDialog.cpp +++ b/pcsx2-qt/Settings/AchievementLoginDialog.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,9 +14,12 @@ */ #include "PrecompiledHeader.h" + #include "AchievementLoginDialog.h" -#include "pcsx2/Frontend/Achievements.h" #include "QtHost.h" + +#include "pcsx2/Achievements.h" + #include AchievementLoginDialog::AchievementLoginDialog(QWidget* parent) diff --git a/pcsx2-qt/Settings/AchievementSettingsWidget.cpp b/pcsx2-qt/Settings/AchievementSettingsWidget.cpp index 9e0297c98b..6e38adb868 100644 --- a/pcsx2-qt/Settings/AchievementSettingsWidget.cpp +++ b/pcsx2-qt/Settings/AchievementSettingsWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -22,8 +22,8 @@ #include "SettingWidgetBinder.h" #include "QtUtils.h" -#include "pcsx2/Frontend/Achievements.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Achievements.h" +#include "pcsx2/Host.h" #include "common/StringUtil.h" diff --git a/pcsx2-qt/Settings/BIOSSettingsWidget.cpp b/pcsx2-qt/Settings/BIOSSettingsWidget.cpp index d4c2ccb5e5..c9569effcd 100644 --- a/pcsx2-qt/Settings/BIOSSettingsWidget.cpp +++ b/pcsx2-qt/Settings/BIOSSettingsWidget.cpp @@ -19,7 +19,7 @@ #include #include -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/ps2/BiosTools.h" #include "BIOSSettingsWidget.h" diff --git a/pcsx2-qt/Settings/ControllerBindingWidgets.cpp b/pcsx2-qt/Settings/ControllerBindingWidgets.cpp index f023c666f0..801f317c03 100644 --- a/pcsx2-qt/Settings/ControllerBindingWidgets.cpp +++ b/pcsx2-qt/Settings/ControllerBindingWidgets.cpp @@ -25,7 +25,7 @@ #include "common/StringUtil.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/PAD/Host/PAD.h" #include "Settings/ControllerBindingWidgets.h" diff --git a/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp b/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp index 217828f3ba..a991aa2183 100644 --- a/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp +++ b/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,15 +15,16 @@ #include "PrecompiledHeader.h" -#include "Frontend/InputManager.h" #include "Settings/ControllerGlobalSettingsWidget.h" #include "Settings/ControllerSettingsDialog.h" #include "Settings/ControllerSettingWidgetBinder.h" #include "QtUtils.h" #include "SettingWidgetBinder.h" +#include "pcsx2/Input/InputManager.h" + #ifdef SDL_BUILD -#include "pcsx2/Frontend/SDLInputSource.h" +#include "pcsx2/Input/SDLInputSource.h" #endif ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, ControllerSettingsDialog* dialog) diff --git a/pcsx2-qt/Settings/ControllerSettingWidgetBinder.h b/pcsx2-qt/Settings/ControllerSettingWidgetBinder.h index 3cc14f76e0..ee502685e6 100644 --- a/pcsx2-qt/Settings/ControllerSettingWidgetBinder.h +++ b/pcsx2-qt/Settings/ControllerSettingWidgetBinder.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,6 +15,11 @@ #pragma once +#include "pcsx2/Host.h" + +#include "QtHost.h" +#include "SettingWidgetBinder.h" + #include #include @@ -27,11 +32,6 @@ #include #include -#include "pcsx2/HostSettings.h" - -#include "QtHost.h" -#include "SettingWidgetBinder.h" - /// This nastyness is required because input profiles aren't overlaid settings like the rest of them, it's /// input profile *or* global, not both. namespace ControllerSettingWidgetBinder diff --git a/pcsx2-qt/Settings/ControllerSettingsDialog.cpp b/pcsx2-qt/Settings/ControllerSettingsDialog.cpp index b6127c45f6..cf91a192cb 100644 --- a/pcsx2-qt/Settings/ControllerSettingsDialog.cpp +++ b/pcsx2-qt/Settings/ControllerSettingsDialog.cpp @@ -21,7 +21,7 @@ #include "Settings/ControllerBindingWidgets.h" #include "Settings/HotkeySettingsWidget.h" -#include "pcsx2/Frontend/CommonHost.h" +#include "pcsx2/CommonHost.h" #include "pcsx2/INISettingsInterface.h" #include "pcsx2/PAD/Host/PAD.h" #include "pcsx2/Sio.h" diff --git a/pcsx2-qt/Settings/ControllerSettingsDialog.h b/pcsx2-qt/Settings/ControllerSettingsDialog.h index 79ac51bc55..c3984bc153 100644 --- a/pcsx2-qt/Settings/ControllerSettingsDialog.h +++ b/pcsx2-qt/Settings/ControllerSettingsDialog.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,8 +15,10 @@ #pragma once #include "ui_ControllerSettingsDialog.h" -#include "pcsx2/Frontend/InputManager.h" + +#include "pcsx2/Input/InputManager.h" #include "pcsx2/USB/USB.h" + #include #include #include diff --git a/pcsx2-qt/Settings/DEV9SettingsWidget.cpp b/pcsx2-qt/Settings/DEV9SettingsWidget.cpp index 0f2035ceec..d412ea67d6 100644 --- a/pcsx2-qt/Settings/DEV9SettingsWidget.cpp +++ b/pcsx2-qt/Settings/DEV9SettingsWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -23,7 +23,7 @@ #include "common/Path.h" #include "common/StringUtil.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/INISettingsInterface.h" #include "DEV9SettingsWidget.h" diff --git a/pcsx2-qt/Settings/DebugSettingsWidget.cpp b/pcsx2-qt/Settings/DebugSettingsWidget.cpp index 74a9f92c0b..9696831725 100644 --- a/pcsx2-qt/Settings/DebugSettingsWidget.cpp +++ b/pcsx2-qt/Settings/DebugSettingsWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -19,9 +19,10 @@ #include "QtUtils.h" #include "SettingWidgetBinder.h" #include "SettingsDialog.h" -#include -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" + +#include DebugSettingsWidget::DebugSettingsWidget(SettingsDialog* dialog, QWidget* parent) : QWidget(parent) diff --git a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp index 84743b9121..4656161ac1 100644 --- a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp +++ b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp @@ -19,7 +19,7 @@ #include #include -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "EmulationSettingsWidget.h" #include "QtUtils.h" diff --git a/pcsx2-qt/Settings/GameSummaryWidget.cpp b/pcsx2-qt/Settings/GameSummaryWidget.cpp index 6d298f6269..b0b8a0ffd2 100644 --- a/pcsx2-qt/Settings/GameSummaryWidget.cpp +++ b/pcsx2-qt/Settings/GameSummaryWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,22 +15,22 @@ #include "PrecompiledHeader.h" -#include "common/StringUtil.h" - -#include "Frontend/GameList.h" -#include "PAD/Host/PAD.h" - #include "GameSummaryWidget.h" #include "SettingsDialog.h" #include "MainWindow.h" #include "QtHost.h" #include "QtUtils.h" -#include -#include +#include "pcsx2/GameList.h" +#include "pcsx2/PAD/Host/PAD.h" + +#include "common/StringUtil.h" #include "fmt/format.h" +#include +#include + GameSummaryWidget::GameSummaryWidget(const GameList::Entry* entry, SettingsDialog* dialog, QWidget* parent) : m_dialog(dialog) { diff --git a/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp b/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp index 267226cdda..9b3c02aa93 100644 --- a/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp @@ -21,7 +21,7 @@ #include "SettingsDialog.h" #include -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/GS/GS.h" #include "pcsx2/GS/GSCapture.h" #include "pcsx2/GS/GSUtil.h" diff --git a/pcsx2-qt/Settings/HotkeySettingsWidget.cpp b/pcsx2-qt/Settings/HotkeySettingsWidget.cpp index a344fa8b32..865525fd44 100644 --- a/pcsx2-qt/Settings/HotkeySettingsWidget.cpp +++ b/pcsx2-qt/Settings/HotkeySettingsWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,12 +15,14 @@ #include "PrecompiledHeader.h" -#include "Frontend/InputManager.h" #include "Settings/HotkeySettingsWidget.h" #include "Settings/ControllerSettingsDialog.h" #include "InputBindingWidget.h" #include "QtUtils.h" #include "SettingWidgetBinder.h" + +#include "pcsx2/Input/InputManager.h" + #include #include #include diff --git a/pcsx2-qt/Settings/InputBindingDialog.h b/pcsx2-qt/Settings/InputBindingDialog.h index b516551e0d..b8c761f265 100644 --- a/pcsx2-qt/Settings/InputBindingDialog.h +++ b/pcsx2-qt/Settings/InputBindingDialog.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,9 +14,12 @@ */ #pragma once + #include "ui_InputBindingDialog.h" + #include "pcsx2/Config.h" -#include "pcsx2/Frontend/InputManager.h" +#include "pcsx2/Input/InputManager.h" + #include #include #include diff --git a/pcsx2-qt/Settings/InputBindingWidget.cpp b/pcsx2-qt/Settings/InputBindingWidget.cpp index 2ffd3210b5..88e90c8b4d 100644 --- a/pcsx2-qt/Settings/InputBindingWidget.cpp +++ b/pcsx2-qt/Settings/InputBindingWidget.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -24,7 +24,7 @@ #include #include -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "pcsx2/GS/GSIntrin.h" // _BitScanForward diff --git a/pcsx2-qt/Settings/InputBindingWidget.h b/pcsx2-qt/Settings/InputBindingWidget.h index b19ee09202..067859a235 100644 --- a/pcsx2-qt/Settings/InputBindingWidget.h +++ b/pcsx2-qt/Settings/InputBindingWidget.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,9 +14,10 @@ */ #pragma once -#include "common/Pcsx2Defs.h" -#include "pcsx2/Frontend/InputManager.h" + #include "pcsx2/Config.h" +#include "pcsx2/Input/InputManager.h" + #include #include #include diff --git a/pcsx2-qt/Settings/SettingsDialog.cpp b/pcsx2-qt/Settings/SettingsDialog.cpp index 7d44911a78..60e7176bee 100644 --- a/pcsx2-qt/Settings/SettingsDialog.cpp +++ b/pcsx2-qt/Settings/SettingsDialog.cpp @@ -15,38 +15,34 @@ #include "PrecompiledHeader.h" -#include "common/FileSystem.h" -#include "common/Path.h" -#include "common/StringUtil.h" - -#include "pcsx2/Frontend/GameList.h" -#include "pcsx2/HostSettings.h" -#include "pcsx2/INISettingsInterface.h" - #include "MainWindow.h" #include "QtHost.h" #include "QtUtils.h" +#include "Settings/AchievementSettingsWidget.h" +#include "Settings/AdvancedSettingsWidget.h" +#include "Settings/AudioSettingsWidget.h" +#include "Settings/BIOSSettingsWidget.h" +#include "Settings/DEV9SettingsWidget.h" +#include "Settings/DebugSettingsWidget.h" +#include "Settings/EmulationSettingsWidget.h" +#include "Settings/FolderSettingsWidget.h" +#include "Settings/GameFixSettingsWidget.h" +#include "Settings/GameListSettingsWidget.h" +#include "Settings/GameSummaryWidget.h" +#include "Settings/GraphicsSettingsWidget.h" +#include "Settings/HotkeySettingsWidget.h" +#include "Settings/InterfaceSettingsWidget.h" +#include "Settings/MemoryCardSettingsWidget.h" #include "SettingsDialog.h" -#include "AdvancedSettingsWidget.h" -#include "AudioSettingsWidget.h" -#include "BIOSSettingsWidget.h" -#include "EmulationSettingsWidget.h" -#include "GameSummaryWidget.h" -#include "GameFixSettingsWidget.h" -#include "GameListSettingsWidget.h" -#include "GraphicsSettingsWidget.h" -#include "DEV9SettingsWidget.h" -#include "FolderSettingsWidget.h" -#include "HotkeySettingsWidget.h" -#include "InterfaceSettingsWidget.h" -#include "MemoryCardSettingsWidget.h" -#include "DebugSettingsWidget.h" +#include "pcsx2/Achievements.h" +#include "pcsx2/GameList.h" +#include "pcsx2/Host.h" +#include "pcsx2/INISettingsInterface.h" -#ifdef ENABLE_ACHIEVEMENTS -#include "AchievementSettingsWidget.h" -#include "pcsx2/Frontend/Achievements.h" -#endif +#include "common/FileSystem.h" +#include "common/Path.h" +#include "common/StringUtil.h" #include #include diff --git a/pcsx2-qt/Themes.cpp b/pcsx2-qt/Themes.cpp index d931dfebb4..386b5f1eb4 100644 --- a/pcsx2-qt/Themes.cpp +++ b/pcsx2-qt/Themes.cpp @@ -17,7 +17,7 @@ #include "QtHost.h" #include "pcsx2/Config.h" -#include "pcsx2/HostSettings.h" +#include "pcsx2/Host.h" #include "common/Path.h" diff --git a/pcsx2/Frontend/Achievements.cpp b/pcsx2/Achievements.cpp similarity index 99% rename from pcsx2/Frontend/Achievements.cpp rename to pcsx2/Achievements.cpp index f5d5f1e1d9..2c8f921334 100644 --- a/pcsx2/Frontend/Achievements.cpp +++ b/pcsx2/Achievements.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,48 +15,48 @@ #include "PrecompiledHeader.h" -#include "Frontend/Achievements.h" -#include "Frontend/CommonHost.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/ImGuiFullscreen.h" -#include "Frontend/ImGuiManager.h" +#ifdef ENABLE_ACHIEVEMENTS + +#include "CommonHost.h" +#include "Achievements.h" +#include "CDVD/IsoFS/IsoFS.h" +#include "CDVD/IsoFS/IsoFSCDVD.h" +#include "Elfheader.h" +#include "GS.h" +#include "Host.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiFullscreen.h" +#include "ImGui/ImGuiManager.h" +#include "IopMem.h" +#include "Memory.h" +#include "VMManager.h" +#include "svnrev.h" +#include "vtlb.h" #include "common/Assertions.h" -#include "common/FileSystem.h" -#include "common/HTTPDownloader.h" #include "common/Console.h" +#include "common/FileSystem.h" #include "common/General.h" +#include "common/HTTPDownloader.h" #include "common/MD5Digest.h" #include "common/Path.h" #include "common/ScopedGuard.h" #include "common/StringUtil.h" #include "common/Timer.h" +#include "fmt/core.h" #include "rc_api_info.h" #include "rc_api_request.h" #include "rc_api_runtime.h" #include "rc_api_user.h" #include "rcheevos.h" -#include "fmt/core.h" - -#include "CDVD/IsoFS/IsoFSCDVD.h" -#include "CDVD/IsoFS/IsoFS.h" -#include "Elfheader.h" -#include "GS.h" -#include "Host.h" -#include "HostSettings.h" -#include "IopMem.h" -#include "Memory.h" -#include "VMManager.h" -#include "vtlb.h" -#include "svnrev.h" #include #include #include #include -#include #include +#include #include #include #include @@ -2262,4 +2262,6 @@ void Achievements::RAIntegration::RACallbackWriteMemory(unsigned int address, un PokeMemory(address, sizeof(value), nullptr, static_cast(value)); } -#endif +#endif // ENABLE_RAINTEGRATION + +#endif // ENABLE_ACHIEVEMENTS diff --git a/pcsx2/Achievements.h b/pcsx2/Achievements.h index 1fb6bfc4e5..b42e3153e7 100644 --- a/pcsx2/Achievements.h +++ b/pcsx2/Achievements.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,34 +14,177 @@ */ #pragma once + #include "common/Pcsx2Types.h" + +#include "Config.h" + +#include +#include +#include +#include +#include +#include #include +#ifdef ENABLE_ACHIEVEMENTS + namespace Achievements { -#ifdef ENABLE_ACHIEVEMENTS + enum class AchievementCategory : u8 + { + Local = 0, + Core = 3, + Unofficial = 5 + }; - // Implemented in Host. - extern bool OnReset(); - extern void LoadState(const u8* state_data, u32 state_data_size); - extern std::vector SaveState(); - extern void GameChanged(u32 crc); + struct Achievement + { + u32 id; + std::string title; + std::string description; + std::string memaddr; + std::string badge_name; + + // badge paths are mutable because they're resolved when they're needed. + mutable std::string locked_badge_path; + mutable std::string unlocked_badge_path; + + u32 points; + AchievementCategory category; + bool locked; + bool active; + bool primed; + }; + + struct Leaderboard + { + u32 id; + std::string title; + std::string description; + int format; + }; + + struct LeaderboardEntry + { + std::string user; + std::string formatted_score; + time_t submitted; + u32 rank; + bool is_self; + }; + +// RAIntegration only exists for Windows, so no point checking it on other platforms. +#ifdef ENABLE_RAINTEGRATION + bool IsUsingRAIntegration(); +#else + __fi static bool IsUsingRAIntegration() + { + return false; + } +#endif + + bool IsActive(); + bool IsLoggedIn(); + bool ChallengeModeActive(); + bool LeaderboardsActive(); + bool IsTestModeActive(); + bool IsUnofficialTestModeActive(); + bool IsRichPresenceEnabled(); + bool HasActiveGame(); + + u32 GetGameID(); + + /// Acquires the achievements lock. Must be held when accessing any achievement state from another thread. + std::unique_lock GetLock(); + + void Initialize(); + void UpdateSettings(const Pcsx2Config::AchievementsOptions& old_config); + + /// Called when the system is being reset. If it returns false, the reset should be aborted. + bool OnReset(); + + /// Called when the system is being shut down. If Shutdown() returns false, the shutdown should be aborted. + bool Shutdown(); + + /// Called when the system is being paused and resumed. + void OnPaused(bool paused); + + /// Called once a frame at vsync time on the CPU thread. + void VSyncUpdate(); + + /// Called to process pending HTTP requests when the VM is paused, because otherwise the vsync event won't fire. + void ProcessPendingHTTPRequestsFromGSThread(); + + void LoadState(const u8* state_data, u32 state_data_size); + std::vector SaveState(); + + /// Returns true if the current game has any achievements or leaderboards. + /// Does not need to have the lock held. + bool SafeHasAchievementsOrLeaderboards(); + + const std::string& GetUsername(); + const std::string& GetRichPresenceString(); + + bool LoginAsync(const char* username, const char* password); + bool Login(const char* username, const char* password); + void Logout(); + + void GameChanged(u32 crc); + + const std::string& GetGameTitle(); + const std::string& GetGameIcon(); + + bool EnumerateAchievements(std::function callback); + u32 GetUnlockedAchiementCount(); + u32 GetAchievementCount(); + u32 GetMaximumPointsForGame(); + u32 GetCurrentPointsForGame(); + + bool EnumerateLeaderboards(std::function callback); + std::optional TryEnumerateLeaderboardEntries(u32 id, std::function callback); + const Leaderboard* GetLeaderboardByID(u32 id); + u32 GetLeaderboardCount(); + bool IsLeaderboardTimeType(const Leaderboard& leaderboard); + + const Achievement* GetAchievementByID(u32 id); + std::pair GetAchievementProgress(const Achievement& achievement); + std::string GetAchievementProgressText(const Achievement& achievement); + const std::string& GetAchievementBadgePath( + const Achievement& achievement, bool download_if_missing = true, bool force_unlocked_icon = false); + std::string GetAchievementBadgeURL(const Achievement& achievement); + u32 GetPrimedAchievementCount(); + +#ifdef ENABLE_RAINTEGRATION + void SwitchToRAIntegration(); + + namespace RAIntegration + { + void MainWindowChanged(void* new_handle); + void GameChanged(); + std::vector> GetMenuItems(); + void ActivateMenuItem(int item); + } // namespace RAIntegration +#endif /// Re-enables hardcode mode if it is enabled in the settings. - extern bool ResetChallengeMode(); + bool ResetChallengeMode(); /// Forces hardcore mode off until next reset. - extern void DisableChallengeMode(); + void DisableChallengeMode(); /// Prompts the user to disable hardcore mode, if they agree, returns true. - extern bool ConfirmChallengeModeDisable(const char* trigger); + bool ConfirmChallengeModeDisable(const char* trigger); /// Returns true if features such as save states should be disabled. - extern bool ChallengeModeActive(); + bool ChallengeModeActive(); +} // namespace Achievements #else - // Make noops when compiling without cheevos. +// Make noops when compiling without cheevos. +namespace Achievements +{ static inline bool OnReset() { return true; @@ -67,12 +210,22 @@ namespace Achievements return false; } - static inline void DisableChallengeMode() {} + static inline void DisableChallengeMode() + { + } static inline bool ConfirmChallengeModeDisable(const char* trigger) { return true; } -#endif } // namespace Achievements + +#endif + +/// Functions implemented in the frontend. +namespace Host +{ + void OnAchievementsRefreshed(); + void OnAchievementsChallengeModeChanged(); +} // namespace Host diff --git a/pcsx2/CDVD/GzippedFileReader.cpp b/pcsx2/CDVD/GzippedFileReader.cpp index 25e37c8bff..d3c79624d9 100644 --- a/pcsx2/CDVD/GzippedFileReader.cpp +++ b/pcsx2/CDVD/GzippedFileReader.cpp @@ -21,7 +21,7 @@ #include "Config.h" #include "ChunksCache.h" #include "GzippedFileReader.h" -#include "HostSettings.h" +#include "Host.h" #include "zlib_indexed.h" #define CLAMP(val, minval, maxval) (std::min(maxval, std::max(minval, val))) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 7dcd0c08ab..c55e110201 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -60,8 +60,8 @@ if(TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static) target_link_libraries(PCSX2_FLAGS INTERFACE SDL2::SDL2) endif() target_sources(PCSX2 PRIVATE - Frontend/SDLInputSource.cpp - Frontend/SDLInputSource.h + Input/SDLInputSource.cpp + Input/SDLInputSource.h ) endif() @@ -83,9 +83,11 @@ endif(WIN32) # Main pcsx2 source set(pcsx2Sources + Achievements.cpp Cache.cpp COP0.cpp COP2.cpp + CommonHost.cpp Counters.cpp Dmac.cpp GameDatabase.cpp @@ -93,14 +95,20 @@ set(pcsx2Sources FW.cpp FiFo.cpp FPU.cpp + GameList.cpp Gif.cpp Gif_Logger.cpp Gif_Unit.cpp GS.cpp + GSDumpReplayer.cpp Host.cpp + Hotkeys.cpp Hw.cpp HwRead.cpp HwWrite.cpp + LayeredSettingsInterface.cpp + LogSink.cpp + INISettingsInterface.cpp Interpreter.cpp IopBios.cpp IopCounters.cpp @@ -150,6 +158,7 @@ set(pcsx2Sources Vif_Transfer.cpp Vif_Unpack.cpp VirtualMemory.cpp + VMManager.cpp vtlb.cpp VU0.cpp VUmicro.cpp @@ -159,7 +168,8 @@ set(pcsx2Sources VU1microInterp.cpp VUflags.cpp VUmicroMem.cpp - VUops.cpp) + VUops.cpp +) # Main pcsx2 header set(pcsx2Headers @@ -167,6 +177,7 @@ set(pcsx2Headers AsyncFileReader.h Cache.h Common.h + CommonHost.h Config.h COP0.h Counters.h @@ -174,18 +185,23 @@ set(pcsx2Headers GameDatabase.h Elfheader.h FW.h + GameList.h Gif.h Gif_Unit.h GS.h + GSDumpReplayer.h Hardware.h Host.h Hw.h + INISettingsInterface.h IopBios.h IopCounters.h IopDma.h IopGte.h IopHw.h IopMem.h + LayeredSettingsInterface.h + LogSink.h PINE.h Mdec.h MTVU.h @@ -216,6 +232,7 @@ set(pcsx2Headers Vif.h Vif_Unpack.h VirtualMemory.h + VMManager.h vtlb.h VUflags.h VUmicro.h @@ -833,16 +850,27 @@ set(pcsx2DebugToolsHeaders DebugTools/DisVUops.h DebugTools/BiosDebugData.h) -# Frontend sources -set(pcsx2FrontendSources - Frontend/ImGuiManager.cpp - Frontend/ImGuiOverlays.cpp +set(pcsx2ImGuiSources + ImGui/FullscreenUI.cpp + ImGui/ImGuiFullscreen.cpp + ImGui/ImGuiManager.cpp + ImGui/ImGuiOverlays.cpp ) -# Frontend headers -set(pcsx2FrontendHeaders - Frontend/ImGuiManager.h - Frontend/ImGuiOverlays.h +set(pcsx2ImGuiHeaders + ImGui/FullscreenUI.h + ImGui/ImGuiFullscreen.h + ImGui/ImGuiManager.h + ImGui/ImGuiOverlays.h +) + +set(pcsx2InputSources + Input/InputManager.cpp + Input/InputSource.cpp +) +set(pcsx2InputHeaders + Input/InputManager.h + Input/InputSource.h ) if(APPLE) @@ -861,42 +889,7 @@ if(APPLE) ) endif() -list(APPEND pcsx2FrontendSources - Frontend/CommonHost.cpp - Frontend/CommonHotkeys.cpp - Frontend/FullscreenUI.cpp - Frontend/GameList.cpp - Frontend/HostSettings.cpp - Frontend/ImGuiFullscreen.cpp - Frontend/InputManager.cpp - Frontend/InputSource.cpp - Frontend/LayeredSettingsInterface.cpp - Frontend/LogSink.cpp - GSDumpReplayer.cpp - INISettingsInterface.cpp - VMManager.cpp -) -list(APPEND pcsx2FrontendHeaders - Frontend/CommonHost.h - Frontend/FullscreenUI.h - Frontend/GameList.h - Frontend/ImGuiFullscreen.h - Frontend/InputManager.h - Frontend/InputSource.h - Frontend/LayeredSettingsInterface.h - Frontend/LogSink.h - GSDumpReplayer.h - HostSettings.h - INISettingsInterface.h - VMManager.h) - if(USE_ACHIEVEMENTS) - list(APPEND pcsx2FrontendSources - Frontend/Achievements.cpp - ) - list(APPEND pcsx2FrontendHeaders - Frontend/Achievements.h - ) target_compile_definitions(PCSX2_FLAGS INTERFACE ENABLE_ACHIEVEMENTS ) @@ -922,13 +915,13 @@ if(USE_DISCORD_PRESENCE) ) endif() if(WIN32) - list(APPEND pcsx2FrontendSources - Frontend/DInputSource.cpp - Frontend/XInputSource.cpp + list(APPEND pcsx2InputSources + Input/DInputSource.cpp + Input/XInputSource.cpp ) - list(APPEND pcsx2FrontendHeaders - Frontend/DInputSource.h - Frontend/XInputSource.h + list(APPEND pcsx2InputHeaders + Input/DInputSource.h + Input/XInputSource.h ) endif() @@ -1132,8 +1125,10 @@ target_sources(PCSX2 PRIVATE ${pcsx2RecordingSources} ${pcsx2DebugToolsSources} ${pcsx2DebugToolsHeaders} - ${pcsx2FrontendSources} - ${pcsx2FrontendHeaders} + ${pcsx2ImGuiSources} + ${pcsx2ImGuiHeaders} + ${pcsx2InputSources} + ${pcsx2InputHeaders} ${pcsx2ps2Sources} ${pcsx2ps2Headers} ) diff --git a/pcsx2/Frontend/CommonHost.cpp b/pcsx2/CommonHost.cpp similarity index 97% rename from pcsx2/Frontend/CommonHost.cpp rename to pcsx2/CommonHost.cpp index 5d1b95fa90..894be30aa6 100644 --- a/pcsx2/Frontend/CommonHost.cpp +++ b/pcsx2/CommonHost.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,32 +14,30 @@ */ #include "PrecompiledHeader.h" -#include "common/Assertions.h" -#include "common/CrashHandler.h" -#include "common/FileSystem.h" -#include "common/Path.h" -#include "common/Timer.h" -#include "common/Threading.h" -#include "Frontend/CommonHost.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/GameList.h" -#include "Frontend/LayeredSettingsInterface.h" -#include "Frontend/InputManager.h" -#include "Frontend/LogSink.h" + +#include "CommonHost.h" +#include "Achievements.h" #include "GS.h" #include "GS/Renderers/HW/GSTextureReplacements.h" +#include "GameList.h" #include "Host.h" -#include "HostSettings.h" #include "IconsFontAwesome5.h" +#include "ImGui/FullscreenUI.h" +#include "Input/InputManager.h" +#include "LayeredSettingsInterface.h" +#include "LogSink.h" #include "MemoryCardFile.h" #include "PAD/Host/PAD.h" #include "PerformanceMetrics.h" #include "Sio.h" #include "VMManager.h" -#ifdef ENABLE_ACHIEVEMENTS -#include "Frontend/Achievements.h" -#endif +#include "common/Assertions.h" +#include "common/CrashHandler.h" +#include "common/FileSystem.h" +#include "common/Path.h" +#include "common/Timer.h" +#include "common/Threading.h" #ifdef ENABLE_DISCORD_PRESENCE #include "discord_rpc.h" diff --git a/pcsx2/Frontend/CommonHost.h b/pcsx2/CommonHost.h similarity index 100% rename from pcsx2/Frontend/CommonHost.h rename to pcsx2/CommonHost.h diff --git a/pcsx2/Frontend/Achievements.h b/pcsx2/Frontend/Achievements.h deleted file mode 100644 index 4969bdf266..0000000000 --- a/pcsx2/Frontend/Achievements.h +++ /dev/null @@ -1,173 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 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 for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#pragma once -#include "common/Pcsx2Defs.h" -#include "pcsx2/Achievements.h" -#include "Config.h" -#include -#include -#include -#include -#include -#include -#include - -namespace Achievements -{ - enum class AchievementCategory : u8 - { - Local = 0, - Core = 3, - Unofficial = 5 - }; - - struct Achievement - { - u32 id; - std::string title; - std::string description; - std::string memaddr; - std::string badge_name; - - // badge paths are mutable because they're resolved when they're needed. - mutable std::string locked_badge_path; - mutable std::string unlocked_badge_path; - - u32 points; - AchievementCategory category; - bool locked; - bool active; - bool primed; - }; - - struct Leaderboard - { - u32 id; - std::string title; - std::string description; - int format; - }; - - struct LeaderboardEntry - { - std::string user; - std::string formatted_score; - time_t submitted; - u32 rank; - bool is_self; - }; - - // RAIntegration only exists for Windows, so no point checking it on other platforms. -#ifdef ENABLE_RAINTEGRATION - - bool IsUsingRAIntegration(); - -#else - - static __fi bool IsUsingRAIntegration() { return false; } - -#endif - - bool IsActive(); - bool IsLoggedIn(); - bool ChallengeModeActive(); - bool LeaderboardsActive(); - bool IsTestModeActive(); - bool IsUnofficialTestModeActive(); - bool IsRichPresenceEnabled(); - bool HasActiveGame(); - - u32 GetGameID(); - - /// Acquires the achievements lock. Must be held when accessing any achievement state from another thread. - std::unique_lock GetLock(); - - void Initialize(); - void UpdateSettings(const Pcsx2Config::AchievementsOptions& old_config); - - /// Called when the system is being reset. If it returns false, the reset should be aborted. - bool OnReset(); - - /// Called when the system is being shut down. If Shutdown() returns false, the shutdown should be aborted. - bool Shutdown(); - - /// Called when the system is being paused and resumed. - void OnPaused(bool paused); - - /// Called once a frame at vsync time on the CPU thread. - void VSyncUpdate(); - - /// Called to process pending HTTP requests when the VM is paused, because otherwise the vsync event won't fire. - void ProcessPendingHTTPRequestsFromGSThread(); - - void LoadState(const u8* state_data, u32 state_data_size); - std::vector SaveState(); - - /// Returns true if the current game has any achievements or leaderboards. - /// Does not need to have the lock held. - bool SafeHasAchievementsOrLeaderboards(); - - const std::string& GetUsername(); - const std::string& GetRichPresenceString(); - - bool LoginAsync(const char* username, const char* password); - bool Login(const char* username, const char* password); - void Logout(); - - void GameChanged(u32 crc); - - const std::string& GetGameTitle(); - const std::string& GetGameIcon(); - - bool EnumerateAchievements(std::function callback); - u32 GetUnlockedAchiementCount(); - u32 GetAchievementCount(); - u32 GetMaximumPointsForGame(); - u32 GetCurrentPointsForGame(); - - bool EnumerateLeaderboards(std::function callback); - std::optional TryEnumerateLeaderboardEntries(u32 id, std::function callback); - const Leaderboard* GetLeaderboardByID(u32 id); - u32 GetLeaderboardCount(); - bool IsLeaderboardTimeType(const Leaderboard& leaderboard); - - const Achievement* GetAchievementByID(u32 id); - std::pair GetAchievementProgress(const Achievement& achievement); - std::string GetAchievementProgressText(const Achievement& achievement); - const std::string& GetAchievementBadgePath( - const Achievement& achievement, bool download_if_missing = true, bool force_unlocked_icon = false); - std::string GetAchievementBadgeURL(const Achievement& achievement); - u32 GetPrimedAchievementCount(); - -#ifdef ENABLE_RAINTEGRATION - void SwitchToRAIntegration(); - - namespace RAIntegration - { - void MainWindowChanged(void* new_handle); - void GameChanged(); - std::vector> GetMenuItems(); - void ActivateMenuItem(int item); - } // namespace RAIntegration -#endif -} // namespace Achievements - -/// Functions implemented in the frontend. -namespace Host -{ - void OnAchievementsRefreshed(); - void OnAchievementsChallengeModeChanged(); -} // namespace Host diff --git a/pcsx2/Frontend/HostSettings.cpp b/pcsx2/Frontend/HostSettings.cpp deleted file mode 100644 index eac5ae2243..0000000000 --- a/pcsx2/Frontend/HostSettings.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2023 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 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 for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#include "PrecompiledHeader.h" -#include "common/Assertions.h" -#include "common/CrashHandler.h" -#include "common/FileSystem.h" -#include "common/Path.h" -#include "Frontend/LayeredSettingsInterface.h" -#include "GS.h" -#include "GS/Renderers/HW/GSTextureReplacements.h" -#include "Host.h" -#include "HostSettings.h" -#include "MemoryCardFile.h" -#include "Sio.h" -#include "VMManager.h" - -static std::mutex s_settings_mutex; -static LayeredSettingsInterface s_layered_settings_interface; - -std::unique_lock Host::GetSettingsLock() -{ - return std::unique_lock(s_settings_mutex); -} - -SettingsInterface* Host::GetSettingsInterface() -{ - return &s_layered_settings_interface; -} - -SettingsInterface* Host::GetSettingsInterfaceForBindings() -{ - SettingsInterface* input_layer = s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_INPUT); - return input_layer ? input_layer : &s_layered_settings_interface; -} - -std::string Host::GetBaseStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetStringValue(section, key, default_value); -} - -bool Host::GetBaseBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetBoolValue(section, key, default_value); -} - -int Host::GetBaseIntSettingValue(const char* section, const char* key, int default_value /*= 0*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetIntValue(section, key, default_value); -} - -uint Host::GetBaseUIntSettingValue(const char* section, const char* key, uint default_value /*= 0*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetUIntValue(section, key, default_value); -} - -float Host::GetBaseFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetFloatValue(section, key, default_value); -} - -double Host::GetBaseDoubleSettingValue(const char* section, const char* key, double default_value /* = 0.0f */) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetDoubleValue(section, key, default_value); -} - -std::vector Host::GetBaseStringListSetting(const char* section, const char* key) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetStringList(section, key); -} - -void Host::SetBaseBoolSettingValue(const char* section, const char* key, bool value) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetBoolValue(section, key, value); -} - -void Host::SetBaseIntSettingValue(const char* section, const char* key, int value) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetIntValue(section, key, value); -} - -void Host::SetBaseUIntSettingValue(const char* section, const char* key, uint value) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetUIntValue(section, key, value); -} - -void Host::SetBaseFloatSettingValue(const char* section, const char* key, float value) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetFloatValue(section, key, value); -} - -void Host::SetBaseStringSettingValue(const char* section, const char* key, const char* value) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringValue(section, key, value); -} - -void Host::SetBaseStringListSettingValue(const char* section, const char* key, const std::vector& values) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringList(section, key, values); -} - -bool Host::AddBaseValueToStringList(const char* section, const char* key, const char* value) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->AddToStringList(section, key, value); -} - -bool Host::RemoveBaseValueFromStringList(const char* section, const char* key, const char* value) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->RemoveFromStringList(section, key, value); -} - -void Host::RemoveBaseSettingValue(const char* section, const char* key) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->DeleteValue(section, key); -} - -std::string Host::GetStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetStringValue(section, key, default_value); -} - -bool Host::GetBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetBoolValue(section, key, default_value); -} - -int Host::GetIntSettingValue(const char* section, const char* key, int default_value /*= 0*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetIntValue(section, key, default_value); -} - -uint Host::GetUIntSettingValue(const char* section, const char* key, uint default_value /*= 0*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetUIntValue(section, key, default_value); -} - -float Host::GetFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetFloatValue(section, key, default_value); -} - -double Host::GetDoubleSettingValue(const char* section, const char* key, double default_value /*= 0.0f*/) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetDoubleValue(section, key, default_value); -} - -std::vector Host::GetStringListSetting(const char* section, const char* key) -{ - std::unique_lock lock(s_settings_mutex); - return s_layered_settings_interface.GetStringList(section, key); -} - -SettingsInterface* Host::Internal::GetBaseSettingsLayer() -{ - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE); -} - -SettingsInterface* Host::Internal::GetGameSettingsLayer() -{ - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_GAME); -} - -SettingsInterface* Host::Internal::GetInputSettingsLayer() -{ - return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_INPUT); -} - -void Host::Internal::SetBaseSettingsLayer(SettingsInterface* sif) -{ - pxAssertRel(s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) == nullptr, "Base layer has not been set"); - s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_BASE, sif); -} - -void Host::Internal::SetGameSettingsLayer(SettingsInterface* sif) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_GAME, sif); -} - -void Host::Internal::SetInputSettingsLayer(SettingsInterface* sif) -{ - std::unique_lock lock(s_settings_mutex); - s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_INPUT, sif); -} - -void Host::Internal::UpdateEmuFolders() -{ - const std::string old_cheats_directory(EmuFolders::Cheats); - const std::string old_cheats_ws_directory(EmuFolders::CheatsWS); - const std::string old_cheats_ni_directory(EmuFolders::CheatsNI); - const std::string old_memcards_directory(EmuFolders::MemoryCards); - const std::string old_textures_directory(EmuFolders::Textures); - const std::string old_videos_directory(EmuFolders::Videos); - - EmuFolders::LoadConfig(*GetBaseSettingsLayer()); - EmuFolders::EnsureFoldersExist(); - - if (VMManager::HasValidVM()) - { - if (EmuFolders::Cheats != old_cheats_directory || EmuFolders::CheatsWS != old_cheats_ws_directory || - EmuFolders::CheatsNI != old_cheats_ni_directory) - { - VMManager::ReloadPatches(true, true); - } - - if (EmuFolders::MemoryCards != old_memcards_directory) - { - FileMcd_EmuClose(); - FileMcd_EmuOpen(); - AutoEject::SetAll(); - } - - if (EmuFolders::Textures != old_textures_directory) - { - GetMTGS().RunOnGSThread([]() { - if (VMManager::HasValidVM()) - GSTextureReplacements::ReloadReplacementMap(); - }); - } - - if (EmuFolders::Videos != old_videos_directory) - { - if (VMManager::HasValidVM()) - GetMTGS().RunOnGSThread(&GSEndCapture); - } - - } -} diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 7c24d09040..77e3f203c1 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -15,92 +15,68 @@ #include "PrecompiledHeader.h" +#include "Config.h" +#include "Counters.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiManager.h" #include "GS.h" #include "GSCapture.h" -#include "GSGL.h" -#include "GSUtil.h" #include "GSExtra.h" -#include "Renderers/Null/GSRendererNull.h" -#include "Renderers/HW/GSRendererHW.h" -#include "Renderers/HW/GSTextureReplacements.h" +#include "GSGL.h" #include "GSLzma.h" +#include "GSUtil.h" +#include "Host.h" +#include "Input/InputManager.h" #include "MultiISA.h" +#include "pcsx2/GS.h" +#include "GS/Renderers/Null/GSRendererNull.h" +#include "GS/Renderers/HW/GSRendererHW.h" +#include "GS/Renderers/HW/GSTextureReplacements.h" + +#ifdef ENABLE_OPENGL +#include "GS/Renderers/OpenGL/GSDeviceOGL.h" +#endif + +#ifdef __APPLE__ +#include "GS/Renderers/Metal/GSMetalCPPAccessible.h" +#endif + +#ifdef ENABLE_VULKAN +#include "GS/Renderers/Vulkan/GSDeviceVK.h" +#endif + +#ifdef _WIN32 + +#include "GS/Renderers/DX11/GSDevice11.h" +#include "GS/Renderers/DX12/GSDevice12.h" +#include "GS/Renderers/DX11/D3D.h" + +#endif #include "common/Console.h" #include "common/FileSystem.h" #include "common/Path.h" #include "common/StringUtil.h" -#include "pcsx2/Config.h" -#include "pcsx2/Counters.h" -#include "pcsx2/Frontend/ImGuiManager.h" -#include "pcsx2/Host.h" -#include "pcsx2/HostSettings.h" -#include "pcsx2/Frontend/FullscreenUI.h" -#include "pcsx2/Frontend/InputManager.h" -#include "pcsx2/GS.h" #include "fmt/format.h" -#ifdef ENABLE_OPENGL -#include "Renderers/OpenGL/GSDeviceOGL.h" -#endif - -#ifdef __APPLE__ -#include "Renderers/Metal/GSMetalCPPAccessible.h" -#endif - -#ifdef ENABLE_VULKAN -#include "Renderers/Vulkan/GSDeviceVK.h" -#endif - -#ifdef _WIN32 - -#include "Renderers/DX11/GSDevice11.h" -#include "Renderers/DX12/GSDevice12.h" -#include "GS/Renderers/DX11/D3D.h" - - -static HRESULT s_hr = E_FAIL; - -#endif - #include -// do NOT undefine this/put it above includes, as x11 people love to redefine -// things that make obscure compiler bugs, unless you want to run around and -// debug obscure compiler errors --govanify -#undef None - Pcsx2Config::GSOptions GSConfig; static u64 s_next_manual_present_time; -int GSinit() +void GSinit() { GSVertexSW::InitStatic(); GSUtil::Init(); - -#ifdef _WIN32 - s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); -#endif - - return 0; } void GSshutdown() { GSclose(); -#ifdef _WIN32 - if (SUCCEEDED(s_hr)) - { - ::CoUninitialize(); - - s_hr = E_FAIL; - } -#endif - // ensure all screenshots have been saved GSJoinSnapshotThreads(); } diff --git a/pcsx2/GS/GS.h b/pcsx2/GS/GS.h index 6de431550a..6087ed125e 100644 --- a/pcsx2/GS/GS.h +++ b/pcsx2/GS/GS.h @@ -69,7 +69,7 @@ class HostDisplay; s16 GSLookupGetSkipCountFunctionId(const std::string_view& name); s16 GSLookupBeforeDrawFunctionId(const std::string_view& name); -int GSinit(); +void GSinit(); void GSshutdown(); bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* basemem); bool GSreopen(bool recreate_device, bool recreate_renderer, const Pcsx2Config::GSOptions& old_config); diff --git a/pcsx2/GS/GSCrc.cpp b/pcsx2/GS/GSCrc.cpp index 2365e065ac..d80a5494b4 100644 --- a/pcsx2/GS/GSCrc.cpp +++ b/pcsx2/GS/GSCrc.cpp @@ -14,10 +14,12 @@ */ #include "PrecompiledHeader.h" -#include "GSCrc.h" -#include "GSExtra.h" -#include "GS.h" -#include "HostSettings.h" + +#include "GS/GSCrc.h" +#include "GS/GSExtra.h" +#include "GS/GS.h" +#include "Host.h" + #include "common/StringUtil.h" const CRC::Game CRC::m_games[] = diff --git a/pcsx2/GS/Renderers/Common/GSDevice.cpp b/pcsx2/GS/Renderers/Common/GSDevice.cpp index 6b7fa3fef1..eb67dcf094 100644 --- a/pcsx2/GS/Renderers/Common/GSDevice.cpp +++ b/pcsx2/GS/Renderers/Common/GSDevice.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,11 +14,12 @@ */ #include "PrecompiledHeader.h" -#include "GSDevice.h" + +#include "GS/Renderers/Common/GSDevice.h" #include "GS/GSGL.h" #include "GS/GS.h" #include "Host.h" -#include "HostSettings.h" + #include "common/Align.h" #include "common/StringUtil.h" diff --git a/pcsx2/GS/Renderers/Common/GSRenderer.cpp b/pcsx2/GS/Renderers/Common/GSRenderer.cpp index f380751c10..17fdd99d52 100644 --- a/pcsx2/GS/Renderers/Common/GSRenderer.cpp +++ b/pcsx2/GS/Renderers/Common/GSRenderer.cpp @@ -15,8 +15,8 @@ #include "PrecompiledHeader.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/ImGuiManager.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiManager.h" #include "GS/Renderers/Common/GSRenderer.h" #include "GS/GSCapture.h" #include "GS/GSGL.h" @@ -24,7 +24,6 @@ #include "Host.h" #include "PerformanceMetrics.h" #include "pcsx2/Config.h" -#include "IconsFontAwesome5.h" #include "VMManager.h" #include "common/FileSystem.h" @@ -34,6 +33,7 @@ #include "common/Timer.h" #include "fmt/core.h" +#include "IconsFontAwesome5.h" #include #include diff --git a/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp b/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp index d49f2923f4..27a93dc846 100644 --- a/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,10 +14,10 @@ */ #include "PrecompiledHeader.h" -#include "GLLoader.h" + +#include "GS/Renderers/OpenGL/GLLoader.h" #include "GS/GS.h" #include "Host.h" -#include "HostSettings.h" #include "glad.h" diff --git a/pcsx2/GSDumpReplayer.cpp b/pcsx2/GSDumpReplayer.cpp index 5f5f307b5d..d9fc0b4697 100644 --- a/pcsx2/GSDumpReplayer.cpp +++ b/pcsx2/GSDumpReplayer.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,7 +15,20 @@ #include "PrecompiledHeader.h" -#include +#include "GS.h" +#include "GS/GSLzma.h" +#include "GSDumpReplayer.h" +#include "GameList.h" +#include "Gif.h" +#include "Gif_Unit.h" +#include "Host.h" +#include "ImGui/ImGuiManager.h" +#include "R3000A.h" +#include "R5900.h" +#include "VMManager.h" +#include "VUmicro.h" + +#include "imgui.h" #include "fmt/core.h" @@ -23,23 +36,7 @@ #include "common/StringUtil.h" #include "common/Timer.h" -#include "imgui.h" - -// Has to come before Gif.h -#include "MemoryTypes.h" - -#include "Frontend/ImGuiManager.h" -#include "Frontend/GameList.h" -#include "Gif.h" -#include "Gif_Unit.h" -#include "GSDumpReplayer.h" -#include "GS/GSLzma.h" -#include "GS.h" -#include "Host.h" -#include "R3000A.h" -#include "R5900.h" -#include "VMManager.h" -#include "VUmicro.h" +#include static void GSDumpReplayerCpuReserve(); static void GSDumpReplayerCpuShutdown(); diff --git a/pcsx2/Frontend/GameList.cpp b/pcsx2/GameList.cpp similarity index 99% rename from pcsx2/Frontend/GameList.cpp rename to pcsx2/GameList.cpp index 5ee3ecf28d..92a3cc4815 100644 --- a/pcsx2/Frontend/GameList.cpp +++ b/pcsx2/GameList.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,16 +15,21 @@ #include "PrecompiledHeader.h" -#include "Frontend/GameList.h" -#include "HostSettings.h" +#include "CDVD/CDVD.h" +#include "Elfheader.h" +#include "GameList.h" +#include "Host.h" +#include "VMManager.h" + #include "common/Assertions.h" #include "common/Console.h" #include "common/FileSystem.h" -#include "common/HeterogeneousContainers.h" #include "common/HTTPDownloader.h" +#include "common/HeterogeneousContainers.h" #include "common/Path.h" #include "common/ProgressCallback.h" #include "common/StringUtil.h" + #include #include #include @@ -34,10 +39,6 @@ #include #include -#include "CDVD/CDVD.h" -#include "Elfheader.h" -#include "VMManager.h" - #ifdef _WIN32 #include "common/RedtapeWindows.h" #endif diff --git a/pcsx2/Frontend/GameList.h b/pcsx2/GameList.h similarity index 99% rename from pcsx2/Frontend/GameList.h rename to pcsx2/GameList.h index c5cccb47e5..85b8e6256e 100644 --- a/pcsx2/Frontend/GameList.h +++ b/pcsx2/GameList.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,8 +14,11 @@ */ #pragma once + #include "GameDatabase.h" + #include "common/Pcsx2Defs.h" + #include #include #include diff --git a/pcsx2/Gif.h b/pcsx2/Gif.h index 51d4ce0404..287fb62415 100644 --- a/pcsx2/Gif.h +++ b/pcsx2/Gif.h @@ -15,6 +15,8 @@ #pragma once +#include "MemoryTypes.h" + #include "common/StringUtil.h" #define COPY_GS_PACKET_TO_MTGS 0 diff --git a/pcsx2/Host.cpp b/pcsx2/Host.cpp index 6e7759c9a0..01558c4a97 100644 --- a/pcsx2/Host.cpp +++ b/pcsx2/Host.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,10 +14,26 @@ */ #include "PrecompiledHeader.h" + +#include "GS.h" +#include "GS/Renderers/HW/GSTextureReplacements.h" #include "Host.h" +#include "LayeredSettingsInterface.h" +#include "MemoryCardFile.h" +#include "Sio.h" +#include "VMManager.h" + +#include "common/Assertions.h" +#include "common/CrashHandler.h" +#include "common/FileSystem.h" +#include "common/Path.h" #include "common/StringUtil.h" + #include +static std::mutex s_settings_mutex; +static LayeredSettingsInterface s_layered_settings_interface; + void Host::ReportFormattedErrorAsync(const std::string_view& title, const char* format, ...) { std::va_list ap; @@ -36,3 +52,242 @@ bool Host::ConfirmFormattedMessage(const std::string_view& title, const char* fo return ConfirmMessage(title, message); } + +std::unique_lock Host::GetSettingsLock() +{ + return std::unique_lock(s_settings_mutex); +} + +SettingsInterface* Host::GetSettingsInterface() +{ + return &s_layered_settings_interface; +} + +SettingsInterface* Host::GetSettingsInterfaceForBindings() +{ + SettingsInterface* input_layer = s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_INPUT); + return input_layer ? input_layer : &s_layered_settings_interface; +} + +std::string Host::GetBaseStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetStringValue(section, key, default_value); +} + +bool Host::GetBaseBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetBoolValue(section, key, default_value); +} + +int Host::GetBaseIntSettingValue(const char* section, const char* key, int default_value /*= 0*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetIntValue(section, key, default_value); +} + +uint Host::GetBaseUIntSettingValue(const char* section, const char* key, uint default_value /*= 0*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetUIntValue(section, key, default_value); +} + +float Host::GetBaseFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetFloatValue(section, key, default_value); +} + +double Host::GetBaseDoubleSettingValue(const char* section, const char* key, double default_value /* = 0.0f */) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->GetDoubleValue(section, key, default_value); +} + +std::vector Host::GetBaseStringListSetting(const char* section, const char* key) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetStringList(section, key); +} + +void Host::SetBaseBoolSettingValue(const char* section, const char* key, bool value) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetBoolValue(section, key, value); +} + +void Host::SetBaseIntSettingValue(const char* section, const char* key, int value) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetIntValue(section, key, value); +} + +void Host::SetBaseUIntSettingValue(const char* section, const char* key, uint value) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetUIntValue(section, key, value); +} + +void Host::SetBaseFloatSettingValue(const char* section, const char* key, float value) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetFloatValue(section, key, value); +} + +void Host::SetBaseStringSettingValue(const char* section, const char* key, const char* value) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringValue(section, key, value); +} + +void Host::SetBaseStringListSettingValue(const char* section, const char* key, const std::vector& values) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->SetStringList(section, key, values); +} + +bool Host::AddBaseValueToStringList(const char* section, const char* key, const char* value) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->AddToStringList(section, key, value); +} + +bool Host::RemoveBaseValueFromStringList(const char* section, const char* key, const char* value) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) + ->RemoveFromStringList(section, key, value); +} + +void Host::RemoveBaseSettingValue(const char* section, const char* key) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->DeleteValue(section, key); +} + +std::string Host::GetStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetStringValue(section, key, default_value); +} + +bool Host::GetBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetBoolValue(section, key, default_value); +} + +int Host::GetIntSettingValue(const char* section, const char* key, int default_value /*= 0*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetIntValue(section, key, default_value); +} + +uint Host::GetUIntSettingValue(const char* section, const char* key, uint default_value /*= 0*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetUIntValue(section, key, default_value); +} + +float Host::GetFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetFloatValue(section, key, default_value); +} + +double Host::GetDoubleSettingValue(const char* section, const char* key, double default_value /*= 0.0f*/) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetDoubleValue(section, key, default_value); +} + +std::vector Host::GetStringListSetting(const char* section, const char* key) +{ + std::unique_lock lock(s_settings_mutex); + return s_layered_settings_interface.GetStringList(section, key); +} + +SettingsInterface* Host::Internal::GetBaseSettingsLayer() +{ + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE); +} + +SettingsInterface* Host::Internal::GetGameSettingsLayer() +{ + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_GAME); +} + +SettingsInterface* Host::Internal::GetInputSettingsLayer() +{ + return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_INPUT); +} + +void Host::Internal::SetBaseSettingsLayer(SettingsInterface* sif) +{ + pxAssertRel(s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE) == nullptr, + "Base layer has not been set"); + s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_BASE, sif); +} + +void Host::Internal::SetGameSettingsLayer(SettingsInterface* sif) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_GAME, sif); +} + +void Host::Internal::SetInputSettingsLayer(SettingsInterface* sif) +{ + std::unique_lock lock(s_settings_mutex); + s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_INPUT, sif); +} + +void Host::Internal::UpdateEmuFolders() +{ + const std::string old_cheats_directory(EmuFolders::Cheats); + const std::string old_cheats_ws_directory(EmuFolders::CheatsWS); + const std::string old_cheats_ni_directory(EmuFolders::CheatsNI); + const std::string old_memcards_directory(EmuFolders::MemoryCards); + const std::string old_textures_directory(EmuFolders::Textures); + const std::string old_videos_directory(EmuFolders::Videos); + + EmuFolders::LoadConfig(*GetBaseSettingsLayer()); + EmuFolders::EnsureFoldersExist(); + + if (VMManager::HasValidVM()) + { + if (EmuFolders::Cheats != old_cheats_directory || EmuFolders::CheatsWS != old_cheats_ws_directory || + EmuFolders::CheatsNI != old_cheats_ni_directory) + { + VMManager::ReloadPatches(true, true); + } + + if (EmuFolders::MemoryCards != old_memcards_directory) + { + FileMcd_EmuClose(); + FileMcd_EmuOpen(); + AutoEject::SetAll(); + } + + if (EmuFolders::Textures != old_textures_directory) + { + GetMTGS().RunOnGSThread([]() { + if (VMManager::HasValidVM()) + GSTextureReplacements::ReloadReplacementMap(); + }); + } + + if (EmuFolders::Videos != old_videos_directory) + { + if (VMManager::HasValidVM()) + GetMTGS().RunOnGSThread(&GSEndCapture); + } + } +} diff --git a/pcsx2/Host.h b/pcsx2/Host.h index d8b4315f80..9685065d79 100644 --- a/pcsx2/Host.h +++ b/pcsx2/Host.h @@ -19,13 +19,16 @@ #include #include +#include +#include #include #include -#include #include enum class VsyncMode; +class SettingsInterface; + namespace Host { /// Typical durations for OSD messages. @@ -89,4 +92,67 @@ namespace Host /// Requests shut down of the current virtual machine. void RequestVMShutdown(bool allow_confirm, bool allow_save_state, bool default_save_state); + + /// Base setting retrieval, bypasses layers. + std::string GetBaseStringSettingValue(const char* section, const char* key, const char* default_value = ""); + bool GetBaseBoolSettingValue(const char* section, const char* key, bool default_value = false); + int GetBaseIntSettingValue(const char* section, const char* key, int default_value = 0); + uint GetBaseUIntSettingValue(const char* section, const char* key, uint default_value = 0); + float GetBaseFloatSettingValue(const char* section, const char* key, float default_value = 0.0f); + double GetBaseDoubleSettingValue(const char* section, const char* key, double default_value = 0.0); + std::vector GetBaseStringListSetting(const char* section, const char* key); + + /// Allows the emucore to write settings back to the frontend. Use with care. + /// You should call CommitBaseSettingChanges() after finishing writing, or it may not be written to disk. + void SetBaseBoolSettingValue(const char* section, const char* key, bool value); + void SetBaseIntSettingValue(const char* section, const char* key, int value); + void SetBaseUIntSettingValue(const char* section, const char* key, uint value); + void SetBaseFloatSettingValue(const char* section, const char* key, float value); + void SetBaseStringSettingValue(const char* section, const char* key, const char* value); + void SetBaseStringListSettingValue(const char* section, const char* key, const std::vector& values); + bool AddBaseValueToStringList(const char* section, const char* key, const char* value); + bool RemoveBaseValueFromStringList(const char* section, const char* key, const char* value); + void RemoveBaseSettingValue(const char* section, const char* key); + void CommitBaseSettingChanges(); + + /// Settings access, thread-safe. + std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = ""); + bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false); + int GetIntSettingValue(const char* section, const char* key, int default_value = 0); + uint GetUIntSettingValue(const char* section, const char* key, uint default_value = 0); + float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f); + double GetDoubleSettingValue(const char* section, const char* key, double default_value = 0.0); + std::vector GetStringListSetting(const char* section, const char* key); + + /// Direct access to settings interface. Must hold the lock when calling GetSettingsInterface() and while using it. + std::unique_lock GetSettingsLock(); + SettingsInterface* GetSettingsInterface(); + + /// Returns the settings interface that controller bindings should be loaded from. + /// If an input profile is being used, this will be the input layer, otherwise the layered interface. + SettingsInterface* GetSettingsInterfaceForBindings(); + + namespace Internal + { + /// Retrieves the base settings layer. Must call with lock held. + SettingsInterface* GetBaseSettingsLayer(); + + /// Retrieves the game settings layer, if present. Must call with lock held. + SettingsInterface* GetGameSettingsLayer(); + + /// Retrieves the input settings layer, if present. Must call with lock held. + SettingsInterface* GetInputSettingsLayer(); + + /// Sets the base settings layer. Should be called by the host at initialization time. + void SetBaseSettingsLayer(SettingsInterface* sif); + + /// Sets the game settings layer. Called by VMManager when the game changes. + void SetGameSettingsLayer(SettingsInterface* sif); + + /// Sets the input profile settings layer. Called by VMManager when the game changes. + void SetInputSettingsLayer(SettingsInterface* sif); + + /// Updates the variables in the EmuFolders namespace, reloading subsystems if needed. Must call with the lock held. + void UpdateEmuFolders(); + } // namespace Internal } // namespace Host diff --git a/pcsx2/HostSettings.h b/pcsx2/HostSettings.h deleted file mode 100644 index d8d57813db..0000000000 --- a/pcsx2/HostSettings.h +++ /dev/null @@ -1,88 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 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 for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#pragma once - -#include "common/Pcsx2Defs.h" -#include -#include - -class SettingsInterface; - -namespace Host -{ - // Base setting retrieval, bypasses layers. - std::string GetBaseStringSettingValue(const char* section, const char* key, const char* default_value = ""); - bool GetBaseBoolSettingValue(const char* section, const char* key, bool default_value = false); - int GetBaseIntSettingValue(const char* section, const char* key, int default_value = 0); - uint GetBaseUIntSettingValue(const char* section, const char* key, uint default_value = 0); - float GetBaseFloatSettingValue(const char* section, const char* key, float default_value = 0.0f); - double GetBaseDoubleSettingValue(const char* section, const char* key, double default_value = 0.0); - std::vector GetBaseStringListSetting(const char* section, const char* key); - - // Allows the emucore to write settings back to the frontend. Use with care. - // You should call CommitBaseSettingChanges() after finishing writing, or it may not be written to disk. - void SetBaseBoolSettingValue(const char* section, const char* key, bool value); - void SetBaseIntSettingValue(const char* section, const char* key, int value); - void SetBaseUIntSettingValue(const char* section, const char* key, uint value); - void SetBaseFloatSettingValue(const char* section, const char* key, float value); - void SetBaseStringSettingValue(const char* section, const char* key, const char* value); - void SetBaseStringListSettingValue(const char* section, const char* key, const std::vector& values); - bool AddBaseValueToStringList(const char* section, const char* key, const char* value); - bool RemoveBaseValueFromStringList(const char* section, const char* key, const char* value); - void RemoveBaseSettingValue(const char* section, const char* key); - void CommitBaseSettingChanges(); - - // Settings access, thread-safe. - std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = ""); - bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false); - int GetIntSettingValue(const char* section, const char* key, int default_value = 0); - uint GetUIntSettingValue(const char* section, const char* key, uint default_value = 0); - float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f); - double GetDoubleSettingValue(const char* section, const char* key, double default_value = 0.0); - std::vector GetStringListSetting(const char* section, const char* key); - - /// Direct access to settings interface. Must hold the lock when calling GetSettingsInterface() and while using it. - std::unique_lock GetSettingsLock(); - SettingsInterface* GetSettingsInterface(); - - /// Returns the settings interface that controller bindings should be loaded from. - /// If an input profile is being used, this will be the input layer, otherwise the layered interface. - SettingsInterface* GetSettingsInterfaceForBindings(); - - namespace Internal - { - /// Retrieves the base settings layer. Must call with lock held. - SettingsInterface* GetBaseSettingsLayer(); - - /// Retrieves the game settings layer, if present. Must call with lock held. - SettingsInterface* GetGameSettingsLayer(); - - /// Retrieves the input settings layer, if present. Must call with lock held. - SettingsInterface* GetInputSettingsLayer(); - - /// Sets the base settings layer. Should be called by the host at initialization time. - void SetBaseSettingsLayer(SettingsInterface* sif); - - /// Sets the game settings layer. Called by VMManager when the game changes. - void SetGameSettingsLayer(SettingsInterface* sif); - - /// Sets the input profile settings layer. Called by VMManager when the game changes. - void SetInputSettingsLayer(SettingsInterface* sif); - - /// Updates the variables in the EmuFolders namespace, reloading subsystems if needed. Must call with the lock held. - void UpdateEmuFolders(); - } // namespace Internal -} // namespace Host \ No newline at end of file diff --git a/pcsx2/Frontend/CommonHotkeys.cpp b/pcsx2/Hotkeys.cpp similarity index 97% rename from pcsx2/Frontend/CommonHotkeys.cpp rename to pcsx2/Hotkeys.cpp index 75aa753d1a..373990acc7 100644 --- a/pcsx2/Frontend/CommonHotkeys.cpp +++ b/pcsx2/Hotkeys.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,23 +14,21 @@ */ #include "PrecompiledHeader.h" -#include "common/Assertions.h" -#include "common/FileSystem.h" -#include "common/Path.h" -#include "pcsx2/Achievements.h" -#include "Frontend/CommonHost.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/InputManager.h" + +#include "CommonHost.h" +#include "Achievements.h" #include "GS.h" #include "Host.h" #include "IconsFontAwesome5.h" +#include "ImGui/FullscreenUI.h" +#include "Input/InputManager.h" #include "Recording/InputRecording.h" #include "SPU2/spu2.h" #include "VMManager.h" -#ifdef ENABLE_ACHIEVEMENTS -#include "Frontend/Achievements.h" -#endif +#include "common/Assertions.h" +#include "common/FileSystem.h" +#include "common/Path.h" static s32 s_current_save_slot = 1; static std::optional s_limiter_mode_prior_to_hold_interaction; diff --git a/pcsx2/Frontend/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp similarity index 99% rename from pcsx2/Frontend/FullscreenUI.cpp rename to pcsx2/ImGui/FullscreenUI.cpp index cdf2db65f4..0a8f85eee6 100644 --- a/pcsx2/Frontend/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -17,13 +17,27 @@ #define IMGUI_DEFINE_MATH_OPERATORS -#include "Frontend/CommonHost.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/ImGuiManager.h" -#include "Frontend/ImGuiFullscreen.h" -#include "Frontend/InputManager.h" -#include "Frontend/GameList.h" -#include "IconsFontAwesome5.h" +#include "CDVD/CDVDcommon.h" +#include "CommonHost.h" +#include "GS/Renderers/Common/GSDevice.h" +#include "GS/Renderers/Common/GSTexture.h" +#include "Achievements.h" +#include "CDVD/CDVDdiscReader.h" +#include "GS.h" +#include "GameList.h" +#include "Host.h" +#include "INISettingsInterface.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiFullscreen.h" +#include "ImGui/ImGuiManager.h" +#include "Input/InputManager.h" +#include "MemoryCardFile.h" +#include "PAD/Host/PAD.h" +#include "Sio.h" +#include "USB/USB.h" +#include "VMManager.h" +#include "ps2/BiosTools.h" +#include "svnrev.h" #include "common/FileSystem.h" #include "common/Console.h" @@ -34,25 +48,9 @@ #include "common/StringUtil.h" #include "common/Timer.h" -#include "CDVD/CDVDcommon.h" -#include "CDVD/CDVDdiscReader.h" -#include "GS.h" -#include "GS/Renderers/Common/GSDevice.h" -#include "GS/Renderers/Common/GSTexture.h" -#include "Host.h" -#include "HostSettings.h" -#include "INISettingsInterface.h" -#include "MemoryCardFile.h" -#include "PAD/Host/PAD.h" -#include "ps2/BiosTools.h" -#include "Sio.h" -#include "USB/USB.h" -#include "VMManager.h" - -#include "svnrev.h" - #include "imgui.h" #include "imgui_internal.h" +#include "IconsFontAwesome5.h" #include "fmt/core.h" @@ -62,10 +60,6 @@ #include #include -#ifdef ENABLE_ACHIEVEMENTS -#include "Frontend/Achievements.h" -#endif - using ImGuiFullscreen::g_large_font; using ImGuiFullscreen::g_layout_padding_left; using ImGuiFullscreen::g_layout_padding_top; diff --git a/pcsx2/Frontend/FullscreenUI.h b/pcsx2/ImGui/FullscreenUI.h similarity index 100% rename from pcsx2/Frontend/FullscreenUI.h rename to pcsx2/ImGui/FullscreenUI.h diff --git a/pcsx2/Frontend/ImGuiFullscreen.cpp b/pcsx2/ImGui/ImGuiFullscreen.cpp similarity index 100% rename from pcsx2/Frontend/ImGuiFullscreen.cpp rename to pcsx2/ImGui/ImGuiFullscreen.cpp diff --git a/pcsx2/Frontend/ImGuiFullscreen.h b/pcsx2/ImGui/ImGuiFullscreen.h similarity index 100% rename from pcsx2/Frontend/ImGuiFullscreen.h rename to pcsx2/ImGui/ImGuiFullscreen.h diff --git a/pcsx2/Frontend/ImGuiManager.cpp b/pcsx2/ImGui/ImGuiManager.cpp similarity index 99% rename from pcsx2/Frontend/ImGuiManager.cpp rename to pcsx2/ImGui/ImGuiManager.cpp index 6daf5a26b3..1865e71591 100644 --- a/pcsx2/Frontend/ImGuiManager.cpp +++ b/pcsx2/ImGui/ImGuiManager.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,35 +15,35 @@ #include "PrecompiledHeader.h" +#include "GS/Renderers/Common/GSDevice.h" +#include "Config.h" +#include "Counters.h" +#include "GS.h" +#include "GS/GS.h" +#include "Host.h" +#include "IconsFontAwesome5.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiFullscreen.h" +#include "ImGui/ImGuiManager.h" +#include "ImGui/ImGuiOverlays.h" +#include "Input/InputManager.h" +#include "PerformanceMetrics.h" +#include "Recording/InputRecording.h" +#include "VMManager.h" + +#include "common/StringUtil.h" +#include "common/Timer.h" + +#include "fmt/core.h" +#include "imgui.h" +#include "imgui_internal.h" + #include #include #include #include #include -#include "fmt/core.h" - -#include "common/StringUtil.h" -#include "common/Timer.h" -#include "imgui.h" -#include "imgui_internal.h" - -#include "Config.h" -#include "Counters.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/ImGuiFullscreen.h" -#include "Frontend/ImGuiManager.h" -#include "Frontend/ImGuiOverlays.h" -#include "Frontend/InputManager.h" -#include "GS.h" -#include "GS/GS.h" -#include "GS/Renderers/Common/GSDevice.h" -#include "Host.h" -#include "IconsFontAwesome5.h" -#include "PerformanceMetrics.h" -#include "Recording/InputRecording.h" -#include "VMManager.h" - namespace ImGuiManager { static void SetStyle(); diff --git a/pcsx2/Frontend/ImGuiManager.h b/pcsx2/ImGui/ImGuiManager.h similarity index 100% rename from pcsx2/Frontend/ImGuiManager.h rename to pcsx2/ImGui/ImGuiManager.h diff --git a/pcsx2/Frontend/ImGuiOverlays.cpp b/pcsx2/ImGui/ImGuiOverlays.cpp similarity index 99% rename from pcsx2/Frontend/ImGuiOverlays.cpp rename to pcsx2/ImGui/ImGuiOverlays.cpp index c4aba3530e..918ff109e5 100644 --- a/pcsx2/Frontend/ImGuiOverlays.cpp +++ b/pcsx2/ImGui/ImGuiOverlays.cpp @@ -15,6 +15,34 @@ #include "PrecompiledHeader.h" +#include "Config.h" +#include "Counters.h" +#include "GS.h" +#include "GS/GS.h" +#include "GS/GSCapture.h" +#include "GS/GSVector.h" +#include "Host.h" +#include "IconsFontAwesome5.h" +#include "ImGui/FullscreenUI.h" +#include "ImGui/ImGuiFullscreen.h" +#include "ImGui/ImGuiManager.h" +#include "ImGui/ImGuiOverlays.h" +#include "Input/InputManager.h" +#include "PAD/Host/KeyStatus.h" +#include "PAD/Host/PAD.h" +#include "PerformanceMetrics.h" +#include "USB/USB.h" +#include "VMManager.h" +#include "pcsx2/Recording/InputRecording.h" + +#include "common/Align.h" +#include "common/StringUtil.h" +#include "common/Timer.h" + +#include "fmt/core.h" +#include "gsl/span" +#include "imgui.h" + #include #include #include @@ -23,35 +51,6 @@ #include #include -#include "gsl/span" -#include "fmt/core.h" - -#include "common/Align.h" -#include "common/StringUtil.h" -#include "common/Timer.h" -#include "imgui.h" - -#include "Config.h" -#include "Counters.h" -#include "Frontend/FullscreenUI.h" -#include "Frontend/ImGuiManager.h" -#include "Frontend/ImGuiFullscreen.h" -#include "Frontend/ImGuiOverlays.h" -#include "Frontend/InputManager.h" -#include "GS.h" -#include "GS/GS.h" -#include "GS/GSCapture.h" -#include "GS/GSVector.h" -#include "Host.h" -#include "IconsFontAwesome5.h" -#include "PerformanceMetrics.h" -#include "PAD/Host/PAD.h" -#include "PAD/Host/KeyStatus.h" -#include "USB/USB.h" - -#include "VMManager.h" -#include "pcsx2/Recording/InputRecording.h" - namespace ImGuiManager { static void FormatProcessorStat(std::string& text, double usage, double time); diff --git a/pcsx2/Frontend/ImGuiOverlays.h b/pcsx2/ImGui/ImGuiOverlays.h similarity index 100% rename from pcsx2/Frontend/ImGuiOverlays.h rename to pcsx2/ImGui/ImGuiOverlays.h diff --git a/pcsx2/Frontend/DInputSource.cpp b/pcsx2/Input/DInputSource.cpp similarity index 99% rename from pcsx2/Frontend/DInputSource.cpp rename to pcsx2/Input/DInputSource.cpp index 481f3dd8d0..47f7c9860c 100644 --- a/pcsx2/Frontend/DInputSource.cpp +++ b/pcsx2/Input/DInputSource.cpp @@ -17,8 +17,8 @@ #define INITGUID -#include "Frontend/DInputSource.h" -#include "Frontend/InputManager.h" +#include "Input/DInputSource.h" +#include "Input/InputManager.h" #include "common/Assertions.h" #include "common/Console.h" #include "common/StringUtil.h" diff --git a/pcsx2/Frontend/DInputSource.h b/pcsx2/Input/DInputSource.h similarity index 98% rename from pcsx2/Frontend/DInputSource.h rename to pcsx2/Input/DInputSource.h index 83aa73026e..8731e68194 100644 --- a/pcsx2/Frontend/DInputSource.h +++ b/pcsx2/Input/DInputSource.h @@ -17,7 +17,7 @@ #define DIRECTINPUT_VERSION 0x0800 #include "common/RedtapeWindows.h" #include "common/RedtapeWilCom.h" -#include "Frontend/InputSource.h" +#include "Input/InputSource.h" #include #include #include diff --git a/pcsx2/Frontend/InputManager.cpp b/pcsx2/Input/InputManager.cpp similarity index 99% rename from pcsx2/Frontend/InputManager.cpp rename to pcsx2/Input/InputManager.cpp index 3c4d3d876f..a77729b962 100644 --- a/pcsx2/Frontend/InputManager.cpp +++ b/pcsx2/Input/InputManager.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,14 +14,16 @@ */ #include "PrecompiledHeader.h" -#include "Frontend/InputManager.h" -#include "Frontend/InputSource.h" -#include "Frontend/ImGuiManager.h" + +#include "ImGui/ImGuiManager.h" +#include "Input/InputManager.h" +#include "Input/InputSource.h" #include "PAD/Host/PAD.h" #include "USB/USB.h" +#include "VMManager.h" + #include "common/StringUtil.h" #include "common/Timer.h" -#include "VMManager.h" #include "fmt/core.h" @@ -1502,12 +1504,12 @@ void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_loc } #ifdef _WIN32 -#include "Frontend/DInputSource.h" -#include "Frontend/XInputSource.h" +#include "Input/DInputSource.h" +#include "Input/XInputSource.h" #endif #ifdef SDL_BUILD -#include "Frontend/SDLInputSource.h" +#include "Input/SDLInputSource.h" #endif void InputManager::ReloadSources(SettingsInterface& si, std::unique_lock& settings_lock) diff --git a/pcsx2/Frontend/InputManager.h b/pcsx2/Input/InputManager.h similarity index 100% rename from pcsx2/Frontend/InputManager.h rename to pcsx2/Input/InputManager.h diff --git a/pcsx2/Frontend/InputSource.cpp b/pcsx2/Input/InputSource.cpp similarity index 99% rename from pcsx2/Frontend/InputSource.cpp rename to pcsx2/Input/InputSource.cpp index 5d8f7d441b..786354f776 100644 --- a/pcsx2/Frontend/InputSource.cpp +++ b/pcsx2/Input/InputSource.cpp @@ -14,7 +14,7 @@ */ #include "PrecompiledHeader.h" -#include "Frontend/InputSource.h" +#include "Input/InputSource.h" #include "common/StringUtil.h" InputSource::InputSource() = default; diff --git a/pcsx2/Frontend/InputSource.h b/pcsx2/Input/InputSource.h similarity index 99% rename from pcsx2/Frontend/InputSource.h rename to pcsx2/Input/InputSource.h index a6288623a2..4900877b60 100644 --- a/pcsx2/Frontend/InputSource.h +++ b/pcsx2/Input/InputSource.h @@ -21,7 +21,7 @@ #include #include "common/Pcsx2Defs.h" -#include "Frontend/InputManager.h" +#include "Input/InputManager.h" class SettingsInterface; diff --git a/pcsx2/Frontend/SDLInputSource.cpp b/pcsx2/Input/SDLInputSource.cpp similarity index 99% rename from pcsx2/Frontend/SDLInputSource.cpp rename to pcsx2/Input/SDLInputSource.cpp index 4993e43514..2802e798bd 100644 --- a/pcsx2/Frontend/SDLInputSource.cpp +++ b/pcsx2/Input/SDLInputSource.cpp @@ -14,10 +14,9 @@ */ #include "PrecompiledHeader.h" -#include "Frontend/SDLInputSource.h" -#include "Frontend/InputManager.h" +#include "Input/SDLInputSource.h" +#include "Input/InputManager.h" #include "Host.h" -#include "HostSettings.h" #include "common/Assertions.h" #include "common/StringUtil.h" #include "common/Console.h" diff --git a/pcsx2/Frontend/SDLInputSource.h b/pcsx2/Input/SDLInputSource.h similarity index 99% rename from pcsx2/Frontend/SDLInputSource.h rename to pcsx2/Input/SDLInputSource.h index 61aa22bc97..64494d8bb1 100644 --- a/pcsx2/Frontend/SDLInputSource.h +++ b/pcsx2/Input/SDLInputSource.h @@ -14,7 +14,7 @@ */ #pragma once -#include "Frontend/InputSource.h" +#include "Input/InputSource.h" #include "SDL.h" #include #include diff --git a/pcsx2/Frontend/XInputSource.cpp b/pcsx2/Input/XInputSource.cpp similarity index 99% rename from pcsx2/Frontend/XInputSource.cpp rename to pcsx2/Input/XInputSource.cpp index 5ac1b69791..d25141ba48 100644 --- a/pcsx2/Frontend/XInputSource.cpp +++ b/pcsx2/Input/XInputSource.cpp @@ -14,8 +14,8 @@ */ #include "PrecompiledHeader.h" -#include "Frontend/XInputSource.h" -#include "Frontend/InputManager.h" +#include "Input/XInputSource.h" +#include "Input/InputManager.h" #include "common/Assertions.h" #include "common/StringUtil.h" #include "common/Console.h" diff --git a/pcsx2/Frontend/XInputSource.h b/pcsx2/Input/XInputSource.h similarity index 97% rename from pcsx2/Frontend/XInputSource.h rename to pcsx2/Input/XInputSource.h index 6fea539249..b42db78822 100644 --- a/pcsx2/Frontend/XInputSource.h +++ b/pcsx2/Input/XInputSource.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,8 +14,11 @@ */ #pragma once -#include "Frontend/InputSource.h" + +#include "Input/InputSource.h" + #include "common/RedtapeWindows.h" + #include #include #include diff --git a/pcsx2/Frontend/LayeredSettingsInterface.cpp b/pcsx2/LayeredSettingsInterface.cpp similarity index 100% rename from pcsx2/Frontend/LayeredSettingsInterface.cpp rename to pcsx2/LayeredSettingsInterface.cpp diff --git a/pcsx2/Frontend/LayeredSettingsInterface.h b/pcsx2/LayeredSettingsInterface.h similarity index 100% rename from pcsx2/Frontend/LayeredSettingsInterface.h rename to pcsx2/LayeredSettingsInterface.h diff --git a/pcsx2/Frontend/LogSink.cpp b/pcsx2/LogSink.cpp similarity index 99% rename from pcsx2/Frontend/LogSink.cpp rename to pcsx2/LogSink.cpp index dec8b66c4d..7c6ed94ff9 100644 --- a/pcsx2/Frontend/LogSink.cpp +++ b/pcsx2/LogSink.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -16,8 +16,8 @@ #include "PrecompiledHeader.h" #include "DebugTools/Debug.h" -#include "Frontend/LogSink.h" -#include "HostSettings.h" +#include "Host.h" +#include "LogSink.h" #include "common/Assertions.h" #include "common/Console.h" @@ -31,8 +31,8 @@ #include "common/RedtapeWindows.h" #endif -#include "fmt/core.h" #include +#include "fmt/core.h" // Used on both Windows and Linux. #ifdef _WIN32 diff --git a/pcsx2/Frontend/LogSink.h b/pcsx2/LogSink.h similarity index 100% rename from pcsx2/Frontend/LogSink.h rename to pcsx2/LogSink.h diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 5eb7178244..6c0b9c3581 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -109,13 +109,6 @@ void SysMtgsThread::ThreadEntryPoint() { Threading::SetNameOfCurrentThread("GS"); - if (GSinit() != 0) - { - Host::ReportErrorAsync("Error", "GSinit() failed."); - m_open_or_close_done.Post(); - return; - } - m_thread_handle = Threading::ThreadHandle::GetForCallingThread(); for (;;) diff --git a/pcsx2/PAD/Host/PAD.cpp b/pcsx2/PAD/Host/PAD.cpp index 66fe7c32a2..014ce03b77 100644 --- a/pcsx2/PAD/Host/PAD.cpp +++ b/pcsx2/PAD/Host/PAD.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -15,18 +15,17 @@ #include "PrecompiledHeader.h" +#include "Host.h" +#include "Input/InputManager.h" +#include "PAD/Host/Global.h" +#include "PAD/Host/KeyStatus.h" +#include "PAD/Host/PAD.h" +#include "PAD/Host/StateManagement.h" + #include "common/FileSystem.h" #include "common/Path.h" -#include "common/StringUtil.h" #include "common/SettingsInterface.h" - -#include "Frontend/InputManager.h" -#include "HostSettings.h" - -#include "PAD/Host/Global.h" -#include "PAD/Host/PAD.h" -#include "PAD/Host/KeyStatus.h" -#include "PAD/Host/StateManagement.h" +#include "common/StringUtil.h" #include diff --git a/pcsx2/PAD/Host/StateManagement.cpp b/pcsx2/PAD/Host/StateManagement.cpp index 71e30eba29..85351fa19a 100644 --- a/pcsx2/PAD/Host/StateManagement.cpp +++ b/pcsx2/PAD/Host/StateManagement.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -18,7 +18,7 @@ #include "PAD/Host/StateManagement.h" #include "PAD/Host/KeyStatus.h" #include "PAD/Host/PAD.h" -#include "Frontend/InputManager.h" +#include "Input/InputManager.h" #include "Sio.h" template diff --git a/pcsx2/SPU2/SndOut_Cubeb.cpp b/pcsx2/SPU2/SndOut_Cubeb.cpp index 21c6efe018..8e946ba2f6 100644 --- a/pcsx2/SPU2/SndOut_Cubeb.cpp +++ b/pcsx2/SPU2/SndOut_Cubeb.cpp @@ -31,8 +31,6 @@ #include #endif -#include "HostSettings.h" - class Cubeb : public SndOutModule { private: diff --git a/pcsx2/SPU2/spu2.cpp b/pcsx2/SPU2/spu2.cpp index b58553b34b..47c2477203 100644 --- a/pcsx2/SPU2/spu2.cpp +++ b/pcsx2/SPU2/spu2.cpp @@ -177,7 +177,7 @@ void SPU2::SetDeviceSampleRateMultiplier(double multiplier) UpdateSampleRate(); } -bool SPU2::Initialize() +void SPU2::Initialize() { pxAssert(regtable[0x400] == nullptr); spu2regs = (s16*)malloc(0x010000); @@ -194,8 +194,8 @@ bool SPU2::Initialize() if (!spu2regs || !_spu2mem || !pcm_cache_data) { - Console.Error("SPU2: Error allocating Memory"); - return false; + // If these memory allocations fail, we have much bigger problems. + pxFailRel("Failed to allocate SPU2 memory"); } // Patch up a copy of regtable that directly maps "nullptrs" to SPU2 memory. @@ -212,7 +212,6 @@ bool SPU2::Initialize() } InitADSR(); - return true; } diff --git a/pcsx2/SPU2/spu2.h b/pcsx2/SPU2/spu2.h index c6591363a0..d7d9fe4af0 100644 --- a/pcsx2/SPU2/spu2.h +++ b/pcsx2/SPU2/spu2.h @@ -24,7 +24,7 @@ struct Pcsx2Config; namespace SPU2 { /// Initialization/cleanup, call at process startup/shutdown. -bool Initialize(); +void Initialize(); void Shutdown(); /// Open/close, call at VM startup/shutdown. diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index 9354a36571..24581e50d7 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2010 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -13,9 +13,30 @@ * If not, see . */ - #include "PrecompiledHeader.h" + +#include "Achievements.h" +#include "CDVD/CDVD.h" +#include "COP0.h" +#include "Cache.h" +#include "Config.h" +#include "Counters.h" +#include "DebugTools/Breakpoints.h" +#include "Elfheader.h" +#include "GS.h" +#include "GS/GS.h" +#include "Host.h" +#include "MTVU.h" +#include "PAD/Host/PAD.h" +#include "Patch.h" +#include "R3000A.h" +#include "SPU2/spu2.h" #include "SaveState.h" +#include "StateWrapper.h" +#include "USB/USB.h" +#include "VMManager.h" +#include "VUmicro.h" +#include "ps2/BiosTools.h" #include "common/FileSystem.h" #include "common/Path.h" @@ -24,31 +45,6 @@ #include "common/StringUtil.h" #include "common/ZipHelpers.h" -#include "ps2/BiosTools.h" -#include "COP0.h" -#include "VUmicro.h" -#include "MTVU.h" -#include "Cache.h" -#include "Config.h" -#include "CDVD/CDVD.h" -#include "R3000A.h" -#include "Elfheader.h" -#include "Counters.h" -#include "Patch.h" -#include "DebugTools/Breakpoints.h" -#include "Host.h" -#include "GS.h" -#include "GS/GS.h" -#include "SPU2/spu2.h" -#include "StateWrapper.h" -#include "PAD/Host/PAD.h" -#include "USB/USB.h" -#include "VMManager.h" - -#ifdef ENABLE_ACHIEVEMENTS -#include "Frontend/Achievements.h" -#endif - #include "fmt/core.h" #include diff --git a/pcsx2/USB/USB.cpp b/pcsx2/USB/USB.cpp index a5712b4954..1511baadb8 100644 --- a/pcsx2/USB/USB.cpp +++ b/pcsx2/USB/USB.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2020 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -13,24 +13,26 @@ * If not, see . */ -#include -#include -#include -#include -#include - #include "PrecompiledHeader.h" + +#include "Host.h" +#include "StateWrapper.h" +#include "USB/USB.h" +#include "USB/deviceproxy.h" +#include "USB/qemu-usb/USBinternal.h" +#include "USB/qemu-usb/desc.h" + #include "common/SettingsInterface.h" #include "common/WindowInfo.h" -#include "USB.h" -#include "qemu-usb/USBinternal.h" -#include "qemu-usb/desc.h" -#include "deviceproxy.h" -#include "HostSettings.h" -#include "StateWrapper.h" #include "fmt/format.h" +#include +#include +#include +#include +#include + #define PSXCLK 36864000 /* 36.864 Mhz */ namespace USB @@ -122,10 +124,9 @@ void USB::UpdateDevice(u32 port) s_usb_device_proxy[port]->UpdateSettings(s_usb_device[port], *Host::GetSettingsInterface()); } -s32 USBinit() +void USBinit() { RegisterDevice::Register(); - return 0; } void USBshutdown() diff --git a/pcsx2/USB/USB.h b/pcsx2/USB/USB.h index 77794ff720..dd818f6180 100644 --- a/pcsx2/USB/USB.h +++ b/pcsx2/USB/USB.h @@ -93,7 +93,7 @@ struct WindowInfo; // --------------------------------------------------------------------- -s32 USBinit(); +void USBinit(); void USBasync(u32 cycles); void USBshutdown(); void USBclose(); diff --git a/pcsx2/USB/usb-hid/usb-hid.cpp b/pcsx2/USB/usb-hid/usb-hid.cpp index d4a4db78ae..6bae8467ec 100644 --- a/pcsx2/USB/usb-hid/usb-hid.cpp +++ b/pcsx2/USB/usb-hid/usb-hid.cpp @@ -24,14 +24,14 @@ */ #include "PrecompiledHeader.h" -#include "USB/deviceproxy.h" -#include "USB/qemu-usb/desc.h" -#include "USB/qemu-usb/USBinternal.h" -#include "usb-hid.h" -#include "USB/USB.h" -#include "StateWrapper.h" -#include "Frontend/InputManager.h" +#include "Input/InputManager.h" +#include "StateWrapper.h" +#include "USB/USB.h" +#include "USB/deviceproxy.h" +#include "USB/qemu-usb/USBinternal.h" +#include "USB/qemu-usb/desc.h" +#include "USB/usb-hid/usb-hid.h" namespace usb_hid { diff --git a/pcsx2/USB/usb-lightgun/guncon2.cpp b/pcsx2/USB/usb-lightgun/guncon2.cpp index 069349566d..84943709df 100644 --- a/pcsx2/USB/usb-lightgun/guncon2.cpp +++ b/pcsx2/USB/usb-lightgun/guncon2.cpp @@ -14,17 +14,17 @@ */ #include "PrecompiledHeader.h" + +#include "GS/GS.h" +#include "Input/InputManager.h" +#include "StateWrapper.h" +#include "USB/USB.h" #include "USB/deviceproxy.h" +#include "USB/qemu-usb/USBinternal.h" #include "USB/qemu-usb/desc.h" #include "USB/usb-lightgun/guncon2.h" -#include "USB/qemu-usb/USBinternal.h" -#include "USB/USB.h" -#include "GS/GS.h" -#include "StateWrapper.h" #include "VMManager.h" -#include "Frontend/InputManager.h" - #include namespace usb_lightgun diff --git a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp index 2786eee51f..2f88357b81 100644 --- a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp +++ b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp @@ -14,10 +14,14 @@ */ #include "PrecompiledHeader.h" + +#include "Input/InputManager.h" #include "USB/usb-pad/usb-pad-sdl-ff.h" -#include "Frontend/InputManager.h" + #include "common/Console.h" + #include "fmt/format.h" + #include #ifdef SDL_BUILD diff --git a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h index 4b3fc8edd8..daca5885b8 100644 --- a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h +++ b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -19,7 +19,7 @@ #ifdef SDL_BUILD -#include "Frontend/SDLInputSource.h" +#include "Input/SDLInputSource.h" namespace usb_pad { diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index e3f83872fa..1709c83117 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -16,20 +16,6 @@ #include "PrecompiledHeader.h" #include "VMManager.h" - -#include -#include -#include - -#include "common/Console.h" -#include "common/FileSystem.h" -#include "common/ScopedGuard.h" -#include "common/StringUtil.h" -#include "common/SettingsWrapper.h" -#include "common/Timer.h" -#include "common/Threading.h" -#include "fmt/core.h" - #include "Achievements.h" #include "Counters.h" #include "CDVD/CDVD.h" @@ -40,7 +26,6 @@ #include "GS.h" #include "GSDumpReplayer.h" #include "Host.h" -#include "HostSettings.h" #include "INISettingsInterface.h" #include "IopBios.h" #include "MTVU.h" @@ -55,15 +40,26 @@ #include "Sio.h" #include "ps2/BiosTools.h" #include "Recording/InputRecordingControls.h" - #include "DebugTools/MIPSAnalyst.h" #include "DebugTools/SymbolMap.h" - -#include "IconsFontAwesome5.h" - #include "Recording/InputRecording.h" +#include "common/Console.h" +#include "common/FileSystem.h" +#include "common/ScopedGuard.h" +#include "common/StringUtil.h" +#include "common/SettingsWrapper.h" +#include "common/Timer.h" +#include "common/Threading.h" #include "common/emitter/tools.h" + +#include "IconsFontAwesome5.h" +#include "fmt/core.h" + +#include +#include +#include + #ifdef _M_X86 #include "common/emitter/x86_intrin.h" #endif @@ -266,23 +262,9 @@ bool VMManager::Internal::InitializeGlobals() x86caps.CalculateMHz(); SysLogMachineCaps(); - if (GSinit() != 0) - { - Host::ReportErrorAsync("Error", "Failed to initialize GS (GSinit())."); - return false; - } - - if (!SPU2::Initialize()) - { - Host::ReportErrorAsync("Error", "Failed to initialize SPU2."); - return false; - } - - if (USBinit() != 0) - { - Host::ReportErrorAsync("Error", "Failed to initialize USB (USBinit())"); - return false; - } + GSinit(); + SPU2::Initialize(); + USBinit(); return true; } diff --git a/pcsx2/pcsx2core.vcxproj b/pcsx2/pcsx2core.vcxproj index a40717bde4..6bc897c0c8 100644 --- a/pcsx2/pcsx2core.vcxproj +++ b/pcsx2/pcsx2core.vcxproj @@ -102,7 +102,6 @@ - @@ -121,6 +120,7 @@ + @@ -139,6 +139,7 @@ + @@ -193,14 +194,7 @@ - - - - - - - - + @@ -220,14 +214,12 @@ + + + + + - - - - - - - @@ -240,8 +232,14 @@ - + + + + + + + @@ -501,6 +499,7 @@ + @@ -552,13 +551,7 @@ - - - - - - - + @@ -579,14 +572,11 @@ + + + + - - - - - - - @@ -597,9 +587,15 @@ - + + + + + + + diff --git a/pcsx2/pcsx2core.vcxproj.filters b/pcsx2/pcsx2core.vcxproj.filters index e09636e522..8c0cf1718c 100644 --- a/pcsx2/pcsx2core.vcxproj.filters +++ b/pcsx2/pcsx2core.vcxproj.filters @@ -205,9 +205,6 @@ {78f5077b-255e-435e-9a51-352171dfaee8} - - {65f21394-287a-471b-a0c1-d8f0d5d95a81} - {98829aa9-bb81-4564-bd6e-128719c4faa0} @@ -268,11 +265,14 @@ {b8542664-8208-48ad-bd47-425a316f293c} + + {aa9a3402-0b59-4e60-8d53-b77f509bf081} + + + {8a23ff29-0a43-4d5b-8c6c-a7722871058a} + - - Misc - Docs @@ -1136,42 +1136,12 @@ System\Ps2\SPU2 - - Host - - - Host - System\Ps2\GS\Renderers\Vulkan System\Ps2\GS\Renderers\Vulkan - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - System @@ -1184,9 +1154,6 @@ System\Ps2\PAD - - Host - System\Ps2\GS\Renderers\Hardware @@ -1217,30 +1184,6 @@ Tools\Input Recording\Utilities - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - System\Ps2\Iop @@ -1415,6 +1358,60 @@ Tools + + Misc\Input + + + Misc\Input + + + Misc\Input + + + Misc\Input + + + Misc\Input + + + System + + + Misc + + + Misc + + + Misc + + + Tools + + + Misc + + + Misc + + + Misc + + + Misc + + + Misc\ImGui + + + Misc\ImGui + + + Misc\ImGui + + + Misc\ImGui + @@ -2089,12 +2086,6 @@ System\Include - - Host - - - Host - System\Ps2\GS\Renderers\Vulkan @@ -2102,30 +2093,6 @@ System\Ps2\GS\Renderers\Vulkan - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - - - Host - System @@ -2168,30 +2135,9 @@ Tools\Input Recording\Utilities - - Host - - - Host - - - Host - - - Host - - - Host - System\Include - - Host - - - Host - System\Ps2\Iop @@ -2372,6 +2318,51 @@ Misc + + Misc\Input + + + Misc\Input + + + Misc\Input + + + Misc\Input + + + Misc\Input + + + System + + + Misc + + + Misc + + + Misc + + + Misc + + + Misc + + + Misc\ImGui + + + Misc\ImGui + + + Misc\ImGui + + + Misc\ImGui + diff --git a/tests/ctest/core/StubHost.cpp b/tests/ctest/core/StubHost.cpp index 165d3fdefa..a95c392136 100644 --- a/tests/ctest/core/StubHost.cpp +++ b/tests/ctest/core/StubHost.cpp @@ -13,18 +13,14 @@ * If not, see . */ -#include "pcsx2/Frontend/CommonHost.h" -#include "pcsx2/Frontend/ImGuiManager.h" -#include "pcsx2/Frontend/InputManager.h" +#include "pcsx2/CommonHost.h" +#include "pcsx2/ImGui/ImGuiManager.h" +#include "pcsx2/Input/InputManager.h" #include "pcsx2/GS.h" #include "pcsx2/GS/GS.h" #include "pcsx2/Host.h" -#include "pcsx2/HostSettings.h" #include "pcsx2/VMManager.h" - -#ifdef ENABLE_ACHIEVEMENTS -#include "pcsx2/Frontend/Achievements.h" -#endif +#include "pcsx2/Achievements.h" void Host::CommitBaseSettingChanges() {