Various build fixes

This commit is contained in:
Connor McLaughlin 2022-03-27 17:16:21 +10:00
parent 3d61e3e379
commit 859a156b3c
8 changed files with 29 additions and 69 deletions

View file

@ -24,7 +24,6 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14.0" CACHE STRING "")
if(NOT ANDROID) if(NOT ANDROID)
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" ON) option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" ON)
option(BUILD_QT_FRONTEND "Build the Qt 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(BUILD_REGTEST "Build regression test runner" OFF)
option(ENABLE_DISCORD_PRESENCE "Build with Discord Rich Presence support" ON) option(ENABLE_DISCORD_PRESENCE "Build with Discord Rich Presence support" ON)
option(ENABLE_CHEEVOS "Build with RetroAchievements support" ON) option(ENABLE_CHEEVOS "Build with RetroAchievements support" ON)
@ -42,7 +41,7 @@ endif()
if((LINUX OR FREEBSD) OR ANDROID) if((LINUX OR FREEBSD) OR ANDROID)
option(USE_EGL "Support EGL OpenGL context creation" ON) option(USE_EGL "Support EGL OpenGL context creation" ON)
endif() 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_DRMKMS "Support DRM/KMS OpenGL contexts" OFF)
option(USE_FBDEV "Support FBDev OpenGL contexts" OFF) option(USE_FBDEV "Support FBDev OpenGL contexts" OFF)
option(USE_EVDEV "Support EVDev controller interface" ON) option(USE_EVDEV "Support EVDev controller interface" ON)
@ -82,40 +81,6 @@ if(ANDROID)
endif() 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. # Common include/library directories on Windows.
if(WIN32 AND USE_SDL2) if(WIN32 AND USE_SDL2)
set(SDL2_FOUND TRUE) 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. # 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_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
@ -284,8 +249,7 @@ endif()
# Write binaries to a seperate directory. # Write binaries to a seperate directory.
if(WIN32 AND NOT BUILD_LIBRETRO_CORE) if(WIN32)
# For Windows, use the source directory, except for libretro.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CPU_ARCH}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CPU_ARCH}")
else() else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
@ -312,6 +276,6 @@ enable_testing()
add_subdirectory(dep) add_subdirectory(dep)
add_subdirectory(src) add_subdirectory(src)
if(ANDROID AND NOT BUILD_LIBRETRO_CORE) if(ANDROID)
add_subdirectory(android/app/src/cpp) add_subdirectory(android/app/src/cpp)
endif() endif()

View file

@ -1,5 +1,5 @@
# DuckStation - PlayStation 1, aka. PSX Emulator # 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 **Discord Server:** https://discord.gg/Buktv3t
@ -43,7 +43,7 @@ Other features include:
- Automatic updates for Windows builds - Automatic updates for Windows builds
- Automatic content scanning - game titles/hashes are provided by redump.org - Automatic content scanning - game titles/hashes are provided by redump.org
- Optional automatic switching of memory cards for each game - 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 - Memory card editor and save importer
- Emulated CPU overclocking - Emulated CPU overclocking
- Integrated and remote debugging - 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`. 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 ## Building
### Windows ### Windows

View file

@ -249,7 +249,7 @@ bool IsValidPSExeHeader(const PSEXEHeader& header, u32 file_size)
if ((header.file_size + sizeof(PSEXEHeader)) > 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", 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<unsigned>(file_size - sizeof(PSEXEHeader)));
} }
return true; return true;

View file

@ -2,6 +2,7 @@
#include "common/types.h" #include "common/types.h"
#include "imgui.h" #include "imgui.h"
#include <functional> #include <functional>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -159,7 +159,6 @@ bool RegTestHostDisplay::SupportsDisplayPixelFormat(HostDisplayPixelFormat forma
bool RegTestHostDisplay::BeginSetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, void** out_buffer, bool RegTestHostDisplay::BeginSetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, void** out_buffer,
u32* out_pitch) u32* out_pitch)
{ {
const u32 pixel_size = GetDisplayPixelFormatSize(format);
const u32 pitch = Common::AlignUpPow2(width * GetDisplayPixelFormatSize(format), 4); const u32 pitch = Common::AlignUpPow2(width * GetDisplayPixelFormatSize(format), 4);
const u32 required_size = height * pitch; const u32 required_size = height * pitch;
if (m_frame_buffer.size() != (required_size / 4)) if (m_frame_buffer.size() != (required_size / 4))

View file

@ -137,6 +137,8 @@ void RegTestHostInterface::OnSystemPerformanceCountersUpdated() {}
void RegTestHostInterface::OnDisplayInvalidated() {} void RegTestHostInterface::OnDisplayInvalidated() {}
void RegTestHostInterface::OnAchievementsRefreshed() {}
std::string RegTestHostInterface::GetStringSettingValue(const char* section, const char* key, std::string RegTestHostInterface::GetStringSettingValue(const char* section, const char* key,
const char* default_value /*= ""*/) const char* default_value /*= ""*/)
{ {
@ -163,6 +165,16 @@ std::vector<std::string> RegTestHostInterface::GetSettingStringList(const char*
return m_settings_interface.GetStringList(section, key); return m_settings_interface.GetStringList(section, key);
} }
SettingsInterface* RegTestHostInterface::GetSettingsInterface()
{
return &m_settings_interface;
}
std::lock_guard<std::recursive_mutex> RegTestHostInterface::GetSettingsLock()
{
return std::lock_guard<std::recursive_mutex>(m_settings_mutex);
}
void RegTestHostInterface::UpdateSettings() void RegTestHostInterface::UpdateSettings()
{ {
SettingsInterface& si = m_settings_interface; SettingsInterface& si = m_settings_interface;

View file

@ -31,6 +31,8 @@ public:
int GetIntSettingValue(const char* section, const char* key, int default_value = 0) override; 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; float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f) override;
std::vector<std::string> GetSettingStringList(const char* section, const char* key) override; std::vector<std::string> GetSettingStringList(const char* section, const char* key) override;
SettingsInterface* GetSettingsInterface() override;
std::lock_guard<std::recursive_mutex> GetSettingsLock() override;
std::string GetBIOSDirectory() override; std::string GetBIOSDirectory() override;
@ -38,6 +40,7 @@ public:
void OnSystemPerformanceCountersUpdated() override; void OnSystemPerformanceCountersUpdated() override;
void OnDisplayInvalidated() override; void OnDisplayInvalidated() override;
void OnAchievementsRefreshed() override;
protected: protected:
bool AcquireHostDisplay() override; bool AcquireHostDisplay() override;
@ -58,4 +61,5 @@ private:
void UpdateSettings(); void UpdateSettings();
RegTestSettingsInterface m_settings_interface; RegTestSettingsInterface m_settings_interface;
std::recursive_mutex m_settings_mutex;
}; };

View file

@ -7,13 +7,14 @@
#include "core/controller.h" #include "core/controller.h"
#include "core/gpu.h" #include "core/gpu.h"
#include "core/host_display.h" #include "core/host_display.h"
#include "core/imgui_fullscreen.h"
#include "core/imgui_styles.h"
#include "core/system.h" #include "core/system.h"
#include "frontend-common/controller_interface.h" #include "frontend-common/controller_interface.h"
#include "frontend-common/d3d11_host_display.h" #include "frontend-common/d3d11_host_display.h"
#include "frontend-common/d3d12_host_display.h" #include "frontend-common/d3d12_host_display.h"
#include "frontend-common/fullscreen_ui.h" #include "frontend-common/fullscreen_ui.h"
#include "frontend-common/icon.h" #include "frontend-common/icon.h"
#include "frontend-common/imgui_styles.h"
#include "frontend-common/ini_settings_interface.h" #include "frontend-common/ini_settings_interface.h"
#include "imgui.h" #include "imgui.h"
#include "imgui_internal.h" #include "imgui_internal.h"
@ -235,9 +236,7 @@ void UWPHostInterface::RequestExit()
[this]() { winrt::Windows::ApplicationModel::Core::CoreApplication::Exit(); }); [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() void UWPHostInterface::Run()
{ {
@ -387,13 +386,9 @@ void UWPHostInterface::RunLater(std::function<void()> callback)
m_queued_callbacks.push_back(std::move(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 bool UWPHostInterface::IsFullscreen() const
{ {