From a9b6f8976e84b5e4874b3343156ce85b867b5ce9 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 26 Aug 2023 14:37:56 +1000 Subject: [PATCH] Build: Clean up optional components --- CMakeLists.txt | 11 +-- cmake/BuildParameters.cmake | 7 -- cmake/Pcsx2Utils.cmake | 43 ---------- cmake/SearchForStuff.cmake | 79 ++++++++----------- common/CMakeLists.txt | 2 +- .../ControllerGlobalSettingsWidget.cpp | 12 +-- pcsx2-qt/pcsx2-qt.vcxproj | 2 +- pcsx2/CMakeLists.txt | 35 +++----- pcsx2/ImGui/FullscreenUI.cpp | 16 +--- pcsx2/Input/InputManager.cpp | 25 ++---- pcsx2/Input/InputManager.h | 4 +- pcsx2/SIO/Pad/Pad.cpp | 4 - pcsx2/SPU2/SndOut.cpp | 8 +- pcsx2/USB/usb-mic/usb-mic-singstar.cpp | 27 +------ pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp | 4 - pcsx2/USB/usb-pad/usb-pad-sdl-ff.h | 5 -- pcsx2/USB/usb-pad/usb-pad.cpp | 8 +- pcsx2/pcsx2.vcxproj | 2 +- 18 files changed, 62 insertions(+), 232 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd27c9a491..af92cc90b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,14 +50,11 @@ add_subdirectory(common) # make pcsx2 add_subdirectory(pcsx2) +add_subdirectory(pcsx2-qt) -if (QT_BUILD) - add_subdirectory(pcsx2-qt) - - # Updater is Windows only for now. - if (WIN32) - add_subdirectory(updater) - endif() +# Updater is Windows only for now. +if (WIN32) + add_subdirectory(updater) endif() # tests diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index ce5b015001..4f77a42b46 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -6,10 +6,6 @@ set(PCSX2_DEFS "") #------------------------------------------------------------------------------- option(DISABLE_BUILD_DATE "Disable including the binary compile date") option(ENABLE_TESTS "Enables building the unit tests" ON) -set(USE_SYSTEM_LIBS "AUTO" CACHE STRING "Use system libraries instead of bundled libraries. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled. Default is AUTO") -set(DEFAULT_USE_SYSTEM_RYML OFF) # System rapidyaml causes a lot of problems -optional_system_library(fmt) -optional_system_library(ryml) option(LTO_PCSX2_CORE "Enable LTO/IPO/LTCG on the subset of pcsx2 that benefits most from it but not anything else") option(USE_VTUNE "Plug VTUNE to profile GS JIT.") option(USE_ACHIEVEMENTS "Build with RetroAchievements support" ON) @@ -24,9 +20,6 @@ option(USE_VULKAN "Enable Vulkan GS renderer" ON) #------------------------------------------------------------------------------- # Path and lib option #------------------------------------------------------------------------------- -option(CUBEB_API "Build Cubeb support on SPU2" ON) -option(QT_BUILD "Build Qt frontend" ON) - if(UNIX AND NOT APPLE) option(ENABLE_SETCAP "Enable networking capability for DEV9" OFF) option(USE_LEGACY_USER_DIRECTORY "Use legacy home/PCSX2 user directory instead of XDG standard" OFF) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 4ef3cdf35b..e9fa821a3c 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -197,49 +197,6 @@ function(source_groups_from_vcxproj_filters file) endforeach() endfunction() -function(optional_system_library library) - string(TOUPPER ${library} upperlib) - if (DEFINED DEFAULT_USE_SYSTEM_${upperlib}) - set(extra " with extra override to ${DEFAULT_USE_SYSTEM_${upperlib}} on fully default builds") - else() - set(extra) - endif() - set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS${extra}. Default is blank.") - if ("${USE_SYSTEM_${upperlib}}" STREQUAL "") - if(${USE_SYSTEM_LIBS} STREQUAL "AUTO" AND DEFINED DEFAULT_USE_SYSTEM_${upperlib}) - set(RESOLVED_USE_SYSTEM_${upperlib} ${DEFAULT_USE_SYSTEM_${upperlib}} PARENT_SCOPE) - else() - set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE) - endif() - else() - set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE) - endif() -endfunction() - -function(find_optional_system_library library bundled_path) - string(TOUPPER ${library} upperlib) - if (RESOLVED_USE_SYSTEM_${upperlib}) - find_package(${library} ${ARGN} QUIET) - if ((NOT ${library}_FOUND) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO")) - find_package(${library} ${ARGN}) # For the message - message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO.") - endif() - endif() - if (${library}_FOUND) - message("Found ${library}: ${${library}_VERSION}") - set(${library}_TYPE "System" PARENT_SCOPE) - else() - if (${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO") - message("No system ${library} was found. Using bundled.") - endif() - if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${bundled_path}/CMakeLists.txt") - message(FATAL_ERROR "No bundled ${library} was found. Did you forget to checkout submodules?") - endif() - add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL) - set(${library}_TYPE "Bundled" PARENT_SCOPE) - endif() -endfunction() - function(fixup_file_properties target) get_target_property(SOURCES ${target} SOURCES) if(APPLE) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index b5c04157c6..dbbd927e97 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -35,6 +35,7 @@ else() set(FIND_FRAMEWORK_BACKUP ${CMAKE_FIND_FRAMEWORK}) set(CMAKE_FIND_FRAMEWORK NEVER) find_package(PNG REQUIRED) + find_package(CURL REQUIRED) set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP}) find_package(Vtune) @@ -115,48 +116,8 @@ if(GCC_VERSION VERSION_GREATER_EQUAL "9.0" AND GCC_VERSION VERSION_LESS "9.2") This text being in a compile log in an open issue may cause it to be closed.") endif() -find_optional_system_library(fmt 3rdparty/fmt/fmt 7.1.3) -find_optional_system_library(ryml 3rdparty/rapidyaml/rapidyaml 0.4.0) - -if(QT_BUILD) - # Default to bundled Qt6 for Windows. - if(WIN32 AND NOT DEFINED Qt6_DIR) - set(Qt6_DIR ${CMAKE_SOURCE_DIR}/3rdparty/qt/6.5.0/msvc2022_64/lib/cmake/Qt6) - endif() - - # Find the Qt components that we need. - find_package(Qt6 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets Network LinguistTools REQUIRED) - - if (APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET AND "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_LESS 10.15) - get_target_property(QT_FEATURES Qt6::Core QT_ENABLED_PUBLIC_FEATURES) - if (cxx17_filesystem IN_LIST QT_FEATURES) - message("Qt compiled with std::filesystem support, requires macOS 10.15") - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) - endif() - endif() - - # rcheevos backend for RetroAchievements. - if(USE_ACHIEVEMENTS) - add_subdirectory(3rdparty/rcheevos EXCLUDE_FROM_ALL) - if(WIN32) - add_subdirectory(3rdparty/rainterface EXCLUDE_FROM_ALL) - endif() - endif() - - # Discord-RPC library for rich presence. - if(USE_DISCORD_PRESENCE) - add_subdirectory(3rdparty/rapidjson EXCLUDE_FROM_ALL) - add_subdirectory(3rdparty/discord-rpc EXCLUDE_FROM_ALL) - endif() - - # Demangler for the debugger - add_subdirectory(3rdparty/demangler EXCLUDE_FROM_ALL) -endif() - -if(NOT WIN32 AND QT_BUILD) - find_package(CURL REQUIRED) -endif() - +add_subdirectory(3rdparty/fmt/fmt EXCLUDE_FROM_ALL) +add_subdirectory(3rdparty/rapidyaml/rapidyaml EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/lzma EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/libchdr EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL) @@ -187,12 +148,38 @@ if(USE_VULKAN) add_subdirectory(3rdparty/vulkan-headers EXCLUDE_FROM_ALL) endif() -if(CUBEB_API) - add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL) - disable_compiler_warnings_for_target(cubeb) - disable_compiler_warnings_for_target(speex) +add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL) +disable_compiler_warnings_for_target(cubeb) +disable_compiler_warnings_for_target(speex) + +# Find the Qt components that we need. +find_package(Qt6 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets Network LinguistTools REQUIRED) + +if (APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET AND "${CMAKE_OSX_DEPLOYMENT_TARGET}" VERSION_LESS 10.15) + get_target_property(QT_FEATURES Qt6::Core QT_ENABLED_PUBLIC_FEATURES) + if (cxx17_filesystem IN_LIST QT_FEATURES) + message("Qt compiled with std::filesystem support, requires macOS 10.15") + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) + endif() endif() +# rcheevos backend for RetroAchievements. +if(USE_ACHIEVEMENTS) + add_subdirectory(3rdparty/rcheevos EXCLUDE_FROM_ALL) + if(WIN32) + add_subdirectory(3rdparty/rainterface EXCLUDE_FROM_ALL) + endif() +endif() + +# Discord-RPC library for rich presence. +if(USE_DISCORD_PRESENCE) + add_subdirectory(3rdparty/rapidjson EXCLUDE_FROM_ALL) + add_subdirectory(3rdparty/discord-rpc EXCLUDE_FROM_ALL) +endif() + +# Demangler for the debugger +add_subdirectory(3rdparty/demangler EXCLUDE_FROM_ALL) + # Deliberately at the end. We don't want to set the flag on third-party projects. if(MSVC) # Don't warn about "deprecated" POSIX functions. diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d8eaa3167b..1d9fe13f6e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -179,7 +179,7 @@ if (USE_GCC AND CMAKE_INTERPROCEDURAL_OPTIMIZATION) set_source_files_properties(FastJmp.cpp PROPERTIES COMPILE_FLAGS -fno-lto) endif() -if(NOT WIN32 AND (QT_BUILD OR NOGUI_BUILD)) +if(NOT WIN32) # libcurl-based HTTPDownloader target_sources(common PRIVATE HTTPDownloaderCurl.cpp diff --git a/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp b/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp index a991aa2183..3ad31ac585 100644 --- a/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp +++ b/pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp @@ -22,10 +22,7 @@ #include "SettingWidgetBinder.h" #include "pcsx2/Input/InputManager.h" - -#ifdef SDL_BUILD #include "pcsx2/Input/SDLInputSource.h" -#endif ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, ControllerSettingsDialog* dialog) : QWidget(parent) @@ -35,17 +32,12 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, SettingsInterface* sif = dialog->getProfileSettingsInterface(); -#ifdef SDL_BUILD SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", "SDLControllerEnhancedMode", false); connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled); connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked); -#else - m_ui.enableSDLSource->setEnabled(false); - m_ui.ledSettings->setEnabled(false); -#endif -#if defined(SDL_BUILD) && defined(_WIN32) +#ifdef _WIN32 SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLRawInput, "InputSources", "SDLRawInput", false); #else m_ui.gridLayout_2->removeWidget(m_ui.enableSDLRawInput); @@ -157,7 +149,6 @@ ControllerLEDSettingsDialog::~ControllerLEDSettingsDialog() = default; void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 player_id) { -#ifdef SDL_BUILD std::string key(fmt::format("Player{}LED", player_id)); const u32 current_value = SDLInputSource::ParseRGBForPlayerId(m_dialog->getStringValue("SDLExtra", key.c_str(), ""), player_id); button->setColor(current_value); @@ -165,7 +156,6 @@ void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 play 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()); }); -#endif } ControllerMouseSettingsDialog::ControllerMouseSettingsDialog(QWidget* parent, ControllerSettingsDialog* dialog) diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj index e4542a59b5..467cce131a 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj +++ b/pcsx2-qt/pcsx2-qt.vcxproj @@ -49,7 +49,7 @@ %(AdditionalIncludeDirectories);$(ProjectDir)\Settings;$(ProjectDir)\GameList;$(ProjectDir)\Tools\InputRecording;$(ProjectDir)\Debugger;$(ProjectDir)\Debugger\Models Use PrecompiledHeader.h - LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_DISCORD_PRESENCE;ENABLE_OPENGL;ENABLE_VULKAN;SDL_BUILD;%(PreprocessorDefinitions) + LZMA_API_STATIC;BUILD_DX=1;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_DISCORD_PRESENCE;ENABLE_OPENGL;ENABLE_VULKAN;%(PreprocessorDefinitions) QT_NO_EXCEPTIONS;%(PreprocessorDefinitions) true diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index ec258de6fa..1b25a6cbca 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -56,15 +56,6 @@ if(USE_LINKED_FFMPEG) target_link_libraries(PCSX2_FLAGS INTERFACE FFMPEG::avcodec FFMPEG::avformat FFMPEG::avutil FFMPEG::swscale FFMPEG::swresample) endif() -if(TARGET SDL2::SDL2) - target_compile_definitions(PCSX2_FLAGS INTERFACE SDL_BUILD) - target_link_libraries(PCSX2_FLAGS INTERFACE SDL2::SDL2) - target_sources(PCSX2 PRIVATE - Input/SDLInputSource.cpp - Input/SDLInputSource.h - ) -endif() - if(WIN32) set(MIN_WIN32 0x0A00) target_compile_definitions(PCSX2_FLAGS INTERFACE @@ -289,6 +280,7 @@ set(pcsx2SPU2Sources SPU2/RegTable.cpp SPU2/Reverb.cpp SPU2/SndOut.cpp + SPU2/SndOut_Cubeb.cpp SPU2/spu2freeze.cpp SPU2/spu2sys.cpp SPU2/Wavedump_wav.cpp @@ -308,12 +300,6 @@ set(pcsx2SPU2Headers SPU2/spdif.h ) -if(CUBEB_API) - list(APPEND pcsx2SPU2Sources SPU2/SndOut_Cubeb.cpp) - target_compile_definitions(PCSX2_FLAGS INTERFACE "SPU2X_CUBEB") - target_link_libraries(PCSX2_FLAGS INTERFACE cubeb) -endif() - if(WIN32) list(APPEND pcsx2SPU2Sources SPU2/SndOut_XAudio2.cpp @@ -424,12 +410,14 @@ set(pcsx2USBSources USB/usb-eyetoy/usb-eyetoy-webcam.cpp USB/usb-hid/usb-hid.cpp USB/usb-lightgun/guncon2.cpp + USB/usb-mic/audiodev-cubeb.cpp USB/usb-mic/usb-headset.cpp USB/usb-mic/usb-mic-logitech.cpp USB/usb-mic/usb-mic-singstar.cpp USB/usb-msd/usb-msd.cpp USB/usb-pad/lg/lg_ff.cpp USB/usb-pad/usb-pad-ff.cpp + USB/usb-pad/usb-pad-sdl-ff.cpp USB/usb-pad/usb-pad.cpp USB/usb-pad/usb-seamic.cpp USB/usb-pad/usb-turntable.cpp @@ -454,27 +442,18 @@ set(pcsx2USBHeaders USB/usb-hid/usb-hid.h USB/usb-lightgun/guncon2.h USB/usb-mic/audio.h + USB/usb-mic/audiodev-cubeb.h USB/usb-mic/audiodev-noop.h USB/usb-mic/audiodev.h USB/usb-mic/usb-headset.h USB/usb-mic/usb-mic-singstar.h USB/usb-msd/usb-msd.h USB/usb-pad/lg/lg_ff.h + USB/usb-pad/usb-pad-sdl-ff.h USB/usb-pad/usb-pad.h USB/usb-printer/usb-printer.h ) -if(CUBEB_API) - list(APPEND pcsx2USBSources USB/usb-mic/audiodev-cubeb.cpp) - list(APPEND pcsx2USBHeaders USB/usb-mic/audiodev-cubeb.h) -endif() - -if(TARGET SDL2::SDL2) - list(APPEND pcsx2USBSources USB/usb-pad/usb-pad-sdl-ff.cpp) - list(APPEND pcsx2USBHeaders USB/usb-pad/usb-pad-sdl-ff.h) -endif() - - # Host PAD set(pcsx2PADSources SIO/Pad/Pad.cpp @@ -859,10 +838,12 @@ set(pcsx2ImGuiHeaders set(pcsx2InputSources Input/InputManager.cpp Input/InputSource.cpp + Input/SDLInputSource.cpp ) set(pcsx2InputHeaders Input/InputManager.h Input/InputSource.h + Input/SDLInputSource.h ) if(APPLE) @@ -1171,6 +1152,8 @@ target_link_libraries(PCSX2_FLAGS INTERFACE libzip::zip cpuinfo zydis + cubeb + SDL2::SDL2 ZLIB::ZLIB SoundTouch::SoundTouch PNG::PNG diff --git a/pcsx2/ImGui/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp index 342da93445..2ca1468491 100644 --- a/pcsx2/ImGui/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -3401,29 +3401,19 @@ void FullscreenUI::DrawAudioSettingsPage() }; static constexpr const char* output_entries[] = { "No Sound (Emulate SPU2 only)", -#ifdef SPU2X_CUBEB "Cubeb (Cross-platform)", -#endif #ifdef _WIN32 "XAudio2", #endif }; static constexpr const char* output_values[] = { "nullout", -#ifdef SPU2X_CUBEB "cubeb", -#endif #ifdef _WIN32 "xaudio2", #endif }; -#if defined(SPU2X_CUBEB) static constexpr const char* default_output_module = "cubeb"; -#elif defined(_WIN32) - static constexpr const char* default_output_module = "xaudio2"; -#else - static constexpr const char* default_output_module = "nullout"; -#endif SettingsInterface* bsi = GetEditingSettingsInterface(); @@ -3802,18 +3792,14 @@ void FullscreenUI::DrawControllerSettingsPage() MenuHeading("Input Sources"); -#ifdef SDL_BUILD DrawToggleSetting(bsi, ICON_FA_COG " Enable SDL Input Source", "The SDL input source supports most controllers.", "InputSources", "SDL", true, true, false); DrawToggleSetting(bsi, ICON_FA_WIFI " SDL DualShock 4 / DualSense Enhanced Mode", "Provides vibration and LED control support over Bluetooth.", "InputSources", "SDLControllerEnhancedMode", false, bsi->GetBoolValue("InputSources", "SDL", true), false); -#endif -#if defined(SDL_BUILD) && defined(_WIN32) +#ifdef _WIN32 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 -#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 diff --git a/pcsx2/Input/InputManager.cpp b/pcsx2/Input/InputManager.cpp index 8d29f4ce75..111300c498 100644 --- a/pcsx2/Input/InputManager.cpp +++ b/pcsx2/Input/InputManager.cpp @@ -444,13 +444,11 @@ InputBindingKey InputManager::MakePointerAxisKey(u32 index, InputPointerAxis axi static std::array(InputSourceType::Count)> s_input_class_names = {{ "Keyboard", "Mouse", + "SDL", #ifdef _WIN32 "DInput", "XInput", #endif -#ifdef SDL_BUILD - "SDL", -#endif }}; InputSource* InputManager::GetInputSourceInterface(InputSourceType type) @@ -469,6 +467,7 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type) { case InputSourceType::Keyboard: case InputSourceType::Pointer: + case InputSourceType::SDL: return true; #ifdef _WIN32 @@ -476,17 +475,7 @@ bool InputManager::GetInputSourceDefaultEnabled(InputSourceType type) return false; case InputSourceType::XInput: - // Disable xinput by default if we have SDL. -#ifdef SDL_BUILD return false; -#else - return true; -#endif -#endif - -#ifdef SDL_BUILD - case InputSourceType::SDL: - return true; #endif default: @@ -1521,22 +1510,18 @@ void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_loc } } +#include "Input/SDLInputSource.h" + #ifdef _WIN32 #include "Input/DInputSource.h" #include "Input/XInputSource.h" #endif -#ifdef SDL_BUILD -#include "Input/SDLInputSource.h" -#endif - void InputManager::ReloadSources(SettingsInterface& si, std::unique_lock& settings_lock) { + UpdateInputSourceState(si, settings_lock, InputSourceType::SDL); #ifdef _WIN32 UpdateInputSourceState(si, settings_lock, InputSourceType::DInput); UpdateInputSourceState(si, settings_lock, InputSourceType::XInput); #endif -#ifdef SDL_BUILD - UpdateInputSourceState(si, settings_lock, InputSourceType::SDL); -#endif } diff --git a/pcsx2/Input/InputManager.h b/pcsx2/Input/InputManager.h index 642383d844..acae4eec2c 100644 --- a/pcsx2/Input/InputManager.h +++ b/pcsx2/Input/InputManager.h @@ -33,12 +33,10 @@ enum class InputSourceType : u32 { Keyboard, Pointer, + SDL, #ifdef _WIN32 DInput, XInput, -#endif -#ifdef SDL_BUILD - SDL, #endif Count, }; diff --git a/pcsx2/SIO/Pad/Pad.cpp b/pcsx2/SIO/Pad/Pad.cpp index 98763a97d8..338facf674 100644 --- a/pcsx2/SIO/Pad/Pad.cpp +++ b/pcsx2/SIO/Pad/Pad.cpp @@ -150,9 +150,7 @@ void Pad::SetDefaultControllerConfig(SettingsInterface& si) InputManager::InputSourceToString(static_cast(i)), InputManager::GetInputSourceDefaultEnabled(static_cast(i))); } -#ifdef SDL_BUILD si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false); -#endif si.SetBoolValue("Pad", "MultitapPort1", false); si.SetBoolValue("Pad", "MultitapPort2", false); si.SetFloatValue("Pad", "PointerXScale", 8.0f); @@ -321,9 +319,7 @@ void Pad::CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface& dest_si->CopyBoolValue(src_si, "InputSources", InputManager::InputSourceToString(static_cast(i))); } -#ifdef SDL_BUILD dest_si->CopyBoolValue(src_si, "InputSources", "SDLControllerEnhancedMode"); -#endif } for (u32 port = 0; port < Pad::NUM_CONTROLLER_PORTS; port++) diff --git a/pcsx2/SPU2/SndOut.cpp b/pcsx2/SPU2/SndOut.cpp index c22562dbf2..101d45bee8 100644 --- a/pcsx2/SPU2/SndOut.cpp +++ b/pcsx2/SPU2/SndOut.cpp @@ -68,23 +68,19 @@ namespace static NullOutModule s_NullOut; static SndOutModule* NullOut = &s_NullOut; +extern SndOutModule* CubebOut; #ifdef _WIN32 extern SndOutModule* XAudio2Out; #endif -#if defined(SPU2X_CUBEB) -extern SndOutModule* CubebOut; -#endif static SndOutModule* mods[] = { NullOut, + CubebOut, #ifdef _WIN32 XAudio2Out, #endif -#if defined(SPU2X_CUBEB) - CubebOut, -#endif }; static SndOutModule* s_output_module; diff --git a/pcsx2/USB/usb-mic/usb-mic-singstar.cpp b/pcsx2/USB/usb-mic/usb-mic-singstar.cpp index 14b5eb6ca5..40ea5184b4 100644 --- a/pcsx2/USB/usb-mic/usb-mic-singstar.cpp +++ b/pcsx2/USB/usb-mic/usb-mic-singstar.cpp @@ -30,6 +30,8 @@ #include "USB/qemu-usb/USBinternal.h" #include "USB/usb-mic/usb-mic-singstar.h" #include "USB/usb-mic/audiodev.h" +#include "USB/usb-mic/audiodev-noop.h" +#include "USB/usb-mic/audiodev-cubeb.h" #include "USB/usb-mic/audio.h" #include "USB/USB.h" #include "Host.h" @@ -886,16 +888,11 @@ namespace usb_mic } } // namespace usb_mic -#include "USB/usb-mic/audiodev-noop.h" - std::unique_ptr AudioDevice::CreateNoopDevice(u32 port, AudioDir dir, u32 channels) { return std::make_unique(port, dir, channels); } -#ifdef SPU2X_CUBEB -#include "USB/usb-mic/audiodev-cubeb.h" - std::unique_ptr AudioDevice::CreateDevice(u32 port, AudioDir dir, u32 channels, std::string devname, s32 latency) { return std::make_unique(port, dir, channels, std::move(devname), latency); @@ -910,23 +907,3 @@ std::vector> AudioDevice::GetOutputDeviceLis { return usb_mic::audiodev_cubeb::CubebAudioDevice::GetDeviceList(false); } - -#else - -std::unique_ptr AudioDevice::CreateDevice(u32 port, AudioDir dir, u32 channels, std::string devname, s32 latency) -{ - Console.Warning("Cubeb is unavailable, creating a noop audio device."); - return CreateNoopDevice(port, dir, channels); -} - -std::vector> AudioDevice::GetInputDeviceList() -{ - return {}; -} - -std::vector> AudioDevice::GetOutputDeviceList() -{ - return {}; -} - -#endif \ No newline at end of file diff --git a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp index 6b4513de8b..a39cb5edf6 100644 --- a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp +++ b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.cpp @@ -24,8 +24,6 @@ #include -#ifdef SDL_BUILD - namespace usb_pad { SDLFFDevice::SDLFFDevice(SDL_Haptic* haptic) @@ -356,5 +354,3 @@ namespace usb_pad } } // namespace usb_pad - -#endif \ No newline at end of file diff --git a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h index 32b4401d60..eb163b1454 100644 --- a/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h +++ b/pcsx2/USB/usb-pad/usb-pad-sdl-ff.h @@ -16,9 +16,6 @@ #pragma once #include "USB/usb-pad/usb-pad.h" - -#ifdef SDL_BUILD - #include "Input/SDLInputSource.h" namespace usb_pad @@ -64,5 +61,3 @@ namespace usb_pad bool m_autocenter_supported = false; }; } // namespace usb_pad - -#endif diff --git a/pcsx2/USB/usb-pad/usb-pad.cpp b/pcsx2/USB/usb-pad/usb-pad.cpp index 7bfd2c3f15..0d3915cace 100644 --- a/pcsx2/USB/usb-pad/usb-pad.cpp +++ b/pcsx2/USB/usb-pad/usb-pad.cpp @@ -16,14 +16,11 @@ #include "PrecompiledHeader.h" #include "usb-pad.h" #include "USB/qemu-usb/USBinternal.h" +#include "USB/usb-pad/usb-pad-sdl-ff.h" #include "USB/USB.h" #include "Host.h" #include "StateWrapper.h" -#ifdef SDL_BUILD -#include "USB/usb-pad/usb-pad-sdl-ff.h" -#endif - namespace usb_pad { static const USBDescStrings df_desc_strings = { @@ -627,10 +624,7 @@ namespace usb_pad return; mFFdev.reset(); - -#ifdef SDL_BUILD mFFdev = SDLFFDevice::Create(mFFdevName); -#endif } static void pad_handle_data(USBDevice* dev, USBPacket* p) diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index 6a97b323ea..eca9076c58 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -64,7 +64,7 @@ Use PrecompiledHeader.h PrecompiledHeader.h;%(ForcedIncludeFiles) - LZMA_API_STATIC;ST_NO_EXCEPTION_HANDLING;ENABLE_DISCORD_PRESENCE;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_OPENGL;ENABLE_VULKAN;SPU2X_CUBEB;SDL_BUILD;%(PreprocessorDefinitions) + LZMA_API_STATIC;ST_NO_EXCEPTION_HANDLING;ENABLE_DISCORD_PRESENCE;ENABLE_RAINTEGRATION;ENABLE_ACHIEVEMENTS;ENABLE_OPENGL;ENABLE_VULKAN;%(PreprocessorDefinitions) XBYAK_NO_EXCEPTION;ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions) $(IntDir)%(RelativeDir)