diff options
91 files changed, 423 insertions, 1922 deletions
diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh index 969ab637c..c2550c966 100644 --- a/.ci/scripts/format/script.sh +++ b/.ci/scripts/format/script.sh | |||
| @@ -7,7 +7,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis | |||
| 7 | fi | 7 | fi |
| 8 | 8 | ||
| 9 | # Default clang-format points to default 3.5 version one | 9 | # Default clang-format points to default 3.5 version one |
| 10 | CLANG_FORMAT=clang-format-10 | 10 | CLANG_FORMAT=clang-format-12 |
| 11 | $CLANG_FORMAT --version | 11 | $CLANG_FORMAT --version |
| 12 | 12 | ||
| 13 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then | 13 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then |
diff --git a/.ci/yuzu-mainline-step1.yml b/.ci/yuzu-mainline-step1.yml index 3fd33d75a..6b6acb5c6 100644 --- a/.ci/yuzu-mainline-step1.yml +++ b/.ci/yuzu-mainline-step1.yml | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | trigger: | 1 | trigger: |
| 2 | - master | 2 | - master |
| 3 | 3 | ||
| 4 | pool: | ||
| 5 | vmImage: 'ubuntu-latest' | ||
| 6 | |||
| 4 | stages: | 7 | stages: |
| 5 | - stage: merge | 8 | - stage: merge |
| 6 | displayName: 'merge' | 9 | displayName: 'merge' |
diff --git a/.ci/yuzu-patreon-step1.yml b/.ci/yuzu-patreon-step1.yml index cf30397cd..c63d7a066 100644 --- a/.ci/yuzu-patreon-step1.yml +++ b/.ci/yuzu-patreon-step1.yml | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | trigger: | 1 | trigger: |
| 2 | - master | 2 | - master |
| 3 | 3 | ||
| 4 | pool: | ||
| 5 | vmImage: 'ubuntu-latest' | ||
| 6 | |||
| 4 | stages: | 7 | stages: |
| 5 | - stage: merge | 8 | - stage: merge |
| 6 | displayName: 'merge' | 9 | displayName: 'merge' |
diff --git a/.gitmodules b/.gitmodules index 749cd0408..dc6ed500f 100644 --- a/.gitmodules +++ b/.gitmodules | |||
| @@ -28,9 +28,6 @@ | |||
| 28 | [submodule "mbedtls"] | 28 | [submodule "mbedtls"] |
| 29 | path = externals/mbedtls | 29 | path = externals/mbedtls |
| 30 | url = https://github.com/yuzu-emu/mbedtls | 30 | url = https://github.com/yuzu-emu/mbedtls |
| 31 | [submodule "libzip"] | ||
| 32 | path = externals/libzip/libzip | ||
| 33 | url = https://github.com/nih-at/libzip.git | ||
| 34 | [submodule "xbyak"] | 31 | [submodule "xbyak"] |
| 35 | path = externals/xbyak | 32 | path = externals/xbyak |
| 36 | url = https://github.com/herumi/xbyak.git | 33 | url = https://github.com/herumi/xbyak.git |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 870d0ebdd..123a3082a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -29,16 +29,10 @@ option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}") | |||
| 29 | 29 | ||
| 30 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) | 30 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) |
| 31 | 31 | ||
| 32 | option(YUZU_ENABLE_BOXCAT "Enable the Boxcat service, a yuzu high-level implementation of BCAT" ON) | ||
| 33 | |||
| 34 | option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) | 32 | option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) |
| 35 | 33 | ||
| 36 | option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) | 34 | option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) |
| 37 | 35 | ||
| 38 | if (NOT ENABLE_WEB_SERVICE) | ||
| 39 | set(YUZU_ENABLE_BOXCAT OFF) | ||
| 40 | endif() | ||
| 41 | |||
| 42 | # Default to a Release build | 36 | # Default to a Release build |
| 43 | get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | 37 | get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) |
| 44 | if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) | 38 | if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) |
| @@ -243,7 +237,7 @@ yuzu_find_packages() | |||
| 243 | 237 | ||
| 244 | # Qt5 requires that we find components, so it doesn't fit our pretty little find package function | 238 | # Qt5 requires that we find components, so it doesn't fit our pretty little find package function |
| 245 | if(ENABLE_QT) | 239 | if(ENABLE_QT) |
| 246 | set(QT_VERSION 5.12) | 240 | set(QT_VERSION 5.15) |
| 247 | # We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official | 241 | # We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official |
| 248 | # Qt5Config inside the root folder instead of the conan generated one. | 242 | # Qt5Config inside the root folder instead of the conan generated one. |
| 249 | if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake) | 243 | if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake) |
| @@ -345,8 +339,8 @@ if(ENABLE_QT) | |||
| 345 | set(QT_PREFIX_HINT) | 339 | set(QT_PREFIX_HINT) |
| 346 | 340 | ||
| 347 | if(YUZU_USE_BUNDLED_QT) | 341 | if(YUZU_USE_BUNDLED_QT) |
| 348 | if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) | 342 | if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) |
| 349 | set(QT_BUILD qt-5.12.8-msvc2017_64) | 343 | set(QT_BUILD qt-5.15.2-msvc2019_64) |
| 350 | elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64) | 344 | elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64) |
| 351 | set(QT_BUILD qt5_5_15_2) | 345 | set(QT_BUILD qt5_5_15_2) |
| 352 | else() | 346 | else() |
| @@ -375,7 +369,7 @@ endif() | |||
| 375 | if (ENABLE_SDL2) | 369 | if (ENABLE_SDL2) |
| 376 | if (YUZU_USE_BUNDLED_SDL2) | 370 | if (YUZU_USE_BUNDLED_SDL2) |
| 377 | # Detect toolchain and platform | 371 | # Detect toolchain and platform |
| 378 | if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) | 372 | if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) |
| 379 | set(SDL2_VER "SDL2-2.0.16") | 373 | set(SDL2_VER "SDL2-2.0.16") |
| 380 | else() | 374 | else() |
| 381 | message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") | 375 | message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") |
| @@ -422,11 +416,6 @@ if (CONAN_REQUIRED_LIBS) | |||
| 422 | endif() | 416 | endif() |
| 423 | include(${CMAKE_BINARY_DIR}/conan.cmake) | 417 | include(${CMAKE_BINARY_DIR}/conan.cmake) |
| 424 | 418 | ||
| 425 | set(CONAN_LIB_OPTIONS | ||
| 426 | libzip:with_openssl=False | ||
| 427 | libzip:enable_windows_crypto=False | ||
| 428 | ) | ||
| 429 | |||
| 430 | conan_check(VERSION 1.24.0 REQUIRED) | 419 | conan_check(VERSION 1.24.0 REQUIRED) |
| 431 | 420 | ||
| 432 | # Manually add iconv to fix a dep conflict between qt and sdl2 | 421 | # Manually add iconv to fix a dep conflict between qt and sdl2 |
| @@ -473,7 +462,7 @@ if (CONAN_REQUIRED_LIBS) | |||
| 473 | if(ENABLE_QT) | 462 | if(ENABLE_QT) |
| 474 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") | 463 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 475 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") | 464 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 476 | find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets) | 465 | find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets) |
| 477 | if (YUZU_USE_QT_WEB_ENGINE) | 466 | if (YUZU_USE_QT_WEB_ENGINE) |
| 478 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) | 467 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) |
| 479 | endif() | 468 | endif() |
| @@ -780,7 +769,7 @@ endif() | |||
| 780 | # against all the src files. This should be used before making a pull request. | 769 | # against all the src files. This should be used before making a pull request. |
| 781 | # ======================================================================= | 770 | # ======================================================================= |
| 782 | 771 | ||
| 783 | set(CLANG_FORMAT_POSTFIX "-10") | 772 | set(CLANG_FORMAT_POSTFIX "-12") |
| 784 | find_program(CLANG_FORMAT | 773 | find_program(CLANG_FORMAT |
| 785 | NAMES clang-format${CLANG_FORMAT_POSTFIX} | 774 | NAMES clang-format${CLANG_FORMAT_POSTFIX} |
| 786 | clang-format | 775 | clang-format |
diff --git a/CMakeModules/CopyYuzuQt5Deps.cmake b/CMakeModules/CopyYuzuQt5Deps.cmake index 4a6aeebbb..dd97f5b2b 100644 --- a/CMakeModules/CopyYuzuQt5Deps.cmake +++ b/CMakeModules/CopyYuzuQt5Deps.cmake | |||
| @@ -33,6 +33,7 @@ function(copy_yuzu_Qt5_deps target_dir) | |||
| 33 | Qt5Positioning$<$<CONFIG:Debug>:d>.* | 33 | Qt5Positioning$<$<CONFIG:Debug>:d>.* |
| 34 | Qt5PrintSupport$<$<CONFIG:Debug>:d>.* | 34 | Qt5PrintSupport$<$<CONFIG:Debug>:d>.* |
| 35 | Qt5Qml$<$<CONFIG:Debug>:d>.* | 35 | Qt5Qml$<$<CONFIG:Debug>:d>.* |
| 36 | Qt5QmlModels$<$<CONFIG:Debug>:d>.* | ||
| 36 | Qt5Quick$<$<CONFIG:Debug>:d>.* | 37 | Qt5Quick$<$<CONFIG:Debug>:d>.* |
| 37 | Qt5QuickWidgets$<$<CONFIG:Debug>:d>.* | 38 | Qt5QuickWidgets$<$<CONFIG:Debug>:d>.* |
| 38 | Qt5WebChannel$<$<CONFIG:Debug>:d>.* | 39 | Qt5WebChannel$<$<CONFIG:Debug>:d>.* |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 0c2c059a9..a76a3d800 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -93,13 +93,6 @@ endif() | |||
| 93 | # Sirit | 93 | # Sirit |
| 94 | add_subdirectory(sirit) | 94 | add_subdirectory(sirit) |
| 95 | 95 | ||
| 96 | # libzip | ||
| 97 | find_package(libzip 1.5) | ||
| 98 | if (NOT libzip_FOUND) | ||
| 99 | message(STATUS "libzip 1.5 or newer not found, falling back to externals") | ||
| 100 | add_subdirectory(libzip EXCLUDE_FROM_ALL) | ||
| 101 | endif() | ||
| 102 | |||
| 103 | if (ENABLE_WEB_SERVICE) | 96 | if (ENABLE_WEB_SERVICE) |
| 104 | find_package(OpenSSL 1.1) | 97 | find_package(OpenSSL 1.1) |
| 105 | if (OPENSSL_FOUND) | 98 | if (OPENSSL_FOUND) |
diff --git a/externals/find-modules/Findlibzip.cmake b/externals/find-modules/Findlibzip.cmake deleted file mode 100644 index 8934de3b8..000000000 --- a/externals/find-modules/Findlibzip.cmake +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | |||
| 2 | find_package(PkgConfig QUIET) | ||
| 3 | pkg_check_modules(PC_libzip QUIET libzip) | ||
| 4 | |||
| 5 | find_path(libzip_INCLUDE_DIR | ||
| 6 | NAMES zip.h | ||
| 7 | PATHS ${PC_libzip_INCLUDE_DIRS} | ||
| 8 | "$ENV{LIB_DIR}/include" | ||
| 9 | "$ENV{INCLUDE}" | ||
| 10 | /usr/local/include | ||
| 11 | /usr/include | ||
| 12 | ) | ||
| 13 | find_path(libzip_INCLUDE_DIR_ZIPCONF | ||
| 14 | NAMES zipconf.h | ||
| 15 | HINTS ${PC_libzip_INCLUDE_DIRS} | ||
| 16 | "$ENV{LIB_DIR}/include" | ||
| 17 | "$ENV{LIB_DIR}/lib/libzip/include" | ||
| 18 | "$ENV{LIB}/lib/libzip/include" | ||
| 19 | /usr/local/lib/libzip/include | ||
| 20 | /usr/lib/libzip/include | ||
| 21 | /usr/local/include | ||
| 22 | /usr/include | ||
| 23 | "$ENV{INCLUDE}" | ||
| 24 | ) | ||
| 25 | find_library(libzip_LIBRARY | ||
| 26 | NAMES zip | ||
| 27 | PATHS ${PC_libzip_LIBRARY_DIRS} | ||
| 28 | "$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib | ||
| 29 | ) | ||
| 30 | |||
| 31 | if (libzip_INCLUDE_DIR_ZIPCONF) | ||
| 32 | FILE(READ "${libzip_INCLUDE_DIR_ZIPCONF}/zipconf.h" _libzip_VERSION_CONTENTS) | ||
| 33 | if (_libzip_VERSION_CONTENTS) | ||
| 34 | STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" libzip_VERSION "${_libzip_VERSION_CONTENTS}") | ||
| 35 | endif() | ||
| 36 | unset(_libzip_VERSION_CONTENTS) | ||
| 37 | endif() | ||
| 38 | |||
| 39 | set(libzip_VERSION ${libzip_VERSION} CACHE STRING "Version number of libzip") | ||
| 40 | |||
| 41 | include(FindPackageHandleStandardArgs) | ||
| 42 | find_package_handle_standard_args(libzip | ||
| 43 | FOUND_VAR libzip_FOUND | ||
| 44 | REQUIRED_VARS | ||
| 45 | libzip_LIBRARY | ||
| 46 | libzip_INCLUDE_DIR | ||
| 47 | libzip_INCLUDE_DIR_ZIPCONF | ||
| 48 | libzip_VERSION | ||
| 49 | VERSION_VAR libzip_VERSION | ||
| 50 | ) | ||
| 51 | |||
| 52 | if(libzip_FOUND) | ||
| 53 | set(libzip_LIBRARIES ${libzip_LIBRARY}) | ||
| 54 | set(libzip_INCLUDE_DIRS ${libzip_INCLUDE_DIR}) | ||
| 55 | set(libzip_DEFINITIONS ${PC_libzip_CFLAGS_OTHER}) | ||
| 56 | endif() | ||
| 57 | |||
| 58 | if(libzip_FOUND AND NOT TARGET libzip::libzip) | ||
| 59 | add_library(libzip::libzip UNKNOWN IMPORTED) | ||
| 60 | set_target_properties(libzip::libzip PROPERTIES | ||
| 61 | IMPORTED_LOCATION "${libzip_LIBRARY}" | ||
| 62 | INTERFACE_COMPILE_OPTIONS "${PC_libzip_CFLAGS_OTHER}" | ||
| 63 | INTERFACE_INCLUDE_DIRECTORIES "${libzip_INCLUDE_DIR}" | ||
| 64 | ) | ||
| 65 | endif() | ||
| 66 | |||
| 67 | mark_as_advanced( | ||
| 68 | libzip_INCLUDE_DIR | ||
| 69 | libzip_INCLUDE_DIR_ZIPCONF | ||
| 70 | libzip_LIBRARY | ||
| 71 | libzip_VERSION | ||
| 72 | ) | ||
diff --git a/externals/libzip/CMakeLists.txt b/externals/libzip/CMakeLists.txt deleted file mode 100644 index ea5329fa0..000000000 --- a/externals/libzip/CMakeLists.txt +++ /dev/null | |||
| @@ -1,564 +0,0 @@ | |||
| 1 | # TODO: | ||
| 2 | # create usable libtool .la file | ||
| 3 | |||
| 4 | CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2) | ||
| 5 | |||
| 6 | LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libzip") | ||
| 7 | |||
| 8 | PROJECT(libzip C) | ||
| 9 | |||
| 10 | OPTION(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON) | ||
| 11 | OPTION(ENABLE_GNUTLS "Enable use of GnuTLS" ON) | ||
| 12 | OPTION(ENABLE_MBEDTLS "Enable use of mbed TLS" ON) | ||
| 13 | OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) | ||
| 14 | OPTION(ENABLE_WINDOWS_CRYPTO "Enable use of Windows cryptography libraries" ON) | ||
| 15 | |||
| 16 | OPTION(ENABLE_BZIP2 "Enable use of BZip2" OFF) | ||
| 17 | OPTION(ENABLE_LZMA "Enable use of LZMA" OFF) | ||
| 18 | |||
| 19 | INCLUDE(CheckFunctionExists) | ||
| 20 | INCLUDE(CheckIncludeFiles) | ||
| 21 | INCLUDE(CheckSymbolExists) | ||
| 22 | INCLUDE(CheckTypeSize) | ||
| 23 | INCLUDE(CheckCSourceRuns) | ||
| 24 | INCLUDE(CheckCSourceCompiles) | ||
| 25 | INCLUDE(CheckStructHasMember) | ||
| 26 | INCLUDE(TestBigEndian) | ||
| 27 | INCLUDE(GNUInstallDirs) | ||
| 28 | IF(ENABLE_COMMONCRYPTO) | ||
| 29 | CHECK_INCLUDE_FILES(CommonCrypto/CommonCrypto.h COMMONCRYPTO_FOUND) | ||
| 30 | ELSE() | ||
| 31 | SET(COMMONCRYPTO_FOUND FALSE) | ||
| 32 | ENDIF() | ||
| 33 | IF(ENABLE_GNUTLS) | ||
| 34 | INCLUDE(FindNettle) | ||
| 35 | INCLUDE(FindGnuTLS) | ||
| 36 | ELSE() | ||
| 37 | SET(GNUTLS_FOUND FALSE) | ||
| 38 | ENDIF() | ||
| 39 | IF(ENABLE_MBEDTLS) | ||
| 40 | FIND_PATH(MBEDTLS_INCLUDE_DIR mbedtls/aes.h) | ||
| 41 | FIND_LIBRARY(MBEDTLS_LIBRARIES NAMES mbedcrypto) | ||
| 42 | ELSE() | ||
| 43 | SET(MBEDTLS_LIBRARIES FALSE) | ||
| 44 | ENDIF() | ||
| 45 | IF(ENABLE_OPENSSL) | ||
| 46 | INCLUDE(FindOpenSSL) | ||
| 47 | ELSE() | ||
| 48 | SET(OPENSSL_FOUND FALSE) | ||
| 49 | ENDIF() | ||
| 50 | IF(WIN32) | ||
| 51 | IF(ENABLE_WINDOWS_CRYPTO) | ||
| 52 | SET(WINDOWS_CRYPTO_FOUND TRUE) | ||
| 53 | ENDIF() | ||
| 54 | ELSE() | ||
| 55 | SET(WINDOWS_CRYPTO_FOUND FALSE) | ||
| 56 | ENDIF() | ||
| 57 | |||
| 58 | OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
| 59 | OPTION(SHARED_LIB_VERSIONNING "Add SO version in .so build" ON) | ||
| 60 | |||
| 61 | SET(PACKAGE "libzip") | ||
| 62 | SET(PACKAGE_NAME ${PACKAGE}) | ||
| 63 | SET(PACKAGE_VERSION_MAJOR "1") | ||
| 64 | SET(PACKAGE_VERSION_MINOR "5") | ||
| 65 | SET(PACKAGE_VERSION_MICRO "2a") | ||
| 66 | #SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") | ||
| 67 | SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_MICRO}") | ||
| 68 | SET(PACKAGE_VERSION ${VERSION}) | ||
| 69 | SET(LIBZIP_VERSION ${PACKAGE_VERSION}) | ||
| 70 | SET(LIBZIP_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR}) | ||
| 71 | SET(LIBZIP_VERSION_MINOR ${PACKAGE_VERSION_MINOR}) | ||
| 72 | SET(LIBZIP_VERSION_MICRO ${PACKAGE_VERSION_MICRO}) | ||
| 73 | SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | ||
| 74 | |||
| 75 | SET(ARCHIVE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) | ||
| 76 | IF(NOT TARGET dist) | ||
| 77 | ADD_CUSTOM_TARGET(dist | ||
| 78 | COMMAND git config tar.tar.xz.command "xz -c" | ||
| 79 | COMMAND git archive --prefix=${ARCHIVE_NAME}/ -o ${ARCHIVE_NAME}.tar.gz HEAD | ||
| 80 | COMMAND git archive --prefix=${ARCHIVE_NAME}/ -o ${ARCHIVE_NAME}.tar.xz HEAD | ||
| 81 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| 82 | ) | ||
| 83 | ADD_CUSTOM_TARGET(distcheck | ||
| 84 | COMMAND chmod -R u+w ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest 2>/dev/null || true | ||
| 85 | COMMAND rm -rf ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest | ||
| 86 | COMMAND cmake -E tar xf ${ARCHIVE_NAME}.tar.gz | ||
| 87 | COMMAND chmod -R u-w ${ARCHIVE_NAME} | ||
| 88 | COMMAND mkdir ${ARCHIVE_NAME}-build | ||
| 89 | COMMAND mkdir ${ARCHIVE_NAME}-dest | ||
| 90 | COMMAND cd ${ARCHIVE_NAME}-build && cmake -DCMAKE_INSTALL_PREFIX=../${ARCHIVE_NAME}-dest ../${ARCHIVE_NAME} | ||
| 91 | COMMAND cd ${ARCHIVE_NAME}-build && make -j4 | ||
| 92 | COMMAND cd ${ARCHIVE_NAME}-build && make test | ||
| 93 | COMMAND cd ${ARCHIVE_NAME}-build && make install | ||
| 94 | # COMMAND cd ${ARCHIVE_NAME}-build && make uninstall | ||
| 95 | # COMMAND if [ `find ${ARCHIVE_NAME}-dest ! -type d | wc -l` -ne 0 ]; then echo leftover files in ${ARCHIVE_NAME}-dest; false; fi | ||
| 96 | COMMAND cd ${ARCHIVE_NAME}-build && make clean | ||
| 97 | COMMAND chmod -R u+w ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest | ||
| 98 | COMMAND rm -rf ${ARCHIVE_NAME} ${ARCHIVE_NAME}-build ${ARCHIVE_NAME}-dest | ||
| 99 | COMMAND echo "${ARCHIVE_NAME}.tar.gz is ready for distribution." | ||
| 100 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| 101 | ) | ||
| 102 | ADD_DEPENDENCIES(distcheck dist) | ||
| 103 | ENDIF(NOT TARGET dist) | ||
| 104 | |||
| 105 | IF(BUILD_SHARED_LIBS) | ||
| 106 | SET(HAVE_SHARED TRUE) | ||
| 107 | ELSE() | ||
| 108 | SET(ZIP_STATIC TRUE) | ||
| 109 | ENDIF() | ||
| 110 | |||
| 111 | # Checks | ||
| 112 | |||
| 113 | CHECK_FUNCTION_EXISTS(_chmod HAVE__CHMOD) | ||
| 114 | CHECK_FUNCTION_EXISTS(_close HAVE__CLOSE) | ||
| 115 | CHECK_FUNCTION_EXISTS(_dup HAVE__DUP) | ||
| 116 | CHECK_FUNCTION_EXISTS(_fdopen HAVE__FDOPEN) | ||
| 117 | CHECK_FUNCTION_EXISTS(_fileno HAVE__FILENO) | ||
| 118 | CHECK_FUNCTION_EXISTS(_open HAVE__OPEN) | ||
| 119 | CHECK_FUNCTION_EXISTS(_setmode HAVE__SETMODE) | ||
| 120 | CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF) | ||
| 121 | CHECK_FUNCTION_EXISTS(_strdup HAVE__STRDUP) | ||
| 122 | CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP) | ||
| 123 | CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64) | ||
| 124 | CHECK_FUNCTION_EXISTS(_strtoui64 HAVE__STRTOUI64) | ||
| 125 | CHECK_FUNCTION_EXISTS(_unlink HAVE__UNLINK) | ||
| 126 | CHECK_FUNCTION_EXISTS(arc4random HAVE_ARC4RANDOM) | ||
| 127 | CHECK_FUNCTION_EXISTS(clonefile HAVE_CLONEFILE) | ||
| 128 | CHECK_FUNCTION_EXISTS(explicit_bzero HAVE_EXPLICIT_BZERO) | ||
| 129 | CHECK_FUNCTION_EXISTS(explicit_memset HAVE_EXPLICIT_MEMSET) | ||
| 130 | CHECK_FUNCTION_EXISTS(fileno HAVE_FILENO) | ||
| 131 | CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) | ||
| 132 | CHECK_FUNCTION_EXISTS(ftello HAVE_FTELLO) | ||
| 133 | CHECK_FUNCTION_EXISTS(getprogname HAVE_GETPROGNAME) | ||
| 134 | CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R) | ||
| 135 | CHECK_FUNCTION_EXISTS(open HAVE_OPEN) | ||
| 136 | CHECK_FUNCTION_EXISTS(setmode HAVE_SETMODE) | ||
| 137 | CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) | ||
| 138 | CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) | ||
| 139 | CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP) | ||
| 140 | CHECK_FUNCTION_EXISTS(stricmp HAVE_STRICMP) | ||
| 141 | CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL) | ||
| 142 | CHECK_FUNCTION_EXISTS(strtoull HAVE_STRTOULL) | ||
| 143 | |||
| 144 | CHECK_INCLUDE_FILES("sys/types.h;sys/stat.h;fts.h" HAVE_FTS_H) | ||
| 145 | CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H) | ||
| 146 | CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H) | ||
| 147 | CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) | ||
| 148 | |||
| 149 | CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H_LIBZIP) | ||
| 150 | CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H_LIBZIP) | ||
| 151 | CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H_LIBZIP) | ||
| 152 | |||
| 153 | # TODO: fix test | ||
| 154 | # this test does not find __progname even when it exists | ||
| 155 | #CHECK_SYMBOL_EXISTS(__progname stdlib.h HAVE___PROGNAME) | ||
| 156 | |||
| 157 | CHECK_TYPE_SIZE(__int8 __INT8_LIBZIP) | ||
| 158 | CHECK_TYPE_SIZE(int8_t INT8_T_LIBZIP) | ||
| 159 | CHECK_TYPE_SIZE(uint8_t UINT8_T_LIBZIP) | ||
| 160 | CHECK_TYPE_SIZE(__int16 __INT16_LIBZIP) | ||
| 161 | CHECK_TYPE_SIZE(int16_t INT16_T_LIBZIP) | ||
| 162 | CHECK_TYPE_SIZE(uint16_t UINT16_T_LIBZIP) | ||
| 163 | CHECK_TYPE_SIZE(__int32 __INT32_LIBZIP) | ||
| 164 | CHECK_TYPE_SIZE(int32_t INT32_T_LIBZIP) | ||
| 165 | CHECK_TYPE_SIZE(uint32_t UINT32_T_LIBZIP) | ||
| 166 | CHECK_TYPE_SIZE(__int64 __INT64_LIBZIP) | ||
| 167 | CHECK_TYPE_SIZE(int64_t INT64_T_LIBZIP) | ||
| 168 | CHECK_TYPE_SIZE(uint64_t UINT64_T_LIBZIP) | ||
| 169 | CHECK_TYPE_SIZE("short" SHORT_LIBZIP) | ||
| 170 | CHECK_TYPE_SIZE("int" INT_LIBZIP) | ||
| 171 | CHECK_TYPE_SIZE("long" LONG_LIBZIP) | ||
| 172 | CHECK_TYPE_SIZE("long long" LONG_LONG_LIBZIP) | ||
| 173 | CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T) | ||
| 174 | CHECK_TYPE_SIZE("size_t" SIZE_T_LIBZIP) | ||
| 175 | CHECK_TYPE_SIZE("ssize_t" SSIZE_T_LIBZIP) | ||
| 176 | |||
| 177 | CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h> | ||
| 178 | #include <linux/fs.h> | ||
| 179 | int main(int argc, char *argv[]) { unsigned long x = FICLONERANGE; }" HAVE_FICLONERANGE) | ||
| 180 | |||
| 181 | CHECK_C_SOURCE_COMPILES(" | ||
| 182 | int foo(char * _Nullable bar); | ||
| 183 | int main(int argc, char *argv[]) { }" HAVE_NULLABLE) | ||
| 184 | |||
| 185 | TEST_BIG_ENDIAN(WORDS_BIGENDIAN) | ||
| 186 | |||
| 187 | #FIND_PACKAGE(ZLIB 1.1.2 REQUIRED) | ||
| 188 | INCLUDE_DIRECTORIES(../zlib/zlib) | ||
| 189 | SET(CMAKE_REQUIRED_INCLUDES ../zlib/zlib) | ||
| 190 | |||
| 191 | IF(ENABLE_BZIP2) | ||
| 192 | FIND_PACKAGE(BZip2) | ||
| 193 | IF(BZIP2_FOUND) | ||
| 194 | SET (HAVE_LIBBZ2 1) | ||
| 195 | |||
| 196 | INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) | ||
| 197 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${BZIP2_LIBRARIES}) | ||
| 198 | ELSE() | ||
| 199 | MESSAGE(WARNING "-- bzip2 library not found; bzip2 support disabled") | ||
| 200 | ENDIF(BZIP2_FOUND) | ||
| 201 | ENDIF(ENABLE_BZIP2) | ||
| 202 | |||
| 203 | IF(ENABLE_LZMA) | ||
| 204 | FIND_PACKAGE(LibLZMA) | ||
| 205 | IF(LIBLZMA_FOUND) | ||
| 206 | SET (HAVE_LIBLZMA 1) | ||
| 207 | |||
| 208 | INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIR}) | ||
| 209 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${LIBLZMA_LIBRARY}) | ||
| 210 | ELSE() | ||
| 211 | MESSAGE(WARNING "-- lzma library not found; lzma support disabled") | ||
| 212 | ENDIF(LIBLZMA_FOUND) | ||
| 213 | ENDIF(ENABLE_LZMA) | ||
| 214 | |||
| 215 | |||
| 216 | IF (COMMONCRYPTO_FOUND) | ||
| 217 | SET (HAVE_CRYPTO 1) | ||
| 218 | SET (HAVE_COMMONCRYPTO 1) | ||
| 219 | ELSEIF (WINDOWS_CRYPTO_FOUND) | ||
| 220 | SET (HAVE_CRYPTO 1) | ||
| 221 | SET (HAVE_WINDOWS_CRYPTO 1) | ||
| 222 | ELSEIF (GNUTLS_FOUND AND NETTLE_FOUND) | ||
| 223 | SET (HAVE_CRYPTO 1) | ||
| 224 | SET (HAVE_GNUTLS 1) | ||
| 225 | INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_DIR} ${NETTLE_INCLUDE_DIR}) | ||
| 226 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${GNUTLS_LIBRARY} ${NETTLE_LIBRARY}) | ||
| 227 | ELSEIF (OPENSSL_FOUND) | ||
| 228 | SET (HAVE_CRYPTO 1) | ||
| 229 | SET (HAVE_OPENSSL 1) | ||
| 230 | INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) | ||
| 231 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${OPENSSL_LIBRARIES}) | ||
| 232 | ELSEIF (MBEDTLS_LIBRARIES) | ||
| 233 | SET (HAVE_CRYPTO 1) | ||
| 234 | SET (HAVE_MBEDTLS 1) | ||
| 235 | INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIR}) | ||
| 236 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} ${MBEDTLS_LIBRARIES}) | ||
| 237 | ENDIF() | ||
| 238 | |||
| 239 | IF (NOT HAVE_CRYPTO) | ||
| 240 | MESSAGE(WARNING "-- neither Common Crypto, GnuTLS, mbed TLS, OpenSSL, nor Windows Cryptography found; AES support disabled") | ||
| 241 | ENDIF() | ||
| 242 | |||
| 243 | IF(MSVC) | ||
| 244 | ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS") | ||
| 245 | ADD_DEFINITIONS("-D_CRT_NONSTDC_NO_DEPRECATE") | ||
| 246 | ENDIF(MSVC) | ||
| 247 | |||
| 248 | if(WIN32) | ||
| 249 | if(HAVE_WINDOWS_CRYPTO) | ||
| 250 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} bcrypt) | ||
| 251 | endif() | ||
| 252 | if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) | ||
| 253 | ADD_DEFINITIONS(-DMS_UWP) | ||
| 254 | else(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) | ||
| 255 | SET (OPTIONAL_LIBRARY ${OPTIONAL_LIBRARY} advapi32) | ||
| 256 | endif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) | ||
| 257 | endif(WIN32) | ||
| 258 | |||
| 259 | ADD_DEFINITIONS("-DHAVE_CONFIG_H") | ||
| 260 | |||
| 261 | # rpath handling: use rpath in installed binaries | ||
| 262 | IF(NOT CMAKE_SYSTEM_NAME MATCHES Linux) | ||
| 263 | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") | ||
| 264 | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
| 265 | ENDIF() | ||
| 266 | |||
| 267 | # fixed size integral types | ||
| 268 | |||
| 269 | IF(HAVE_INTTYPES_H_LIBZIP) | ||
| 270 | SET(LIBZIP_TYPES_INCLUDE "#define __STDC_FORMAT_MACROS 1 | ||
| 271 | #include <inttypes.h>") | ||
| 272 | ELSEIF(HAVE_STDINT_H_LIBZIP) | ||
| 273 | SET(LIBZIP_TYPES_INCLUDE "#include <stdint.h>") | ||
| 274 | ELSEIF(HAVE_SYS_TYPES_H_LIBZIP) | ||
| 275 | SET(LIBZIP_TYPES_INCLUDE "#include <sys/types.h>") | ||
| 276 | ENDIF() | ||
| 277 | |||
| 278 | IF(HAVE_INT8_T_LIBZIP) | ||
| 279 | SET(ZIP_INT8_T int8_t) | ||
| 280 | ELSEIF(HAVE___INT8_LIBZIP) | ||
| 281 | SET(ZIP_INT8_T __int8) | ||
| 282 | ELSE() | ||
| 283 | SET(ZIP_INT8_T "signed char") | ||
| 284 | ENDIF() | ||
| 285 | |||
| 286 | IF(HAVE_UINT8_T_LIBZIP) | ||
| 287 | SET(ZIP_UINT8_T uint8_t) | ||
| 288 | ELSEIF(HAVE___INT8_LIBZIP) | ||
| 289 | SET(ZIP_UINT8_T "unsigned __int8") | ||
| 290 | ELSE() | ||
| 291 | SET(ZIP_UINT8_T "unsigned char") | ||
| 292 | ENDIF() | ||
| 293 | |||
| 294 | IF(HAVE_INT16_T_LIBZIP) | ||
| 295 | SET(ZIP_INT16_T int16_t) | ||
| 296 | ELSEIF(HAVE___INT16_LIBZIP) | ||
| 297 | SET(INT16_T_LIBZIP __int16) | ||
| 298 | ELSEIF(SHORT_LIBZIP EQUAL 2) | ||
| 299 | SET(INT16_T_LIBZIP short) | ||
| 300 | ENDIF() | ||
| 301 | |||
| 302 | IF(HAVE_UINT16_T_LIBZIP) | ||
| 303 | SET(ZIP_UINT16_T uint16_t) | ||
| 304 | ELSEIF(HAVE___INT16_LIBZIP) | ||
| 305 | SET(UINT16_T_LIBZIP "unsigned __int16") | ||
| 306 | ELSEIF(SHORT_LIBZIP EQUAL 2) | ||
| 307 | SET(UINT16_T_LIBZIP "unsigned short") | ||
| 308 | ENDIF() | ||
| 309 | |||
| 310 | IF(HAVE_INT32_T_LIBZIP) | ||
| 311 | SET(ZIP_INT32_T int32_t) | ||
| 312 | ELSEIF(HAVE___INT32_LIBZIP) | ||
| 313 | SET(ZIP_INT32_T __int32) | ||
| 314 | ELSEIF(INT_LIBZIP EQUAL 4) | ||
| 315 | SET(ZIP_INT32_T int) | ||
| 316 | ELSEIF(LONG_LIBZIP EQUAL 4) | ||
| 317 | SET(ZIP_INT32_T long) | ||
| 318 | ENDIF() | ||
| 319 | |||
| 320 | IF(HAVE_UINT32_T_LIBZIP) | ||
| 321 | SET(ZIP_UINT32_T uint32_t) | ||
| 322 | ELSEIF(HAVE___INT32_LIBZIP) | ||
| 323 | SET(ZIP_UINT32_T "unsigned __int32") | ||
| 324 | ELSEIF(INT_LIBZIP EQUAL 4) | ||
| 325 | SET(ZIP_UINT32_T "unsigned int") | ||
| 326 | ELSEIF(LONG_LIBZIP EQUAL 4) | ||
| 327 | SET(ZIP_UINT32_T "unsigned long") | ||
| 328 | ENDIF() | ||
| 329 | |||
| 330 | IF(HAVE_INT64_T_LIBZIP) | ||
| 331 | SET(ZIP_INT64_T int64_t) | ||
| 332 | ELSEIF(HAVE___INT64_LIBZIP) | ||
| 333 | SET(ZIP_INT64_T __int64) | ||
| 334 | ELSEIF(LONG_LIBZIP EQUAL 8) | ||
| 335 | SET(ZIP_INT64_T long) | ||
| 336 | ELSEIF(LONG_LONG_LIBZIP EQUAL 8) | ||
| 337 | SET(ZIP_INT64_T "long long") | ||
| 338 | ENDIF() | ||
| 339 | |||
| 340 | IF(HAVE_UINT64_T_LIBZIP) | ||
| 341 | SET(ZIP_UINT64_T uint64_t) | ||
| 342 | ELSEIF(HAVE___INT64_LIBZIP) | ||
| 343 | SET(ZIP_UINT64_T "unsigned __int64") | ||
| 344 | ELSEIF(LONG_LIBZIP EQUAL 8) | ||
| 345 | SET(ZIP_UINT64_T "unsigned long") | ||
| 346 | ELSEIF(LONG_LONG_LIBZIP EQUAL 8) | ||
| 347 | SET(ZIP_UINT64_T "unsigned long long") | ||
| 348 | ENDIF() | ||
| 349 | |||
| 350 | IF(HAVE_NULLABLE) | ||
| 351 | SET(ZIP_NULLABLE_DEFINES) | ||
| 352 | ELSE() | ||
| 353 | SET(ZIP_NULLABLE_DEFINES "#define _Nullable | ||
| 354 | #define _Nonnull") | ||
| 355 | ENDIF() | ||
| 356 | |||
| 357 | # write out config file | ||
| 358 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libzip/cmake-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/libzip/config.h) | ||
| 359 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libzip/cmake-zipconf.h.in ${CMAKE_CURRENT_BINARY_DIR}/libzip/zipconf.h) | ||
| 360 | |||
| 361 | # installation | ||
| 362 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzip/zipconf.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
| 363 | INSTALL(FILES libzip/lib/zip.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
| 364 | |||
| 365 | SET(CMAKE_C_VISIBILITY_PRESET hidden) | ||
| 366 | |||
| 367 | ADD_LIBRARY(zip | ||
| 368 | libzip/lib/zip_add.c | ||
| 369 | libzip/lib/zip_add_dir.c | ||
| 370 | libzip/lib/zip_add_entry.c | ||
| 371 | libzip/lib/zip_algorithm_deflate.c | ||
| 372 | libzip/lib/zip_buffer.c | ||
| 373 | libzip/lib/zip_close.c | ||
| 374 | libzip/lib/zip_delete.c | ||
| 375 | libzip/lib/zip_dir_add.c | ||
| 376 | libzip/lib/zip_dirent.c | ||
| 377 | libzip/lib/zip_discard.c | ||
| 378 | libzip/lib/zip_entry.c | ||
| 379 | libzip/lib/zip_err_str.c | ||
| 380 | libzip/lib/zip_error.c | ||
| 381 | libzip/lib/zip_error_clear.c | ||
| 382 | libzip/lib/zip_error_get.c | ||
| 383 | libzip/lib/zip_error_get_sys_type.c | ||
| 384 | libzip/lib/zip_error_strerror.c | ||
| 385 | libzip/lib/zip_error_to_str.c | ||
| 386 | libzip/lib/zip_extra_field.c | ||
| 387 | libzip/lib/zip_extra_field_api.c | ||
| 388 | libzip/lib/zip_fclose.c | ||
| 389 | libzip/lib/zip_fdopen.c | ||
| 390 | libzip/lib/zip_file_add.c | ||
| 391 | libzip/lib/zip_file_error_clear.c | ||
| 392 | libzip/lib/zip_file_error_get.c | ||
| 393 | libzip/lib/zip_file_get_comment.c | ||
| 394 | libzip/lib/zip_file_get_external_attributes.c | ||
| 395 | libzip/lib/zip_file_get_offset.c | ||
| 396 | libzip/lib/zip_file_rename.c | ||
| 397 | libzip/lib/zip_file_replace.c | ||
| 398 | libzip/lib/zip_file_set_comment.c | ||
| 399 | libzip/lib/zip_file_set_encryption.c | ||
| 400 | libzip/lib/zip_file_set_external_attributes.c | ||
| 401 | libzip/lib/zip_file_set_mtime.c | ||
| 402 | libzip/lib/zip_file_strerror.c | ||
| 403 | libzip/lib/zip_filerange_crc.c | ||
| 404 | libzip/lib/zip_fopen.c | ||
| 405 | libzip/lib/zip_fopen_encrypted.c | ||
| 406 | libzip/lib/zip_fopen_index.c | ||
| 407 | libzip/lib/zip_fopen_index_encrypted.c | ||
| 408 | libzip/lib/zip_fread.c | ||
| 409 | libzip/lib/zip_fseek.c | ||
| 410 | libzip/lib/zip_ftell.c | ||
| 411 | libzip/lib/zip_get_archive_comment.c | ||
| 412 | libzip/lib/zip_get_archive_flag.c | ||
| 413 | libzip/lib/zip_get_encryption_implementation.c | ||
| 414 | libzip/lib/zip_get_file_comment.c | ||
| 415 | libzip/lib/zip_get_name.c | ||
| 416 | libzip/lib/zip_get_num_entries.c | ||
| 417 | libzip/lib/zip_get_num_files.c | ||
| 418 | libzip/lib/zip_hash.c | ||
| 419 | libzip/lib/zip_io_util.c | ||
| 420 | libzip/lib/zip_libzip_version.c | ||
| 421 | libzip/lib/zip_memdup.c | ||
| 422 | libzip/lib/zip_name_locate.c | ||
| 423 | libzip/lib/zip_new.c | ||
| 424 | libzip/lib/zip_open.c | ||
| 425 | libzip/lib/zip_progress.c | ||
| 426 | libzip/lib/zip_rename.c | ||
| 427 | libzip/lib/zip_replace.c | ||
| 428 | libzip/lib/zip_set_archive_comment.c | ||
| 429 | libzip/lib/zip_set_archive_flag.c | ||
| 430 | libzip/lib/zip_set_default_password.c | ||
| 431 | libzip/lib/zip_set_file_comment.c | ||
| 432 | libzip/lib/zip_set_file_compression.c | ||
| 433 | libzip/lib/zip_set_name.c | ||
| 434 | libzip/lib/zip_source_accept_empty.c | ||
| 435 | libzip/lib/zip_source_begin_write.c | ||
| 436 | libzip/lib/zip_source_begin_write_cloning.c | ||
| 437 | libzip/lib/zip_source_buffer.c | ||
| 438 | libzip/lib/zip_source_call.c | ||
| 439 | libzip/lib/zip_source_close.c | ||
| 440 | libzip/lib/zip_source_commit_write.c | ||
| 441 | libzip/lib/zip_source_compress.c | ||
| 442 | libzip/lib/zip_source_crc.c | ||
| 443 | libzip/lib/zip_source_error.c | ||
| 444 | libzip/lib/zip_source_filep.c | ||
| 445 | libzip/lib/zip_source_free.c | ||
| 446 | libzip/lib/zip_source_function.c | ||
| 447 | libzip/lib/zip_source_get_compression_flags.c | ||
| 448 | libzip/lib/zip_source_is_deleted.c | ||
| 449 | libzip/lib/zip_source_layered.c | ||
| 450 | libzip/lib/zip_source_open.c | ||
| 451 | libzip/lib/zip_source_pkware.c | ||
| 452 | libzip/lib/zip_source_read.c | ||
| 453 | libzip/lib/zip_source_remove.c | ||
| 454 | libzip/lib/zip_source_rollback_write.c | ||
| 455 | libzip/lib/zip_source_seek.c | ||
| 456 | libzip/lib/zip_source_seek_write.c | ||
| 457 | libzip/lib/zip_source_stat.c | ||
| 458 | libzip/lib/zip_source_supports.c | ||
| 459 | libzip/lib/zip_source_tell.c | ||
| 460 | libzip/lib/zip_source_tell_write.c | ||
| 461 | libzip/lib/zip_source_window.c | ||
| 462 | libzip/lib/zip_source_write.c | ||
| 463 | libzip/lib/zip_source_zip.c | ||
| 464 | libzip/lib/zip_source_zip_new.c | ||
| 465 | libzip/lib/zip_stat.c | ||
| 466 | libzip/lib/zip_stat_index.c | ||
| 467 | libzip/lib/zip_stat_init.c | ||
| 468 | libzip/lib/zip_strerror.c | ||
| 469 | libzip/lib/zip_string.c | ||
| 470 | libzip/lib/zip_unchange.c | ||
| 471 | libzip/lib/zip_unchange_all.c | ||
| 472 | libzip/lib/zip_unchange_archive.c | ||
| 473 | libzip/lib/zip_unchange_data.c | ||
| 474 | libzip/lib/zip_utf-8.c | ||
| 475 | ) | ||
| 476 | |||
| 477 | IF(WIN32) | ||
| 478 | target_sources(zip PRIVATE | ||
| 479 | libzip/lib/zip_source_win32handle.c | ||
| 480 | libzip/lib/zip_source_win32utf8.c | ||
| 481 | libzip/lib/zip_source_win32w.c | ||
| 482 | ) | ||
| 483 | IF(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) | ||
| 484 | ELSE() | ||
| 485 | target_sources(zip PRIVATE libzip/lib/zip_source_win32a.c) | ||
| 486 | ENDIF() | ||
| 487 | ELSE() | ||
| 488 | target_sources(zip PRIVATE | ||
| 489 | libzip/lib/zip_mkstempm.c | ||
| 490 | libzip/lib/zip_source_file.c | ||
| 491 | libzip/lib/zip_random_unix.c | ||
| 492 | ) | ||
| 493 | ENDIF() | ||
| 494 | |||
| 495 | IF(HAVE_LIBBZ2) | ||
| 496 | target_sources(zip PRIVATE libzip/lib/zip_algorithm_bzip2.c) | ||
| 497 | ENDIF() | ||
| 498 | |||
| 499 | IF(HAVE_LIBLZMA) | ||
| 500 | target_sources(zip PRIVATE libzip/lib/zip_algorithm_xz.c) | ||
| 501 | ENDIF() | ||
| 502 | |||
| 503 | IF(HAVE_COMMONCRYPTO) | ||
| 504 | target_sources(zip PRIVATE libzip/lib/zip_crypto_commoncrypto.c) | ||
| 505 | ELSEIF(HAVE_WINDOWS_CRYPTO) | ||
| 506 | target_sources(zip PRIVATE libzip/lib/zip_crypto_win.c) | ||
| 507 | ELSEIF(HAVE_GNUTLS) | ||
| 508 | target_sources(zip PRIVATE libzip/lib/zip_crypto_gnutls.c) | ||
| 509 | ELSEIF(HAVE_OPENSSL) | ||
| 510 | target_sources(zip PRIVATE libzip/lib/zip_crypto_openssl.c) | ||
| 511 | ELSEIF(HAVE_MBEDTLS) | ||
| 512 | target_sources(zip PRIVATE libzip/lib/zip_crypto_mbedtls.c) | ||
| 513 | ENDIF() | ||
| 514 | |||
| 515 | IF(HAVE_CRYPTO) | ||
| 516 | target_sources(zip PRIVATE | ||
| 517 | libzip/lib/zip_winzip_aes.c | ||
| 518 | libzip/lib/zip_source_winzip_aes_decode.c | ||
| 519 | libzip/lib/zip_source_winzip_aes_encode.c | ||
| 520 | ) | ||
| 521 | ENDIF() | ||
| 522 | |||
| 523 | target_include_directories(zip | ||
| 524 | PUBLIC | ||
| 525 | libzip/lib | ||
| 526 | ${CMAKE_CURRENT_BINARY_DIR}/libzip | ||
| 527 | ) | ||
| 528 | |||
| 529 | # pkgconfig file | ||
| 530 | SET(prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 531 | SET(exec_prefix \${prefix}) | ||
| 532 | SET(bindir \${exec_prefix}/${CMAKE_INSTALL_BINDIR}) | ||
| 533 | SET(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR}) | ||
| 534 | SET(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR}) | ||
| 535 | IF(CMAKE_SYSTEM_NAME MATCHES BSD) | ||
| 536 | SET(PKG_CONFIG_RPATH "-Wl,-R\${libdir}") | ||
| 537 | ENDIF(CMAKE_SYSTEM_NAME MATCHES BSD) | ||
| 538 | get_target_property(LIBS_PRIVATE zip LINK_LIBRARIES) | ||
| 539 | foreach(LIB ${LIBS_PRIVATE}) | ||
| 540 | if(LIB MATCHES "^/") | ||
| 541 | get_filename_component(LIB ${LIB} NAME_WE) | ||
| 542 | string(REGEX REPLACE "^lib" "" LIB ${LIB}) | ||
| 543 | endif() | ||
| 544 | set(LIBS "${LIBS} -l${LIB}") | ||
| 545 | endforeach() | ||
| 546 | CONFIGURE_FILE(libzip/libzip.pc.in libzip/libzip.pc @ONLY) | ||
| 547 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzip.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) | ||
| 548 | |||
| 549 | ADD_CUSTOM_TARGET(update_zip_err_str | ||
| 550 | COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/libzip/lib/make_zip_err_str.sh ${CMAKE_CURRENT_SOURCE_DIR}/libzip/lib/zip.h ${CMAKE_CURRENT_SOURCE_DIR}/libzip/lib/zip_err_str.c | ||
| 551 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libzip/lib/zip.h ${CMAKE_CURRENT_SOURCE_DIR}/libzip/lib/make_zip_err_str.sh | ||
| 552 | ) | ||
| 553 | |||
| 554 | IF(SHARED_LIB_VERSIONNING) | ||
| 555 | SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 5.0 SOVERSION 5) | ||
| 556 | ENDIF() | ||
| 557 | |||
| 558 | TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARIES} ${OPTIONAL_LIBRARY}) | ||
| 559 | INSTALL(TARGETS zip | ||
| 560 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| 561 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| 562 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| 563 | ) | ||
| 564 | |||
diff --git a/externals/libzip/libzip b/externals/libzip/libzip deleted file mode 160000 | |||
| Subproject 89bd6d63bdea9da7627695f6c82e54f16d368b5 | |||
diff --git a/src/common/alignment.h b/src/common/alignment.h index 32d796ffa..1b56569d1 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -9,41 +9,48 @@ | |||
| 9 | namespace Common { | 9 | namespace Common { |
| 10 | 10 | ||
| 11 | template <typename T> | 11 | template <typename T> |
| 12 | requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUp(T value, size_t size) { | 12 | requires std::is_unsigned_v<T> |
| 13 | [[nodiscard]] constexpr T AlignUp(T value, size_t size) { | ||
| 13 | auto mod{static_cast<T>(value % size)}; | 14 | auto mod{static_cast<T>(value % size)}; |
| 14 | value -= mod; | 15 | value -= mod; |
| 15 | return static_cast<T>(mod == T{0} ? value : value + size); | 16 | return static_cast<T>(mod == T{0} ? value : value + size); |
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | template <typename T> | 19 | template <typename T> |
| 19 | requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { | 20 | requires std::is_unsigned_v<T> |
| 21 | [[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { | ||
| 20 | return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); | 22 | return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); |
| 21 | } | 23 | } |
| 22 | 24 | ||
| 23 | template <typename T> | 25 | template <typename T> |
| 24 | requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignDown(T value, size_t size) { | 26 | requires std::is_unsigned_v<T> |
| 27 | [[nodiscard]] constexpr T AlignDown(T value, size_t size) { | ||
| 25 | return static_cast<T>(value - value % size); | 28 | return static_cast<T>(value - value % size); |
| 26 | } | 29 | } |
| 27 | 30 | ||
| 28 | template <typename T> | 31 | template <typename T> |
| 29 | requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool Is4KBAligned(T value) { | 32 | requires std::is_unsigned_v<T> |
| 33 | [[nodiscard]] constexpr bool Is4KBAligned(T value) { | ||
| 30 | return (value & 0xFFF) == 0; | 34 | return (value & 0xFFF) == 0; |
| 31 | } | 35 | } |
| 32 | 36 | ||
| 33 | template <typename T> | 37 | template <typename T> |
| 34 | requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool IsWordAligned(T value) { | 38 | requires std::is_unsigned_v<T> |
| 39 | [[nodiscard]] constexpr bool IsWordAligned(T value) { | ||
| 35 | return (value & 0b11) == 0; | 40 | return (value & 0b11) == 0; |
| 36 | } | 41 | } |
| 37 | 42 | ||
| 38 | template <typename T> | 43 | template <typename T> |
| 39 | requires std::is_integral_v<T>[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { | 44 | requires std::is_integral_v<T> |
| 45 | [[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { | ||
| 40 | using U = typename std::make_unsigned_t<T>; | 46 | using U = typename std::make_unsigned_t<T>; |
| 41 | const U mask = static_cast<U>(alignment - 1); | 47 | const U mask = static_cast<U>(alignment - 1); |
| 42 | return (value & mask) == 0; | 48 | return (value & mask) == 0; |
| 43 | } | 49 | } |
| 44 | 50 | ||
| 45 | template <typename T, typename U> | 51 | template <typename T, typename U> |
| 46 | requires std::is_integral_v<T>[[nodiscard]] constexpr T DivideUp(T x, U y) { | 52 | requires std::is_integral_v<T> |
| 53 | [[nodiscard]] constexpr T DivideUp(T x, U y) { | ||
| 47 | return (x + (y - 1)) / y; | 54 | return (x + (y - 1)) / y; |
| 48 | } | 55 | } |
| 49 | 56 | ||
diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h index 95e1489a9..e1db35464 100644 --- a/src/common/div_ceil.h +++ b/src/common/div_ceil.h | |||
| @@ -11,15 +11,15 @@ namespace Common { | |||
| 11 | 11 | ||
| 12 | /// Ceiled integer division. | 12 | /// Ceiled integer division. |
| 13 | template <typename N, typename D> | 13 | template <typename N, typename D> |
| 14 | requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeil(N number, | 14 | requires std::is_integral_v<N> && std::is_unsigned_v<D> |
| 15 | D divisor) { | 15 | [[nodiscard]] constexpr N DivCeil(N number, D divisor) { |
| 16 | return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); | 16 | return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | /// Ceiled integer division with logarithmic divisor in base 2 | 19 | /// Ceiled integer division with logarithmic divisor in base 2 |
| 20 | template <typename N, typename D> | 20 | template <typename N, typename D> |
| 21 | requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeilLog2( | 21 | requires std::is_integral_v<N> && std::is_unsigned_v<D> |
| 22 | N value, D alignment_log2) { | 22 | [[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { |
| 23 | return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); | 23 | return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); |
| 24 | } | 24 | } |
| 25 | 25 | ||
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 6661244cf..b44a44949 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp | |||
| @@ -314,8 +314,8 @@ private: | |||
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) { | 316 | void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) { |
| 317 | placeholders.erase(it); | ||
| 318 | placeholder_host_pointers.erase(it->lower()); | 317 | placeholder_host_pointers.erase(it->lower()); |
| 318 | placeholders.erase(it); | ||
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /// Return true when a given memory region is a "nieche" and the placeholders don't have to be | 321 | /// Return true when a given memory region is a "nieche" and the placeholders don't have to be |
diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h index 1f696fe80..3173cc449 100644 --- a/src/common/intrusive_red_black_tree.h +++ b/src/common/intrusive_red_black_tree.h | |||
| @@ -235,20 +235,19 @@ public: | |||
| 235 | 235 | ||
| 236 | template <typename T> | 236 | template <typename T> |
| 237 | concept HasLightCompareType = requires { | 237 | concept HasLightCompareType = requires { |
| 238 | { std::is_same<typename T::LightCompareType, void>::value } | 238 | { std::is_same<typename T::LightCompareType, void>::value } -> std::convertible_to<bool>; |
| 239 | ->std::convertible_to<bool>; | ||
| 240 | }; | 239 | }; |
| 241 | 240 | ||
| 242 | namespace impl { | 241 | namespace impl { |
| 243 | 242 | ||
| 244 | template <typename T, typename Default> | 243 | template <typename T, typename Default> |
| 245 | consteval auto* GetLightCompareType() { | 244 | consteval auto* GetLightCompareType() { |
| 246 | if constexpr (HasLightCompareType<T>) { | 245 | if constexpr (HasLightCompareType<T>) { |
| 247 | return static_cast<typename T::LightCompareType*>(nullptr); | 246 | return static_cast<typename T::LightCompareType*>(nullptr); |
| 248 | } else { | 247 | } else { |
| 249 | return static_cast<Default*>(nullptr); | 248 | return static_cast<Default*>(nullptr); |
| 249 | } | ||
| 250 | } | 250 | } |
| 251 | } | ||
| 252 | 251 | ||
| 253 | } // namespace impl | 252 | } // namespace impl |
| 254 | 253 | ||
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 69f0bd8c0..9dd5e3efb 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -69,8 +69,6 @@ void LogSettings() { | |||
| 69 | log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir)); | 69 | log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir)); |
| 70 | log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir)); | 70 | log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir)); |
| 71 | log_setting("Debugging_ProgramArgs", values.program_args.GetValue()); | 71 | log_setting("Debugging_ProgramArgs", values.program_args.GetValue()); |
| 72 | log_setting("Services_BCATBackend", values.bcat_backend.GetValue()); | ||
| 73 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local.GetValue()); | ||
| 74 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); | 72 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); |
| 75 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); | 73 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); |
| 76 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); | 74 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); |
diff --git a/src/common/settings.h b/src/common/settings.h index c53d5acc3..402339443 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -568,8 +568,6 @@ struct Values { | |||
| 568 | BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; | 568 | BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; |
| 569 | 569 | ||
| 570 | // Network | 570 | // Network |
| 571 | BasicSetting<std::string> bcat_backend{"none", "bcat_backend"}; | ||
| 572 | BasicSetting<bool> bcat_boxcat_local{false, "bcat_boxcat_local"}; | ||
| 573 | BasicSetting<std::string> network_interface{std::string(), "network_interface"}; | 571 | BasicSetting<std::string> network_interface{std::string(), "network_interface"}; |
| 574 | 572 | ||
| 575 | // WebService | 573 | // WebService |
diff --git a/src/common/uuid.h b/src/common/uuid.h index 2353179d8..8ea01f8da 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h | |||
| @@ -58,6 +58,13 @@ struct UUID { | |||
| 58 | uuid = INVALID_UUID; | 58 | uuid = INVALID_UUID; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | [[nodiscard]] constexpr bool IsInvalid() const { | ||
| 62 | return uuid == INVALID_UUID; | ||
| 63 | } | ||
| 64 | [[nodiscard]] constexpr bool IsValid() const { | ||
| 65 | return !IsInvalid(); | ||
| 66 | } | ||
| 67 | |||
| 61 | // TODO(ogniK): Properly generate a Nintendo ID | 68 | // TODO(ogniK): Properly generate a Nintendo ID |
| 62 | [[nodiscard]] constexpr u64 GetNintendoID() const { | 69 | [[nodiscard]] constexpr u64 GetNintendoID() const { |
| 63 | return uuid[0]; | 70 | return uuid[0]; |
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 22dba3c2d..ba7c363c1 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h | |||
| @@ -667,8 +667,8 @@ template <typename T> | |||
| 667 | 667 | ||
| 668 | // linear interpolation via float: 0.0=begin, 1.0=end | 668 | // linear interpolation via float: 0.0=begin, 1.0=end |
| 669 | template <typename X> | 669 | template <typename X> |
| 670 | [[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, | 670 | [[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) |
| 671 | const float t) { | 671 | Lerp(const X& begin, const X& end, const float t) { |
| 672 | return begin * (1.f - t) + end * t; | 672 | return begin * (1.f - t) + end * t; |
| 673 | } | 673 | } |
| 674 | 674 | ||
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6f98fbc08..9f0fbba2d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -106,8 +106,6 @@ add_library(core STATIC | |||
| 106 | file_sys/vfs_concat.h | 106 | file_sys/vfs_concat.h |
| 107 | file_sys/vfs_layered.cpp | 107 | file_sys/vfs_layered.cpp |
| 108 | file_sys/vfs_layered.h | 108 | file_sys/vfs_layered.h |
| 109 | file_sys/vfs_libzip.cpp | ||
| 110 | file_sys/vfs_libzip.h | ||
| 111 | file_sys/vfs_offset.cpp | 109 | file_sys/vfs_offset.cpp |
| 112 | file_sys/vfs_offset.h | 110 | file_sys/vfs_offset.h |
| 113 | file_sys/vfs_real.cpp | 111 | file_sys/vfs_real.cpp |
| @@ -654,13 +652,6 @@ add_library(core STATIC | |||
| 654 | tools/freezer.h | 652 | tools/freezer.h |
| 655 | ) | 653 | ) |
| 656 | 654 | ||
| 657 | if (YUZU_ENABLE_BOXCAT) | ||
| 658 | target_sources(core PRIVATE | ||
| 659 | hle/service/bcat/backend/boxcat.cpp | ||
| 660 | hle/service/bcat/backend/boxcat.h | ||
| 661 | ) | ||
| 662 | endif() | ||
| 663 | |||
| 664 | if (MSVC) | 655 | if (MSVC) |
| 665 | target_compile_options(core PRIVATE | 656 | target_compile_options(core PRIVATE |
| 666 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 657 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| @@ -691,12 +682,7 @@ endif() | |||
| 691 | create_target_directory_groups(core) | 682 | create_target_directory_groups(core) |
| 692 | 683 | ||
| 693 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 684 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) |
| 694 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus zip) | 685 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus) |
| 695 | |||
| 696 | if (YUZU_ENABLE_BOXCAT) | ||
| 697 | target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) | ||
| 698 | target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json) | ||
| 699 | endif() | ||
| 700 | 686 | ||
| 701 | if (ENABLE_WEB_SERVICE) | 687 | if (ENABLE_WEB_SERVICE) |
| 702 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) | 688 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 54ebed2c1..bb268a319 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -305,7 +305,6 @@ struct System::Impl { | |||
| 305 | is_powered_on = false; | 305 | is_powered_on = false; |
| 306 | exit_lock = false; | 306 | exit_lock = false; |
| 307 | 307 | ||
| 308 | gpu_core.reset(); | ||
| 309 | services.reset(); | 308 | services.reset(); |
| 310 | service_manager.reset(); | 309 | service_manager.reset(); |
| 311 | cheat_engine.reset(); | 310 | cheat_engine.reset(); |
| @@ -315,6 +314,7 @@ struct System::Impl { | |||
| 315 | core_timing.Shutdown(); | 314 | core_timing.Shutdown(); |
| 316 | app_loader.reset(); | 315 | app_loader.reset(); |
| 317 | perf_stats.reset(); | 316 | perf_stats.reset(); |
| 317 | gpu_core.reset(); | ||
| 318 | kernel.Shutdown(); | 318 | kernel.Shutdown(); |
| 319 | memory.Reset(); | 319 | memory.Reset(); |
| 320 | applet_manager.ClearAll(); | 320 | applet_manager.ClearAll(); |
| @@ -421,6 +421,7 @@ struct System::Impl { | |||
| 421 | bool is_async_gpu{}; | 421 | bool is_async_gpu{}; |
| 422 | 422 | ||
| 423 | ExecuteProgramCallback execute_program_callback; | 423 | ExecuteProgramCallback execute_program_callback; |
| 424 | ExitCallback exit_callback; | ||
| 424 | 425 | ||
| 425 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; | 426 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; |
| 426 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; | 427 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; |
| @@ -798,6 +799,18 @@ void System::ExecuteProgram(std::size_t program_index) { | |||
| 798 | } | 799 | } |
| 799 | } | 800 | } |
| 800 | 801 | ||
| 802 | void System::RegisterExitCallback(ExitCallback&& callback) { | ||
| 803 | impl->exit_callback = std::move(callback); | ||
| 804 | } | ||
| 805 | |||
| 806 | void System::Exit() { | ||
| 807 | if (impl->exit_callback) { | ||
| 808 | impl->exit_callback(); | ||
| 809 | } else { | ||
| 810 | LOG_CRITICAL(Core, "exit_callback must be initialized by the frontend"); | ||
| 811 | } | ||
| 812 | } | ||
| 813 | |||
| 801 | void System::ApplySettings() { | 814 | void System::ApplySettings() { |
| 802 | if (IsPoweredOn()) { | 815 | if (IsPoweredOn()) { |
| 803 | Renderer().RefreshBaseSettings(); | 816 | Renderer().RefreshBaseSettings(); |
diff --git a/src/core/core.h b/src/core/core.h index 715ab88e7..a796472b2 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -387,6 +387,18 @@ public: | |||
| 387 | */ | 387 | */ |
| 388 | void ExecuteProgram(std::size_t program_index); | 388 | void ExecuteProgram(std::size_t program_index); |
| 389 | 389 | ||
| 390 | /// Type used for the frontend to designate a callback for System to exit the application. | ||
| 391 | using ExitCallback = std::function<void()>; | ||
| 392 | |||
| 393 | /** | ||
| 394 | * Registers a callback from the frontend for System to exit the application. | ||
| 395 | * @param callback Callback from the frontend to exit the application. | ||
| 396 | */ | ||
| 397 | void RegisterExitCallback(ExitCallback&& callback); | ||
| 398 | |||
| 399 | /// Instructs the frontend to exit the application. | ||
| 400 | void Exit(); | ||
| 401 | |||
| 390 | /// Applies any changes to settings to this core instance. | 402 | /// Applies any changes to settings to this core instance. |
| 391 | void ApplySettings(); | 403 | void ApplySettings(); |
| 392 | 404 | ||
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 01ae1a567..35a53d36c 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -77,7 +77,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address | |||
| 77 | aci_header.title_id = title_id; | 77 | aci_header.title_id = title_id; |
| 78 | aci_file_access.permissions = filesystem_permissions; | 78 | aci_file_access.permissions = filesystem_permissions; |
| 79 | npdm_header.system_resource_size = system_resource_size; | 79 | npdm_header.system_resource_size = system_resource_size; |
| 80 | aci_kernel_capabilities = std ::move(capabilities); | 80 | aci_kernel_capabilities = std::move(capabilities); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | bool ProgramMetadata::Is64BitProgram() const { | 83 | bool ProgramMetadata::Is64BitProgram() const { |
diff --git a/src/core/file_sys/vfs_libzip.cpp b/src/core/file_sys/vfs_libzip.cpp deleted file mode 100644 index 00e256779..000000000 --- a/src/core/file_sys/vfs_libzip.cpp +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string> | ||
| 6 | |||
| 7 | #ifdef __GNUC__ | ||
| 8 | #pragma GCC diagnostic push | ||
| 9 | #pragma GCC diagnostic ignored "-Wshadow" | ||
| 10 | #endif | ||
| 11 | #include <zip.h> | ||
| 12 | #ifdef __GNUC__ | ||
| 13 | #pragma GCC diagnostic pop | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #include "common/fs/path_util.h" | ||
| 17 | #include "core/file_sys/vfs.h" | ||
| 18 | #include "core/file_sys/vfs_libzip.h" | ||
| 19 | #include "core/file_sys/vfs_vector.h" | ||
| 20 | |||
| 21 | namespace FileSys { | ||
| 22 | |||
| 23 | VirtualDir ExtractZIP(VirtualFile file) { | ||
| 24 | zip_error_t error{}; | ||
| 25 | |||
| 26 | const auto data = file->ReadAllBytes(); | ||
| 27 | std::unique_ptr<zip_source_t, decltype(&zip_source_close)> src{ | ||
| 28 | zip_source_buffer_create(data.data(), data.size(), 0, &error), zip_source_close}; | ||
| 29 | if (src == nullptr) | ||
| 30 | return nullptr; | ||
| 31 | |||
| 32 | std::unique_ptr<zip_t, decltype(&zip_close)> zip{zip_open_from_source(src.get(), 0, &error), | ||
| 33 | zip_close}; | ||
| 34 | if (zip == nullptr) | ||
| 35 | return nullptr; | ||
| 36 | |||
| 37 | std::shared_ptr<VectorVfsDirectory> out = std::make_shared<VectorVfsDirectory>(); | ||
| 38 | |||
| 39 | const auto num_entries = static_cast<std::size_t>(zip_get_num_entries(zip.get(), 0)); | ||
| 40 | |||
| 41 | zip_stat_t stat{}; | ||
| 42 | zip_stat_init(&stat); | ||
| 43 | |||
| 44 | for (std::size_t i = 0; i < num_entries; ++i) { | ||
| 45 | const auto stat_res = zip_stat_index(zip.get(), i, 0, &stat); | ||
| 46 | if (stat_res == -1) | ||
| 47 | return nullptr; | ||
| 48 | |||
| 49 | const std::string name(stat.name); | ||
| 50 | if (name.empty()) | ||
| 51 | continue; | ||
| 52 | |||
| 53 | if (name.back() != '/') { | ||
| 54 | std::unique_ptr<zip_file_t, decltype(&zip_fclose)> file2{ | ||
| 55 | zip_fopen_index(zip.get(), i, 0), zip_fclose}; | ||
| 56 | |||
| 57 | std::vector<u8> buf(stat.size); | ||
| 58 | if (zip_fread(file2.get(), buf.data(), buf.size()) != s64(buf.size())) | ||
| 59 | return nullptr; | ||
| 60 | |||
| 61 | const auto parts = Common::FS::SplitPathComponents(stat.name); | ||
| 62 | const auto new_file = std::make_shared<VectorVfsFile>(buf, parts.back()); | ||
| 63 | |||
| 64 | std::shared_ptr<VectorVfsDirectory> dtrv = out; | ||
| 65 | for (std::size_t j = 0; j < parts.size() - 1; ++j) { | ||
| 66 | if (dtrv == nullptr) | ||
| 67 | return nullptr; | ||
| 68 | const auto subdir = dtrv->GetSubdirectory(parts[j]); | ||
| 69 | if (subdir == nullptr) { | ||
| 70 | const auto temp = std::make_shared<VectorVfsDirectory>( | ||
| 71 | std::vector<VirtualFile>{}, std::vector<VirtualDir>{}, parts[j]); | ||
| 72 | dtrv->AddDirectory(temp); | ||
| 73 | dtrv = temp; | ||
| 74 | } else { | ||
| 75 | dtrv = std::dynamic_pointer_cast<VectorVfsDirectory>(subdir); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | if (dtrv == nullptr) | ||
| 80 | return nullptr; | ||
| 81 | dtrv->AddFile(new_file); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | return out; | ||
| 86 | } | ||
| 87 | |||
| 88 | } // namespace FileSys | ||
diff --git a/src/core/file_sys/vfs_libzip.h b/src/core/file_sys/vfs_libzip.h deleted file mode 100644 index f68af576a..000000000 --- a/src/core/file_sys/vfs_libzip.h +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/file_sys/vfs_types.h" | ||
| 8 | |||
| 9 | namespace FileSys { | ||
| 10 | |||
| 11 | VirtualDir ExtractZIP(VirtualFile zip); | ||
| 12 | |||
| 13 | } // namespace FileSys | ||
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 4c58c310f..3e4f90be2 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp | |||
| @@ -13,7 +13,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default; | |||
| 13 | void DefaultProfileSelectApplet::SelectProfile( | 13 | void DefaultProfileSelectApplet::SelectProfile( |
| 14 | std::function<void(std::optional<Common::UUID>)> callback) const { | 14 | std::function<void(std::optional<Common::UUID>)> callback) const { |
| 15 | Service::Account::ProfileManager manager; | 15 | Service::Account::ProfileManager manager; |
| 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); | 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()) |
| 17 | .value_or(Common::UUID{Common::INVALID_UUID})); | ||
| 17 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); | 18 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); |
| 18 | } | 19 | } |
| 19 | 20 | ||
diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp index 6a420d5b0..44d13169f 100644 --- a/src/core/hle/kernel/k_handle_table.cpp +++ b/src/core/hle/kernel/k_handle_table.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | namespace Kernel { | 7 | namespace Kernel { |
| 8 | 8 | ||
| 9 | KHandleTable::KHandleTable(KernelCore& kernel_) : kernel{kernel_} {} | 9 | KHandleTable::KHandleTable(KernelCore& kernel_) : kernel{kernel_} {} |
| 10 | KHandleTable ::~KHandleTable() = default; | 10 | KHandleTable::~KHandleTable() = default; |
| 11 | 11 | ||
| 12 | ResultCode KHandleTable::Finalize() { | 12 | ResultCode KHandleTable::Finalize() { |
| 13 | // Get the table and clear our record of it. | 13 | // Get the table and clear our record of it. |
diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index 4aa669d95..f4d71ad7e 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h | |||
| @@ -22,12 +22,10 @@ class KThread; | |||
| 22 | 22 | ||
| 23 | template <typename T> | 23 | template <typename T> |
| 24 | concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) { | 24 | concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) { |
| 25 | { t.GetAffinityMask() } | 25 | { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>; |
| 26 | ->Common::ConvertibleTo<u64>; | ||
| 27 | {t.SetAffinityMask(0)}; | 26 | {t.SetAffinityMask(0)}; |
| 28 | 27 | ||
| 29 | { t.GetAffinity(0) } | 28 | { t.GetAffinity(0) } -> std::same_as<bool>; |
| 30 | ->std::same_as<bool>; | ||
| 31 | {t.SetAffinity(0, false)}; | 29 | {t.SetAffinity(0, false)}; |
| 32 | {t.SetAll()}; | 30 | {t.SetAll()}; |
| 33 | }; | 31 | }; |
| @@ -38,25 +36,20 @@ concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) { | |||
| 38 | {(typename T::QueueEntry()).Initialize()}; | 36 | {(typename T::QueueEntry()).Initialize()}; |
| 39 | {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; | 37 | {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; |
| 40 | {(typename T::QueueEntry()).SetNext(std::addressof(t))}; | 38 | {(typename T::QueueEntry()).SetNext(std::addressof(t))}; |
| 41 | { (typename T::QueueEntry()).GetNext() } | 39 | { (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>; |
| 42 | ->std::same_as<T*>; | 40 | { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>; |
| 43 | { (typename T::QueueEntry()).GetPrev() } | 41 | { t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>; |
| 44 | ->std::same_as<T*>; | ||
| 45 | { t.GetPriorityQueueEntry(0) } | ||
| 46 | ->std::same_as<typename T::QueueEntry&>; | ||
| 47 | 42 | ||
| 48 | {t.GetAffinityMask()}; | 43 | {t.GetAffinityMask()}; |
| 49 | { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } | 44 | { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask; |
| 50 | ->KPriorityQueueAffinityMask; | ||
| 51 | 45 | ||
| 52 | { t.GetActiveCore() } | 46 | { t.GetActiveCore() } -> Common::ConvertibleTo<s32>; |
| 53 | ->Common::ConvertibleTo<s32>; | 47 | { t.GetPriority() } -> Common::ConvertibleTo<s32>; |
| 54 | { t.GetPriority() } | ||
| 55 | ->Common::ConvertibleTo<s32>; | ||
| 56 | }; | 48 | }; |
| 57 | 49 | ||
| 58 | template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> | 50 | template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> |
| 59 | requires KPriorityQueueMember<Member> class KPriorityQueue { | 51 | requires KPriorityQueueMember<Member> |
| 52 | class KPriorityQueue { | ||
| 60 | public: | 53 | public: |
| 61 | using AffinityMaskType = std::remove_cv_t< | 54 | using AffinityMaskType = std::remove_cv_t< |
| 62 | std::remove_reference_t<decltype(std::declval<Member>().GetAffinityMask())>>; | 55 | std::remove_reference_t<decltype(std::declval<Member>().GetAffinityMask())>>; |
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index 12cfae919..c8ccc1ae4 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h | |||
| @@ -197,7 +197,7 @@ private: | |||
| 197 | 197 | ||
| 198 | class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { | 198 | class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { |
| 199 | public: | 199 | public: |
| 200 | explicit KScopedSchedulerLock(KernelCore & kernel); | 200 | explicit KScopedSchedulerLock(KernelCore& kernel); |
| 201 | ~KScopedSchedulerLock(); | 201 | ~KScopedSchedulerLock(); |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index 72c3b0252..4fb180fc6 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h | |||
| @@ -13,19 +13,18 @@ namespace Kernel { | |||
| 13 | 13 | ||
| 14 | template <typename T> | 14 | template <typename T> |
| 15 | concept KLockable = !std::is_reference_v<T> && requires(T & t) { | 15 | concept KLockable = !std::is_reference_v<T> && requires(T & t) { |
| 16 | { t.Lock() } | 16 | { t.Lock() } -> std::same_as<void>; |
| 17 | ->std::same_as<void>; | 17 | { t.Unlock() } -> std::same_as<void>; |
| 18 | { t.Unlock() } | ||
| 19 | ->std::same_as<void>; | ||
| 20 | }; | 18 | }; |
| 21 | 19 | ||
| 22 | template <typename T> | 20 | template <typename T> |
| 23 | requires KLockable<T> class [[nodiscard]] KScopedLock { | 21 | requires KLockable<T> |
| 22 | class [[nodiscard]] KScopedLock { | ||
| 24 | public: | 23 | public: |
| 25 | explicit KScopedLock(T * l) : lock_ptr(l) { | 24 | explicit KScopedLock(T* l) : lock_ptr(l) { |
| 26 | this->lock_ptr->Lock(); | 25 | this->lock_ptr->Lock(); |
| 27 | } | 26 | } |
| 28 | explicit KScopedLock(T & l) : KScopedLock(std::addressof(l)) {} | 27 | explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) {} |
| 29 | 28 | ||
| 30 | ~KScopedLock() { | 29 | ~KScopedLock() { |
| 31 | this->lock_ptr->Unlock(); | 30 | this->lock_ptr->Unlock(); |
| @@ -34,7 +33,7 @@ public: | |||
| 34 | KScopedLock(const KScopedLock&) = delete; | 33 | KScopedLock(const KScopedLock&) = delete; |
| 35 | KScopedLock& operator=(const KScopedLock&) = delete; | 34 | KScopedLock& operator=(const KScopedLock&) = delete; |
| 36 | 35 | ||
| 37 | KScopedLock(KScopedLock &&) = delete; | 36 | KScopedLock(KScopedLock&&) = delete; |
| 38 | KScopedLock& operator=(KScopedLock&&) = delete; | 37 | KScopedLock& operator=(KScopedLock&&) = delete; |
| 39 | 38 | ||
| 40 | private: | 39 | private: |
diff --git a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h index a86af56dd..f6c75f2d9 100644 --- a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h +++ b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h | |||
| @@ -17,7 +17,7 @@ namespace Kernel { | |||
| 17 | 17 | ||
| 18 | class [[nodiscard]] KScopedSchedulerLockAndSleep { | 18 | class [[nodiscard]] KScopedSchedulerLockAndSleep { |
| 19 | public: | 19 | public: |
| 20 | explicit KScopedSchedulerLockAndSleep(KernelCore & kernel_, KThread * t, s64 timeout) | 20 | explicit KScopedSchedulerLockAndSleep(KernelCore& kernel_, KThread* t, s64 timeout) |
| 21 | : kernel(kernel_), thread(t), timeout_tick(timeout) { | 21 | : kernel(kernel_), thread(t), timeout_tick(timeout) { |
| 22 | // Lock the scheduler. | 22 | // Lock the scheduler. |
| 23 | kernel.GlobalSchedulerContext().scheduler_lock.Lock(); | 23 | kernel.GlobalSchedulerContext().scheduler_lock.Lock(); |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6d9ec0a8a..689b36056 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -929,8 +929,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex | |||
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | const auto user_list = profile_manager->GetAllUsers(); | 931 | const auto user_list = profile_manager->GetAllUsers(); |
| 932 | if (std::all_of(user_list.begin(), user_list.end(), | 932 | if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { |
| 933 | [](const auto& user) { return user.uuid == Common::INVALID_UUID; })) { | ||
| 934 | rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code | 933 | rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code |
| 935 | rb.PushRaw<u128>(Common::INVALID_UUID); | 934 | rb.PushRaw<u128>(Common::INVALID_UUID); |
| 936 | return; | 935 | return; |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 24a1c9157..568303ced 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -208,9 +208,10 @@ bool ProfileManager::UserExists(UUID uuid) const { | |||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | bool ProfileManager::UserExistsIndex(std::size_t index) const { | 210 | bool ProfileManager::UserExistsIndex(std::size_t index) const { |
| 211 | if (index >= MAX_USERS) | 211 | if (index >= MAX_USERS) { |
| 212 | return false; | 212 | return false; |
| 213 | return profiles[index].user_uuid.uuid != Common::INVALID_UUID; | 213 | } |
| 214 | return profiles[index].user_uuid.IsValid(); | ||
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | /// Opens a specific user | 217 | /// Opens a specific user |
| @@ -304,7 +305,7 @@ bool ProfileManager::RemoveUser(UUID uuid) { | |||
| 304 | 305 | ||
| 305 | bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { | 306 | bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { |
| 306 | const auto index = GetUserIndex(uuid); | 307 | const auto index = GetUserIndex(uuid); |
| 307 | if (!index || profile_new.user_uuid == UUID(Common::INVALID_UUID)) { | 308 | if (!index || profile_new.user_uuid.IsInvalid()) { |
| 308 | return false; | 309 | return false; |
| 309 | } | 310 | } |
| 310 | 311 | ||
| @@ -346,7 +347,7 @@ void ProfileManager::ParseUserSaveFile() { | |||
| 346 | } | 347 | } |
| 347 | 348 | ||
| 348 | for (const auto& user : data.users) { | 349 | for (const auto& user : data.users) { |
| 349 | if (user.uuid == UUID(Common::INVALID_UUID)) { | 350 | if (user.uuid.IsInvalid()) { |
| 350 | continue; | 351 | continue; |
| 351 | } | 352 | } |
| 352 | 353 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c3ac73131..49e9787a4 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -275,12 +275,14 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv | |||
| 275 | {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, | 275 | {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, |
| 276 | {19, &ISelfController::SetAlbumImageOrientation, "SetAlbumImageOrientation"}, | 276 | {19, &ISelfController::SetAlbumImageOrientation, "SetAlbumImageOrientation"}, |
| 277 | {20, nullptr, "SetDesirableKeyboardLayout"}, | 277 | {20, nullptr, "SetDesirableKeyboardLayout"}, |
| 278 | {21, nullptr, "GetScreenShotProgramId"}, | ||
| 278 | {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"}, | 279 | {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"}, |
| 279 | {41, nullptr, "IsSystemBufferSharingEnabled"}, | 280 | {41, nullptr, "IsSystemBufferSharingEnabled"}, |
| 280 | {42, nullptr, "GetSystemSharedLayerHandle"}, | 281 | {42, nullptr, "GetSystemSharedLayerHandle"}, |
| 281 | {43, nullptr, "GetSystemSharedBufferHandle"}, | 282 | {43, nullptr, "GetSystemSharedBufferHandle"}, |
| 282 | {44, &ISelfController::CreateManagedDisplaySeparableLayer, "CreateManagedDisplaySeparableLayer"}, | 283 | {44, &ISelfController::CreateManagedDisplaySeparableLayer, "CreateManagedDisplaySeparableLayer"}, |
| 283 | {45, nullptr, "SetManagedDisplayLayerSeparationMode"}, | 284 | {45, nullptr, "SetManagedDisplayLayerSeparationMode"}, |
| 285 | {46, nullptr, "SetRecordingLayerCompositionEnabled"}, | ||
| 284 | {50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"}, | 286 | {50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"}, |
| 285 | {51, nullptr, "ApproveToDisplay"}, | 287 | {51, nullptr, "ApproveToDisplay"}, |
| 286 | {60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"}, | 288 | {60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"}, |
| @@ -302,6 +304,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv | |||
| 302 | {100, &ISelfController::SetAlbumImageTakenNotificationEnabled, "SetAlbumImageTakenNotificationEnabled"}, | 304 | {100, &ISelfController::SetAlbumImageTakenNotificationEnabled, "SetAlbumImageTakenNotificationEnabled"}, |
| 303 | {110, nullptr, "SetApplicationAlbumUserData"}, | 305 | {110, nullptr, "SetApplicationAlbumUserData"}, |
| 304 | {120, nullptr, "SaveCurrentScreenshot"}, | 306 | {120, nullptr, "SaveCurrentScreenshot"}, |
| 307 | {130, nullptr, "SetRecordVolumeMuted"}, | ||
| 305 | {1000, nullptr, "GetDebugStorageChannel"}, | 308 | {1000, nullptr, "GetDebugStorageChannel"}, |
| 306 | }; | 309 | }; |
| 307 | // clang-format on | 310 | // clang-format on |
| @@ -329,10 +332,10 @@ ISelfController::~ISelfController() = default; | |||
| 329 | void ISelfController::Exit(Kernel::HLERequestContext& ctx) { | 332 | void ISelfController::Exit(Kernel::HLERequestContext& ctx) { |
| 330 | LOG_DEBUG(Service_AM, "called"); | 333 | LOG_DEBUG(Service_AM, "called"); |
| 331 | 334 | ||
| 332 | system.Shutdown(); | ||
| 333 | |||
| 334 | IPC::ResponseBuilder rb{ctx, 2}; | 335 | IPC::ResponseBuilder rb{ctx, 2}; |
| 335 | rb.Push(ResultSuccess); | 336 | rb.Push(ResultSuccess); |
| 337 | |||
| 338 | system.Exit(); | ||
| 336 | } | 339 | } |
| 337 | 340 | ||
| 338 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { | 341 | void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { |
| @@ -683,6 +686,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, | |||
| 683 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, | 686 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, |
| 684 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, | 687 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, |
| 685 | {110, nullptr, "OpenMyGpuErrorHandler"}, | 688 | {110, nullptr, "OpenMyGpuErrorHandler"}, |
| 689 | {120, nullptr, "GetAppletLaunchedHistory"}, | ||
| 686 | {200, nullptr, "GetOperationModeSystemInfo"}, | 690 | {200, nullptr, "GetOperationModeSystemInfo"}, |
| 687 | {300, nullptr, "GetSettingsPlatformRegion"}, | 691 | {300, nullptr, "GetSettingsPlatformRegion"}, |
| 688 | {400, nullptr, "ActivateMigrationService"}, | 692 | {400, nullptr, "ActivateMigrationService"}, |
diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index bdc21778e..a6e891944 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp | |||
| @@ -60,7 +60,7 @@ void ProfileSelect::Execute() { | |||
| 60 | void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { | 60 | void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { |
| 61 | UserSelectionOutput output{}; | 61 | UserSelectionOutput output{}; |
| 62 | 62 | ||
| 63 | if (uuid.has_value() && uuid->uuid != Common::INVALID_UUID) { | 63 | if (uuid.has_value() && uuid->IsValid()) { |
| 64 | output.result = 0; | 64 | output.result = 0; |
| 65 | output.uuid_selected = uuid->uuid; | 65 | output.uuid_selected = uuid->uuid; |
| 66 | } else { | 66 | } else { |
diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 8c4c49b85..2e46e7161 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp | |||
| @@ -41,6 +41,14 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { | |||
| 41 | {27, nullptr, "SetVolumeMappingTableForDev"}, | 41 | {27, nullptr, "SetVolumeMappingTableForDev"}, |
| 42 | {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, | 42 | {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, |
| 43 | {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, | 43 | {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, |
| 44 | {30, nullptr, "Unknown30"}, | ||
| 45 | {31, nullptr, "Unknown31"}, | ||
| 46 | {32, nullptr, "Unknown32"}, | ||
| 47 | {33, nullptr, "Unknown33"}, | ||
| 48 | {34, nullptr, "Unknown34"}, | ||
| 49 | {10000, nullptr, "Unknown10000"}, | ||
| 50 | {10001, nullptr, "Unknown10001"}, | ||
| 51 | {10002, nullptr, "Unknown10002"}, | ||
| 44 | }; | 52 | }; |
| 45 | // clang-format on | 53 | // clang-format on |
| 46 | 54 | ||
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 3e7fd6024..570525019 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp | |||
| @@ -3,38 +3,65 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/core.h" | ||
| 6 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/kernel/hle_ipc.h" | 8 | #include "core/hle/kernel/hle_ipc.h" |
| 9 | #include "core/hle/kernel/k_event.h" | ||
| 8 | #include "core/hle/service/audio/audin_u.h" | 10 | #include "core/hle/service/audio/audin_u.h" |
| 9 | 11 | ||
| 10 | namespace Service::Audio { | 12 | namespace Service::Audio { |
| 11 | 13 | ||
| 12 | class IAudioIn final : public ServiceFramework<IAudioIn> { | 14 | IAudioIn::IAudioIn(Core::System& system_) |
| 13 | public: | 15 | : ServiceFramework{system_, "IAudioIn"}, buffer_event{system_.Kernel()} { |
| 14 | explicit IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} { | 16 | // clang-format off |
| 15 | // clang-format off | 17 | static const FunctionInfo functions[] = { |
| 16 | static const FunctionInfo functions[] = { | 18 | {0, nullptr, "GetAudioInState"}, |
| 17 | {0, nullptr, "GetAudioInState"}, | 19 | {1, &IAudioIn::Start, "Start"}, |
| 18 | {1, nullptr, "Start"}, | 20 | {2, nullptr, "Stop"}, |
| 19 | {2, nullptr, "Stop"}, | 21 | {3, nullptr, "AppendAudioInBuffer"}, |
| 20 | {3, nullptr, "AppendAudioInBuffer"}, | 22 | {4, &IAudioIn::RegisterBufferEvent, "RegisterBufferEvent"}, |
| 21 | {4, nullptr, "RegisterBufferEvent"}, | 23 | {5, nullptr, "GetReleasedAudioInBuffer"}, |
| 22 | {5, nullptr, "GetReleasedAudioInBuffer"}, | 24 | {6, nullptr, "ContainsAudioInBuffer"}, |
| 23 | {6, nullptr, "ContainsAudioInBuffer"}, | 25 | {7, nullptr, "AppendUacInBuffer"}, |
| 24 | {7, nullptr, "AppendUacInBuffer"}, | 26 | {8, &IAudioIn::AppendAudioInBufferAuto, "AppendAudioInBufferAuto"}, |
| 25 | {8, nullptr, "AppendAudioInBufferAuto"}, | 27 | {9, nullptr, "GetReleasedAudioInBuffersAuto"}, |
| 26 | {9, nullptr, "GetReleasedAudioInBuffersAuto"}, | 28 | {10, nullptr, "AppendUacInBufferAuto"}, |
| 27 | {10, nullptr, "AppendUacInBufferAuto"}, | 29 | {11, nullptr, "GetAudioInBufferCount"}, |
| 28 | {11, nullptr, "GetAudioInBufferCount"}, | 30 | {12, nullptr, "SetDeviceGain"}, |
| 29 | {12, nullptr, "SetDeviceGain"}, | 31 | {13, nullptr, "GetDeviceGain"}, |
| 30 | {13, nullptr, "GetDeviceGain"}, | 32 | {14, nullptr, "FlushAudioInBuffers"}, |
| 31 | {14, nullptr, "FlushAudioInBuffers"}, | 33 | }; |
| 32 | }; | 34 | // clang-format on |
| 33 | // clang-format on | 35 | |
| 34 | 36 | RegisterHandlers(functions); | |
| 35 | RegisterHandlers(functions); | 37 | |
| 36 | } | 38 | Kernel::KAutoObject::Create(std::addressof(buffer_event)); |
| 37 | }; | 39 | buffer_event.Initialize("IAudioIn:BufferEvent"); |
| 40 | } | ||
| 41 | |||
| 42 | IAudioIn::~IAudioIn() = default; | ||
| 43 | |||
| 44 | void IAudioIn::Start(Kernel::HLERequestContext& ctx) { | ||
| 45 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 46 | |||
| 47 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 48 | rb.Push(ResultSuccess); | ||
| 49 | } | ||
| 50 | |||
| 51 | void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) { | ||
| 52 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 53 | |||
| 54 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 55 | rb.Push(ResultSuccess); | ||
| 56 | rb.PushCopyObjects(buffer_event.GetReadableEvent()); | ||
| 57 | } | ||
| 58 | |||
| 59 | void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) { | ||
| 60 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 61 | |||
| 62 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 63 | rb.Push(ResultSuccess); | ||
| 64 | } | ||
| 38 | 65 | ||
| 39 | AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} { | 66 | AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} { |
| 40 | // clang-format off | 67 | // clang-format off |
diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h index 0d75ae5ac..f2f7f9932 100644 --- a/src/core/hle/service/audio/audin_u.h +++ b/src/core/hle/service/audio/audin_u.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/k_event.h" | ||
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| 9 | namespace Core { | 10 | namespace Core { |
| @@ -16,6 +17,19 @@ class HLERequestContext; | |||
| 16 | 17 | ||
| 17 | namespace Service::Audio { | 18 | namespace Service::Audio { |
| 18 | 19 | ||
| 20 | class IAudioIn final : public ServiceFramework<IAudioIn> { | ||
| 21 | public: | ||
| 22 | explicit IAudioIn(Core::System& system_); | ||
| 23 | ~IAudioIn() override; | ||
| 24 | |||
| 25 | private: | ||
| 26 | void Start(Kernel::HLERequestContext& ctx); | ||
| 27 | void RegisterBufferEvent(Kernel::HLERequestContext& ctx); | ||
| 28 | void AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx); | ||
| 29 | |||
| 30 | Kernel::KEvent buffer_event; | ||
| 31 | }; | ||
| 32 | |||
| 19 | class AudInU final : public ServiceFramework<AudInU> { | 33 | class AudInU final : public ServiceFramework<AudInU> { |
| 20 | public: | 34 | public: |
| 21 | explicit AudInU(Core::System& system_); | 35 | explicit AudInU(Core::System& system_); |
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index b769fe959..1a91719f5 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -187,7 +187,8 @@ public: | |||
| 187 | {10, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceNameAuto"}, | 187 | {10, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceNameAuto"}, |
| 188 | {11, &IAudioDevice::QueryAudioDeviceInputEvent, "QueryAudioDeviceInputEvent"}, | 188 | {11, &IAudioDevice::QueryAudioDeviceInputEvent, "QueryAudioDeviceInputEvent"}, |
| 189 | {12, &IAudioDevice::QueryAudioDeviceOutputEvent, "QueryAudioDeviceOutputEvent"}, | 189 | {12, &IAudioDevice::QueryAudioDeviceOutputEvent, "QueryAudioDeviceOutputEvent"}, |
| 190 | {13, nullptr, "GetAudioSystemMasterVolumeSetting"}, | 190 | {13, nullptr, "GetActiveAudioOutputDeviceName"}, |
| 191 | {14, nullptr, "ListAudioOutputDeviceName"}, | ||
| 191 | }; | 192 | }; |
| 192 | RegisterHandlers(functions); | 193 | RegisterHandlers(functions); |
| 193 | } | 194 | } |
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp deleted file mode 100644 index 7ca7f2aac..000000000 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ /dev/null | |||
| @@ -1,548 +0,0 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <fmt/ostream.h> | ||
| 6 | |||
| 7 | #ifdef __GNUC__ | ||
| 8 | #pragma GCC diagnostic push | ||
| 9 | #pragma GCC diagnostic ignored "-Wshadow" | ||
| 10 | #ifndef __clang__ | ||
| 11 | #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" | ||
| 12 | #endif | ||
| 13 | #endif | ||
| 14 | #include <httplib.h> | ||
| 15 | #include <mbedtls/sha256.h> | ||
| 16 | #include <nlohmann/json.hpp> | ||
| 17 | #ifdef __GNUC__ | ||
| 18 | #pragma GCC diagnostic pop | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #include "common/fs/file.h" | ||
| 22 | #include "common/fs/fs.h" | ||
| 23 | #include "common/fs/path_util.h" | ||
| 24 | #include "common/hex_util.h" | ||
| 25 | #include "common/logging/log.h" | ||
| 26 | #include "common/settings.h" | ||
| 27 | #include "core/core.h" | ||
| 28 | #include "core/file_sys/vfs.h" | ||
| 29 | #include "core/file_sys/vfs_libzip.h" | ||
| 30 | #include "core/file_sys/vfs_vector.h" | ||
| 31 | #include "core/frontend/applets/error.h" | ||
| 32 | #include "core/hle/service/am/applets/applets.h" | ||
| 33 | #include "core/hle/service/bcat/backend/boxcat.h" | ||
| 34 | |||
| 35 | namespace Service::BCAT { | ||
| 36 | namespace { | ||
| 37 | |||
| 38 | // Prevents conflicts with windows macro called CreateFile | ||
| 39 | FileSys::VirtualFile VfsCreateFileWrap(FileSys::VirtualDir dir, std::string_view name) { | ||
| 40 | return dir->CreateFile(name); | ||
| 41 | } | ||
| 42 | |||
| 43 | // Prevents conflicts with windows macro called DeleteFile | ||
| 44 | bool VfsDeleteFileWrap(FileSys::VirtualDir dir, std::string_view name) { | ||
| 45 | return dir->DeleteFile(name); | ||
| 46 | } | ||
| 47 | |||
| 48 | constexpr ResultCode ERROR_GENERAL_BCAT_FAILURE{ErrorModule::BCAT, 1}; | ||
| 49 | |||
| 50 | constexpr char BOXCAT_HOSTNAME[] = "api.yuzu-emu.org"; | ||
| 51 | |||
| 52 | // Formatted using fmt with arg[0] = hex title id | ||
| 53 | constexpr char BOXCAT_PATHNAME_DATA[] = "/game-assets/{:016X}/boxcat"; | ||
| 54 | constexpr char BOXCAT_PATHNAME_LAUNCHPARAM[] = "/game-assets/{:016X}/launchparam"; | ||
| 55 | |||
| 56 | constexpr char BOXCAT_PATHNAME_EVENTS[] = "/game-assets/boxcat/events"; | ||
| 57 | |||
| 58 | constexpr char BOXCAT_API_VERSION[] = "1"; | ||
| 59 | constexpr char BOXCAT_CLIENT_TYPE[] = "yuzu"; | ||
| 60 | |||
| 61 | // HTTP status codes for Boxcat | ||
| 62 | enum class ResponseStatus { | ||
| 63 | Ok = 200, ///< Operation completed successfully. | ||
| 64 | BadClientVersion = 301, ///< The Boxcat-Client-Version doesn't match the server. | ||
| 65 | NoUpdate = 304, ///< The digest provided would match the new data, no need to update. | ||
| 66 | NoMatchTitleId = 404, ///< The title ID provided doesn't have a boxcat implementation. | ||
| 67 | NoMatchBuildId = 406, ///< The build ID provided is blacklisted (potentially because of format | ||
| 68 | ///< issues or whatnot) and has no data. | ||
| 69 | }; | ||
| 70 | |||
| 71 | enum class DownloadResult { | ||
| 72 | Success = 0, | ||
| 73 | NoResponse, | ||
| 74 | GeneralWebError, | ||
| 75 | NoMatchTitleId, | ||
| 76 | NoMatchBuildId, | ||
| 77 | InvalidContentType, | ||
| 78 | GeneralFSError, | ||
| 79 | BadClientVersion, | ||
| 80 | }; | ||
| 81 | |||
| 82 | constexpr std::array<const char*, 8> DOWNLOAD_RESULT_LOG_MESSAGES{ | ||
| 83 | "Success", | ||
| 84 | "There was no response from the server.", | ||
| 85 | "There was a general web error code returned from the server.", | ||
| 86 | "The title ID of the current game doesn't have a boxcat implementation. If you believe an " | ||
| 87 | "implementation should be added, contact yuzu support.", | ||
| 88 | "The build ID of the current version of the game is marked as incompatible with the current " | ||
| 89 | "BCAT distribution. Try upgrading or downgrading your game version or contacting yuzu support.", | ||
| 90 | "The content type of the web response was invalid.", | ||
| 91 | "There was a general filesystem error while saving the zip file.", | ||
| 92 | "The server is either too new or too old to serve the request. Try using the latest version of " | ||
| 93 | "an official release of yuzu.", | ||
| 94 | }; | ||
| 95 | |||
| 96 | std::ostream& operator<<(std::ostream& os, DownloadResult result) { | ||
| 97 | return os << DOWNLOAD_RESULT_LOG_MESSAGES.at(static_cast<std::size_t>(result)); | ||
| 98 | } | ||
| 99 | |||
| 100 | constexpr u32 PORT = 443; | ||
| 101 | constexpr u32 TIMEOUT_SECONDS = 30; | ||
| 102 | [[maybe_unused]] constexpr u64 VFS_COPY_BLOCK_SIZE = 1ULL << 24; // 4MB | ||
| 103 | |||
| 104 | std::filesystem::path GetBINFilePath(u64 title_id) { | ||
| 105 | return Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / "bcat" / | ||
| 106 | fmt::format("{:016X}/launchparam.bin", title_id); | ||
| 107 | } | ||
| 108 | |||
| 109 | std::filesystem::path GetZIPFilePath(u64 title_id) { | ||
| 110 | return Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / "bcat" / | ||
| 111 | fmt::format("{:016X}/data.zip", title_id); | ||
| 112 | } | ||
| 113 | |||
| 114 | // If the error is something the user should know about (build ID mismatch, bad client version), | ||
| 115 | // display an error. | ||
| 116 | void HandleDownloadDisplayResult(const AM::Applets::AppletManager& applet_manager, | ||
| 117 | DownloadResult res) { | ||
| 118 | if (res == DownloadResult::Success || res == DownloadResult::NoResponse || | ||
| 119 | res == DownloadResult::GeneralWebError || res == DownloadResult::GeneralFSError || | ||
| 120 | res == DownloadResult::NoMatchTitleId || res == DownloadResult::InvalidContentType) { | ||
| 121 | return; | ||
| 122 | } | ||
| 123 | |||
| 124 | const auto& frontend{applet_manager.GetAppletFrontendSet()}; | ||
| 125 | frontend.error->ShowCustomErrorText( | ||
| 126 | ResultUnknown, "There was an error while attempting to use Boxcat.", | ||
| 127 | DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {}); | ||
| 128 | } | ||
| 129 | |||
| 130 | bool VfsRawCopyProgress(FileSys::VirtualFile src, FileSys::VirtualFile dest, | ||
| 131 | std::string_view dir_name, ProgressServiceBackend& progress, | ||
| 132 | std::size_t block_size = 0x1000) { | ||
| 133 | if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) | ||
| 134 | return false; | ||
| 135 | if (!dest->Resize(src->GetSize())) | ||
| 136 | return false; | ||
| 137 | |||
| 138 | progress.StartDownloadingFile(dir_name, src->GetName(), src->GetSize()); | ||
| 139 | |||
| 140 | std::vector<u8> temp(std::min(block_size, src->GetSize())); | ||
| 141 | for (std::size_t i = 0; i < src->GetSize(); i += block_size) { | ||
| 142 | const auto read = std::min(block_size, src->GetSize() - i); | ||
| 143 | |||
| 144 | if (src->Read(temp.data(), read, i) != read) { | ||
| 145 | return false; | ||
| 146 | } | ||
| 147 | |||
| 148 | if (dest->Write(temp.data(), read, i) != read) { | ||
| 149 | return false; | ||
| 150 | } | ||
| 151 | |||
| 152 | progress.UpdateFileProgress(i); | ||
| 153 | } | ||
| 154 | |||
| 155 | progress.FinishDownloadingFile(); | ||
| 156 | |||
| 157 | return true; | ||
| 158 | } | ||
| 159 | |||
| 160 | bool VfsRawCopyDProgressSingle(FileSys::VirtualDir src, FileSys::VirtualDir dest, | ||
| 161 | ProgressServiceBackend& progress, std::size_t block_size = 0x1000) { | ||
| 162 | if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) | ||
| 163 | return false; | ||
| 164 | |||
| 165 | for (const auto& file : src->GetFiles()) { | ||
| 166 | const auto out_file = VfsCreateFileWrap(dest, file->GetName()); | ||
| 167 | if (!VfsRawCopyProgress(file, out_file, src->GetName(), progress, block_size)) { | ||
| 168 | return false; | ||
| 169 | } | ||
| 170 | } | ||
| 171 | progress.CommitDirectory(src->GetName()); | ||
| 172 | |||
| 173 | return true; | ||
| 174 | } | ||
| 175 | |||
| 176 | bool VfsRawCopyDProgress(FileSys::VirtualDir src, FileSys::VirtualDir dest, | ||
| 177 | ProgressServiceBackend& progress, std::size_t block_size = 0x1000) { | ||
| 178 | if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) | ||
| 179 | return false; | ||
| 180 | |||
| 181 | for (const auto& dir : src->GetSubdirectories()) { | ||
| 182 | const auto out = dest->CreateSubdirectory(dir->GetName()); | ||
| 183 | if (!VfsRawCopyDProgressSingle(dir, out, progress, block_size)) { | ||
| 184 | return false; | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 188 | return true; | ||
| 189 | } | ||
| 190 | |||
| 191 | } // Anonymous namespace | ||
| 192 | |||
| 193 | class Boxcat::Client { | ||
| 194 | public: | ||
| 195 | Client(std::filesystem::path path_, u64 title_id_, u64 build_id_) | ||
| 196 | : path(std::move(path_)), title_id(title_id_), build_id(build_id_) {} | ||
| 197 | |||
| 198 | DownloadResult DownloadDataZip() { | ||
| 199 | return DownloadInternal(fmt::format(BOXCAT_PATHNAME_DATA, title_id), TIMEOUT_SECONDS, | ||
| 200 | "application/zip"); | ||
| 201 | } | ||
| 202 | |||
| 203 | DownloadResult DownloadLaunchParam() { | ||
| 204 | return DownloadInternal(fmt::format(BOXCAT_PATHNAME_LAUNCHPARAM, title_id), | ||
| 205 | TIMEOUT_SECONDS / 3, "application/octet-stream"); | ||
| 206 | } | ||
| 207 | |||
| 208 | private: | ||
| 209 | DownloadResult DownloadInternal(const std::string& resolved_path, u32 timeout_seconds, | ||
| 210 | const std::string& content_type_name) { | ||
| 211 | if (client == nullptr) { | ||
| 212 | client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT); | ||
| 213 | client->set_connection_timeout(timeout_seconds); | ||
| 214 | client->set_read_timeout(timeout_seconds); | ||
| 215 | client->set_write_timeout(timeout_seconds); | ||
| 216 | } | ||
| 217 | |||
| 218 | httplib::Headers headers{ | ||
| 219 | {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, | ||
| 220 | {std::string("Boxcat-Client-Type"), std::string(BOXCAT_CLIENT_TYPE)}, | ||
| 221 | {std::string("Game-Build-Id"), fmt::format("{:016X}", build_id)}, | ||
| 222 | }; | ||
| 223 | |||
| 224 | if (Common::FS::Exists(path)) { | ||
| 225 | Common::FS::IOFile file{path, Common::FS::FileAccessMode::Read, | ||
| 226 | Common::FS::FileType::BinaryFile}; | ||
| 227 | if (file.IsOpen()) { | ||
| 228 | std::vector<u8> bytes(file.GetSize()); | ||
| 229 | void(file.Read(bytes)); | ||
| 230 | const auto digest = DigestFile(bytes); | ||
| 231 | headers.insert({std::string("If-None-Match"), Common::HexToString(digest, false)}); | ||
| 232 | } | ||
| 233 | } | ||
| 234 | |||
| 235 | const auto response = client->Get(resolved_path.c_str(), headers); | ||
| 236 | if (response == nullptr) | ||
| 237 | return DownloadResult::NoResponse; | ||
| 238 | |||
| 239 | if (response->status == static_cast<int>(ResponseStatus::NoUpdate)) | ||
| 240 | return DownloadResult::Success; | ||
| 241 | if (response->status == static_cast<int>(ResponseStatus::BadClientVersion)) | ||
| 242 | return DownloadResult::BadClientVersion; | ||
| 243 | if (response->status == static_cast<int>(ResponseStatus::NoMatchTitleId)) | ||
| 244 | return DownloadResult::NoMatchTitleId; | ||
| 245 | if (response->status == static_cast<int>(ResponseStatus::NoMatchBuildId)) | ||
| 246 | return DownloadResult::NoMatchBuildId; | ||
| 247 | if (response->status != static_cast<int>(ResponseStatus::Ok)) | ||
| 248 | return DownloadResult::GeneralWebError; | ||
| 249 | |||
| 250 | const auto content_type = response->headers.find("content-type"); | ||
| 251 | if (content_type == response->headers.end() || | ||
| 252 | content_type->second.find(content_type_name) == std::string::npos) { | ||
| 253 | return DownloadResult::InvalidContentType; | ||
| 254 | } | ||
| 255 | |||
| 256 | if (!Common::FS::CreateDirs(path)) { | ||
| 257 | return DownloadResult::GeneralFSError; | ||
| 258 | } | ||
| 259 | |||
| 260 | Common::FS::IOFile file{path, Common::FS::FileAccessMode::Append, | ||
| 261 | Common::FS::FileType::BinaryFile}; | ||
| 262 | if (!file.IsOpen()) { | ||
| 263 | return DownloadResult::GeneralFSError; | ||
| 264 | } | ||
| 265 | |||
| 266 | if (!file.SetSize(response->body.size())) { | ||
| 267 | return DownloadResult::GeneralFSError; | ||
| 268 | } | ||
| 269 | |||
| 270 | if (file.Write(response->body) != response->body.size()) { | ||
| 271 | return DownloadResult::GeneralFSError; | ||
| 272 | } | ||
| 273 | |||
| 274 | return DownloadResult::Success; | ||
| 275 | } | ||
| 276 | |||
| 277 | using Digest = std::array<u8, 0x20>; | ||
| 278 | static Digest DigestFile(std::vector<u8> bytes) { | ||
| 279 | Digest out{}; | ||
| 280 | mbedtls_sha256_ret(bytes.data(), bytes.size(), out.data(), 0); | ||
| 281 | return out; | ||
| 282 | } | ||
| 283 | |||
| 284 | std::unique_ptr<httplib::SSLClient> client; | ||
| 285 | std::filesystem::path path; | ||
| 286 | u64 title_id; | ||
| 287 | u64 build_id; | ||
| 288 | }; | ||
| 289 | |||
| 290 | Boxcat::Boxcat(AM::Applets::AppletManager& applet_manager_, DirectoryGetter getter) | ||
| 291 | : Backend(std::move(getter)), applet_manager{applet_manager_} {} | ||
| 292 | |||
| 293 | Boxcat::~Boxcat() = default; | ||
| 294 | |||
| 295 | void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGetter dir_getter, | ||
| 296 | TitleIDVersion title, ProgressServiceBackend& progress, | ||
| 297 | std::optional<std::string> dir_name = {}) { | ||
| 298 | progress.SetNeedHLELock(true); | ||
| 299 | |||
| 300 | if (Settings::values.bcat_boxcat_local) { | ||
| 301 | LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download."); | ||
| 302 | const auto dir = dir_getter(title.title_id); | ||
| 303 | if (dir) | ||
| 304 | progress.SetTotalSize(dir->GetSize()); | ||
| 305 | progress.FinishDownload(ResultSuccess); | ||
| 306 | return; | ||
| 307 | } | ||
| 308 | |||
| 309 | const auto zip_path = GetZIPFilePath(title.title_id); | ||
| 310 | Boxcat::Client client{zip_path, title.title_id, title.build_id}; | ||
| 311 | |||
| 312 | progress.StartConnecting(); | ||
| 313 | |||
| 314 | const auto res = client.DownloadDataZip(); | ||
| 315 | if (res != DownloadResult::Success) { | ||
| 316 | LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res); | ||
| 317 | |||
| 318 | if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) { | ||
| 319 | Common::FS::RemoveFile(zip_path); | ||
| 320 | } | ||
| 321 | |||
| 322 | HandleDownloadDisplayResult(applet_manager, res); | ||
| 323 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 324 | return; | ||
| 325 | } | ||
| 326 | |||
| 327 | progress.StartProcessingDataList(); | ||
| 328 | |||
| 329 | Common::FS::IOFile zip{zip_path, Common::FS::FileAccessMode::Read, | ||
| 330 | Common::FS::FileType::BinaryFile}; | ||
| 331 | const auto size = zip.GetSize(); | ||
| 332 | std::vector<u8> bytes(size); | ||
| 333 | if (!zip.IsOpen() || size == 0 || zip.Read(bytes) != bytes.size()) { | ||
| 334 | LOG_ERROR(Service_BCAT, "Boxcat failed to read ZIP file at path '{}'!", | ||
| 335 | Common::FS::PathToUTF8String(zip_path)); | ||
| 336 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 337 | return; | ||
| 338 | } | ||
| 339 | |||
| 340 | const auto extracted = FileSys::ExtractZIP(std::make_shared<FileSys::VectorVfsFile>(bytes)); | ||
| 341 | if (extracted == nullptr) { | ||
| 342 | LOG_ERROR(Service_BCAT, "Boxcat failed to extract ZIP file!"); | ||
| 343 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 344 | return; | ||
| 345 | } | ||
| 346 | |||
| 347 | if (dir_name == std::nullopt) { | ||
| 348 | progress.SetTotalSize(extracted->GetSize()); | ||
| 349 | |||
| 350 | const auto target_dir = dir_getter(title.title_id); | ||
| 351 | if (target_dir == nullptr || !VfsRawCopyDProgress(extracted, target_dir, progress)) { | ||
| 352 | LOG_ERROR(Service_BCAT, "Boxcat failed to copy extracted ZIP to target directory!"); | ||
| 353 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 354 | return; | ||
| 355 | } | ||
| 356 | } else { | ||
| 357 | const auto target_dir = dir_getter(title.title_id); | ||
| 358 | if (target_dir == nullptr) { | ||
| 359 | LOG_ERROR(Service_BCAT, "Boxcat failed to get directory for title ID!"); | ||
| 360 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 361 | return; | ||
| 362 | } | ||
| 363 | |||
| 364 | const auto target_sub = target_dir->GetSubdirectory(*dir_name); | ||
| 365 | const auto source_sub = extracted->GetSubdirectory(*dir_name); | ||
| 366 | |||
| 367 | progress.SetTotalSize(source_sub->GetSize()); | ||
| 368 | |||
| 369 | std::vector<std::string> filenames; | ||
| 370 | { | ||
| 371 | const auto files = target_sub->GetFiles(); | ||
| 372 | std::transform(files.begin(), files.end(), std::back_inserter(filenames), | ||
| 373 | [](const auto& vfile) { return vfile->GetName(); }); | ||
| 374 | } | ||
| 375 | |||
| 376 | for (const auto& filename : filenames) { | ||
| 377 | VfsDeleteFileWrap(target_sub, filename); | ||
| 378 | } | ||
| 379 | |||
| 380 | if (target_sub == nullptr || source_sub == nullptr || | ||
| 381 | !VfsRawCopyDProgressSingle(source_sub, target_sub, progress)) { | ||
| 382 | LOG_ERROR(Service_BCAT, "Boxcat failed to copy extracted ZIP to target directory!"); | ||
| 383 | progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); | ||
| 384 | return; | ||
| 385 | } | ||
| 386 | } | ||
| 387 | |||
| 388 | progress.FinishDownload(ResultSuccess); | ||
| 389 | } | ||
| 390 | |||
| 391 | bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { | ||
| 392 | is_syncing.exchange(true); | ||
| 393 | |||
| 394 | std::thread([this, title, &progress] { | ||
| 395 | SynchronizeInternal(applet_manager, dir_getter, title, progress); | ||
| 396 | }).detach(); | ||
| 397 | |||
| 398 | return true; | ||
| 399 | } | ||
| 400 | |||
| 401 | bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name, | ||
| 402 | ProgressServiceBackend& progress) { | ||
| 403 | is_syncing.exchange(true); | ||
| 404 | |||
| 405 | std::thread([this, title, name, &progress] { | ||
| 406 | SynchronizeInternal(applet_manager, dir_getter, title, progress, name); | ||
| 407 | }).detach(); | ||
| 408 | |||
| 409 | return true; | ||
| 410 | } | ||
| 411 | |||
| 412 | bool Boxcat::Clear(u64 title_id) { | ||
| 413 | if (Settings::values.bcat_boxcat_local) { | ||
| 414 | LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping clear."); | ||
| 415 | return true; | ||
| 416 | } | ||
| 417 | |||
| 418 | const auto dir = dir_getter(title_id); | ||
| 419 | |||
| 420 | std::vector<std::string> dirnames; | ||
| 421 | |||
| 422 | for (const auto& subdir : dir->GetSubdirectories()) | ||
| 423 | dirnames.push_back(subdir->GetName()); | ||
| 424 | |||
| 425 | for (const auto& subdir : dirnames) { | ||
| 426 | if (!dir->DeleteSubdirectoryRecursive(subdir)) | ||
| 427 | return false; | ||
| 428 | } | ||
| 429 | |||
| 430 | return true; | ||
| 431 | } | ||
| 432 | |||
| 433 | void Boxcat::SetPassphrase(u64 title_id, const Passphrase& passphrase) { | ||
| 434 | LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id, | ||
| 435 | Common::HexToString(passphrase)); | ||
| 436 | } | ||
| 437 | |||
| 438 | std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title) { | ||
| 439 | const auto bin_file_path = GetBINFilePath(title.title_id); | ||
| 440 | |||
| 441 | if (Settings::values.bcat_boxcat_local) { | ||
| 442 | LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download."); | ||
| 443 | } else { | ||
| 444 | Client launch_client{bin_file_path, title.title_id, title.build_id}; | ||
| 445 | |||
| 446 | const auto res = launch_client.DownloadLaunchParam(); | ||
| 447 | if (res != DownloadResult::Success) { | ||
| 448 | LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res); | ||
| 449 | |||
| 450 | if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) { | ||
| 451 | Common::FS::RemoveFile(bin_file_path); | ||
| 452 | } | ||
| 453 | |||
| 454 | HandleDownloadDisplayResult(applet_manager, res); | ||
| 455 | return std::nullopt; | ||
| 456 | } | ||
| 457 | } | ||
| 458 | |||
| 459 | Common::FS::IOFile bin{bin_file_path, Common::FS::FileAccessMode::Read, | ||
| 460 | Common::FS::FileType::BinaryFile}; | ||
| 461 | const auto size = bin.GetSize(); | ||
| 462 | std::vector<u8> bytes(size); | ||
| 463 | if (!bin.IsOpen() || size == 0 || bin.Read(bytes) != bytes.size()) { | ||
| 464 | LOG_ERROR(Service_BCAT, "Boxcat failed to read launch parameter binary at path '{}'!", | ||
| 465 | Common::FS::PathToUTF8String(bin_file_path)); | ||
| 466 | return std::nullopt; | ||
| 467 | } | ||
| 468 | |||
| 469 | return bytes; | ||
| 470 | } | ||
| 471 | |||
| 472 | Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global, | ||
| 473 | std::map<std::string, EventStatus>& games) { | ||
| 474 | httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT)}; | ||
| 475 | client.set_connection_timeout(static_cast<int>(TIMEOUT_SECONDS)); | ||
| 476 | client.set_read_timeout(static_cast<int>(TIMEOUT_SECONDS)); | ||
| 477 | client.set_write_timeout(static_cast<int>(TIMEOUT_SECONDS)); | ||
| 478 | |||
| 479 | httplib::Headers headers{ | ||
| 480 | {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, | ||
| 481 | {std::string("Boxcat-Client-Type"), std::string(BOXCAT_CLIENT_TYPE)}, | ||
| 482 | }; | ||
| 483 | |||
| 484 | if (!client.is_valid()) { | ||
| 485 | LOG_ERROR(Service_BCAT, "Client is invalid, going offline!"); | ||
| 486 | return StatusResult::Offline; | ||
| 487 | } | ||
| 488 | |||
| 489 | if (!client.is_socket_open()) { | ||
| 490 | LOG_ERROR(Service_BCAT, "Failed to open socket, going offline!"); | ||
| 491 | return StatusResult::Offline; | ||
| 492 | } | ||
| 493 | |||
| 494 | const auto response = client.Get(BOXCAT_PATHNAME_EVENTS, headers); | ||
| 495 | if (response == nullptr) | ||
| 496 | return StatusResult::Offline; | ||
| 497 | |||
| 498 | if (response->status == static_cast<int>(ResponseStatus::BadClientVersion)) | ||
| 499 | return StatusResult::BadClientVersion; | ||
| 500 | |||
| 501 | try { | ||
| 502 | nlohmann::json json = nlohmann::json::parse(response->body); | ||
| 503 | |||
| 504 | if (!json["online"].get<bool>()) | ||
| 505 | return StatusResult::Offline; | ||
| 506 | |||
| 507 | if (json["global"].is_null()) | ||
| 508 | global = std::nullopt; | ||
| 509 | else | ||
| 510 | global = json["global"].get<std::string>(); | ||
| 511 | |||
| 512 | if (json["games"].is_array()) { | ||
| 513 | for (const auto& object : json["games"]) { | ||
| 514 | if (object.is_object() && object.find("name") != object.end()) { | ||
| 515 | EventStatus detail{}; | ||
| 516 | if (object["header"].is_string()) { | ||
| 517 | detail.header = object["header"].get<std::string>(); | ||
| 518 | } else { | ||
| 519 | detail.header = std::nullopt; | ||
| 520 | } | ||
| 521 | |||
| 522 | if (object["footer"].is_string()) { | ||
| 523 | detail.footer = object["footer"].get<std::string>(); | ||
| 524 | } else { | ||
| 525 | detail.footer = std::nullopt; | ||
| 526 | } | ||
| 527 | |||
| 528 | if (object["events"].is_array()) { | ||
| 529 | for (const auto& event : object["events"]) { | ||
| 530 | if (!event.is_string()) | ||
| 531 | continue; | ||
| 532 | detail.events.push_back(event.get<std::string>()); | ||
| 533 | } | ||
| 534 | } | ||
| 535 | |||
| 536 | games.insert_or_assign(object["name"], std::move(detail)); | ||
| 537 | } | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | return StatusResult::Success; | ||
| 542 | } catch (const nlohmann::json::parse_error& error) { | ||
| 543 | LOG_ERROR(Service_BCAT, "{}", error.what()); | ||
| 544 | return StatusResult::ParseError; | ||
| 545 | } | ||
| 546 | } | ||
| 547 | |||
| 548 | } // namespace Service::BCAT | ||
diff --git a/src/core/hle/service/bcat/backend/boxcat.h b/src/core/hle/service/bcat/backend/boxcat.h deleted file mode 100644 index d65b42e58..000000000 --- a/src/core/hle/service/bcat/backend/boxcat.h +++ /dev/null | |||
| @@ -1,64 +0,0 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <atomic> | ||
| 8 | #include <map> | ||
| 9 | #include <optional> | ||
| 10 | #include "core/hle/service/bcat/backend/backend.h" | ||
| 11 | |||
| 12 | namespace Service::AM::Applets { | ||
| 13 | class AppletManager; | ||
| 14 | } | ||
| 15 | |||
| 16 | namespace Service::BCAT { | ||
| 17 | |||
| 18 | struct EventStatus { | ||
| 19 | std::optional<std::string> header; | ||
| 20 | std::optional<std::string> footer; | ||
| 21 | std::vector<std::string> events; | ||
| 22 | }; | ||
| 23 | |||
| 24 | /// Boxcat is yuzu's custom backend implementation of Nintendo's BCAT service. It is free to use and | ||
| 25 | /// doesn't require a switch or nintendo account. The content is controlled by the yuzu team. | ||
| 26 | class Boxcat final : public Backend { | ||
| 27 | friend void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, | ||
| 28 | DirectoryGetter dir_getter, TitleIDVersion title, | ||
| 29 | ProgressServiceBackend& progress, | ||
| 30 | std::optional<std::string> dir_name); | ||
| 31 | |||
| 32 | public: | ||
| 33 | explicit Boxcat(AM::Applets::AppletManager& applet_manager_, DirectoryGetter getter); | ||
| 34 | ~Boxcat() override; | ||
| 35 | |||
| 36 | bool Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) override; | ||
| 37 | bool SynchronizeDirectory(TitleIDVersion title, std::string name, | ||
| 38 | ProgressServiceBackend& progress) override; | ||
| 39 | |||
| 40 | bool Clear(u64 title_id) override; | ||
| 41 | |||
| 42 | void SetPassphrase(u64 title_id, const Passphrase& passphrase) override; | ||
| 43 | |||
| 44 | std::optional<std::vector<u8>> GetLaunchParameter(TitleIDVersion title) override; | ||
| 45 | |||
| 46 | enum class StatusResult { | ||
| 47 | Success, | ||
| 48 | Offline, | ||
| 49 | ParseError, | ||
| 50 | BadClientVersion, | ||
| 51 | }; | ||
| 52 | |||
| 53 | static StatusResult GetStatus(std::optional<std::string>& global, | ||
| 54 | std::map<std::string, EventStatus>& games); | ||
| 55 | |||
| 56 | private: | ||
| 57 | std::atomic_bool is_syncing{false}; | ||
| 58 | |||
| 59 | class Client; | ||
| 60 | std::unique_ptr<Client> client; | ||
| 61 | AM::Applets::AppletManager& applet_manager; | ||
| 62 | }; | ||
| 63 | |||
| 64 | } // namespace Service::BCAT | ||
diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp index 72294eb2e..701f634f8 100644 --- a/src/core/hle/service/bcat/bcat_module.cpp +++ b/src/core/hle/service/bcat/bcat_module.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <cctype> | 5 | #include <cctype> |
| 6 | #include <mbedtls/md5.h> | 6 | #include <mbedtls/md5.h> |
| 7 | #include "backend/boxcat.h" | ||
| 8 | #include "common/hex_util.h" | 7 | #include "common/hex_util.h" |
| 9 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 10 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| @@ -578,12 +577,6 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( | |||
| 578 | 577 | ||
| 579 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, | 578 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, |
| 580 | DirectoryGetter getter) { | 579 | DirectoryGetter getter) { |
| 581 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 582 | if (Settings::values.bcat_backend.GetValue() == "boxcat") { | ||
| 583 | return std::make_unique<Boxcat>(system.GetAppletManager(), std::move(getter)); | ||
| 584 | } | ||
| 585 | #endif | ||
| 586 | |||
| 587 | return std::make_unique<NullBackend>(std::move(getter)); | 580 | return std::make_unique<NullBackend>(std::move(getter)); |
| 588 | } | 581 | } |
| 589 | 582 | ||
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index 46da438ef..acf791de2 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp | |||
| @@ -175,6 +175,10 @@ public: | |||
| 175 | {143, nullptr, "GetAudioControlInputState"}, | 175 | {143, nullptr, "GetAudioControlInputState"}, |
| 176 | {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, | 176 | {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, |
| 177 | {145, nullptr, "GetConnectedAudioDevice"}, | 177 | {145, nullptr, "GetConnectedAudioDevice"}, |
| 178 | {146, nullptr, "CloseAudioControlInput"}, | ||
| 179 | {147, nullptr, "RegisterAudioControlNotification"}, | ||
| 180 | {148, nullptr, "SendAudioControlPassthroughCommand"}, | ||
| 181 | {149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, | ||
| 178 | {256, nullptr, "IsManufacturingMode"}, | 182 | {256, nullptr, "IsManufacturingMode"}, |
| 179 | {257, nullptr, "EmulateBluetoothCrash"}, | 183 | {257, nullptr, "EmulateBluetoothCrash"}, |
| 180 | {258, nullptr, "GetBleChannelMap"}, | 184 | {258, nullptr, "GetBleChannelMap"}, |
diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index 2b5314691..33a976ddf 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp | |||
| @@ -15,6 +15,7 @@ CAPS_SS::CAPS_SS(Core::System& system_) : ServiceFramework{system_, "caps:ss"} { | |||
| 15 | {204, nullptr, "SaveEditedScreenShotEx0"}, | 15 | {204, nullptr, "SaveEditedScreenShotEx0"}, |
| 16 | {206, nullptr, "Unknown206"}, | 16 | {206, nullptr, "Unknown206"}, |
| 17 | {208, nullptr, "SaveScreenShotOfMovieEx1"}, | 17 | {208, nullptr, "SaveScreenShotOfMovieEx1"}, |
| 18 | {1000, nullptr, "Unknown1000"}, | ||
| 18 | }; | 19 | }; |
| 19 | // clang-format on | 20 | // clang-format on |
| 20 | 21 | ||
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 110c7cb1c..f6184acc9 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp | |||
| @@ -55,6 +55,8 @@ public: | |||
| 55 | {36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, | 55 | {36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, |
| 56 | {37, nullptr, "OwnTicket2"}, | 56 | {37, nullptr, "OwnTicket2"}, |
| 57 | {38, nullptr, "OwnTicket3"}, | 57 | {38, nullptr, "OwnTicket3"}, |
| 58 | {39, nullptr, "DeleteAllInactivePersonalizedTicket"}, | ||
| 59 | {40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, | ||
| 58 | {501, nullptr, "Unknown501"}, | 60 | {501, nullptr, "Unknown501"}, |
| 59 | {502, nullptr, "Unknown502"}, | 61 | {502, nullptr, "Unknown502"}, |
| 60 | {503, nullptr, "GetTitleKey"}, | 62 | {503, nullptr, "GetTitleKey"}, |
| @@ -88,11 +90,15 @@ public: | |||
| 88 | {1503, nullptr, "Unknown1503"}, | 90 | {1503, nullptr, "Unknown1503"}, |
| 89 | {1504, nullptr, "Unknown1504"}, | 91 | {1504, nullptr, "Unknown1504"}, |
| 90 | {1505, nullptr, "Unknown1505"}, | 92 | {1505, nullptr, "Unknown1505"}, |
| 93 | {1506, nullptr, "Unknown1506"}, | ||
| 91 | {2000, nullptr, "Unknown2000"}, | 94 | {2000, nullptr, "Unknown2000"}, |
| 92 | {2001, nullptr, "Unknown2001"}, | 95 | {2001, nullptr, "Unknown2001"}, |
| 96 | {2002, nullptr, "Unknown2002"}, | ||
| 97 | {2003, nullptr, "Unknown2003"}, | ||
| 93 | {2100, nullptr, "Unknown2100"}, | 98 | {2100, nullptr, "Unknown2100"}, |
| 94 | {2501, nullptr, "Unknown2501"}, | 99 | {2501, nullptr, "Unknown2501"}, |
| 95 | {2502, nullptr, "Unknown2502"}, | 100 | {2502, nullptr, "Unknown2502"}, |
| 101 | {2601, nullptr, "Unknown2601"}, | ||
| 96 | {3001, nullptr, "Unknown3001"}, | 102 | {3001, nullptr, "Unknown3001"}, |
| 97 | {3002, nullptr, "Unknown3002"}, | 103 | {3002, nullptr, "Unknown3002"}, |
| 98 | }; | 104 | }; |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 4fcc6f93a..9ee146caf 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -507,6 +507,7 @@ private: | |||
| 507 | LarkNesRight = 18, | 507 | LarkNesRight = 18, |
| 508 | Lucia = 19, | 508 | Lucia = 19, |
| 509 | Verification = 20, | 509 | Verification = 20, |
| 510 | Lagon = 21, | ||
| 510 | }; | 511 | }; |
| 511 | 512 | ||
| 512 | struct NPadEntry { | 513 | struct NPadEntry { |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a1707a72a..8c363142c 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -106,7 +106,7 @@ void IAppletResource::DeactivateController(HidController controller) { | |||
| 106 | controllers[static_cast<size_t>(controller)]->DeactivateController(); | 106 | controllers[static_cast<size_t>(controller)]->DeactivateController(); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | IAppletResource ::~IAppletResource() { | 109 | IAppletResource::~IAppletResource() { |
| 110 | system.CoreTiming().UnscheduleEvent(pad_update_event, 0); | 110 | system.CoreTiming().UnscheduleEvent(pad_update_event, 0); |
| 111 | system.CoreTiming().UnscheduleEvent(motion_update_event, 0); | 111 | system.CoreTiming().UnscheduleEvent(motion_update_event, 0); |
| 112 | } | 112 | } |
| @@ -239,6 +239,12 @@ Hid::Hid(Core::System& system_) | |||
| 239 | {81, &Hid::ResetGyroscopeZeroDriftMode, "ResetGyroscopeZeroDriftMode"}, | 239 | {81, &Hid::ResetGyroscopeZeroDriftMode, "ResetGyroscopeZeroDriftMode"}, |
| 240 | {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, | 240 | {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, |
| 241 | {83, &Hid::IsFirmwareUpdateAvailableForSixAxisSensor, "IsFirmwareUpdateAvailableForSixAxisSensor"}, | 241 | {83, &Hid::IsFirmwareUpdateAvailableForSixAxisSensor, "IsFirmwareUpdateAvailableForSixAxisSensor"}, |
| 242 | {84, nullptr, "EnableSixAxisSensorUnalteredPassthrough"}, | ||
| 243 | {85, nullptr, "IsSixAxisSensorUnalteredPassthroughEnabled"}, | ||
| 244 | {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, | ||
| 245 | {87, nullptr, "LoadSixAxisSensorCalibrationParameter"}, | ||
| 246 | {88, nullptr, "GetSixAxisSensorIcInformation"}, | ||
| 247 | {89, nullptr, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, | ||
| 242 | {91, &Hid::ActivateGesture, "ActivateGesture"}, | 248 | {91, &Hid::ActivateGesture, "ActivateGesture"}, |
| 243 | {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, | 249 | {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, |
| 244 | {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, | 250 | {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, |
| @@ -1656,6 +1662,9 @@ public: | |||
| 1656 | {12, nullptr, "UnsetTouchScreenAutoPilotState"}, | 1662 | {12, nullptr, "UnsetTouchScreenAutoPilotState"}, |
| 1657 | {13, nullptr, "GetTouchScreenConfiguration"}, | 1663 | {13, nullptr, "GetTouchScreenConfiguration"}, |
| 1658 | {14, nullptr, "ProcessTouchScreenAutoTune"}, | 1664 | {14, nullptr, "ProcessTouchScreenAutoTune"}, |
| 1665 | {15, nullptr, "ForceStopTouchScreenManagement"}, | ||
| 1666 | {16, nullptr, "ForceRestartTouchScreenManagement"}, | ||
| 1667 | {17, nullptr, "IsTouchScreenManaged"}, | ||
| 1659 | {20, nullptr, "DeactivateMouse"}, | 1668 | {20, nullptr, "DeactivateMouse"}, |
| 1660 | {21, nullptr, "SetMouseAutoPilotState"}, | 1669 | {21, nullptr, "SetMouseAutoPilotState"}, |
| 1661 | {22, nullptr, "UnsetMouseAutoPilotState"}, | 1670 | {22, nullptr, "UnsetMouseAutoPilotState"}, |
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index e4c703da4..32533cd94 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp | |||
| @@ -31,6 +31,7 @@ public: | |||
| 31 | {24, nullptr, "DestroyTokenWithApplicationId"}, | 31 | {24, nullptr, "DestroyTokenWithApplicationId"}, |
| 32 | {25, nullptr, "QueryIsTokenValid"}, | 32 | {25, nullptr, "QueryIsTokenValid"}, |
| 33 | {26, nullptr, "ListenToMyApplicationId"}, | 33 | {26, nullptr, "ListenToMyApplicationId"}, |
| 34 | {27, nullptr, "DestroyTokenAll"}, | ||
| 34 | {31, nullptr, "UploadTokenToBaaS"}, | 35 | {31, nullptr, "UploadTokenToBaaS"}, |
| 35 | {32, nullptr, "DestroyTokenForBaaS"}, | 36 | {32, nullptr, "DestroyTokenForBaaS"}, |
| 36 | {33, nullptr, "CreateTokenForBaaS"}, | 37 | {33, nullptr, "CreateTokenForBaaS"}, |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index a33e47d0b..789000294 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices { | |||
| 16 | 16 | ||
| 17 | nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_) | 17 | nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_) |
| 18 | : nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {} | 18 | : nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {} |
| 19 | nvdisp_disp0 ::~nvdisp_disp0() = default; | 19 | nvdisp_disp0::~nvdisp_disp0() = default; |
| 20 | 20 | ||
| 21 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 21 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | std::vector<u8>& output) { | 22 | std::vector<u8>& output) { |
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 7d85ecb6a..b9e765f1d 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -415,6 +415,18 @@ void BSD::Write(Kernel::HLERequestContext& ctx) { | |||
| 415 | }); | 415 | }); |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | void BSD::Read(Kernel::HLERequestContext& ctx) { | ||
| 419 | IPC::RequestParser rp{ctx}; | ||
| 420 | const s32 fd = rp.Pop<s32>(); | ||
| 421 | |||
| 422 | LOG_WARNING(Service, "(STUBBED) called. fd={} len={}", fd, ctx.GetWriteBufferSize()); | ||
| 423 | |||
| 424 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 425 | rb.Push(ResultSuccess); | ||
| 426 | rb.Push<u32>(0); // ret | ||
| 427 | rb.Push<u32>(0); // bsd errno | ||
| 428 | } | ||
| 429 | |||
| 418 | void BSD::Close(Kernel::HLERequestContext& ctx) { | 430 | void BSD::Close(Kernel::HLERequestContext& ctx) { |
| 419 | IPC::RequestParser rp{ctx}; | 431 | IPC::RequestParser rp{ctx}; |
| 420 | const s32 fd = rp.Pop<s32>(); | 432 | const s32 fd = rp.Pop<s32>(); |
| @@ -855,7 +867,7 @@ BSD::BSD(Core::System& system_, const char* name) : ServiceFramework{system_, na | |||
| 855 | {22, &BSD::Shutdown, "Shutdown"}, | 867 | {22, &BSD::Shutdown, "Shutdown"}, |
| 856 | {23, nullptr, "ShutdownAllSockets"}, | 868 | {23, nullptr, "ShutdownAllSockets"}, |
| 857 | {24, &BSD::Write, "Write"}, | 869 | {24, &BSD::Write, "Write"}, |
| 858 | {25, nullptr, "Read"}, | 870 | {25, &BSD::Read, "Read"}, |
| 859 | {26, &BSD::Close, "Close"}, | 871 | {26, &BSD::Close, "Close"}, |
| 860 | {27, nullptr, "DuplicateSocket"}, | 872 | {27, nullptr, "DuplicateSocket"}, |
| 861 | {28, nullptr, "GetResourceStatistics"}, | 873 | {28, nullptr, "GetResourceStatistics"}, |
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index 1d2df9c61..d68beef5c 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h | |||
| @@ -135,6 +135,7 @@ private: | |||
| 135 | void Send(Kernel::HLERequestContext& ctx); | 135 | void Send(Kernel::HLERequestContext& ctx); |
| 136 | void SendTo(Kernel::HLERequestContext& ctx); | 136 | void SendTo(Kernel::HLERequestContext& ctx); |
| 137 | void Write(Kernel::HLERequestContext& ctx); | 137 | void Write(Kernel::HLERequestContext& ctx); |
| 138 | void Read(Kernel::HLERequestContext& ctx); | ||
| 138 | void Close(Kernel::HLERequestContext& ctx); | 139 | void Close(Kernel::HLERequestContext& ctx); |
| 139 | void EventFd(Kernel::HLERequestContext& ctx); | 140 | void EventFd(Kernel::HLERequestContext& ctx); |
| 140 | 141 | ||
diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp index bd334bbef..5c2354cdd 100644 --- a/src/core/hle/service/time/system_clock_core.cpp +++ b/src/core/hle/service/time/system_clock_core.cpp | |||
| @@ -13,7 +13,7 @@ SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_) | |||
| 13 | context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId(); | 13 | context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId(); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | SystemClockCore ::~SystemClockCore() = default; | 16 | SystemClockCore::~SystemClockCore() = default; |
| 17 | 17 | ||
| 18 | ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const { | 18 | ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const { |
| 19 | posix_time = 0; | 19 | posix_time = 0; |
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp index 5c3108768..3871e7316 100644 --- a/src/core/hle/service/time/time_zone_service.cpp +++ b/src/core/hle/service/time/time_zone_service.cpp | |||
| @@ -10,8 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | namespace Service::Time { | 11 | namespace Service::Time { |
| 12 | 12 | ||
| 13 | ITimeZoneService ::ITimeZoneService(Core::System& system_, | 13 | ITimeZoneService::ITimeZoneService(Core::System& system_, |
| 14 | TimeZone::TimeZoneContentManager& time_zone_manager_) | 14 | TimeZone::TimeZoneContentManager& time_zone_manager_) |
| 15 | : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} { | 15 | : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} { |
| 16 | static const FunctionInfo functions[] = { | 16 | static const FunctionInfo functions[] = { |
| 17 | {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, | 17 | {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, |
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index 7f436c3bb..2ee103b37 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp | |||
| @@ -97,7 +97,7 @@ public: | |||
| 97 | {3, nullptr, "GetAlternateInterface"}, | 97 | {3, nullptr, "GetAlternateInterface"}, |
| 98 | {4, nullptr, "GetCurrentFrame"}, | 98 | {4, nullptr, "GetCurrentFrame"}, |
| 99 | {5, nullptr, "CtrlXferAsync"}, | 99 | {5, nullptr, "CtrlXferAsync"}, |
| 100 | {6, nullptr, "Unknown6"}, | 100 | {6, nullptr, "GetCtrlXferCompletionEvent"}, |
| 101 | {7, nullptr, "GetCtrlXferReport"}, | 101 | {7, nullptr, "GetCtrlXferReport"}, |
| 102 | {8, nullptr, "ResetDevice"}, | 102 | {8, nullptr, "ResetDevice"}, |
| 103 | {9, nullptr, "OpenUsbEp"}, | 103 | {9, nullptr, "OpenUsbEp"}, |
| @@ -183,8 +183,8 @@ public: | |||
| 183 | {4, nullptr, "GetHostPdcFirmwareRevision"}, | 183 | {4, nullptr, "GetHostPdcFirmwareRevision"}, |
| 184 | {5, nullptr, "GetHostPdcManufactureId"}, | 184 | {5, nullptr, "GetHostPdcManufactureId"}, |
| 185 | {6, nullptr, "GetHostPdcDeviceId"}, | 185 | {6, nullptr, "GetHostPdcDeviceId"}, |
| 186 | {7, nullptr, "AwakeCradle"}, | 186 | {7, nullptr, "EnableCradleRecovery"}, |
| 187 | {8, nullptr, "SleepCradle"}, | 187 | {8, nullptr, "DisableCradleRecovery"}, |
| 188 | }; | 188 | }; |
| 189 | // clang-format on | 189 | // clang-format on |
| 190 | 190 | ||
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 8e8fc40ca..be3d52d54 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -831,6 +831,7 @@ public: | |||
| 831 | {6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, | 831 | {6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, |
| 832 | {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, | 832 | {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, |
| 833 | {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, | 833 | {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, |
| 834 | {6013, nullptr, "SetLayerOpacity"}, | ||
| 834 | {7000, nullptr, "SetContentVisibility"}, | 835 | {7000, nullptr, "SetContentVisibility"}, |
| 835 | {8000, nullptr, "SetConductorLayer"}, | 836 | {8000, nullptr, "SetConductorLayer"}, |
| 836 | {8001, nullptr, "SetTimestampTracking"}, | 837 | {8001, nullptr, "SetTimestampTracking"}, |
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp index 72eea52f0..a3e0664b9 100644 --- a/src/core/network/network.cpp +++ b/src/core/network/network.cpp | |||
| @@ -366,8 +366,6 @@ std::optional<IPv4Address> GetHostIPv4Address() { | |||
| 366 | if (res != network_interfaces.end()) { | 366 | if (res != network_interfaces.end()) { |
| 367 | char ip_addr[16] = {}; | 367 | char ip_addr[16] = {}; |
| 368 | ASSERT(inet_ntop(AF_INET, &res->ip_address, ip_addr, sizeof(ip_addr)) != nullptr); | 368 | ASSERT(inet_ntop(AF_INET, &res->ip_address, ip_addr, sizeof(ip_addr)) != nullptr); |
| 369 | LOG_INFO(Network, "IP address: {}", ip_addr); | ||
| 370 | |||
| 371 | return TranslateIPv4(res->ip_address); | 369 | return TranslateIPv4(res->ip_address); |
| 372 | } else { | 370 | } else { |
| 373 | LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface); | 371 | LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface); |
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 18d7d8817..f3907c65a 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -346,8 +346,8 @@ void InputSubsystem::ReloadInputDevices() { | |||
| 346 | impl->udp->ReloadSockets(); | 346 | impl->udp->ReloadSockets(); |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers([ | 349 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers( |
| 350 | [maybe_unused]] Polling::DeviceType type) const { | 350 | [[maybe_unused]] Polling::DeviceType type) const { |
| 351 | #ifdef HAVE_SDL2 | 351 | #ifdef HAVE_SDL2 |
| 352 | return impl->sdl->GetPollers(type); | 352 | return impl->sdl->GetPollers(type); |
| 353 | #else | 353 | #else |
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index 03888b7cb..ab6211b29 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -254,11 +254,25 @@ public: | |||
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | bool IsJoyconLeft() const { | 256 | bool IsJoyconLeft() const { |
| 257 | return std::strstr(GetControllerName().c_str(), "Joy-Con Left") != nullptr; | 257 | const std::string controller_name = GetControllerName(); |
| 258 | if (std::strstr(controller_name.c_str(), "Joy-Con Left") != nullptr) { | ||
| 259 | return true; | ||
| 260 | } | ||
| 261 | if (std::strstr(controller_name.c_str(), "Joy-Con (L)") != nullptr) { | ||
| 262 | return true; | ||
| 263 | } | ||
| 264 | return false; | ||
| 258 | } | 265 | } |
| 259 | 266 | ||
| 260 | bool IsJoyconRight() const { | 267 | bool IsJoyconRight() const { |
| 261 | return std::strstr(GetControllerName().c_str(), "Joy-Con Right") != nullptr; | 268 | const std::string controller_name = GetControllerName(); |
| 269 | if (std::strstr(controller_name.c_str(), "Joy-Con Right") != nullptr) { | ||
| 270 | return true; | ||
| 271 | } | ||
| 272 | if (std::strstr(controller_name.c_str(), "Joy-Con (R)") != nullptr) { | ||
| 273 | return true; | ||
| 274 | } | ||
| 275 | return false; | ||
| 262 | } | 276 | } |
| 263 | 277 | ||
| 264 | std::string GetControllerName() const { | 278 | std::string GetControllerName() const { |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index 580063fa9..170db269a 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -58,8 +58,8 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding, | |||
| 58 | const auto cbuf{fmt::format("{}_cbuf{}", ctx.stage_name, binding.U32())}; | 58 | const auto cbuf{fmt::format("{}_cbuf{}", ctx.stage_name, binding.U32())}; |
| 59 | const auto cbuf_cast{fmt::format("{}({}[{}]{{}})", cast, cbuf, index)}; | 59 | const auto cbuf_cast{fmt::format("{}({}[{}]{{}})", cast, cbuf, index)}; |
| 60 | const auto extraction{num_bits == 32 ? cbuf_cast | 60 | const auto extraction{num_bits == 32 ? cbuf_cast |
| 61 | : fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast, | 61 | : fmt::format("bitfieldExtract({},int({}),{})", cbuf_cast, |
| 62 | bit_offset, num_bits)}; | 62 | bit_offset, num_bits)}; |
| 63 | if (!component_indexing_bug) { | 63 | if (!component_indexing_bug) { |
| 64 | const auto result{fmt::format(fmt::runtime(extraction), swizzle)}; | 64 | const auto result{fmt::format(fmt::runtime(extraction), swizzle)}; |
| 65 | ctx.Add("{}={};", ret, result); | 65 | ctx.Add("{}={};", ret, result); |
diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index f3b12d04b..a12ddcc8f 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h | |||
| @@ -11,14 +11,16 @@ | |||
| 11 | namespace Shader { | 11 | namespace Shader { |
| 12 | 12 | ||
| 13 | template <typename T> | 13 | template <typename T> |
| 14 | requires std::is_destructible_v<T> class ObjectPool { | 14 | requires std::is_destructible_v<T> |
| 15 | class ObjectPool { | ||
| 15 | public: | 16 | public: |
| 16 | explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { | 17 | explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { |
| 17 | node = &chunks.emplace_back(new_chunk_size); | 18 | node = &chunks.emplace_back(new_chunk_size); |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | template <typename... Args> | 21 | template <typename... Args> |
| 21 | requires std::is_constructible_v<T, Args...>[[nodiscard]] T* Create(Args&&... args) { | 22 | requires std::is_constructible_v<T, Args...> |
| 23 | [[nodiscard]] T* Create(Args&&... args) { | ||
| 22 | return std::construct_at(Memory(), std::forward<Args>(args)...); | 24 | return std::construct_at(Memory(), std::forward<Args>(args)...); |
| 23 | } | 25 | } |
| 24 | 26 | ||
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 7bfd57369..d350c9b36 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -570,13 +570,12 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 570 | ForEachWrittenRange(*cpu_src_address, amount, mirror); | 570 | ForEachWrittenRange(*cpu_src_address, amount, mirror); |
| 571 | // This subtraction in this order is important for overlapping copies. | 571 | // This subtraction in this order is important for overlapping copies. |
| 572 | common_ranges.subtract(subtract_interval); | 572 | common_ranges.subtract(subtract_interval); |
| 573 | bool atleast_1_download = tmp_intervals.size() != 0; | 573 | const bool has_new_downloads = tmp_intervals.size() != 0; |
| 574 | for (const IntervalType add_interval : tmp_intervals) { | 574 | for (const IntervalType& add_interval : tmp_intervals) { |
| 575 | common_ranges.add(add_interval); | 575 | common_ranges.add(add_interval); |
| 576 | } | 576 | } |
| 577 | |||
| 578 | runtime.CopyBuffer(dest_buffer, src_buffer, copies); | 577 | runtime.CopyBuffer(dest_buffer, src_buffer, copies); |
| 579 | if (atleast_1_download) { | 578 | if (has_new_downloads) { |
| 580 | dest_buffer.MarkRegionAsGpuModified(*cpu_dest_address, amount); | 579 | dest_buffer.MarkRegionAsGpuModified(*cpu_dest_address, amount); |
| 581 | } | 580 | } |
| 582 | std::vector<u8> tmp_buffer(amount); | 581 | std::vector<u8> tmp_buffer(amount); |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index c7ec1eac9..67388d980 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -82,41 +82,41 @@ void MaxwellDMA::Launch() { | |||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | void MaxwellDMA::CopyPitchToPitch() { | 84 | void MaxwellDMA::CopyPitchToPitch() { |
| 85 | // When `multi_line_enable` bit is disabled the copy is performed as if we were copying a 1D | 85 | // When `multi_line_enable` bit is enabled we copy a 2D image of dimensions |
| 86 | // buffer of length `line_length_in`. | 86 | // (line_length_in, line_count). |
| 87 | // Otherwise we copy a 2D image of dimensions (line_length_in, line_count). | 87 | // Otherwise the copy is performed as if we were copying a 1D buffer of length line_length_in. |
| 88 | auto& accelerate = rasterizer->AccessAccelerateDMA(); | 88 | const bool remap_enabled = regs.launch_dma.remap_enable != 0; |
| 89 | if (!regs.launch_dma.multi_line_enable) { | 89 | if (regs.launch_dma.multi_line_enable) { |
| 90 | const bool is_buffer_clear = regs.launch_dma.remap_enable != 0 && | 90 | UNIMPLEMENTED_IF(remap_enabled); |
| 91 | regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A; | 91 | |
| 92 | // TODO: allow multisized components. | 92 | // Perform a line-by-line copy. |
| 93 | if (is_buffer_clear) { | 93 | // We're going to take a subrect of size (line_length_in, line_count) from the source |
| 94 | ASSERT(regs.remap_const.component_size_minus_one == 3); | 94 | // rectangle. There is no need to manually flush/invalidate the regions because CopyBlock |
| 95 | accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value); | 95 | // does that for us. |
| 96 | std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value); | 96 | for (u32 line = 0; line < regs.line_count; ++line) { |
| 97 | memory_manager.WriteBlockUnsafe(regs.offset_out, | 97 | const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in; |
| 98 | reinterpret_cast<u8*>(tmp_buffer.data()), | 98 | const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out; |
| 99 | regs.line_length_in * sizeof(u32)); | 99 | memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in); |
| 100 | return; | ||
| 101 | } | ||
| 102 | UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); | ||
| 103 | if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) { | ||
| 104 | std::vector<u8> tmp_buffer(regs.line_length_in); | ||
| 105 | memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in); | ||
| 106 | memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in); | ||
| 107 | } | 100 | } |
| 108 | return; | 101 | return; |
| 109 | } | 102 | } |
| 110 | 103 | // TODO: allow multisized components. | |
| 111 | UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); | 104 | auto& accelerate = rasterizer->AccessAccelerateDMA(); |
| 112 | 105 | const bool is_const_a_dst = regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A; | |
| 113 | // Perform a line-by-line copy. | 106 | const bool is_buffer_clear = remap_enabled && is_const_a_dst; |
| 114 | // We're going to take a subrect of size (line_length_in, line_count) from the source rectangle. | 107 | if (is_buffer_clear) { |
| 115 | // There is no need to manually flush/invalidate the regions because CopyBlock does that for us. | 108 | ASSERT(regs.remap_const.component_size_minus_one == 3); |
| 116 | for (u32 line = 0; line < regs.line_count; ++line) { | 109 | accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value); |
| 117 | const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in; | 110 | std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value); |
| 118 | const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out; | 111 | memory_manager.WriteBlockUnsafe(regs.offset_out, reinterpret_cast<u8*>(tmp_buffer.data()), |
| 119 | memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in); | 112 | regs.line_length_in * sizeof(u32)); |
| 113 | return; | ||
| 114 | } | ||
| 115 | UNIMPLEMENTED_IF(remap_enabled); | ||
| 116 | if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) { | ||
| 117 | std::vector<u8> tmp_buffer(regs.line_length_in); | ||
| 118 | memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in); | ||
| 119 | memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in); | ||
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index 9e457ae16..a04514425 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -175,7 +175,7 @@ public: | |||
| 175 | static_assert(sizeof(LaunchDMA) == 4); | 175 | static_assert(sizeof(LaunchDMA) == 4); |
| 176 | 176 | ||
| 177 | struct RemapConst { | 177 | struct RemapConst { |
| 178 | enum Swizzle : u32 { | 178 | enum class Swizzle : u32 { |
| 179 | SRC_X = 0, | 179 | SRC_X = 0, |
| 180 | SRC_Y = 1, | 180 | SRC_Y = 1, |
| 181 | SRC_Z = 2, | 181 | SRC_Z = 2, |
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index c9cff7450..20d748c12 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt | |||
| @@ -6,7 +6,6 @@ set(SHADER_FILES | |||
| 6 | convert_float_to_depth.frag | 6 | convert_float_to_depth.frag |
| 7 | full_screen_triangle.vert | 7 | full_screen_triangle.vert |
| 8 | opengl_copy_bc4.comp | 8 | opengl_copy_bc4.comp |
| 9 | opengl_copy_bgra.comp | ||
| 10 | opengl_present.frag | 9 | opengl_present.frag |
| 11 | opengl_present.vert | 10 | opengl_present.vert |
| 12 | pitch_unswizzle.comp | 11 | pitch_unswizzle.comp |
diff --git a/src/video_core/host_shaders/opengl_copy_bgra.comp b/src/video_core/host_shaders/opengl_copy_bgra.comp deleted file mode 100644 index 2571a4abf..000000000 --- a/src/video_core/host_shaders/opengl_copy_bgra.comp +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #version 430 core | ||
| 6 | |||
| 7 | layout (local_size_x = 4, local_size_y = 4) in; | ||
| 8 | |||
| 9 | layout(binding = 0, rgba8) readonly uniform image2DArray bgr_input; | ||
| 10 | layout(binding = 1, rgba8) writeonly uniform image2DArray bgr_output; | ||
| 11 | |||
| 12 | void main() { | ||
| 13 | vec4 color = imageLoad(bgr_input, ivec3(gl_GlobalInvocationID)); | ||
| 14 | imageStore(bgr_output, ivec3(gl_GlobalInvocationID), color.bgra); | ||
| 15 | } | ||
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 07a995f7d..187a28e4d 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp | |||
| @@ -147,8 +147,7 @@ void BufferCacheRuntime::CopyBuffer(Buffer& dst_buffer, Buffer& src_buffer, | |||
| 147 | 147 | ||
| 148 | void BufferCacheRuntime::ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value) { | 148 | void BufferCacheRuntime::ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value) { |
| 149 | glClearNamedBufferSubData(dest_buffer.Handle(), GL_R32UI, static_cast<GLintptr>(offset), | 149 | glClearNamedBufferSubData(dest_buffer.Handle(), GL_R32UI, static_cast<GLintptr>(offset), |
| 150 | static_cast<GLsizeiptr>(size / sizeof(u32)), GL_RED, GL_UNSIGNED_INT, | 150 | static_cast<GLsizeiptr>(size), GL_RED, GL_UNSIGNED_INT, &value); |
| 151 | &value); | ||
| 152 | } | 151 | } |
| 153 | 152 | ||
| 154 | void BufferCacheRuntime::BindIndexBuffer(Buffer& buffer, u32 offset, u32 size) { | 153 | void BufferCacheRuntime::BindIndexBuffer(Buffer& buffer, u32 offset, u32 size) { |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index b0aee6cc1..54dae2c41 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -461,7 +461,7 @@ bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) { | |||
| 461 | if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { | 461 | if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { |
| 462 | return false; | 462 | return false; |
| 463 | } | 463 | } |
| 464 | if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { | 464 | if (IsPixelFormatBGR(dst.info.format) != IsPixelFormatBGR(src.info.format)) { |
| 465 | return false; | 465 | return false; |
| 466 | } | 466 | } |
| 467 | return true; | 467 | return true; |
| @@ -473,7 +473,7 @@ void TextureCacheRuntime::EmulateCopyImage(Image& dst, Image& src, | |||
| 473 | ASSERT(src.info.type == ImageType::e3D); | 473 | ASSERT(src.info.type == ImageType::e3D); |
| 474 | util_shaders.CopyBC4(dst, src, copies); | 474 | util_shaders.CopyBC4(dst, src, copies); |
| 475 | } else if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { | 475 | } else if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { |
| 476 | util_shaders.CopyBGR(dst, src, copies); | 476 | bgr_copy_pass.CopyBGR(dst, src, copies); |
| 477 | } else { | 477 | } else { |
| 478 | UNREACHABLE(); | 478 | UNREACHABLE(); |
| 479 | } | 479 | } |
| @@ -1112,4 +1112,37 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM | |||
| 1112 | framebuffer.handle = handle; | 1112 | framebuffer.handle = handle; |
| 1113 | } | 1113 | } |
| 1114 | 1114 | ||
| 1115 | void BGRCopyPass::CopyBGR(Image& dst_image, Image& src_image, | ||
| 1116 | std::span<const VideoCommon::ImageCopy> copies) { | ||
| 1117 | static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0}; | ||
| 1118 | const u32 requested_pbo_size = | ||
| 1119 | std::max(src_image.unswizzled_size_bytes, dst_image.unswizzled_size_bytes); | ||
| 1120 | |||
| 1121 | if (bgr_pbo_size < requested_pbo_size) { | ||
| 1122 | bgr_pbo.Create(); | ||
| 1123 | bgr_pbo_size = requested_pbo_size; | ||
| 1124 | glNamedBufferData(bgr_pbo.handle, bgr_pbo_size, nullptr, GL_STREAM_COPY); | ||
| 1125 | } | ||
| 1126 | for (const ImageCopy& copy : copies) { | ||
| 1127 | ASSERT(copy.src_offset == zero_offset); | ||
| 1128 | ASSERT(copy.dst_offset == zero_offset); | ||
| 1129 | |||
| 1130 | // Copy from source to PBO | ||
| 1131 | glPixelStorei(GL_PACK_ALIGNMENT, 1); | ||
| 1132 | glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width); | ||
| 1133 | glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr_pbo.handle); | ||
| 1134 | glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, | ||
| 1135 | copy.src_subresource.num_layers, src_image.GlFormat(), | ||
| 1136 | src_image.GlType(), static_cast<GLsizei>(bgr_pbo_size), nullptr); | ||
| 1137 | |||
| 1138 | // Copy from PBO to destination in desired GL format | ||
| 1139 | glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||
| 1140 | glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width); | ||
| 1141 | glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr_pbo.handle); | ||
| 1142 | glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, | ||
| 1143 | copy.dst_subresource.num_layers, dst_image.GlFormat(), | ||
| 1144 | dst_image.GlType(), nullptr); | ||
| 1145 | } | ||
| 1146 | } | ||
| 1147 | |||
| 1115 | } // namespace OpenGL | 1148 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 4a4f6301c..c498a8a8f 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -47,6 +47,19 @@ struct FormatProperties { | |||
| 47 | bool is_compressed; | 47 | bool is_compressed; |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | class BGRCopyPass { | ||
| 51 | public: | ||
| 52 | BGRCopyPass() = default; | ||
| 53 | ~BGRCopyPass() = default; | ||
| 54 | |||
| 55 | void CopyBGR(Image& dst_image, Image& src_image, | ||
| 56 | std::span<const VideoCommon::ImageCopy> copies); | ||
| 57 | |||
| 58 | private: | ||
| 59 | OGLBuffer bgr_pbo; | ||
| 60 | size_t bgr_pbo_size{}; | ||
| 61 | }; | ||
| 62 | |||
| 50 | class TextureCacheRuntime { | 63 | class TextureCacheRuntime { |
| 51 | friend Framebuffer; | 64 | friend Framebuffer; |
| 52 | friend Image; | 65 | friend Image; |
| @@ -118,6 +131,7 @@ private: | |||
| 118 | const Device& device; | 131 | const Device& device; |
| 119 | StateTracker& state_tracker; | 132 | StateTracker& state_tracker; |
| 120 | UtilShaders util_shaders; | 133 | UtilShaders util_shaders; |
| 134 | BGRCopyPass bgr_copy_pass; | ||
| 121 | 135 | ||
| 122 | std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; | 136 | std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; |
| 123 | bool has_broken_texture_view_formats = false; | 137 | bool has_broken_texture_view_formats = false; |
| @@ -162,6 +176,14 @@ public: | |||
| 162 | return texture.handle; | 176 | return texture.handle; |
| 163 | } | 177 | } |
| 164 | 178 | ||
| 179 | GLuint GlFormat() const noexcept { | ||
| 180 | return gl_format; | ||
| 181 | } | ||
| 182 | |||
| 183 | GLuint GlType() const noexcept { | ||
| 184 | return gl_type; | ||
| 185 | } | ||
| 186 | |||
| 165 | private: | 187 | private: |
| 166 | void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset); | 188 | void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset); |
| 167 | 189 | ||
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 672f94bfc..39158aa3e 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -52,7 +52,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB | |||
| 52 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT | 52 | {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT |
| 53 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT | 53 | {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT |
| 54 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM | 54 | {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM |
| 55 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM | 55 | {GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_UNORM |
| 56 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT | 56 | {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT |
| 57 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT | 57 | {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT |
| 58 | {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT | 58 | {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT |
| @@ -81,7 +81,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB | |||
| 81 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM | 81 | {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM |
| 82 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM | 82 | {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM |
| 83 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM | 83 | {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM |
| 84 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_SRGB | 84 | {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_SRGB |
| 85 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB | 85 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB |
| 86 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB | 86 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB |
| 87 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB | 87 | {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB |
diff --git a/src/video_core/renderer_opengl/util_shaders.cpp b/src/video_core/renderer_opengl/util_shaders.cpp index 333f35a1c..897c380b3 100644 --- a/src/video_core/renderer_opengl/util_shaders.cpp +++ b/src/video_core/renderer_opengl/util_shaders.cpp | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include "video_core/host_shaders/block_linear_unswizzle_2d_comp.h" | 14 | #include "video_core/host_shaders/block_linear_unswizzle_2d_comp.h" |
| 15 | #include "video_core/host_shaders/block_linear_unswizzle_3d_comp.h" | 15 | #include "video_core/host_shaders/block_linear_unswizzle_3d_comp.h" |
| 16 | #include "video_core/host_shaders/opengl_copy_bc4_comp.h" | 16 | #include "video_core/host_shaders/opengl_copy_bc4_comp.h" |
| 17 | #include "video_core/host_shaders/opengl_copy_bgra_comp.h" | ||
| 18 | #include "video_core/host_shaders/pitch_unswizzle_comp.h" | 17 | #include "video_core/host_shaders/pitch_unswizzle_comp.h" |
| 19 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 18 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 20 | #include "video_core/renderer_opengl/gl_shader_util.h" | 19 | #include "video_core/renderer_opengl/gl_shader_util.h" |
| @@ -44,11 +43,6 @@ namespace { | |||
| 44 | OGLProgram MakeProgram(std::string_view source) { | 43 | OGLProgram MakeProgram(std::string_view source) { |
| 45 | return CreateProgram(source, GL_COMPUTE_SHADER); | 44 | return CreateProgram(source, GL_COMPUTE_SHADER); |
| 46 | } | 45 | } |
| 47 | |||
| 48 | size_t NumPixelsInCopy(const VideoCommon::ImageCopy& copy) { | ||
| 49 | return static_cast<size_t>(copy.extent.width * copy.extent.height * | ||
| 50 | copy.src_subresource.num_layers); | ||
| 51 | } | ||
| 52 | } // Anonymous namespace | 46 | } // Anonymous namespace |
| 53 | 47 | ||
| 54 | UtilShaders::UtilShaders(ProgramManager& program_manager_) | 48 | UtilShaders::UtilShaders(ProgramManager& program_manager_) |
| @@ -56,7 +50,6 @@ UtilShaders::UtilShaders(ProgramManager& program_manager_) | |||
| 56 | block_linear_unswizzle_2d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_2D_COMP)), | 50 | block_linear_unswizzle_2d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_2D_COMP)), |
| 57 | block_linear_unswizzle_3d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_3D_COMP)), | 51 | block_linear_unswizzle_3d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_3D_COMP)), |
| 58 | pitch_unswizzle_program(MakeProgram(PITCH_UNSWIZZLE_COMP)), | 52 | pitch_unswizzle_program(MakeProgram(PITCH_UNSWIZZLE_COMP)), |
| 59 | copy_bgra_program(MakeProgram(OPENGL_COPY_BGRA_COMP)), | ||
| 60 | copy_bc4_program(MakeProgram(OPENGL_COPY_BC4_COMP)) { | 53 | copy_bc4_program(MakeProgram(OPENGL_COPY_BC4_COMP)) { |
| 61 | const auto swizzle_table = Tegra::Texture::MakeSwizzleTable(); | 54 | const auto swizzle_table = Tegra::Texture::MakeSwizzleTable(); |
| 62 | swizzle_table_buffer.Create(); | 55 | swizzle_table_buffer.Create(); |
| @@ -255,43 +248,6 @@ void UtilShaders::CopyBC4(Image& dst_image, Image& src_image, std::span<const Im | |||
| 255 | program_manager.RestoreGuestCompute(); | 248 | program_manager.RestoreGuestCompute(); |
| 256 | } | 249 | } |
| 257 | 250 | ||
| 258 | void UtilShaders::CopyBGR(Image& dst_image, Image& src_image, | ||
| 259 | std::span<const VideoCommon::ImageCopy> copies) { | ||
| 260 | static constexpr GLuint BINDING_INPUT_IMAGE = 0; | ||
| 261 | static constexpr GLuint BINDING_OUTPUT_IMAGE = 1; | ||
| 262 | static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0}; | ||
| 263 | const u32 bytes_per_block = BytesPerBlock(dst_image.info.format); | ||
| 264 | switch (bytes_per_block) { | ||
| 265 | case 2: | ||
| 266 | // BGR565 copy | ||
| 267 | for (const ImageCopy& copy : copies) { | ||
| 268 | ASSERT(copy.src_offset == zero_offset); | ||
| 269 | ASSERT(copy.dst_offset == zero_offset); | ||
| 270 | bgr_copy_pass.Execute(dst_image, src_image, copy); | ||
| 271 | } | ||
| 272 | break; | ||
| 273 | case 4: { | ||
| 274 | // BGRA8 copy | ||
| 275 | program_manager.BindComputeProgram(copy_bgra_program.handle); | ||
| 276 | constexpr GLenum FORMAT = GL_RGBA8; | ||
| 277 | for (const ImageCopy& copy : copies) { | ||
| 278 | ASSERT(copy.src_offset == zero_offset); | ||
| 279 | ASSERT(copy.dst_offset == zero_offset); | ||
| 280 | glBindImageTexture(BINDING_INPUT_IMAGE, src_image.StorageHandle(), | ||
| 281 | copy.src_subresource.base_level, GL_FALSE, 0, GL_READ_ONLY, FORMAT); | ||
| 282 | glBindImageTexture(BINDING_OUTPUT_IMAGE, dst_image.StorageHandle(), | ||
| 283 | copy.dst_subresource.base_level, GL_FALSE, 0, GL_WRITE_ONLY, FORMAT); | ||
| 284 | glDispatchCompute(copy.extent.width, copy.extent.height, copy.extent.depth); | ||
| 285 | } | ||
| 286 | program_manager.RestoreGuestCompute(); | ||
| 287 | break; | ||
| 288 | } | ||
| 289 | default: | ||
| 290 | UNREACHABLE(); | ||
| 291 | break; | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | GLenum StoreFormat(u32 bytes_per_block) { | 251 | GLenum StoreFormat(u32 bytes_per_block) { |
| 296 | switch (bytes_per_block) { | 252 | switch (bytes_per_block) { |
| 297 | case 1: | 253 | case 1: |
| @@ -309,36 +265,4 @@ GLenum StoreFormat(u32 bytes_per_block) { | |||
| 309 | return GL_R8UI; | 265 | return GL_R8UI; |
| 310 | } | 266 | } |
| 311 | 267 | ||
| 312 | void Bgr565CopyPass::Execute(const Image& dst_image, const Image& src_image, | ||
| 313 | const ImageCopy& copy) { | ||
| 314 | if (CopyBufferCreationNeeded(copy)) { | ||
| 315 | CreateNewCopyBuffer(copy, GL_TEXTURE_2D_ARRAY, GL_RGB565); | ||
| 316 | } | ||
| 317 | // Copy from source to PBO | ||
| 318 | glPixelStorei(GL_PACK_ALIGNMENT, 1); | ||
| 319 | glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width); | ||
| 320 | glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr16_pbo.handle); | ||
| 321 | glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, | ||
| 322 | copy.src_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, | ||
| 323 | static_cast<GLsizei>(bgr16_pbo_size), nullptr); | ||
| 324 | |||
| 325 | // Copy from PBO to destination in reverse order | ||
| 326 | glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||
| 327 | glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width); | ||
| 328 | glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr16_pbo.handle); | ||
| 329 | glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, | ||
| 330 | copy.dst_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, | ||
| 331 | nullptr); | ||
| 332 | } | ||
| 333 | |||
| 334 | bool Bgr565CopyPass::CopyBufferCreationNeeded(const ImageCopy& copy) { | ||
| 335 | return bgr16_pbo_size < NumPixelsInCopy(copy) * sizeof(u16); | ||
| 336 | } | ||
| 337 | |||
| 338 | void Bgr565CopyPass::CreateNewCopyBuffer(const ImageCopy& copy, GLenum target, GLuint format) { | ||
| 339 | bgr16_pbo.Create(); | ||
| 340 | bgr16_pbo_size = NumPixelsInCopy(copy) * sizeof(u16); | ||
| 341 | glNamedBufferData(bgr16_pbo.handle, bgr16_pbo_size, nullptr, GL_STREAM_COPY); | ||
| 342 | } | ||
| 343 | |||
| 344 | } // namespace OpenGL | 268 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/util_shaders.h b/src/video_core/renderer_opengl/util_shaders.h index ef881e35f..5de95ea7a 100644 --- a/src/video_core/renderer_opengl/util_shaders.h +++ b/src/video_core/renderer_opengl/util_shaders.h | |||
| @@ -19,22 +19,6 @@ class ProgramManager; | |||
| 19 | 19 | ||
| 20 | struct ImageBufferMap; | 20 | struct ImageBufferMap; |
| 21 | 21 | ||
| 22 | class Bgr565CopyPass { | ||
| 23 | public: | ||
| 24 | Bgr565CopyPass() = default; | ||
| 25 | ~Bgr565CopyPass() = default; | ||
| 26 | |||
| 27 | void Execute(const Image& dst_image, const Image& src_image, | ||
| 28 | const VideoCommon::ImageCopy& copy); | ||
| 29 | |||
| 30 | private: | ||
| 31 | [[nodiscard]] bool CopyBufferCreationNeeded(const VideoCommon::ImageCopy& copy); | ||
| 32 | void CreateNewCopyBuffer(const VideoCommon::ImageCopy& copy, GLenum target, GLuint format); | ||
| 33 | |||
| 34 | OGLBuffer bgr16_pbo; | ||
| 35 | size_t bgr16_pbo_size{}; | ||
| 36 | }; | ||
| 37 | |||
| 38 | class UtilShaders { | 22 | class UtilShaders { |
| 39 | public: | 23 | public: |
| 40 | explicit UtilShaders(ProgramManager& program_manager); | 24 | explicit UtilShaders(ProgramManager& program_manager); |
| @@ -55,9 +39,6 @@ public: | |||
| 55 | void CopyBC4(Image& dst_image, Image& src_image, | 39 | void CopyBC4(Image& dst_image, Image& src_image, |
| 56 | std::span<const VideoCommon::ImageCopy> copies); | 40 | std::span<const VideoCommon::ImageCopy> copies); |
| 57 | 41 | ||
| 58 | void CopyBGR(Image& dst_image, Image& src_image, | ||
| 59 | std::span<const VideoCommon::ImageCopy> copies); | ||
| 60 | |||
| 61 | private: | 42 | private: |
| 62 | ProgramManager& program_manager; | 43 | ProgramManager& program_manager; |
| 63 | 44 | ||
| @@ -67,10 +48,7 @@ private: | |||
| 67 | OGLProgram block_linear_unswizzle_2d_program; | 48 | OGLProgram block_linear_unswizzle_2d_program; |
| 68 | OGLProgram block_linear_unswizzle_3d_program; | 49 | OGLProgram block_linear_unswizzle_3d_program; |
| 69 | OGLProgram pitch_unswizzle_program; | 50 | OGLProgram pitch_unswizzle_program; |
| 70 | OGLProgram copy_bgra_program; | ||
| 71 | OGLProgram copy_bc4_program; | 51 | OGLProgram copy_bc4_program; |
| 72 | |||
| 73 | Bgr565CopyPass bgr_copy_pass; | ||
| 74 | }; | 52 | }; |
| 75 | 53 | ||
| 76 | GLenum StoreFormat(u32 bytes_per_block); | 54 | GLenum StoreFormat(u32 bytes_per_block); |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index adb6b7a3b..74822814d 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -97,19 +97,14 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, | |||
| 97 | Core::Frontend::EmuWindow& emu_window, | 97 | Core::Frontend::EmuWindow& emu_window, |
| 98 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, | 98 | Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, |
| 99 | std::unique_ptr<Core::Frontend::GraphicsContext> context_) try | 99 | std::unique_ptr<Core::Frontend::GraphicsContext> context_) try |
| 100 | : RendererBase(emu_window, std::move(context_)), | 100 | : RendererBase(emu_window, std::move(context_)), telemetry_session(telemetry_session_), |
| 101 | telemetry_session(telemetry_session_), | 101 | cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary()), |
| 102 | cpu_memory(cpu_memory_), | ||
| 103 | gpu(gpu_), | ||
| 104 | library(OpenLibrary()), | ||
| 105 | instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, | 102 | instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, |
| 106 | true, Settings::values.renderer_debug.GetValue())), | 103 | true, Settings::values.renderer_debug.GetValue())), |
| 107 | debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr), | 104 | debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr), |
| 108 | surface(CreateSurface(instance, render_window)), | 105 | surface(CreateSurface(instance, render_window)), |
| 109 | device(CreateDevice(instance, dld, *surface)), | 106 | device(CreateDevice(instance, dld, *surface)), memory_allocator(device, false), |
| 110 | memory_allocator(device, false), | 107 | state_tracker(gpu), scheduler(device, state_tracker), |
| 111 | state_tracker(gpu), | ||
| 112 | scheduler(device, state_tracker), | ||
| 113 | swapchain(*surface, device, scheduler, render_window.GetFramebufferLayout().width, | 108 | swapchain(*surface, device, scheduler, render_window.GetFramebufferLayout().width, |
| 114 | render_window.GetFramebufferLayout().height, false), | 109 | render_window.GetFramebufferLayout().height, false), |
| 115 | blit_screen(cpu_memory, render_window, device, memory_allocator, swapchain, scheduler, | 110 | blit_screen(cpu_memory, render_window, device, memory_allocator, swapchain, scheduler, |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 7c0f91007..11cd41ad7 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -507,8 +507,9 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { | |||
| 507 | vertex_attributes.push_back({ | 507 | vertex_attributes.push_back({ |
| 508 | .location = static_cast<u32>(index), | 508 | .location = static_cast<u32>(index), |
| 509 | .binding = 0, | 509 | .binding = 0, |
| 510 | .format = type == 1 ? VK_FORMAT_R32_SFLOAT | 510 | .format = type == 1 ? VK_FORMAT_R32_SFLOAT |
| 511 | : type == 2 ? VK_FORMAT_R32_SINT : VK_FORMAT_R32_UINT, | 511 | : type == 2 ? VK_FORMAT_R32_SINT |
| 512 | : VK_FORMAT_R32_UINT, | ||
| 512 | .offset = 0, | 513 | .offset = 0, |
| 513 | }); | 514 | }); |
| 514 | } | 515 | } |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index bd22e4e83..85fc1712f 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h | |||
| @@ -212,7 +212,6 @@ private: | |||
| 212 | vk::CommandBuffer current_cmdbuf; | 212 | vk::CommandBuffer current_cmdbuf; |
| 213 | 213 | ||
| 214 | std::unique_ptr<CommandChunk> chunk; | 214 | std::unique_ptr<CommandChunk> chunk; |
| 215 | std::jthread worker_thread; | ||
| 216 | 215 | ||
| 217 | State state; | 216 | State state; |
| 218 | 217 | ||
| @@ -226,6 +225,7 @@ private: | |||
| 226 | std::mutex work_mutex; | 225 | std::mutex work_mutex; |
| 227 | std::condition_variable_any work_cv; | 226 | std::condition_variable_any work_cv; |
| 228 | std::condition_variable wait_cv; | 227 | std::condition_variable wait_cv; |
| 228 | std::jthread worker_thread; | ||
| 229 | }; | 229 | }; |
| 230 | 230 | ||
| 231 | } // namespace Vulkan | 231 | } // namespace Vulkan |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index ff979a7ac..3b87640b5 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -127,7 +127,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 127 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); | 127 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); |
| 128 | VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; | 128 | VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; |
| 129 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && | 129 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && |
| 130 | info.size.width == info.size.height) { | 130 | info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { |
| 131 | flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; | 131 | flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; |
| 132 | } | 132 | } |
| 133 | if (info.type == ImageType::e3D) { | 133 | if (info.type == ImageType::e3D) { |
diff --git a/src/video_core/texture_cache/slot_vector.h b/src/video_core/texture_cache/slot_vector.h index 74cd3c9d8..50df06409 100644 --- a/src/video_core/texture_cache/slot_vector.h +++ b/src/video_core/texture_cache/slot_vector.h | |||
| @@ -31,8 +31,8 @@ struct SlotId { | |||
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | template <class T> | 33 | template <class T> |
| 34 | requires std::is_nothrow_move_assignable_v<T>&& | 34 | requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T> |
| 35 | std::is_nothrow_move_constructible_v<T> class SlotVector { | 35 | class SlotVector { |
| 36 | public: | 36 | public: |
| 37 | class Iterator { | 37 | class Iterator { |
| 38 | friend SlotVector<T>; | 38 | friend SlotVector<T>; |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index c2ec9f76a..6388ed2eb 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
| @@ -588,22 +588,27 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 588 | ext_extended_dynamic_state = false; | 588 | ext_extended_dynamic_state = false; |
| 589 | } | 589 | } |
| 590 | } | 590 | } |
| 591 | |||
| 592 | sets_per_pool = 64; | 591 | sets_per_pool = 64; |
| 593 | if (driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE) { | 592 | |
| 593 | const bool is_amd = | ||
| 594 | driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; | ||
| 595 | if (is_amd) { | ||
| 594 | // AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2. | 596 | // AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2. |
| 595 | sets_per_pool = 96; | 597 | sets_per_pool = 96; |
| 596 | } | 598 | // Disable VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT on AMD GCN4 and lower as it is broken. |
| 597 | |||
| 598 | const bool is_amd = driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || | ||
| 599 | driver_id == VK_DRIVER_ID_MESA_RADV || | ||
| 600 | driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; | ||
| 601 | if (ext_sampler_filter_minmax && is_amd) { | ||
| 602 | // Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken. | ||
| 603 | if (!is_float16_supported) { | 599 | if (!is_float16_supported) { |
| 604 | LOG_WARNING( | 600 | LOG_WARNING( |
| 605 | Render_Vulkan, | 601 | Render_Vulkan, |
| 606 | "Blacklisting AMD GCN4 and lower for VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME"); | 602 | "AMD GCN4 and earlier do not properly support VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); |
| 603 | has_broken_cube_compatibility = true; | ||
| 604 | } | ||
| 605 | } | ||
| 606 | const bool is_amd_or_radv = is_amd || driver_id == VK_DRIVER_ID_MESA_RADV; | ||
| 607 | if (ext_sampler_filter_minmax && is_amd_or_radv) { | ||
| 608 | // Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken. | ||
| 609 | if (!is_float16_supported) { | ||
| 610 | LOG_WARNING(Render_Vulkan, | ||
| 611 | "Blacklisting AMD GCN4 and earlier for VK_EXT_sampler_filter_minmax"); | ||
| 607 | ext_sampler_filter_minmax = false; | 612 | ext_sampler_filter_minmax = false; |
| 608 | } | 613 | } |
| 609 | } | 614 | } |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index bc180a32a..d9e74f1aa 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -309,6 +309,11 @@ public: | |||
| 309 | return has_renderdoc || has_nsight_graphics; | 309 | return has_renderdoc || has_nsight_graphics; |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | /// Returns true when the device does not properly support cube compatibility. | ||
| 313 | bool HasBrokenCubeImageCompability() const { | ||
| 314 | return has_broken_cube_compatibility; | ||
| 315 | } | ||
| 316 | |||
| 312 | /// Returns the vendor name reported from Vulkan. | 317 | /// Returns the vendor name reported from Vulkan. |
| 313 | std::string_view GetVendorName() const { | 318 | std::string_view GetVendorName() const { |
| 314 | return vendor_name; | 319 | return vendor_name; |
| @@ -417,6 +422,7 @@ private: | |||
| 417 | bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization. | 422 | bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization. |
| 418 | bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. | 423 | bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. |
| 419 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. | 424 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. |
| 425 | bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit | ||
| 420 | bool has_renderdoc{}; ///< Has RenderDoc attached | 426 | bool has_renderdoc{}; ///< Has RenderDoc attached |
| 421 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached | 427 | bool has_nsight_graphics{}; ///< Has Nsight Graphics attached |
| 422 | 428 | ||
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index b6dda283d..402be6a78 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt | |||
| @@ -290,10 +290,6 @@ if (YUZU_USE_QT_WEB_ENGINE) | |||
| 290 | target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE) | 290 | target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE) |
| 291 | endif () | 291 | endif () |
| 292 | 292 | ||
| 293 | if (YUZU_ENABLE_BOXCAT) | ||
| 294 | target_compile_definitions(yuzu PRIVATE -DYUZU_ENABLE_BOXCAT) | ||
| 295 | endif () | ||
| 296 | |||
| 297 | if(UNIX AND NOT APPLE) | 293 | if(UNIX AND NOT APPLE) |
| 298 | install(TARGETS yuzu RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 294 | install(TARGETS yuzu RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
| 299 | endif() | 295 | endif() |
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 652d99570..7d433ca50 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp | |||
| @@ -54,6 +54,9 @@ QtNXWebEngineView::QtNXWebEngineView(QWidget* parent, Core::System& system, | |||
| 54 | input_interpreter(std::make_unique<InputInterpreter>(system)), | 54 | input_interpreter(std::make_unique<InputInterpreter>(system)), |
| 55 | default_profile{QWebEngineProfile::defaultProfile()}, | 55 | default_profile{QWebEngineProfile::defaultProfile()}, |
| 56 | global_settings{QWebEngineSettings::globalSettings()} { | 56 | global_settings{QWebEngineSettings::globalSettings()} { |
| 57 | default_profile->setPersistentStoragePath(QString::fromStdString(Common::FS::PathToUTF8String( | ||
| 58 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::YuzuDir) / "qtwebengine"))); | ||
| 59 | |||
| 57 | QWebEngineScript gamepad; | 60 | QWebEngineScript gamepad; |
| 58 | QWebEngineScript window_nx; | 61 | QWebEngineScript window_nx; |
| 59 | 62 | ||
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 1519a46ed..8b9e186b0 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -302,12 +302,17 @@ GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, | |||
| 302 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); | 302 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); |
| 303 | connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, | 303 | connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, |
| 304 | Qt::QueuedConnection); | 304 | Qt::QueuedConnection); |
| 305 | connect(this, &GRenderWindow::ExitSignal, parent, &GMainWindow::OnExit, Qt::QueuedConnection); | ||
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | void GRenderWindow::ExecuteProgram(std::size_t program_index) { | 308 | void GRenderWindow::ExecuteProgram(std::size_t program_index) { |
| 308 | emit ExecuteProgramSignal(program_index); | 309 | emit ExecuteProgramSignal(program_index); |
| 309 | } | 310 | } |
| 310 | 311 | ||
| 312 | void GRenderWindow::Exit() { | ||
| 313 | emit ExitSignal(); | ||
| 314 | } | ||
| 315 | |||
| 311 | GRenderWindow::~GRenderWindow() { | 316 | GRenderWindow::~GRenderWindow() { |
| 312 | input_subsystem->Shutdown(); | 317 | input_subsystem->Shutdown(); |
| 313 | } | 318 | } |
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 402dd2ee1..54c4e2142 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -181,6 +181,9 @@ public: | |||
| 181 | */ | 181 | */ |
| 182 | void ExecuteProgram(std::size_t program_index); | 182 | void ExecuteProgram(std::size_t program_index); |
| 183 | 183 | ||
| 184 | /// Instructs the window to exit the application. | ||
| 185 | void Exit(); | ||
| 186 | |||
| 184 | public slots: | 187 | public slots: |
| 185 | void OnEmulationStarting(EmuThread* emu_thread); | 188 | void OnEmulationStarting(EmuThread* emu_thread); |
| 186 | void OnEmulationStopping(); | 189 | void OnEmulationStopping(); |
| @@ -191,6 +194,7 @@ signals: | |||
| 191 | void Closed(); | 194 | void Closed(); |
| 192 | void FirstFrameDisplayed(); | 195 | void FirstFrameDisplayed(); |
| 193 | void ExecuteProgramSignal(std::size_t program_index); | 196 | void ExecuteProgramSignal(std::size_t program_index); |
| 197 | void ExitSignal(); | ||
| 194 | void MouseActivity(); | 198 | void MouseActivity(); |
| 195 | 199 | ||
| 196 | private: | 200 | private: |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 27b67fd9e..eb941ce02 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -562,7 +562,11 @@ void Config::ReadControlValues() { | |||
| 562 | ReadTouchscreenValues(); | 562 | ReadTouchscreenValues(); |
| 563 | ReadMotionTouchValues(); | 563 | ReadMotionTouchValues(); |
| 564 | 564 | ||
| 565 | #ifdef _WIN32 | ||
| 565 | ReadBasicSetting(Settings::values.enable_raw_input); | 566 | ReadBasicSetting(Settings::values.enable_raw_input); |
| 567 | #else | ||
| 568 | Settings::values.enable_raw_input = false; | ||
| 569 | #endif | ||
| 566 | ReadBasicSetting(Settings::values.emulate_analog_keyboard); | 570 | ReadBasicSetting(Settings::values.emulate_analog_keyboard); |
| 567 | Settings::values.mouse_panning = false; | 571 | Settings::values.mouse_panning = false; |
| 568 | ReadBasicSetting(Settings::values.mouse_panning_sensitivity); | 572 | ReadBasicSetting(Settings::values.mouse_panning_sensitivity); |
| @@ -705,8 +709,6 @@ void Config::ReadDebuggingValues() { | |||
| 705 | 709 | ||
| 706 | void Config::ReadServiceValues() { | 710 | void Config::ReadServiceValues() { |
| 707 | qt_config->beginGroup(QStringLiteral("Services")); | 711 | qt_config->beginGroup(QStringLiteral("Services")); |
| 708 | ReadBasicSetting(Settings::values.bcat_backend); | ||
| 709 | ReadBasicSetting(Settings::values.bcat_boxcat_local); | ||
| 710 | ReadBasicSetting(Settings::values.network_interface); | 712 | ReadBasicSetting(Settings::values.network_interface); |
| 711 | qt_config->endGroup(); | 713 | qt_config->endGroup(); |
| 712 | } | 714 | } |
| @@ -1265,8 +1267,6 @@ void Config::SaveDebuggingValues() { | |||
| 1265 | void Config::SaveNetworkValues() { | 1267 | void Config::SaveNetworkValues() { |
| 1266 | qt_config->beginGroup(QStringLiteral("Services")); | 1268 | qt_config->beginGroup(QStringLiteral("Services")); |
| 1267 | 1269 | ||
| 1268 | WriteBasicSetting(Settings::values.bcat_backend); | ||
| 1269 | WriteBasicSetting(Settings::values.bcat_boxcat_local); | ||
| 1270 | WriteBasicSetting(Settings::values.network_interface); | 1270 | WriteBasicSetting(Settings::values.network_interface); |
| 1271 | 1271 | ||
| 1272 | qt_config->endGroup(); | 1272 | qt_config->endGroup(); |
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index d20fd86b6..b30f09013 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp | |||
| @@ -88,6 +88,10 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent) | |||
| 88 | connect(ui->buttonMotionTouch, &QPushButton::clicked, this, | 88 | connect(ui->buttonMotionTouch, &QPushButton::clicked, this, |
| 89 | &ConfigureInputAdvanced::CallMotionTouchConfigDialog); | 89 | &ConfigureInputAdvanced::CallMotionTouchConfigDialog); |
| 90 | 90 | ||
| 91 | #ifndef _WIN32 | ||
| 92 | ui->enable_raw_input->setVisible(false); | ||
| 93 | #endif | ||
| 94 | |||
| 91 | LoadConfiguration(); | 95 | LoadConfiguration(); |
| 92 | } | 96 | } |
| 93 | 97 | ||
diff --git a/src/yuzu/configuration/configure_network.cpp b/src/yuzu/configuration/configure_network.cpp index ae22f1018..cc15d36c2 100644 --- a/src/yuzu/configuration/configure_network.cpp +++ b/src/yuzu/configuration/configure_network.cpp | |||
| @@ -6,64 +6,25 @@ | |||
| 6 | #include <QtConcurrent/QtConcurrent> | 6 | #include <QtConcurrent/QtConcurrent> |
| 7 | #include "common/settings.h" | 7 | #include "common/settings.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/service/bcat/backend/boxcat.h" | ||
| 10 | #include "core/network/network_interface.h" | 9 | #include "core/network/network_interface.h" |
| 11 | #include "ui_configure_network.h" | 10 | #include "ui_configure_network.h" |
| 12 | #include "yuzu/configuration/configure_network.h" | 11 | #include "yuzu/configuration/configure_network.h" |
| 13 | 12 | ||
| 14 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 15 | namespace { | ||
| 16 | QString FormatEventStatusString(const Service::BCAT::EventStatus& status) { | ||
| 17 | QString out; | ||
| 18 | |||
| 19 | if (status.header.has_value()) { | ||
| 20 | out += QStringLiteral("<i>%1</i><br>").arg(QString::fromStdString(*status.header)); | ||
| 21 | } | ||
| 22 | |||
| 23 | if (status.events.size() == 1) { | ||
| 24 | out += QStringLiteral("%1<br>").arg(QString::fromStdString(status.events.front())); | ||
| 25 | } else { | ||
| 26 | for (const auto& event : status.events) { | ||
| 27 | out += QStringLiteral("- %1<br>").arg(QString::fromStdString(event)); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | if (status.footer.has_value()) { | ||
| 32 | out += QStringLiteral("<i>%1</i><br>").arg(QString::fromStdString(*status.footer)); | ||
| 33 | } | ||
| 34 | |||
| 35 | return out; | ||
| 36 | } | ||
| 37 | } // Anonymous namespace | ||
| 38 | #endif | ||
| 39 | |||
| 40 | ConfigureNetwork::ConfigureNetwork(QWidget* parent) | 13 | ConfigureNetwork::ConfigureNetwork(QWidget* parent) |
| 41 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) { | 14 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) { |
| 42 | ui->setupUi(this); | 15 | ui->setupUi(this); |
| 43 | 16 | ||
| 44 | ui->bcat_source->addItem(QStringLiteral("None")); | ||
| 45 | ui->bcat_empty_label->setHidden(true); | ||
| 46 | ui->bcat_empty_header->setHidden(true); | ||
| 47 | |||
| 48 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 49 | ui->bcat_source->addItem(QStringLiteral("Boxcat"), QStringLiteral("boxcat")); | ||
| 50 | #endif | ||
| 51 | |||
| 52 | ui->network_interface->addItem(tr("None")); | 17 | ui->network_interface->addItem(tr("None")); |
| 53 | for (const auto& iface : Network::GetAvailableNetworkInterfaces()) { | 18 | for (const auto& iface : Network::GetAvailableNetworkInterfaces()) { |
| 54 | ui->network_interface->addItem(QString::fromStdString(iface.name)); | 19 | ui->network_interface->addItem(QString::fromStdString(iface.name)); |
| 55 | } | 20 | } |
| 56 | 21 | ||
| 57 | connect(ui->bcat_source, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | ||
| 58 | &ConfigureNetwork::OnBCATImplChanged); | ||
| 59 | |||
| 60 | this->SetConfiguration(); | 22 | this->SetConfiguration(); |
| 61 | } | 23 | } |
| 62 | 24 | ||
| 63 | ConfigureNetwork::~ConfigureNetwork() = default; | 25 | ConfigureNetwork::~ConfigureNetwork() = default; |
| 64 | 26 | ||
| 65 | void ConfigureNetwork::ApplyConfiguration() { | 27 | void ConfigureNetwork::ApplyConfiguration() { |
| 66 | Settings::values.bcat_backend = ui->bcat_source->currentText().toLower().toStdString(); | ||
| 67 | Settings::values.network_interface = ui->network_interface->currentText().toStdString(); | 28 | Settings::values.network_interface = ui->network_interface->currentText().toStdString(); |
| 68 | } | 29 | } |
| 69 | 30 | ||
| @@ -74,86 +35,8 @@ void ConfigureNetwork::RetranslateUi() { | |||
| 74 | void ConfigureNetwork::SetConfiguration() { | 35 | void ConfigureNetwork::SetConfiguration() { |
| 75 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 36 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); |
| 76 | 37 | ||
| 77 | const int index = | ||
| 78 | ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend.GetValue())); | ||
| 79 | ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); | ||
| 80 | |||
| 81 | const std::string& network_interface = Settings::values.network_interface.GetValue(); | 38 | const std::string& network_interface = Settings::values.network_interface.GetValue(); |
| 82 | 39 | ||
| 83 | ui->network_interface->setCurrentText(QString::fromStdString(network_interface)); | 40 | ui->network_interface->setCurrentText(QString::fromStdString(network_interface)); |
| 84 | ui->network_interface->setEnabled(runtime_lock); | 41 | ui->network_interface->setEnabled(runtime_lock); |
| 85 | } | 42 | } |
| 86 | |||
| 87 | std::pair<QString, QString> ConfigureNetwork::BCATDownloadEvents() { | ||
| 88 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 89 | std::optional<std::string> global; | ||
| 90 | std::map<std::string, Service::BCAT::EventStatus> map; | ||
| 91 | const auto res = Service::BCAT::Boxcat::GetStatus(global, map); | ||
| 92 | |||
| 93 | switch (res) { | ||
| 94 | case Service::BCAT::Boxcat::StatusResult::Success: | ||
| 95 | break; | ||
| 96 | case Service::BCAT::Boxcat::StatusResult::Offline: | ||
| 97 | return {QString{}, | ||
| 98 | tr("The boxcat service is offline or you are not connected to the internet.")}; | ||
| 99 | case Service::BCAT::Boxcat::StatusResult::ParseError: | ||
| 100 | return {QString{}, | ||
| 101 | tr("There was an error while processing the boxcat event data. Contact the yuzu " | ||
| 102 | "developers.")}; | ||
| 103 | case Service::BCAT::Boxcat::StatusResult::BadClientVersion: | ||
| 104 | return {QString{}, | ||
| 105 | tr("The version of yuzu you are using is either too new or too old for the server. " | ||
| 106 | "Try updating to the latest official release of yuzu.")}; | ||
| 107 | } | ||
| 108 | |||
| 109 | if (map.empty()) { | ||
| 110 | return {QStringLiteral("Current Boxcat Events"), | ||
| 111 | tr("There are currently no events on boxcat.")}; | ||
| 112 | } | ||
| 113 | |||
| 114 | QString out; | ||
| 115 | |||
| 116 | if (global.has_value()) { | ||
| 117 | out += QStringLiteral("%1<br>").arg(QString::fromStdString(*global)); | ||
| 118 | } | ||
| 119 | |||
| 120 | for (const auto& [key, value] : map) { | ||
| 121 | out += QStringLiteral("%1<b>%2</b><br>%3") | ||
| 122 | .arg(out.isEmpty() ? QString{} : QStringLiteral("<br>")) | ||
| 123 | .arg(QString::fromStdString(key)) | ||
| 124 | .arg(FormatEventStatusString(value)); | ||
| 125 | } | ||
| 126 | return {tr("Current Boxcat Events"), std::move(out)}; | ||
| 127 | #else | ||
| 128 | return {tr("Current Boxcat Events"), tr("There are currently no events on boxcat.")}; | ||
| 129 | #endif | ||
| 130 | } | ||
| 131 | |||
| 132 | void ConfigureNetwork::OnBCATImplChanged() { | ||
| 133 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 134 | const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat"); | ||
| 135 | ui->bcat_empty_header->setHidden(!boxcat); | ||
| 136 | ui->bcat_empty_label->setHidden(!boxcat); | ||
| 137 | ui->bcat_empty_header->setText(QString{}); | ||
| 138 | ui->bcat_empty_label->setText(tr("Yuzu is retrieving the latest boxcat status...")); | ||
| 139 | |||
| 140 | if (!boxcat) | ||
| 141 | return; | ||
| 142 | |||
| 143 | const auto future = QtConcurrent::run([this] { return BCATDownloadEvents(); }); | ||
| 144 | |||
| 145 | watcher.setFuture(future); | ||
| 146 | connect(&watcher, &QFutureWatcher<std::pair<QString, QString>>::finished, this, | ||
| 147 | [this] { OnUpdateBCATEmptyLabel(watcher.result()); }); | ||
| 148 | #endif | ||
| 149 | } | ||
| 150 | |||
| 151 | void ConfigureNetwork::OnUpdateBCATEmptyLabel(std::pair<QString, QString> string) { | ||
| 152 | #ifdef YUZU_ENABLE_BOXCAT | ||
| 153 | const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat"); | ||
| 154 | if (boxcat) { | ||
| 155 | ui->bcat_empty_header->setText(string.first); | ||
| 156 | ui->bcat_empty_label->setText(string.second); | ||
| 157 | } | ||
| 158 | #endif | ||
| 159 | } | ||
diff --git a/src/yuzu/configuration/configure_network.h b/src/yuzu/configuration/configure_network.h index 442b68e6b..028fd4acc 100644 --- a/src/yuzu/configuration/configure_network.h +++ b/src/yuzu/configuration/configure_network.h | |||
| @@ -25,10 +25,5 @@ public: | |||
| 25 | private: | 25 | private: |
| 26 | void SetConfiguration(); | 26 | void SetConfiguration(); |
| 27 | 27 | ||
| 28 | std::pair<QString, QString> BCATDownloadEvents(); | ||
| 29 | void OnBCATImplChanged(); | ||
| 30 | void OnUpdateBCATEmptyLabel(std::pair<QString, QString> string); | ||
| 31 | |||
| 32 | std::unique_ptr<Ui::ConfigureNetwork> ui; | 28 | std::unique_ptr<Ui::ConfigureNetwork> ui; |
| 33 | QFutureWatcher<std::pair<QString, QString>> watcher{this}; | ||
| 34 | }; | 29 | }; |
diff --git a/src/yuzu/configuration/configure_network.ui b/src/yuzu/configuration/configure_network.ui index 5f9b7e97b..9a79262f0 100644 --- a/src/yuzu/configuration/configure_network.ui +++ b/src/yuzu/configuration/configure_network.ui | |||
| @@ -35,92 +35,6 @@ | |||
| 35 | </layout> | 35 | </layout> |
| 36 | </widget> | 36 | </widget> |
| 37 | </item> | 37 | </item> |
| 38 | <item> | ||
| 39 | <widget class="QGroupBox" name="groupBox"> | ||
| 40 | <property name="title"> | ||
| 41 | <string>BCAT</string> | ||
| 42 | </property> | ||
| 43 | <layout class="QGridLayout" name="gridLayout"> | ||
| 44 | <item row="3" column="0"> | ||
| 45 | <widget class="QLabel" name="bcat_empty_header"> | ||
| 46 | <property name="text"> | ||
| 47 | <string/> | ||
| 48 | </property> | ||
| 49 | <property name="alignment"> | ||
| 50 | <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> | ||
| 51 | </property> | ||
| 52 | <property name="wordWrap"> | ||
| 53 | <bool>true</bool> | ||
| 54 | </property> | ||
| 55 | </widget> | ||
| 56 | </item> | ||
| 57 | <item row="0" column="0"> | ||
| 58 | <widget class="QLabel" name="label"> | ||
| 59 | <property name="maximumSize"> | ||
| 60 | <size> | ||
| 61 | <width>16777215</width> | ||
| 62 | <height>16777215</height> | ||
| 63 | </size> | ||
| 64 | </property> | ||
| 65 | <property name="text"> | ||
| 66 | <string>BCAT Backend</string> | ||
| 67 | </property> | ||
| 68 | </widget> | ||
| 69 | </item> | ||
| 70 | <item row="1" column="1" colspan="2"> | ||
| 71 | <widget class="QLabel" name="label_2"> | ||
| 72 | <property name="maximumSize"> | ||
| 73 | <size> | ||
| 74 | <width>260</width> | ||
| 75 | <height>16777215</height> | ||
| 76 | </size> | ||
| 77 | </property> | ||
| 78 | <property name="text"> | ||
| 79 | <string>BCAT is Nintendo's way of sending data to games to engage its community and unlock additional content.</string> | ||
| 80 | </property> | ||
| 81 | <property name="wordWrap"> | ||
| 82 | <bool>true</bool> | ||
| 83 | </property> | ||
| 84 | </widget> | ||
| 85 | </item> | ||
| 86 | <item row="2" column="1" colspan="2"> | ||
| 87 | <widget class="QLabel" name="label_3"> | ||
| 88 | <property name="text"> | ||
| 89 | <string><html><head/><body><p><a href="https://yuzu-emu.org/help/feature/boxcat"><span style=" text-decoration: underline; color:#0000ff;">Learn more about BCAT, Boxcat, and Current Events</span></a></p></body></html></string> | ||
| 90 | </property> | ||
| 91 | <property name="openExternalLinks"> | ||
| 92 | <bool>true</bool> | ||
| 93 | </property> | ||
| 94 | </widget> | ||
| 95 | </item> | ||
| 96 | <item row="0" column="1" colspan="2"> | ||
| 97 | <widget class="QComboBox" name="bcat_source"/> | ||
| 98 | </item> | ||
| 99 | <item row="3" column="1" colspan="2"> | ||
| 100 | <widget class="QLabel" name="bcat_empty_label"> | ||
| 101 | <property name="enabled"> | ||
| 102 | <bool>true</bool> | ||
| 103 | </property> | ||
| 104 | <property name="maximumSize"> | ||
| 105 | <size> | ||
| 106 | <width>260</width> | ||
| 107 | <height>16777215</height> | ||
| 108 | </size> | ||
| 109 | </property> | ||
| 110 | <property name="text"> | ||
| 111 | <string/> | ||
| 112 | </property> | ||
| 113 | <property name="alignment"> | ||
| 114 | <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> | ||
| 115 | </property> | ||
| 116 | <property name="wordWrap"> | ||
| 117 | <bool>true</bool> | ||
| 118 | </property> | ||
| 119 | </widget> | ||
| 120 | </item> | ||
| 121 | </layout> | ||
| 122 | </widget> | ||
| 123 | </item> | ||
| 124 | </layout> | 38 | </layout> |
| 125 | </item> | 39 | </item> |
| 126 | <item> | 40 | <item> |
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index ac849b01d..136614bf8 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp | |||
| @@ -76,7 +76,7 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t | |||
| 76 | } | 76 | } |
| 77 | } // Anonymous namespace | 77 | } // Anonymous namespace |
| 78 | 78 | ||
| 79 | ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent) | 79 | ConfigureProfileManager::ConfigureProfileManager(QWidget* parent) |
| 80 | : QWidget(parent), ui(new Ui::ConfigureProfileManager), | 80 | : QWidget(parent), ui(new Ui::ConfigureProfileManager), |
| 81 | profile_manager(std::make_unique<Service::Account::ProfileManager>()) { | 81 | profile_manager(std::make_unique<Service::Account::ProfileManager>()) { |
| 82 | ui->setupUi(this); | 82 | ui->setupUi(this); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3c2824362..552c2cc63 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1384,6 +1384,9 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1384 | system.RegisterExecuteProgramCallback( | 1384 | system.RegisterExecuteProgramCallback( |
| 1385 | [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); | 1385 | [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); |
| 1386 | 1386 | ||
| 1387 | // Register an Exit callback such that Core can exit the currently running application. | ||
| 1388 | system.RegisterExitCallback([this]() { render_window->Exit(); }); | ||
| 1389 | |||
| 1387 | connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); | 1390 | connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); |
| 1388 | connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); | 1391 | connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); |
| 1389 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views | 1392 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views |
| @@ -2469,6 +2472,10 @@ void GMainWindow::OnExecuteProgram(std::size_t program_index) { | |||
| 2469 | BootGame(last_filename_booted, 0, program_index); | 2472 | BootGame(last_filename_booted, 0, program_index); |
| 2470 | } | 2473 | } |
| 2471 | 2474 | ||
| 2475 | void GMainWindow::OnExit() { | ||
| 2476 | OnStopGame(); | ||
| 2477 | } | ||
| 2478 | |||
| 2472 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { | 2479 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { |
| 2473 | OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, | 2480 | OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, |
| 2474 | QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); | 2481 | QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); |
| @@ -2913,8 +2920,13 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie | |||
| 2913 | if (title_name.empty()) { | 2920 | if (title_name.empty()) { |
| 2914 | setWindowTitle(QString::fromStdString(window_title)); | 2921 | setWindowTitle(QString::fromStdString(window_title)); |
| 2915 | } else { | 2922 | } else { |
| 2916 | const auto run_title = | 2923 | const auto run_title = [window_title, title_name, title_version, gpu_vendor]() { |
| 2917 | fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, gpu_vendor); | 2924 | if (title_version.empty()) { |
| 2925 | return fmt::format("{} | {} | {}", window_title, title_name, gpu_vendor); | ||
| 2926 | } | ||
| 2927 | return fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, | ||
| 2928 | gpu_vendor); | ||
| 2929 | }(); | ||
| 2918 | setWindowTitle(QString::fromStdString(run_title)); | 2930 | setWindowTitle(QString::fromStdString(run_title)); |
| 2919 | } | 2931 | } |
| 2920 | } | 2932 | } |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 36eed6103..60ce01471 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -153,6 +153,7 @@ signals: | |||
| 153 | public slots: | 153 | public slots: |
| 154 | void OnLoadComplete(); | 154 | void OnLoadComplete(); |
| 155 | void OnExecuteProgram(std::size_t program_index); | 155 | void OnExecuteProgram(std::size_t program_index); |
| 156 | void OnExit(); | ||
| 156 | void ControllerSelectorReconfigureControllers( | 157 | void ControllerSelectorReconfigureControllers( |
| 157 | const Core::Frontend::ControllerParameters& parameters); | 158 | const Core::Frontend::ControllerParameters& parameters); |
| 158 | void SoftwareKeyboardInitialize( | 159 | void SoftwareKeyboardInitialize( |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index d74eb7e2b..434518d53 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -518,10 +518,6 @@ void Config::ReadValues() { | |||
| 518 | ReadSetting("WebService", Settings::values.web_api_url); | 518 | ReadSetting("WebService", Settings::values.web_api_url); |
| 519 | ReadSetting("WebService", Settings::values.yuzu_username); | 519 | ReadSetting("WebService", Settings::values.yuzu_username); |
| 520 | ReadSetting("WebService", Settings::values.yuzu_token); | 520 | ReadSetting("WebService", Settings::values.yuzu_token); |
| 521 | |||
| 522 | // Services | ||
| 523 | ReadSetting("Services", Settings::values.bcat_backend); | ||
| 524 | ReadSetting("Services", Settings::values.bcat_boxcat_local); | ||
| 525 | } | 521 | } |
| 526 | 522 | ||
| 527 | void Config::Reload() { | 523 | void Config::Reload() { |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 72f3213fb..8119a50d8 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -428,11 +428,6 @@ web_api_url = https://api.yuzu-emu.org | |||
| 428 | yuzu_username = | 428 | yuzu_username = |
| 429 | yuzu_token = | 429 | yuzu_token = |
| 430 | 430 | ||
| 431 | [Services] | ||
| 432 | # The name of the backend to use for BCAT | ||
| 433 | # If this is set to 'boxcat' boxcat will be used, otherwise a null implementation will be used | ||
| 434 | bcat_backend = | ||
| 435 | |||
| 436 | [AddOns] | 431 | [AddOns] |
| 437 | # Used to disable add-ons | 432 | # Used to disable add-ons |
| 438 | # List of title IDs of games that will have add-ons disabled (separated by '|'): | 433 | # List of title IDs of games that will have add-ons disabled (separated by '|'): |