From 4b7b3bd6956573c2edd8a2815ad476fa4feb4d3c Mon Sep 17 00:00:00 2001 From: TheRhysWyrill Date: Thu, 8 Jun 2023 16:31:20 +0100 Subject: [PATCH] Fix build errors, add version to main menu --- common/vsprops/common.props | 2 +- pcsx2-winrt/App.cpp | 48 +++++++++++-------------- pcsx2-winrt/Package.appxmanifest | 4 +-- pcsx2-winrt/pcsx2-winrt.vcxproj | 34 +++++++++--------- pcsx2-winrt/pcsx2-winrt.vcxproj.filters | 5 +-- pcsx2/GS/GS.cpp | 2 ++ pcsx2/ImGui/FullscreenUI.cpp | 15 ++++++-- pcsx2/Input/DInputSource.cpp | 2 +- pcsx2/Input/InputManager.cpp | 6 ++-- pcsx2/Input/InputManager.h | 2 +- pcsx2/Input/XInputSource.cpp | 2 +- pcsx2/Pcsx2Config.cpp | 8 ++++- 12 files changed, 67 insertions(+), 63 deletions(-) diff --git a/common/vsprops/common.props b/common/vsprops/common.props index e6afc06fb550a..8101d787b4634 100644 --- a/common/vsprops/common.props +++ b/common/vsprops/common.props @@ -54,7 +54,7 @@ comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies) - dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;d3d12.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;OneCore.lib;%(AdditionalDependencies) + dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;d3d12.lib;dxgi.lib;strmiids.lib;opengl32.lib;OneCore.lib;%(AdditionalDependencies) true Windows diff --git a/pcsx2-winrt/App.cpp b/pcsx2-winrt/App.cpp index e085ec43e0cfd..d9426a46a19c3 100644 --- a/pcsx2-winrt/App.cpp +++ b/pcsx2-winrt/App.cpp @@ -35,26 +35,24 @@ #include "common/StringUtil.h" #include "pcsx2/CDVD/CDVD.h" -#include "pcsx2/Frontend/CommonHost.h" -#include "pcsx2/Frontend/InputManager.h" -#include "pcsx2/Frontend/ImGuiManager.h" -#include "pcsx2/Frontend/LogSink.h" +#include "pcsx2/ImGui/ImGuiManager.h" +#include "pcsx2/Input/InputManager.h" +#include "pcsx2/LogSink.h" #include "pcsx2/GS.h" #include "pcsx2/GS/GS.h" #include "pcsx2/GSDumpReplayer.h" #include "pcsx2/Host.h" -#include "pcsx2/HostSettings.h" #include "pcsx2/INISettingsInterface.h" #include "pcsx2/PAD/Host/PAD.h" #include "pcsx2/PerformanceMetrics.h" #include "pcsx2/VMManager.h" -#include "Frontend/GameList.h" +#include "pcsx2/GameList.h" #ifdef ENABLE_ACHIEVEMENTS -#include "pcsx2/Frontend/Achievements.h" +#include "pcsx2/Achievements.h" #endif -#include +#include "3rdparty/imgui/include/imgui.h" using namespace winrt; @@ -70,13 +68,14 @@ static winrt::Windows::UI::Core::CoreWindow* s_corewind = NULL; static std::mutex m_event_mutex; static std::deque> m_event_queue; static bool s_running = true; +static std::thread s_gamescanner_thread; namespace WinRTHost { static bool InitializeConfig(); static std::optional GetPlatformWindowInfo(); static void ProcessEventQueue(); -} // namespace GSRunner +} // namespace WinRTHost static std::unique_ptr s_settings_interface; alignas(16) static SysMtgsThread s_mtgs_thread; @@ -87,7 +86,7 @@ END_HOTKEY_LIST() bool WinRTHost::InitializeConfig() { - if (!CommonHost::InitializeCriticalFolders()) + if (!EmuFolders::InitializeCriticalFolders()) return false; const std::string path(Path::Combine(EmuFolders::Settings, "PCSX2.ini")); @@ -95,16 +94,16 @@ bool WinRTHost::InitializeConfig() s_settings_interface = std::make_unique(std::move(path)); Host::Internal::SetBaseSettingsLayer(s_settings_interface.get()); - if (!s_settings_interface->Load() || !CommonHost::CheckSettingsVersion()) + if (!s_settings_interface->Load() || !VMManager::Internal::CheckSettingsVersion()) { - CommonHost::SetDefaultSettings(*s_settings_interface, true, true, true, true, true); + VMManager::SetDefaultSettings(*s_settings_interface, true, true, true, true, true); auto lock = Host::GetSettingsLock(); if (!s_settings_interface->Save()) Console.Error("Failed to save settings."); } - CommonHost::LoadStartupSettings(); + VMManager::Internal::LoadStartupSettings(); return true; } @@ -117,19 +116,17 @@ void Host::CommitBaseSettingChanges() void Host::LoadSettings(SettingsInterface& si, std::unique_lock& lock) { - CommonHost::LoadSettings(si, lock); } void Host::CheckForSettingsChanges(const Pcsx2Config& old_config) { - CommonHost::CheckForSettingsChanges(old_config); } bool Host::RequestResetSettings(bool folders, bool core, bool controllers, bool hotkeys, bool ui) { { auto lock = Host::GetSettingsLock(); - CommonHost::SetDefaultSettings(*s_settings_interface.get(), folders, core, controllers, hotkeys, ui); + VMManager::SetDefaultSettings(*s_settings_interface.get(), folders, core, controllers, hotkeys, ui); } Host::CommitBaseSettingChanges(); @@ -253,7 +250,7 @@ void Host::ReleaseRenderWindow() void Host::BeginPresentFrame() { - CommonHost::CPUThreadVSync(); + VMManager::Internal::VSyncOnCPUThread; } void Host::RequestResizeHostDisplay(s32 width, s32 height) @@ -262,33 +259,27 @@ void Host::RequestResizeHostDisplay(s32 width, s32 height) void Host::OnVMStarting() { - CommonHost::OnVMStarting(); } void Host::OnVMStarted() { - CommonHost::OnVMStarted(); } void Host::OnVMDestroyed() { - CommonHost::OnVMDestroyed(); } void Host::OnVMPaused() { - CommonHost::OnVMPaused(); } void Host::OnVMResumed() { - CommonHost::OnVMResumed(); } void Host::OnGameChanged(const std::string& disc_path, const std::string& elf_override, const std::string& game_serial, const std::string& game_name, u32 game_crc) { - CommonHost::OnGameChanged(disc_path, elf_override, game_serial, game_name, game_crc); } void Host::OnPerformanceMetricsUpdated() @@ -315,7 +306,7 @@ void Host::RunOnCPUThread(std::function function, bool block /* = false void Host::RefreshGameListAsync(bool invalidate_cache) { - GetMTGS().RunOnGSThread([invalidate_cache]() { + s_gamescanner_thread = std::thread([invalidate_cache]() { GameList::Refresh(invalidate_cache, false); }); } @@ -400,7 +391,7 @@ std::optional WinRTHost::GetPlatformWindowInfo() return wi; } -void Host::CPUThreadVSync() +void Host::VSyncOnCPUThread() { WinRTHost::ProcessEventQueue(); } @@ -548,7 +539,7 @@ struct App : implements [](const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Core::BackRequestedEventArgs& args) { args.Handled(true); }); - CommonHost::CPUThreadInitialize(); + VMManager::Internal::CPUThreadInitialize(); WinRTHost::ProcessEventQueue(); if (VMManager::GetState() != VMState::Running) @@ -600,6 +591,7 @@ struct App : implements else { WinRTHost::ProcessEventQueue(); + InputManager::PollSources(); } Sleep(1); @@ -611,14 +603,14 @@ struct App : implements auto asyncOperation = winrt::Windows::System::Launcher::LaunchUriAsync(m_uri); asyncOperation.Completed([](winrt::Windows::Foundation::IAsyncOperation const& sender, winrt::Windows::Foundation::AsyncStatus const asyncStatus) { - CommonHost::CPUThreadShutdown(); + VMManager::Internal::CPUThreadShutdown(); CoreApplication::Exit(); return; }); } else { - CommonHost::CPUThreadShutdown(); + VMManager::Internal::CPUThreadShutdown(); CoreApplication::Exit(); } } diff --git a/pcsx2-winrt/Package.appxmanifest b/pcsx2-winrt/Package.appxmanifest index 98314568b51f7..8682500b27106 100644 --- a/pcsx2-winrt/Package.appxmanifest +++ b/pcsx2-winrt/Package.appxmanifest @@ -1,9 +1,9 @@  + Version="2.0.2.0" /> pcsx2-winrt diff --git a/pcsx2-winrt/pcsx2-winrt.vcxproj b/pcsx2-winrt/pcsx2-winrt.vcxproj index 5811b551c9009..2861980f7ed2f 100644 --- a/pcsx2-winrt/pcsx2-winrt.vcxproj +++ b/pcsx2-winrt/pcsx2-winrt.vcxproj @@ -1,5 +1,4 @@ - - + @@ -49,7 +48,7 @@ - + @@ -59,23 +58,26 @@ False False True - Always + Never x64 0 True pcsx2-winrt_TemporaryKey.pfx SHA256 + D:\TheRhysWyrill\Downloads\Emu Stuff\AppPackages\ + False - $(SolutionDir)3rdparty\xbyak;%(AdditionalIncludeDirectories) + $(SolutionDir)3rdparty\fmt\fmt\include;%(AdditionalIncludeDirectories); $(SolutionDir)3rdparty\freetype\include;%(AdditionalIncludeDirectories) - $(SolutionDir)3rdparty\xz\xz\src\liblzma\api;%(AdditionalIncludeDirectories) - $(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories) - $(SolutionDir)3rdparty\libpng;%(AdditionalIncludeDirectories) $(SolutionDir)3rdparty\glad\include;%(AdditionalIncludeDirectories) - $(SolutionDir)3rdparty\simpleini\include;%(AdditionalIncludeDirectories) + $(SolutionDir)3rdparty\libpng;%(AdditionalIncludeDirectories) $(SolutionDir)3rdparty\rapidyaml\rapidyaml\ext\c4core\src\c4\ext\fast_float\include;%(AdditionalIncludeDirectories); + $(SolutionDir)3rdparty\simpleini\include;%(AdditionalIncludeDirectories) + $(SolutionDir)3rdparty\xbyak;%(AdditionalIncludeDirectories) + $(SolutionDir)3rdparty\xz\xz\src\liblzma\api;%(AdditionalIncludeDirectories) + $(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories) $(ProjectDir);$(SolutionDir)pcsx2;%(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories);$(ProjectDir)\Settings;$(ProjectDir)\GameList @@ -83,13 +85,12 @@ NotUsing PrecompiledHeader.h $(IntDir)pcsx2.pch - WIN32_LEAN_AND_MEAN;LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;DIRECTINPUT_VERSION=0x0800;PCSX2_CORE;WINRT_XBOX;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;DIRECTINPUT_VERSION=0x0800;PCSX2_CORE;WINRT_XBOX;UNICODE;_UNICODE;%(PreprocessorDefinitions) PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions) PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions) NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions) _M_SSE=0x401;%(PreprocessorDefinitions) _M_SSE=0x501;%(PreprocessorDefinitions) - UNICODE;_UNICODE;%(PreprocessorDefinitions) AdvancedVectorExtensions2 AdvancedVectorExtensions2 -march=nehalem %(AdditionalOptions) @@ -141,7 +142,7 @@ {4639972e-424e-4e13-8b07-ca403c481346} - + {6c7986c4-3e4d-4dcc-b3c6-6bb12b238995} @@ -162,12 +163,12 @@ - _DEBUG;ENABLE_ACHIEVEMENTS;UNICODE;_UNICODE;%(PreprocessorDefinitions) + _DEBUG;%(PreprocessorDefinitions) - NDEBUG;ENABLE_ACHIEVEMENTS;UNICODE;_UNICODE;%(PreprocessorDefinitions) + NDEBUG;%(PreprocessorDefinitions) true @@ -202,10 +203,7 @@ true - - true - - + true diff --git a/pcsx2-winrt/pcsx2-winrt.vcxproj.filters b/pcsx2-winrt/pcsx2-winrt.vcxproj.filters index 818d0f535556f..c288665416cfc 100644 --- a/pcsx2-winrt/pcsx2-winrt.vcxproj.filters +++ b/pcsx2-winrt/pcsx2-winrt.vcxproj.filters @@ -169,10 +169,7 @@ - - resources - - + resources diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 7d14c1787d1e8..d4c8cab268a1c 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -51,6 +51,8 @@ #include "GS/Renderers/DX12/GSDevice12.h" #include "GS/Renderers/DX11/D3D.h" +#endif + #ifdef WINRT_XBOX #pragma comment(lib, "mincore") #endif diff --git a/pcsx2/ImGui/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp index 56974d5bd1154..80ad964dceaa5 100644 --- a/pcsx2/ImGui/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -1092,6 +1092,14 @@ void FullscreenUI::DrawLandingWindow() ImVec2((ImGui::GetWindowWidth() * 0.5f) - (image_size * 0.5f), (ImGui::GetWindowHeight() * 0.5f) - (image_size * 0.5f))); ImGui::Image(s_app_icon_texture->GetNativeHandle(), ImVec2(image_size, image_size)); } + + const char version_txt[] = "v2.0.2"; + ImGui::PushFont(g_medium_font); + ImGui::SetCursorPos( + ImVec2(LayoutScale(10.0f), ImGui::GetWindowHeight() - LayoutScale(20.0f))); + ImGui::Text(version_txt); + ImGui::PopFont(); + EndFullscreenColumnWindow(); if (BeginFullscreenColumnWindow(-710.0f, 0.0f, "menu", UIBackgroundColor)) @@ -1153,10 +1161,9 @@ void FullscreenUI::DrawLandingWindow() EndMenuButtons(); const char warning_txt[] = "XBSX2.0 is an unofficial fork of PCSX2. Please do not contact PCSX2 for any help with Xbox/XBSX2 related issues."; - const ImVec2 rev_size(g_medium_font->CalcTextSizeA(g_medium_font->FontSize, FLT_MAX, 0.0f, warning_txt)); ImGui::PushFont(g_medium_font); ImGui::SetCursorPos( - ImVec2(LayoutScale(10.0f), ImGui::GetWindowHeight() - rev_size.y - LayoutScale(20.0f))); + ImVec2(LayoutScale(10.0f), ImGui::GetWindowHeight() - LayoutScale(20.0f))); ImGui::Text(warning_txt); ImGui::PopFont(); } @@ -3752,6 +3759,7 @@ void FullscreenUI::DrawControllerSettingsPage() if (MenuButton(ICON_FA_SAVE " Save Profile", "Stores the current settings to an input profile.")) DoSaveInputProfile(); +#ifndef WINRT_XBOX MenuHeading("Input Sources"); #ifdef SDL_BUILD @@ -3765,9 +3773,10 @@ void FullscreenUI::DrawControllerSettingsPage() DrawToggleSetting(bsi, ICON_FA_COG " SDL Raw Input", "Allow SDL to use raw access to input devices.", "InputSources", "SDLRawInput", false, bsi->GetBoolValue("InputSources", "SDL", true), false); #endif -#if _WIN32 && !WINRT_XBOX +#ifdef _WIN32 DrawToggleSetting(bsi, ICON_FA_COG " Enable XInput Input Source", "The XInput source provides support for XBox 360/XBox One/XBox Series controllers.", "InputSources", "XInput", false, true, false); +#endif #endif MenuHeading("Multitap"); diff --git a/pcsx2/Input/DInputSource.cpp b/pcsx2/Input/DInputSource.cpp index 44c2b0710a9cc..da0d863dfaed7 100644 --- a/pcsx2/Input/DInputSource.cpp +++ b/pcsx2/Input/DInputSource.cpp @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ -#if !WINRT_XBOX +#ifndef WINRT_XBOX #include "PrecompiledHeader.h" diff --git a/pcsx2/Input/InputManager.cpp b/pcsx2/Input/InputManager.cpp index 325da42647c2d..4c4b5cb8c1a29 100644 --- a/pcsx2/Input/InputManager.cpp +++ b/pcsx2/Input/InputManager.cpp @@ -445,7 +445,7 @@ static std::array(InputSourceType::Count)> s_input "Mouse", #endif #ifdef _WIN32 -#if !WINRT_XBOX +#ifndef WINRT_XBOX "DInput", #endif "XInput", @@ -469,13 +469,13 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type) { switch (type) { -#if !WINRT_XBOX +#ifndef WINRT_XBOX case InputSourceType::Keyboard: case InputSourceType::Pointer: return true; #endif #ifdef _WIN32 -#if !WINRT_XBOX +#ifndef WINRT_XBOX case InputSourceType::DInput: return false; #endif diff --git a/pcsx2/Input/InputManager.h b/pcsx2/Input/InputManager.h index 6072af2002c75..ddacffe73ed1d 100644 --- a/pcsx2/Input/InputManager.h +++ b/pcsx2/Input/InputManager.h @@ -34,7 +34,7 @@ enum class InputSourceType : u32 Keyboard, Pointer, #ifdef _WIN32 -#if !WINRT_XBOX +#ifndef WINRT_XBOX DInput, #endif XInput, diff --git a/pcsx2/Input/XInputSource.cpp b/pcsx2/Input/XInputSource.cpp index 8505df2a97f05..c2e7873a77058 100644 --- a/pcsx2/Input/XInputSource.cpp +++ b/pcsx2/Input/XInputSource.cpp @@ -103,7 +103,7 @@ bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock