CMake: Remove unsupported options

This commit is contained in:
Stenzek 2023-09-16 14:39:13 +10:00
parent 5ec2fca758
commit 72746e0f30
18 changed files with 173 additions and 318 deletions

View File

@ -15,55 +15,32 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules/")
# Platform detection. # Platform detection.
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX TRUE) set(LINUX TRUE)
set(SUPPORTS_X11 TRUE)
set(SUPPORTS_WAYLAND TRUE)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(FREEBSD TRUE) set(FREEBSD TRUE)
set(SUPPORTS_X11 TRUE)
endif() endif()
# Global options. # Renderer options.
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF)
option(BUILD_QT_FRONTEND "Build the Qt frontend" ON)
option(BUILD_REGTEST "Build regression test runner" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
option(ENABLE_CUBEB "Build with Cubeb audio output" ON)
option(ENABLE_OPENGL "Build with OpenGL renderer" ON) option(ENABLE_OPENGL "Build with OpenGL renderer" ON)
option(ENABLE_VULKAN "Build with Vulkan renderer" ON) option(ENABLE_VULKAN "Build with Vulkan renderer" ON)
option(ENABLE_DISCORD_PRESENCE "Build with Discord Rich Presence support" ON)
#option(USE_SDL2 "Link with SDL2 for controller support" ON)
set(USE_SDL2 ON)
# Global options.
if(NOT ANDROID)
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF)
option(BUILD_QT_FRONTEND "Build the Qt frontend" ON)
option(BUILD_REGTEST "Build regression test runner" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
# OpenGL context creation methods. set(ENABLE_CUBEB ON)
if(SUPPORTS_X11) set(ENABLE_DISCORD_PRESENCE ON)
option(USE_X11 "Support X11 window system" ON) set(USE_SDL2 ON)
endif()
if(SUPPORTS_WAYLAND)
option(USE_WAYLAND "Support Wayland window system" ON)
endif()
if((LINUX OR FREEBSD) AND NOT ANDROID)
option(USE_DBUS "Enable DBus support for screensaver inhibiting" ON)
endif()
if(APPLE)
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
endif()
if(ANDROID) if(LINUX OR FREEBSD)
if(CMAKE_BUILD_TYPE STREQUAL "Release") option(USE_X11 "Support X11 window system" ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) option(USE_WAYLAND "Support Wayland window system" ON)
endif()
if(APPLE)
option(SKIP_POSTPROCESS_BUNDLE "Disable bundle post-processing, including Qt additions" OFF)
endif() endif()
set(BUILD_NOGUI_FRONTEND OFF CACHE BOOL "")
set(BUILD_QT_FRONTEND OFF CACHE BOOL "")
set(BUILD_REGTEST OFF CACHE BOOL "")
set(ENABLE_CUBEB OFF CACHE BOOL "")
set(ENABLE_OPENGL ON CACHE BOOL "")
set(ENABLE_VULKAN ON CACHE BOOL "")
set(ENABLE_DISCORD_PRESENCE OFF CACHE BOOL "")
set(ENABLE_CHEEVOS ON CACHE BOOL "")
set(USE_SDL2 OFF CACHE BOOL "")
set(USE_X11 OFF CACHE BOOL "")
set(USE_WAYLAND OFF CACHE BOOL "")
endif() endif()
@ -73,9 +50,11 @@ if(USE_SDL2)
endif() endif()
if(NOT WIN32 AND NOT ANDROID) if(NOT WIN32 AND NOT ANDROID)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(Libbacktrace) if(NOT APPLE)
if(NOT LIBBACKTRACE_FOUND) find_package(Libbacktrace)
message(WARNING "libbacktrace not found, crashes will not produce backtraces.") if(NOT LIBBACKTRACE_FOUND)
message(WARNING "libbacktrace not found, crashes will not produce backtraces.")
endif()
endif() endif()
endif() endif()
if(BUILD_QT_FRONTEND) if(BUILD_QT_FRONTEND)
@ -99,9 +78,6 @@ endif()
if(USE_WAYLAND) if(USE_WAYLAND)
message(STATUS "Wayland support enabled") message(STATUS "Wayland support enabled")
endif() endif()
if(ENABLE_CHEEVOS)
message(STATUS "RetroAchievements support enabled")
endif()
# Set _DEBUG macro for Debug builds. # Set _DEBUG macro for Debug builds.

View File

@ -1,46 +0,0 @@
# This module can be used in two different ways.
#
# When invoked as `cmake -P DolphinPostprocessBundle.cmake`, it fixes up an
# application folder to be standalone. It bundles all required libraries from
# the system and fixes up library IDs. Any additional shared libraries, like
# plugins, that are found under Contents/MacOS/ will be made standalone as well.
#
# When called with `include(DolphinPostprocessBundle)`, it defines a helper
# function `dolphin_postprocess_bundle` that sets up the command form of the
# module as a post-build step.
if(CMAKE_GENERATOR)
# Being called as include(DolphinPostprocessBundle), so define a helper function.
set(_DOLPHIN_POSTPROCESS_BUNDLE_MODULE_LOCATION "${CMAKE_CURRENT_LIST_FILE}")
function(dolphin_postprocess_bundle target)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -DDOLPHIN_BUNDLE_PATH="$<TARGET_FILE_DIR:${target}>/../.."
-P "${_DOLPHIN_POSTPROCESS_BUNDLE_MODULE_LOCATION}"
)
endfunction()
return()
endif()
get_filename_component(DOLPHIN_BUNDLE_PATH "${DOLPHIN_BUNDLE_PATH}" ABSOLUTE)
message(STATUS "Fixing up application bundle: ${DOLPHIN_BUNDLE_PATH}")
# Make sure to fix up any additional shared libraries (like plugins) that are
# needed.
file(GLOB_RECURSE extra_libs "${DOLPHIN_BUNDLE_PATH}/Contents/MacOS/*.dylib")
# BundleUtilities doesn't support DYLD_FALLBACK_LIBRARY_PATH behavior, which
# makes it sometimes break on libraries that do weird things with @rpath. Specify
# equivalent search directories until https://gitlab.kitware.com/cmake/cmake/issues/16625
# is fixed and in our minimum CMake version.
set(extra_dirs "/usr/local/lib" "/lib" "/usr/lib")
# BundleUtilities is overly verbose, so disable most of its messages
function(message)
if(NOT ARGV MATCHES "^STATUS;")
_message(${ARGV})
endif()
endfunction()
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle("${DOLPHIN_BUNDLE_PATH}" "${extra_libs}" "${extra_dirs}")

View File

@ -1,123 +1,123 @@
add_library(core add_library(core
achievements.cpp achievements.cpp
achievements.h achievements.h
analog_controller.cpp analog_controller.cpp
analog_controller.h analog_controller.h
analog_joystick.cpp analog_joystick.cpp
analog_joystick.h analog_joystick.h
bios.cpp bios.cpp
bios.h bios.h
bus.cpp bus.cpp
bus.h bus.h
cdrom.cpp cdrom.cpp
cdrom.h cdrom.h
cdrom_async_reader.cpp cdrom_async_reader.cpp
cdrom_async_reader.h cdrom_async_reader.h
cheats.cpp cheats.cpp
cheats.h cheats.h
controller.cpp controller.cpp
controller.h controller.h
cpu_code_cache.cpp cpu_code_cache.cpp
cpu_code_cache.h cpu_code_cache.h
cpu_core.cpp cpu_core.cpp
cpu_core.h cpu_core.h
cpu_core_private.h cpu_core_private.h
cpu_disasm.cpp cpu_disasm.cpp
cpu_disasm.h cpu_disasm.h
cpu_types.cpp cpu_types.cpp
cpu_types.h cpu_types.h
digital_controller.cpp digital_controller.cpp
digital_controller.h digital_controller.h
dma.cpp dma.cpp
dma.h dma.h
fullscreen_ui.cpp fullscreen_ui.cpp
fullscreen_ui.h fullscreen_ui.h
game_database.cpp game_database.cpp
game_database.h game_database.h
game_list.cpp game_list.cpp
game_list.h game_list.h
gdb_protocol.cpp gdb_protocol.cpp
gdb_protocol.h gdb_protocol.h
gpu.cpp gpu.cpp
gpu.h gpu.h
gpu_backend.cpp gpu_backend.cpp
gpu_backend.h gpu_backend.h
gpu_commands.cpp gpu_commands.cpp
gpu_hw.cpp gpu_hw.cpp
gpu_hw.h gpu_hw.h
gpu_hw_shadergen.cpp gpu_hw_shadergen.cpp
gpu_hw_shadergen.h gpu_hw_shadergen.h
gpu_shadergen.cpp gpu_shadergen.cpp
gpu_shadergen.h gpu_shadergen.h
gpu_sw.cpp gpu_sw.cpp
gpu_sw.h gpu_sw.h
gpu_sw_backend.cpp gpu_sw_backend.cpp
gpu_sw_backend.h gpu_sw_backend.h
gpu_types.h gpu_types.h
guncon.cpp guncon.cpp
guncon.h guncon.h
gte.cpp gte.cpp
gte.h gte.h
gte_types.h gte_types.h
host.cpp host.cpp
host.h host.h
host_interface_progress_callback.cpp host_interface_progress_callback.cpp
host_interface_progress_callback.h host_interface_progress_callback.h
hotkeys.cpp hotkeys.cpp
input_types.h input_types.h
imgui_overlays.cpp imgui_overlays.cpp
imgui_overlays.h imgui_overlays.h
interrupt_controller.cpp interrupt_controller.cpp
interrupt_controller.h interrupt_controller.h
mdec.cpp mdec.cpp
mdec.h mdec.h
memory_card.cpp memory_card.cpp
memory_card.h memory_card.h
memory_card_image.cpp memory_card_image.cpp
memory_card_image.h memory_card_image.h
multitap.cpp multitap.cpp
multitap.h multitap.h
negcon.cpp negcon.cpp
negcon.h negcon.h
pad.cpp pad.cpp
pad.h pad.h
pcdrv.cpp pcdrv.cpp
pcdrv.h pcdrv.h
pgxp.cpp pgxp.cpp
pgxp.h pgxp.h
playstation_mouse.cpp playstation_mouse.cpp
playstation_mouse.h playstation_mouse.h
psf_loader.cpp psf_loader.cpp
psf_loader.h psf_loader.h
resources.cpp resources.cpp
resources.h resources.h
save_state_version.h save_state_version.h
settings.cpp settings.cpp
settings.h settings.h
shader_cache_version.h shader_cache_version.h
sio.cpp sio.cpp
sio.h sio.h
spu.cpp spu.cpp
spu.h spu.h
system.cpp system.cpp
system.h system.h
texture_replacements.cpp texture_replacements.cpp
texture_replacements.h texture_replacements.h
timers.cpp timers.cpp
timers.h timers.h
timing_event.cpp timing_event.cpp
timing_event.h timing_event.h
types.h types.h
) )
set(RECOMPILER_SRCS set(RECOMPILER_SRCS
cpu_recompiler_code_generator.cpp cpu_recompiler_code_generator.cpp
cpu_recompiler_code_generator.h cpu_recompiler_code_generator.h
cpu_recompiler_code_generator_generic.cpp cpu_recompiler_code_generator_generic.cpp
cpu_recompiler_register_cache.cpp cpu_recompiler_register_cache.cpp
cpu_recompiler_register_cache.h cpu_recompiler_register_cache.h
cpu_recompiler_thunks.h cpu_recompiler_thunks.h
cpu_recompiler_types.h cpu_recompiler_types.h
) )
target_precompile_headers(core PRIVATE "pch.h") target_precompile_headers(core PRIVATE "pch.h")

View File

@ -3219,7 +3219,7 @@ void FullscreenUI::DrawControllerSettingsPage()
MenuHeading("Input Sources"); MenuHeading("Input Sources");
#ifdef WITH_SDL2 #ifdef USE_SDL2
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable SDL Input Source"), DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable SDL Input Source"),
FSUI_CSTR("The SDL input source supports most controllers."), "InputSources", "SDL", true, true, FSUI_CSTR("The SDL input source supports most controllers."), "InputSources", "SDL", true, true,
false); false);

View File

@ -319,7 +319,7 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
{ {
switch (backend) switch (backend)
{ {
#ifdef WITH_CUBEB #ifdef USE_CUBEB
case AudioBackend::Cubeb: case AudioBackend::Cubeb:
return AudioStream::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch); return AudioStream::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif #endif

View File

@ -1247,7 +1247,7 @@ const char* Settings::GetDisplayScalingDisplayName(DisplayScalingMode mode)
static constexpr const char* s_audio_backend_names[] = { static constexpr const char* s_audio_backend_names[] = {
"Null", "Null",
#ifdef WITH_CUBEB #ifdef USE_CUBEB
"Cubeb", "Cubeb",
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@ -1259,7 +1259,7 @@ static constexpr const char* s_audio_backend_names[] = {
}; };
static constexpr const char* s_audio_backend_display_names[] = { static constexpr const char* s_audio_backend_display_names[] = {
TRANSLATE_NOOP("AudioBackend", "Null (No Output)"), TRANSLATE_NOOP("AudioBackend", "Null (No Output)"),
#ifdef WITH_CUBEB #ifdef USE_CUBEB
TRANSLATE_NOOP("AudioBackend", "Cubeb"), TRANSLATE_NOOP("AudioBackend", "Cubeb"),
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -446,7 +446,7 @@ struct Settings
static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled; static constexpr CPUFastmemMode DEFAULT_CPU_FASTMEM_MODE = CPUFastmemMode::Disabled;
#endif #endif
#if defined(WITH_CUBEB) #if defined(USE_CUBEB)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb; static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Cubeb;
#elif defined(_WIN32) #elif defined(_WIN32)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2; static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;

View File

@ -144,7 +144,7 @@ enum class DisplayScalingMode : u8
enum class AudioBackend : u8 enum class AudioBackend : u8
{ {
Null, Null,
#ifdef WITH_CUBEB #ifdef USE_CUBEB
Cubeb, Cubeb,
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -9,6 +9,12 @@ set(SRCS
aboutdialog.cpp aboutdialog.cpp
aboutdialog.h aboutdialog.h
aboutdialog.ui aboutdialog.ui
achievementlogindialog.cpp
achievementlogindialog.h
achievementlogindialog.ui
achievementsettingswidget.cpp
achievementsettingswidget.h
achievementsettingswidget.ui
advancedsettingswidget.cpp advancedsettingswidget.cpp
advancedsettingswidget.h advancedsettingswidget.h
advancedsettingswidget.ui advancedsettingswidget.ui
@ -136,17 +142,6 @@ set(SRCS
setupwizarddialog.ui setupwizarddialog.ui
) )
if(ENABLE_CHEEVOS)
set(SRCS ${SRCS}
achievementlogindialog.cpp
achievementlogindialog.h
achievementlogindialog.ui
achievementsettingswidget.cpp
achievementsettingswidget.h
achievementsettingswidget.ui
)
endif()
set(TS_FILES set(TS_FILES
translations/duckstation-qt_de.ts translations/duckstation-qt_de.ts
translations/duckstation-qt_en.ts translations/duckstation-qt_en.ts

View File

@ -103,7 +103,7 @@ void AudioSettingsWidget::updateDriverNames()
std::vector<std::string> names; std::vector<std::string> names;
std::vector<std::pair<std::string, std::string>> devices; std::vector<std::pair<std::string, std::string>> devices;
#ifdef WITH_CUBEB #ifdef USE_CUBEB
if (backend == AudioBackend::Cubeb) if (backend == AudioBackend::Cubeb)
{ {
names = AudioStream::GetCubebDriverNames(); names = AudioStream::GetCubebDriverNames();

View File

@ -16,17 +16,12 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
SettingsInterface* sif = dialog->getProfileSettingsInterface(); SettingsInterface* sif = dialog->getProfileSettingsInterface();
#ifdef WITH_SDL2
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources",
"SDLControllerEnhancedMode", false); "SDLControllerEnhancedMode", false);
connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this,
&ControllerGlobalSettingsWidget::updateSDLOptionsEnabled); &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked); connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);
#else
m_ui.enableSDLSource->setEnabled(false);
m_ui.ledSettings->setEnabled(false);
#endif
#ifdef _WIN32 #ifdef _WIN32
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDInputSource, "InputSources", "DInput", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDInputSource, "InputSources", "DInput", false);
@ -129,7 +124,6 @@ ControllerLEDSettingsDialog::~ControllerLEDSettingsDialog() = default;
void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 player_id) void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 player_id)
{ {
#ifdef WITH_SDL2
std::string key(fmt::format("Player{}LED", player_id)); std::string key(fmt::format("Player{}LED", player_id));
const u32 current_value = const u32 current_value =
SDLInputSource::ParseRGBForPlayerId(m_dialog->getStringValue("SDLExtra", key.c_str(), ""), player_id); SDLInputSource::ParseRGBForPlayerId(m_dialog->getStringValue("SDLExtra", key.c_str(), ""), player_id);
@ -138,5 +132,4 @@ void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 play
connect(button, &ColorPickerButton::colorChanged, this, [this, key = std::move(key)](u32 new_rgb) { connect(button, &ColorPickerButton::colorChanged, this, [this, key = std::move(key)](u32 new_rgb) {
m_dialog->setStringValue("SDLExtra", key.c_str(), fmt::format("{:06X}", new_rgb).c_str()); m_dialog->setStringValue("SDLExtra", key.c_str(), fmt::format("{:06X}", new_rgb).c_str());
}); });
#endif
} }

View File

@ -74,25 +74,22 @@ target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(util PUBLIC common simpleini imgui) target_link_libraries(util PUBLIC common simpleini imgui)
target_link_libraries(util PRIVATE stb libchdr zlib soundtouch Zstd::Zstd reshadefx) target_link_libraries(util PRIVATE stb libchdr zlib soundtouch Zstd::Zstd reshadefx)
if(ENABLE_CUBEB) if(USE_CUBEB)
target_sources(util PRIVATE target_sources(util PRIVATE
cubeb_audio_stream.cpp cubeb_audio_stream.cpp
cubeb_audio_stream.h cubeb_audio_stream.h
) )
target_compile_definitions(util PUBLIC "WITH_CUBEB=1") target_compile_definitions(util PUBLIC "USE_CUBEB=1")
target_link_libraries(util PRIVATE cubeb) target_link_libraries(util PRIVATE cubeb)
endif() endif()
if(USE_X11) if(USE_X11)
target_compile_definitions(util PRIVATE "-DUSE_X11=1") target_compile_definitions(util PRIVATE "-DUSE_X11=1")
target_include_directories(util PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xrandr_INCLUDE_PATH}") target_link_libraries(util PRIVATE X11::X11 X11::Xrandr)
target_link_libraries(util PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}")
endif() endif()
if(USE_WAYLAND) if(USE_WAYLAND)
target_compile_definitions(util PRIVATE "-DUSE_WAYLAND=1") target_compile_definitions(util PRIVATE "-DUSE_WAYLAND=1")
elseif(SUPPORTS_WAYLAND)
message(WARNING "Wayland support for renderers is disabled.\nDuckStation will FAIL to start on Wayland.")
endif() endif()
if(ENABLE_OPENGL) if(ENABLE_OPENGL)
@ -199,7 +196,7 @@ if(USE_SDL2)
sdl_input_source.cpp sdl_input_source.cpp
sdl_input_source.h sdl_input_source.h
) )
target_compile_definitions(util PUBLIC "WITH_SDL2=1") target_compile_definitions(util PUBLIC "USE_SDL2=1")
target_link_libraries(util PUBLIC SDL2::SDL2) target_link_libraries(util PUBLIC SDL2::SDL2)
# Copy bundled SDL2 to output on Windows. # Copy bundled SDL2 to output on Windows.
@ -215,14 +212,6 @@ if(USE_SDL2)
endif() endif()
endif() endif()
if(USE_DBUS)
target_compile_definitions(util PRIVATE USE_DBUS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
endif()
if(WIN32) if(WIN32)
target_sources(util PRIVATE target_sources(util PRIVATE
d3d_common.cpp d3d_common.cpp
@ -288,6 +277,10 @@ elseif(NOT ANDROID)
target_sources(util PRIVATE target_sources(util PRIVATE
platform_misc_unix.cpp platform_misc_unix.cpp
) )
find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
endif() endif()
function(add_util_resources target) function(add_util_resources target)

View File

@ -79,7 +79,7 @@ public:
static std::unique_ptr<AudioStream> CreateNullStream(u32 sample_rate, u32 channels, u32 buffer_ms); static std::unique_ptr<AudioStream> CreateNullStream(u32 sample_rate, u32 channels, u32 buffer_ms);
#ifdef WITH_CUBEB #ifdef USE_CUBEB
static std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, static std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms,
u32 latency_ms, AudioStretchMode stretch); u32 latency_ms, AudioStretchMode stretch);
static std::vector<std::string> GetCubebDriverNames(); static std::vector<std::string> GetCubebDriverNames();

View File

@ -481,7 +481,7 @@ static std::array<const char*, static_cast<u32>(InputSourceType::Count)> s_input
"XInput", "XInput",
"RawInput", "RawInput",
#endif #endif
#ifdef WITH_SDL2 #ifdef USE_SDL2
"SDL", "SDL",
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__
@ -512,17 +512,12 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type)
return false; return false;
case InputSourceType::XInput: case InputSourceType::XInput:
// Disable xinput by default if we have SDL.
#ifdef WITH_SDL2
return false; return false;
#else
return true;
#endif
case InputSourceType::RawInput: case InputSourceType::RawInput:
return false; return false;
#endif #endif
#ifdef WITH_SDL2 #ifdef USE_SDL2
case InputSourceType::SDL: case InputSourceType::SDL:
return true; return true;
#endif #endif
@ -1931,7 +1926,7 @@ void InputManager::ReloadSources(SettingsInterface& si, std::unique_lock<std::mu
UpdateInputSourceState(si, settings_lock, InputSourceType::XInput, &InputSource::CreateXInputSource); UpdateInputSourceState(si, settings_lock, InputSourceType::XInput, &InputSource::CreateXInputSource);
UpdateInputSourceState(si, settings_lock, InputSourceType::RawInput, &InputSource::CreateWin32RawInputSource); UpdateInputSourceState(si, settings_lock, InputSourceType::RawInput, &InputSource::CreateWin32RawInputSource);
#endif #endif
#ifdef WITH_SDL2 #ifdef USE_SDL2
UpdateInputSourceState(si, settings_lock, InputSourceType::SDL, &InputSource::CreateSDLSource); UpdateInputSourceState(si, settings_lock, InputSourceType::SDL, &InputSource::CreateSDLSource);
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__

View File

@ -27,7 +27,7 @@ enum class InputSourceType : u32
XInput, XInput,
RawInput, RawInput,
#endif #endif
#ifdef WITH_SDL2 #ifdef USE_SDL2
SDL, SDL,
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__

View File

@ -74,7 +74,7 @@ public:
static std::unique_ptr<InputSource> CreateXInputSource(); static std::unique_ptr<InputSource> CreateXInputSource();
static std::unique_ptr<InputSource> CreateWin32RawInputSource(); static std::unique_ptr<InputSource> CreateWin32RawInputSource();
#endif #endif
#ifdef WITH_SDL2 #ifdef USE_SDL2
static std::unique_ptr<InputSource> CreateSDLSource(); static std::unique_ptr<InputSource> CreateSDLSource();
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__

View File

@ -1,47 +1,20 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com> // SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com> and contributors.
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "input_manager.h"
#include "platform_misc.h"
#include "common/log.h" #include "common/log.h"
#include "common/scoped_guard.h" #include "common/scoped_guard.h"
#include "common/string.h" #include "common/string.h"
#include "input_manager.h"
#include "platform_misc.h"
#include <cinttypes>
Log_SetChannel(PlatformMisc);
#include <cinttypes>
#include <spawn.h> #include <spawn.h>
#include <unistd.h> #include <unistd.h>
#if !defined(USE_DBUS) && defined(USE_X11)
#include <cstdio>
#include <sys/wait.h>
static bool SetScreensaverInhibitX11(bool inhibit, const WindowInfo& wi)
{
TinyString command;
command.AppendString("xdg-screensaver");
TinyString operation;
operation.AppendString(inhibit ? "suspend" : "resume");
TinyString id;
id.Format("0x%" PRIx64, static_cast<u64>(reinterpret_cast<uintptr_t>(wi.window_handle)));
char* argv[4] = {command.GetWriteableCharArray(), operation.GetWriteableCharArray(), id.GetWriteableCharArray(),
nullptr};
pid_t pid;
int res = posix_spawnp(&pid, "xdg-screensaver", nullptr, nullptr, argv, environ);
if (res != 0)
{
Log_ErrorPrintf("posix_spawnp() failed: %d", res);
return false;
}
return true;
}
#elif defined(USE_DBUS)
#include <dbus/dbus.h> #include <dbus/dbus.h>
Log_SetChannel(PlatformMisc);
static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char* program_name, const char* reason) static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char* program_name, const char* reason)
{ {
static dbus_uint32_t s_cookie; static dbus_uint32_t s_cookie;
@ -115,33 +88,9 @@ static bool SetScreensaverInhibitDBus(const bool inhibit_requested, const char*
return true; return true;
} }
#endif
static bool SetScreensaverInhibit(bool inhibit) static bool SetScreensaverInhibit(bool inhibit)
{ {
#ifdef USE_DBUS
return SetScreensaverInhibitDBus(inhibit, "DuckStation", "DuckStation VM is running."); return SetScreensaverInhibitDBus(inhibit, "DuckStation", "DuckStation VM is running.");
#else
std::optional<WindowInfo> wi(Host::GetTopLevelWindowInfo());
if (!wi.has_value())
{
Log_ErrorPrintf("No top-level window.");
return false;
}
switch (wi->type)
{
#ifdef USE_X11
case WindowInfo::Type::X11:
return SetScreensaverInhibitX11(inhibit, wi.value());
#endif
default:
Log_ErrorPrintf("Unknown type: %u", static_cast<unsigned>(wi->type));
return false;
}
#endif
} }
static bool s_screensaver_suspended; static bool s_screensaver_suspended;

View File

@ -5,7 +5,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);SOUNDTOUCH_FLOAT_SAMPLES;SOUNDTOUCH_ALLOW_SSE;ST_NO_EXCEPTION_HANDLING=1</PreprocessorDefinitions> <PreprocessorDefinitions>%(PreprocessorDefinitions);SOUNDTOUCH_FLOAT_SAMPLES;SOUNDTOUCH_ALLOW_SSE;ST_NO_EXCEPTION_HANDLING=1</PreprocessorDefinitions>
<PreprocessorDefinitions>WITH_CUBEB=1;WITH_SDL2=1;WITH_DINPUT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>USE_CUBEB=1;USE_SDL2=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">%(PreprocessorDefinitions);WITH_OPENGL=1;WITH_VULKAN=1</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">%(PreprocessorDefinitions);WITH_OPENGL=1;WITH_VULKAN=1</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">%(PreprocessorDefinitions);SOUNDTOUCH_USE_NEON</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">%(PreprocessorDefinitions);SOUNDTOUCH_USE_NEON</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\soundtouch\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\libchdr\include;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\d3d12ma\include;$(SolutionDir)dep\zstd\lib</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\soundtouch\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\libchdr\include;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\d3d12ma\include;$(SolutionDir)dep\zstd\lib</AdditionalIncludeDirectories>