Skip to content

Commit

Permalink
Merge branch 'main' into qt-style
Browse files Browse the repository at this point in the history
  • Loading branch information
tomboylover93 authored Dec 27, 2024
2 parents a3f5ca8 + abe85fd commit ff3ace7
Show file tree
Hide file tree
Showing 67 changed files with 3,015 additions and 248 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@
path = externals/MoltenVK/cereal
url = https://github.com/USCiLab/cereal
shallow = true
[submodule "externals/cubeb"]
path = externals/cubeb
url = https://github.com/mozilla/cubeb
shallow = true
30 changes: 20 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ git_describe(GIT_DESC --always --long --dirty)
git_branch_name(GIT_BRANCH)
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY)

find_package(Boost 1.84.0 CONFIG)
find_package(FFmpeg 5.1.2 MODULE)
Expand All @@ -127,6 +127,7 @@ find_package(xxHash 0.8.2 MODULE)
find_package(ZLIB 1.3 MODULE)
find_package(Zydis 5.0.0 CONFIG)
find_package(pugixml 1.14 CONFIG)
find_package(cubeb CONFIG)

if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC)
find_package(cryptopp 8.9.0 MODULE)
Expand Down Expand Up @@ -198,9 +199,10 @@ set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
src/core/libraries/audio/audioin.h
src/core/libraries/audio/audioout.cpp
src/core/libraries/audio/audioout.h
src/core/libraries/audio/sdl_audio.cpp
src/core/libraries/audio/sdl_audio.h
src/core/libraries/audio/audioout_backend.h
src/core/libraries/audio/audioout_error.h
src/core/libraries/audio/cubeb_audio.cpp
src/core/libraries/audio/sdl_audio.cpp
src/core/libraries/ngs2/ngs2.cpp
src/core/libraries/ngs2/ngs2.h
)
Expand Down Expand Up @@ -493,6 +495,7 @@ set(COMMON src/common/logging/backend.cpp
src/common/polyfill_thread.h
src/common/rdtsc.cpp
src/common/rdtsc.h
src/common/ringbuffer.h
src/common/signal_context.h
src/common/signal_context.cpp
src/common/singleton.h
Expand All @@ -517,7 +520,7 @@ set(COMMON src/common/logging/backend.cpp
src/common/number_utils.cpp
src/common/memory_patcher.h
src/common/memory_patcher.cpp
src/common/scm_rev.cpp
${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp
src/common/scm_rev.h
)

Expand Down Expand Up @@ -884,7 +887,7 @@ endif()
create_target_directory_groups(shadps4)

target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers cubeb::cubeb)

target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
Expand All @@ -901,11 +904,18 @@ endif()
if (APPLE)
if (ENABLE_QT_GUI)
# Include MoltenVK in the app bundle, along with an ICD file so it can be found by the system Vulkan loader if used for loading layers.
target_sources(shadps4 PRIVATE externals/MoltenVK/MoltenVK_icd.json)
set_source_files_properties(externals/MoltenVK/MoltenVK_icd.json
PROPERTIES MACOSX_PACKAGE_LOCATION Resources/vulkan/icd.d)
add_custom_command(TARGET shadps4 POST_BUILD
COMMAND cmake -E copy $<TARGET_LINKER_FILE:MoltenVK> $<TARGET_BUNDLE_DIR:shadps4>/Contents/Frameworks/libMoltenVK.dylib)
set(MVK_ICD ${CMAKE_CURRENT_SOURCE_DIR}/externals/MoltenVK/MoltenVK_icd.json)
target_sources(shadps4 PRIVATE ${MVK_ICD})
set_source_files_properties(${MVK_ICD} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/vulkan/icd.d)

set(MVK_DYLIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/externals/MoltenVK/libMoltenVK.dylib)
set(MVK_DYLIB_DST ${CMAKE_CURRENT_BINARY_DIR}/shadps4.app/Contents/Frameworks/libMoltenVK.dylib)
add_custom_command(
OUTPUT ${MVK_DYLIB_DST}
DEPENDS ${MVK_DYLIB_SRC}
COMMAND cmake -E copy ${MVK_DYLIB_SRC} ${MVK_DYLIB_DST})
add_custom_target(CopyMoltenVK DEPENDS ${MVK_DYLIB_DST})
add_dependencies(shadps4 CopyMoltenVK)
set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path/../Frameworks")
else()
# For non-bundled SDL build, just do a normal library link.
Expand Down
7 changes: 7 additions & 0 deletions LICENSES/ISC.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ISC License

<copyright notice>

Permission to use, copy, modify, and /or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
10 changes: 10 additions & 0 deletions externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ if (NOT TARGET stb::headers)
add_library(stb::headers ALIAS stb)
endif()

# cubeb
if (NOT TARGET cubeb::cubeb)
option(BUILD_TESTS "" OFF)
option(BUILD_TOOLS "" OFF)
option(BUNDLE_SPEEX "" ON)
option(USE_SANITIZERS "" OFF)
add_subdirectory(cubeb)
add_library(cubeb::cubeb ALIAS cubeb)
endif()

# Apple-only dependencies
if (APPLE)
# date
Expand Down
1 change: 1 addition & 0 deletions externals/cubeb
Submodule cubeb added at 9a9d03
17 changes: 17 additions & 0 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static int cursorHideTimeout = 5; // 5 seconds (default)
static bool separateupdatefolder = false;
static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false;
static std::string audioBackend = "cubeb";

// Gui
std::vector<std::filesystem::path> settings_install_dirs = {};
Expand Down Expand Up @@ -244,6 +245,10 @@ bool getCheckCompatibilityOnStartup() {
return checkCompatibilityOnStartup;
}

std::string getAudioBackend() {
return audioBackend;
}

void setGpuId(s32 selectedGpuId) {
gpuId = selectedGpuId;
}
Expand Down Expand Up @@ -380,6 +385,10 @@ void setCheckCompatibilityOnStartup(bool use) {
checkCompatibilityOnStartup = use;
}

void setAudioBackend(std::string backend) {
audioBackend = backend;
}

void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
main_window_geometry_x = x;
main_window_geometry_y = y;
Expand Down Expand Up @@ -620,6 +629,12 @@ void load(const std::filesystem::path& path) {
vkCrashDiagnostic = toml::find_or<bool>(vk, "crashDiagnostic", false);
}

if (data.contains("Audio")) {
const toml::value& audio = data.at("Audio");

audioBackend = toml::find_or<std::string>(audio, "backend", "cubeb");
}

if (data.contains("Debug")) {
const toml::value& debug = data.at("Debug");

Expand Down Expand Up @@ -719,6 +734,7 @@ void save(const std::filesystem::path& path) {
data["Vulkan"]["rdocEnable"] = rdocEnable;
data["Vulkan"]["rdocMarkersEnable"] = vkMarkers;
data["Vulkan"]["crashDiagnostic"] = vkCrashDiagnostic;
data["Audio"]["backend"] = audioBackend;
data["Debug"]["DebugDump"] = isDebugDump;
data["Debug"]["CollectShader"] = isShaderDebug;

Expand Down Expand Up @@ -824,6 +840,7 @@ void setDefaultValues() {
separateupdatefolder = false;
compatibilityData = false;
checkCompatibilityOnStartup = false;
audioBackend = "cubeb";
}

} // namespace Config
2 changes: 2 additions & 0 deletions src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bool getEnableDiscordRPC();
bool getSeparateUpdateEnabled();
bool getCompatibilityEnabled();
bool getCheckCompatibilityOnStartup();
std::string getAudioBackend();

std::string getLogFilter();
std::string getLogType();
Expand Down Expand Up @@ -76,6 +77,7 @@ void setSeparateUpdateEnabled(bool use);
void setGameInstallDirs(const std::vector<std::filesystem::path>& settings_install_dirs_config);
void setCompatibilityEnabled(bool use);
void setCheckCompatibilityOnStartup(bool use);
void setAudioBackend(std::string backend);

void setCursorState(s16 cursorState);
void setCursorHideTimeout(int newcursorHideTimeout);
Expand Down
Loading

0 comments on commit ff3ace7

Please sign in to comment.