From 859a156b3c9f920a618cbbb3b5996fcc75267562 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 27 Mar 2022 17:16:21 +1000 Subject: [PATCH] Various build fixes --- CMakeLists.txt | 44 ++----------------- README.md | 19 +------- src/core/bios.cpp | 2 +- src/core/imgui_fullscreen.h | 1 + .../regtest_host_display.cpp | 1 - .../regtest_host_interface.cpp | 12 +++++ .../regtest_host_interface.h | 4 ++ src/duckstation-uwp/uwp_host_interface.cpp | 15 +++---- 8 files changed, 29 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a3a5bfc9..a02270e70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14.0" CACHE STRING "") if(NOT ANDROID) option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" ON) option(BUILD_QT_FRONTEND "Build the Qt frontend" ON) - option(BUILD_LIBRETRO_CORE "Build a libretro core" OFF) option(BUILD_REGTEST "Build regression test runner" OFF) option(ENABLE_DISCORD_PRESENCE "Build with Discord Rich Presence support" ON) option(ENABLE_CHEEVOS "Build with RetroAchievements support" ON) @@ -42,7 +41,7 @@ endif() if((LINUX OR FREEBSD) OR ANDROID) option(USE_EGL "Support EGL OpenGL context creation" ON) endif() -if((LINUX OR FREEBSD) AND NOT ANDROID AND NOT BUILD_LIBRETRO_CORE) +if((LINUX OR FREEBSD) AND NOT ANDROID) option(USE_DRMKMS "Support DRM/KMS OpenGL contexts" OFF) option(USE_FBDEV "Support FBDev OpenGL contexts" OFF) option(USE_EVDEV "Support EVDev controller interface" ON) @@ -82,40 +81,6 @@ if(ANDROID) endif() -# Disable platform integration when building for libretro. -if(BUILD_LIBRETRO_CORE) - message("Building libretro core, disabling platform integration.") - - if(USE_EGL) - set(USE_EGL OFF) - endif() - if(BUILD_NOGUI_FRONTEND) - set(BUILD_NOGUI_FRONTEND OFF) - endif() - if(BUILD_QT_FRONTEND) - set(BUILD_QT_FRONTEND OFF) - endif() - if(ENABLE_DISCORD_PRESENCE) - set(ENABLE_DISCORD_PRESENCE OFF) - endif() - if(ENABLE_CHEEVOS) - set(ENABLE_CHEEVOS OFF) - endif() - if(USE_SDL2) - set(USE_SDL2 OFF) - endif() - if(USE_X11) - set(USE_X11 OFF) - endif() - if(USE_WAYLAND) - set(USE_WAYLAND OFF) - endif() - - # Force PIC when compiling a libretro core. - set(CMAKE_POSITION_INDEPENDENT_CODE ON) -endif() - - # Common include/library directories on Windows. if(WIN32 AND USE_SDL2) set(SDL2_FOUND TRUE) @@ -225,7 +190,7 @@ endif() # Default symbol visibility to hidden, that way we don't go through the PLT for intra-library calls. -if(ANDROID OR BUILD_LIBRETRO_CORE) +if(ANDROID) set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) @@ -284,8 +249,7 @@ endif() # Write binaries to a seperate directory. -if(WIN32 AND NOT BUILD_LIBRETRO_CORE) - # For Windows, use the source directory, except for libretro. +if(WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CPU_ARCH}") else() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") @@ -312,6 +276,6 @@ enable_testing() add_subdirectory(dep) add_subdirectory(src) -if(ANDROID AND NOT BUILD_LIBRETRO_CORE) +if(ANDROID) add_subdirectory(android/app/src/cpp) endif() diff --git a/README.md b/README.md index 3a35c72d6..e162d95cb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # DuckStation - PlayStation 1, aka. PSX Emulator -[Latest News](#latest-news) | [Features](#features) | [Screenshots](#screenshots) | [Downloading and Running](#downloading-and-running) | [Libretro Core](#libretro-core) | [Building](#building) | [Disclaimers](#disclaimers) +[Latest News](#latest-news) | [Features](#features) | [Screenshots](#screenshots) | [Downloading and Running](#downloading-and-running) | [Building](#building) | [Disclaimers](#disclaimers) **Discord Server:** https://discord.gg/Buktv3t @@ -43,7 +43,7 @@ Other features include: - Automatic updates for Windows builds - Automatic content scanning - game titles/hashes are provided by redump.org - Optional automatic switching of memory cards for each game - - Supports loading cheats from libretro or PCSXR format lists + - Supports loading cheats from existing lists - Memory card editor and save importer - Emulated CPU overclocking - Integrated and remote debugging @@ -149,21 +149,6 @@ For these games, make sure that the CD image and its corresponding SBI (.sbi) fi For example, if your disc image was named `Spyro3.cue`, you would place the SBI file in the same directory, and name it `Spyro3.sbi`. -### Libretro Core - -DuckStation is available as a libretro core. It supports most features of the full frontend, within the constraints and limitations of being a libretro core. - -The libretro core is provided under the terms of the Creative Commons Attribution-NonCommercial-NoDerivatives International License (BY-NC-ND 4.0, https://creativecommons.org/licenses/by-nc-nd/4.0/). COMMERCIAL DISTRIBUTION AND USAGE IS PROHIBITED. By downloading the libretro core, you agree that you will not distribute or utilize it with any paid applications, services, or products. This includes server side use in streaming environments. Put simply, it is free for personal use, but you are not allowed to utilize DuckStation to make money. - -The core is maintained by a third party, and is not provided as part of the GitHub release. You can download the core through the links below. The changelog is viewable at https://www.duckstation.org/libretro/changelog.txt - -- Windows x64 (64-bit): https://www.duckstation.org/libretro/duckstation_libretro_windows_x64.zip -- Android AArch64 (64-bit): https://www.duckstation.org/libretro/duckstation_libretro_android_aarch64.zip -- Android armv7 (32-bit): https://www.duckstation.org/libretro/duckstation_libretro_android_armv7.zip -- Linux x64 (64-bit): https://www.duckstation.org/libretro/duckstation_libretro_linux_x64.zip -- Linux AArch64 (64-bit): https://www.duckstation.org/libretro/duckstation_libretro_linux_aarch64.zip -- Linux armv7 (32-bit): https://www.duckstation.org/libretro/duckstation_libretro_linux_armv7.zip - ## Building ### Windows diff --git a/src/core/bios.cpp b/src/core/bios.cpp index 4113e22c7..eab3c1593 100644 --- a/src/core/bios.cpp +++ b/src/core/bios.cpp @@ -249,7 +249,7 @@ bool IsValidPSExeHeader(const PSEXEHeader& header, u32 file_size) if ((header.file_size + sizeof(PSEXEHeader)) > file_size) { Log_WarningPrintf("Incorrect file size in PS-EXE header: %u bytes should not be greater than %u bytes", - header.file_size, file_size - sizeof(PSEXEHeader)); + header.file_size, static_cast(file_size - sizeof(PSEXEHeader))); } return true; diff --git a/src/core/imgui_fullscreen.h b/src/core/imgui_fullscreen.h index d7b3b7e74..35cddf76c 100644 --- a/src/core/imgui_fullscreen.h +++ b/src/core/imgui_fullscreen.h @@ -2,6 +2,7 @@ #include "common/types.h" #include "imgui.h" #include +#include #include #include diff --git a/src/duckstation-regtest/regtest_host_display.cpp b/src/duckstation-regtest/regtest_host_display.cpp index dc896d713..08f48adcb 100644 --- a/src/duckstation-regtest/regtest_host_display.cpp +++ b/src/duckstation-regtest/regtest_host_display.cpp @@ -159,7 +159,6 @@ bool RegTestHostDisplay::SupportsDisplayPixelFormat(HostDisplayPixelFormat forma bool RegTestHostDisplay::BeginSetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, void** out_buffer, u32* out_pitch) { - const u32 pixel_size = GetDisplayPixelFormatSize(format); const u32 pitch = Common::AlignUpPow2(width * GetDisplayPixelFormatSize(format), 4); const u32 required_size = height * pitch; if (m_frame_buffer.size() != (required_size / 4)) diff --git a/src/duckstation-regtest/regtest_host_interface.cpp b/src/duckstation-regtest/regtest_host_interface.cpp index f4b58ff14..e8b87a90f 100644 --- a/src/duckstation-regtest/regtest_host_interface.cpp +++ b/src/duckstation-regtest/regtest_host_interface.cpp @@ -137,6 +137,8 @@ void RegTestHostInterface::OnSystemPerformanceCountersUpdated() {} void RegTestHostInterface::OnDisplayInvalidated() {} +void RegTestHostInterface::OnAchievementsRefreshed() {} + std::string RegTestHostInterface::GetStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/) { @@ -163,6 +165,16 @@ std::vector RegTestHostInterface::GetSettingStringList(const char* return m_settings_interface.GetStringList(section, key); } +SettingsInterface* RegTestHostInterface::GetSettingsInterface() +{ + return &m_settings_interface; +} + +std::lock_guard RegTestHostInterface::GetSettingsLock() +{ + return std::lock_guard(m_settings_mutex); +} + void RegTestHostInterface::UpdateSettings() { SettingsInterface& si = m_settings_interface; diff --git a/src/duckstation-regtest/regtest_host_interface.h b/src/duckstation-regtest/regtest_host_interface.h index e0a52beb3..6631cdc3f 100644 --- a/src/duckstation-regtest/regtest_host_interface.h +++ b/src/duckstation-regtest/regtest_host_interface.h @@ -31,6 +31,8 @@ public: int GetIntSettingValue(const char* section, const char* key, int default_value = 0) override; float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f) override; std::vector GetSettingStringList(const char* section, const char* key) override; + SettingsInterface* GetSettingsInterface() override; + std::lock_guard GetSettingsLock() override; std::string GetBIOSDirectory() override; @@ -38,6 +40,7 @@ public: void OnSystemPerformanceCountersUpdated() override; void OnDisplayInvalidated() override; + void OnAchievementsRefreshed() override; protected: bool AcquireHostDisplay() override; @@ -58,4 +61,5 @@ private: void UpdateSettings(); RegTestSettingsInterface m_settings_interface; + std::recursive_mutex m_settings_mutex; }; diff --git a/src/duckstation-uwp/uwp_host_interface.cpp b/src/duckstation-uwp/uwp_host_interface.cpp index 8bf4f38ce..cc573a6e2 100644 --- a/src/duckstation-uwp/uwp_host_interface.cpp +++ b/src/duckstation-uwp/uwp_host_interface.cpp @@ -7,13 +7,14 @@ #include "core/controller.h" #include "core/gpu.h" #include "core/host_display.h" +#include "core/imgui_fullscreen.h" +#include "core/imgui_styles.h" #include "core/system.h" #include "frontend-common/controller_interface.h" #include "frontend-common/d3d11_host_display.h" #include "frontend-common/d3d12_host_display.h" #include "frontend-common/fullscreen_ui.h" #include "frontend-common/icon.h" -#include "frontend-common/imgui_styles.h" #include "frontend-common/ini_settings_interface.h" #include "imgui.h" #include "imgui_internal.h" @@ -235,9 +236,7 @@ void UWPHostInterface::RequestExit() [this]() { winrt::Windows::ApplicationModel::Core::CoreApplication::Exit(); }); } -void UWPHostInterface::SetMouseMode(bool relative, bool hide_cursor) -{ -} +void UWPHostInterface::SetMouseMode(bool relative, bool hide_cursor) {} void UWPHostInterface::Run() { @@ -387,13 +386,9 @@ void UWPHostInterface::RunLater(std::function callback) m_queued_callbacks.push_back(std::move(callback)); } -void UWPHostInterface::OnDisplayInvalidated() -{ -} +void UWPHostInterface::OnDisplayInvalidated() {} -void UWPHostInterface::OnSystemPerformanceCountersUpdated() -{ -} +void UWPHostInterface::OnSystemPerformanceCountersUpdated() {} bool UWPHostInterface::IsFullscreen() const {