Skip to content

Commit

Permalink
Fix build errors, add version to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRhysWyrill committed Jul 9, 2023
1 parent da8da0e commit ff01148
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 62 deletions.
48 changes: 20 additions & 28 deletions pcsx2-winrt/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <imgui/include/imgui.h>
#include "3rdparty/imgui/include/imgui.h"

using namespace winrt;

Expand All @@ -70,13 +68,14 @@ static winrt::Windows::UI::Core::CoreWindow* s_corewind = NULL;
static std::mutex m_event_mutex;
static std::deque<std::function<void()>> m_event_queue;
static bool s_running = true;
static std::thread s_gamescanner_thread;

namespace WinRTHost
{
static bool InitializeConfig();
static std::optional<WindowInfo> GetPlatformWindowInfo();
static void ProcessEventQueue();
} // namespace GSRunner
} // namespace WinRTHost

static std::unique_ptr<INISettingsInterface> s_settings_interface;
alignas(16) static SysMtgsThread s_mtgs_thread;
Expand All @@ -87,24 +86,24 @@ END_HOTKEY_LIST()

bool WinRTHost::InitializeConfig()
{
if (!CommonHost::InitializeCriticalFolders())
if (!EmuFolders::InitializeCriticalFolders())
return false;

const std::string path(Path::Combine(EmuFolders::Settings, "PCSX2.ini"));
Console.WriteLn("Loading config from %s.", path.c_str());
s_settings_interface = std::make_unique<INISettingsInterface>(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;
}

Expand All @@ -117,19 +116,17 @@ void Host::CommitBaseSettingChanges()

void Host::LoadSettings(SettingsInterface& si, std::unique_lock<std::mutex>& 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();
Expand Down Expand Up @@ -253,7 +250,7 @@ void Host::ReleaseRenderWindow()

void Host::BeginPresentFrame()
{
CommonHost::CPUThreadVSync();
VMManager::Internal::VSyncOnCPUThread;
}

void Host::RequestResizeHostDisplay(s32 width, s32 height)
Expand All @@ -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()
Expand All @@ -315,7 +306,7 @@ void Host::RunOnCPUThread(std::function<void()> 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);
});
}
Expand Down Expand Up @@ -400,7 +391,7 @@ std::optional<WindowInfo> WinRTHost::GetPlatformWindowInfo()
return wi;
}

void Host::CPUThreadVSync()
void Host::VSyncOnCPUThread()
{
WinRTHost::ProcessEventQueue();
}
Expand Down Expand Up @@ -548,7 +539,7 @@ struct App : implements<App, IFrameworkViewSource, IFrameworkView>
[](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)
Expand Down Expand Up @@ -600,6 +591,7 @@ struct App : implements<App, IFrameworkViewSource, IFrameworkView>
else
{
WinRTHost::ProcessEventQueue();
InputManager::PollSources();
}

Sleep(1);
Expand All @@ -611,14 +603,14 @@ struct App : implements<App, IFrameworkViewSource, IFrameworkView>
auto asyncOperation = winrt::Windows::System::Launcher::LaunchUriAsync(m_uri);
asyncOperation.Completed([](winrt::Windows::Foundation::IAsyncOperation<bool> const& sender,
winrt::Windows::Foundation::AsyncStatus const asyncStatus) {
CommonHost::CPUThreadShutdown();
VMManager::Internal::CPUThreadShutdown();
CoreApplication::Exit();
return;
});
}
else
{
CommonHost::CPUThreadShutdown();
VMManager::Internal::CPUThreadShutdown();
CoreApplication::Exit();
}
}
Expand Down
4 changes: 2 additions & 2 deletions pcsx2-winrt/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp rescap iot">
<Identity
Name="595c25f0-b370-4d7a-9b14-3027fbd69ecf"
Name="XBSX2"
Publisher="CN=SirMangler"
Version="2.0.1" />
Version="2.0.2.0" />
<mp:PhoneIdentity PhoneProductId="595c25f0-b370-4d7a-9b14-3027fbd69ecf" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>pcsx2-winrt</DisplayName>
Expand Down
34 changes: 16 additions & 18 deletions pcsx2-winrt/pcsx2-winrt.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220418.1\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="$(SolutionDir)common\vsprops\BaseProjectConfig.props" />
<Import Project="$(SolutionDir)common\vsprops\ProjectConfigAVX2.props" />
Expand Down Expand Up @@ -49,7 +48,7 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)common\vsprops\common.props" />
<Import Project="$(SolutionDir)common\vsprops\BaseProperties.props" />
<Import Project="$(SolutionDir)common\vsprops\3rdpartyDeps.props" />
<Import Project="$(SolutionDir)common\vsprops\CommonLibrary.props" />
<Import Condition="$(Configuration.Contains(Debug))" Project="$(SolutionDir)common\vsprops\CodeGen_Debug.props" />
<Import Condition="$(Configuration.Contains(Devel))" Project="$(SolutionDir)common\vsprops\CodeGen_Devel.props" />
<Import Condition="$(Configuration.Contains(Release))" Project="$(SolutionDir)common\vsprops\CodeGen_Release.props" />
Expand All @@ -59,37 +58,39 @@
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppxBundle>Never</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<PackageCertificateKeyFile>pcsx2-winrt_TemporaryKey.pfx</PackageCertificateKeyFile>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxPackageDir>D:\TheRhysWyrill\Downloads\Emu Stuff\AppPackages\</AppxPackageDir>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\xbyak;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\fmt\fmt\include;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\freetype\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\glad\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\simpleini\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\rapidyaml\rapidyaml\ext\c4core\src\c4\ext\fast_float\include;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\simpleini\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\xbyak;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\xz\xz\src\liblzma\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)pcsx2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<!-- Needed for moc pch -->
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(ProjectDir)\Settings;$(ProjectDir)\GameList</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pcsx2.pch</PrecompiledHeaderOutputFile>
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;DIRECTINPUT_VERSION=0x0800;PCSX2_CORE;WINRT_XBOX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Debug))">PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Devel))">PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Release))">NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="!$(Configuration.Contains(AVX2))">_M_SSE=0x401;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(AVX2))">_M_SSE=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet Condition="!$(Configuration.Contains(AVX2)) Or $(Configuration.Contains(Clang))">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="$(Configuration.Contains(AVX2)) And !$(Configuration.Contains(Clang))">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<AdditionalOptions Condition="$(Configuration.Contains(Clang)) And !$(Configuration.Contains(AVX2))"> -march=nehalem %(AdditionalOptions)</AdditionalOptions>
Expand Down Expand Up @@ -141,7 +142,7 @@
<ProjectReference Include="$(SolutionDir)common\common.vcxproj">
<Project>{4639972e-424e-4e13-8b07-ca403c481346}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)pcsx2\pcsx2core.vcxproj">
<ProjectReference Include="$(SolutionDir)pcsx2\pcsx2.vcxproj">
<Project>{6c7986c4-3e4d-4dcc-b3c6-6bb12b238995}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)3rdparty\glad\glad.vcxproj">
Expand All @@ -162,12 +163,12 @@
</ItemGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;ENABLE_ACHIEVEMENTS;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)' == 'Release' or '$(Configuration)' == 'Release AVX2'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;ENABLE_ACHIEVEMENTS;UNICODE;_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
Expand Down Expand Up @@ -202,10 +203,7 @@
<None Include="resources\GameIndex.yaml">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="resources\cheats_ws.zip">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="resources\cheats_ni.zip">
<None Include="resources\patches.zip">
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions pcsx2-winrt/pcsx2-winrt.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@
<None Include="packages.config" />
<None Include="pcsx2-winrt_TemporaryKey.pfx" />
<None Include="PropertySheet.props" />
<None Include="resources\cheats_ni.zip">
<Filter>resources</Filter>
</None>
<None Include="resources\cheats_ws.zip">
<None Include="resources\patches.zip">
<Filter>resources</Filter>
</None>
<None Include="resources\GameIndex.yaml">
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/GS/GS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#include "GS/Renderers/DX12/GSDevice12.h"
#include "GS/Renderers/DX11/D3D.h"

#endif

#ifdef WINRT_XBOX
#pragma comment(lib, "mincore")
#endif
Expand Down
15 changes: 12 additions & 3 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,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))
Expand Down Expand Up @@ -1172,10 +1180,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();
}
Expand Down Expand Up @@ -3816,6 +3823,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
Expand All @@ -3829,9 +3837,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");
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/Input/DInputSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#if !WINRT_XBOX
#ifndef WINRT_XBOX

#include "PrecompiledHeader.h"

Expand Down
Loading

0 comments on commit ff01148

Please sign in to comment.