diff options
| -rw-r--r-- | CMakeLists.txt | 24 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 5 | ||||
| m--------- | externals/SDL | 0 | ||||
| -rw-r--r-- | externals/libusb/CMakeLists.txt | 74 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_base.h | 3 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 3 |
8 files changed, 79 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba207dfd1..97afaf1a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -23,6 +23,8 @@ option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) | |||
| 23 | 23 | ||
| 24 | option(YUZU_USE_BUNDLED_BOOST "Download bundled Boost" OFF) | 24 | option(YUZU_USE_BUNDLED_BOOST "Download bundled Boost" OFF) |
| 25 | 25 | ||
| 26 | option(YUZU_USE_BUNDLED_LIBUSB "Compile bundled libusb" OFF) | ||
| 27 | |||
| 26 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ON "WIN32" OFF) | 28 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ON "WIN32" OFF) |
| 27 | 29 | ||
| 28 | 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) |
| @@ -420,14 +422,22 @@ elseif (TARGET Boost::boost) | |||
| 420 | endif() | 422 | endif() |
| 421 | 423 | ||
| 422 | # Ensure libusb is properly configured (based on dolphin libusb include) | 424 | # Ensure libusb is properly configured (based on dolphin libusb include) |
| 423 | if(NOT APPLE) | 425 | if(NOT APPLE AND NOT YUZU_USE_BUNDLED_LIBUSB) |
| 424 | include(FindPkgConfig) | 426 | include(FindPkgConfig) |
| 425 | find_package(LibUSB) | 427 | if (PKG_CONFIG_FOUND) |
| 426 | endif() | 428 | pkg_check_modules(LIBUSB QUIET libusb-1.0>=1.0.24) |
| 427 | if (NOT LIBUSB_FOUND) | 429 | else() |
| 428 | add_subdirectory(externals/libusb) | 430 | find_package(LibUSB) |
| 429 | set(LIBUSB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/libusb/libusb/libusb") | 431 | endif() |
| 430 | set(LIBUSB_LIBRARIES usb) | 432 | |
| 433 | if (LIBUSB_FOUND) | ||
| 434 | add_library(usb INTERFACE) | ||
| 435 | target_include_directories(usb INTERFACE "${LIBUSB_INCLUDE_DIRS}") | ||
| 436 | target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}") | ||
| 437 | else() | ||
| 438 | message(WARNING "libusb not found, falling back to externals") | ||
| 439 | set(YUZU_USE_BUNDLED_LIBUSB ON) | ||
| 440 | endif() | ||
| 431 | endif() | 441 | endif() |
| 432 | 442 | ||
| 433 | # List of all FFmpeg components required | 443 | # List of all FFmpeg components required |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index aae0baa0b..5402a532f 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -45,6 +45,11 @@ target_include_directories(microprofile INTERFACE ./microprofile) | |||
| 45 | add_library(unicorn-headers INTERFACE) | 45 | add_library(unicorn-headers INTERFACE) |
| 46 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) | 46 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) |
| 47 | 47 | ||
| 48 | # libusb | ||
| 49 | if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) | ||
| 50 | add_subdirectory(libusb) | ||
| 51 | endif() | ||
| 52 | |||
| 48 | # SDL2 | 53 | # SDL2 |
| 49 | if (NOT SDL2_FOUND AND ENABLE_SDL2) | 54 | if (NOT SDL2_FOUND AND ENABLE_SDL2) |
| 50 | if (NOT WIN32) | 55 | if (NOT WIN32) |
diff --git a/externals/SDL b/externals/SDL | |||
| Subproject 107db2d89953ee7cc03417d43da1f26bd03aad5 | Subproject 2f248a2a31c3323ecc37c00ad5e269e347ae392 | ||
diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt index 3ef007b40..06ce0fba7 100644 --- a/externals/libusb/CMakeLists.txt +++ b/externals/libusb/CMakeLists.txt | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | if (MINGW) | 1 | set(LIBUSB_FOUND ON CACHE BOOL "libusb is present" FORCE) |
| 2 | # The MinGW toolchain for some reason doesn't work with this CMakeLists file after updating to | 2 | set(LIBUSB_VERSION "1.0.24" CACHE STRING "libusb version string" FORCE) |
| 3 | # 1.0.24, so we do it the old-fashioned way for now. We may want to move native Linux toolchains | 3 | |
| 4 | # to here, too (TODO lat9nq?). | 4 | if (MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) |
| 5 | # GNU toolchains for some reason doesn't work with the later half of this CMakeLists after | ||
| 6 | # updating to 1.0.24, so we do it the old-fashioned way for now. | ||
| 5 | 7 | ||
| 6 | set(LIBUSB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libusb") | 8 | set(LIBUSB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libusb") |
| 7 | set(LIBUSB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libusb") | 9 | set(LIBUSB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libusb") |
| 10 | |||
| 8 | # Workarounds for MSYS/MinGW | 11 | # Workarounds for MSYS/MinGW |
| 9 | if (MSYS) | 12 | if (MSYS) |
| 10 | # CMake on Windows passes `C:/`, but we need `/C/` or `/c/` to use `configure` | 13 | # CMake on Windows passes `C:/`, but we need `/C/` or `/c/` to use `configure` |
| @@ -19,36 +22,42 @@ if (MINGW) | |||
| 19 | 22 | ||
| 20 | set(LIBUSB_CONFIGURE "${LIBUSB_SRC_DIR}/configure") | 23 | set(LIBUSB_CONFIGURE "${LIBUSB_SRC_DIR}/configure") |
| 21 | set(LIBUSB_MAKEFILE "${LIBUSB_PREFIX}/Makefile") | 24 | set(LIBUSB_MAKEFILE "${LIBUSB_PREFIX}/Makefile") |
| 22 | set(LIBUSB_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll.a") | ||
| 23 | set(LIBUSB_SHARED_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll") | ||
| 24 | set(LIBUSB_SHARED_LIBRARY_DEST "${CMAKE_BINARY_DIR}/bin/libusb-1.0.dll") | ||
| 25 | 25 | ||
| 26 | # Causes "externals/libusb/libusb/libusb/os/windows_winusb.c:1427:2: error: conversion to non-scalar type requested", so cannot statically link it for now. | 26 | if (MINGW) |
| 27 | # set(LIBUSB_CFLAGS "-DGUID_DEVINTERFACE_USB_DEVICE=\\(GUID\\){0xA5DCBF10,0x6530,0x11D2,{0x90,0x1F,0x00,0xC0,0x4F,0xB9,0x51,0xED}}") | 27 | set(LIBUSB_LIBRARIES "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll.a" CACHE PATH "libusb library path" FORCE) |
| 28 | set(LIBUSB_SHARED_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll") | ||
| 29 | set(LIBUSB_SHARED_LIBRARY_DEST "${CMAKE_BINARY_DIR}/bin/libusb-1.0.dll") | ||
| 30 | |||
| 31 | set(LIBUSB_CONFIGURE_ARGS --host=x86_64-w64-mingw32 --build=x86_64-windows) | ||
| 32 | else() | ||
| 33 | set(LIBUSB_LIBRARIES "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.a" CACHE PATH "libusb library path" FORCE) | ||
| 34 | endif() | ||
| 35 | |||
| 36 | set(LIBUSB_INCLUDE_DIRS "${LIBUSB_SRC_DIR}/libusb" CACHE PATH "libusb headers path" FORCE) | ||
| 37 | |||
| 38 | # MINGW: causes "externals/libusb/libusb/libusb/os/windows_winusb.c:1427:2: error: conversion to non-scalar type requested", so cannot statically link it for now. | ||
| 39 | if (NOT MINGW) | ||
| 40 | set(LIBUSB_CFLAGS "-DGUID_DEVINTERFACE_USB_DEVICE=\\(GUID\\){0xA5DCBF10,0x6530,0x11D2,{0x90,0x1F,0x00,0xC0,0x4F,0xB9,0x51,0xED}}") | ||
| 41 | endif() | ||
| 28 | 42 | ||
| 29 | make_directory("${LIBUSB_PREFIX}") | 43 | make_directory("${LIBUSB_PREFIX}") |
| 30 | 44 | ||
| 31 | add_custom_command( | 45 | add_custom_command( |
| 32 | OUTPUT | 46 | OUTPUT |
| 33 | "${LIBUSB_LIBRARY}" | 47 | "${LIBUSB_LIBRARIES}" |
| 34 | COMMAND | 48 | COMMAND |
| 35 | make | 49 | make |
| 36 | WORKING_DIRECTORY | 50 | WORKING_DIRECTORY |
| 37 | "${LIBUSB_PREFIX}" | 51 | "${LIBUSB_PREFIX}" |
| 38 | ) | 52 | ) |
| 39 | 53 | ||
| 40 | # We may use this path for other GNU toolchains, so put all of the MinGW-specific stuff here | ||
| 41 | if (MINGW) | ||
| 42 | set(LIBUSB_CONFIGURE_ARGS --host=x86_64-w64-mingw32 --build=x86_64-windows) | ||
| 43 | endif() | ||
| 44 | |||
| 45 | add_custom_command( | 54 | add_custom_command( |
| 46 | OUTPUT | 55 | OUTPUT |
| 47 | "${LIBUSB_MAKEFILE}" | 56 | "${LIBUSB_MAKEFILE}" |
| 48 | COMMAND | 57 | COMMAND |
| 49 | # /bin/env | 58 | env |
| 50 | # CFLAGS="${LIBUSB_CFLAGS}" | 59 | CFLAGS="${LIBUSB_CFLAGS}" |
| 51 | /bin/sh "${LIBUSB_CONFIGURE}" | 60 | sh "${LIBUSB_CONFIGURE}" |
| 52 | ${LIBUSB_CONFIGURE_ARGS} | 61 | ${LIBUSB_CONFIGURE_ARGS} |
| 53 | --srcdir="${LIBUSB_SRC_DIR}" | 62 | --srcdir="${LIBUSB_SRC_DIR}" |
| 54 | WORKING_DIRECTORY | 63 | WORKING_DIRECTORY |
| @@ -59,7 +68,7 @@ if (MINGW) | |||
| 59 | OUTPUT | 68 | OUTPUT |
| 60 | "${LIBUSB_CONFIGURE}" | 69 | "${LIBUSB_CONFIGURE}" |
| 61 | COMMAND | 70 | COMMAND |
| 62 | /bin/sh "${LIBUSB_SRC_DIR}/bootstrap.sh" | 71 | sh "${LIBUSB_SRC_DIR}/bootstrap.sh" |
| 63 | WORKING_DIRECTORY | 72 | WORKING_DIRECTORY |
| 64 | "${LIBUSB_SRC_DIR}" | 73 | "${LIBUSB_SRC_DIR}" |
| 65 | ) | 74 | ) |
| @@ -68,19 +77,30 @@ if (MINGW) | |||
| 68 | OUTPUT | 77 | OUTPUT |
| 69 | "${LIBUSB_SHARED_LIBRARY_DEST}" | 78 | "${LIBUSB_SHARED_LIBRARY_DEST}" |
| 70 | COMMAND | 79 | COMMAND |
| 71 | /bin/cp "${LIBUSB_SHARED_LIBRARY}" "${LIBUSB_SHARED_LIBRARY_DEST}" | 80 | cp "${LIBUSB_SHARED_LIBRARY}" "${LIBUSB_SHARED_LIBRARY_DEST}" |
| 72 | ) | 81 | ) |
| 73 | 82 | ||
| 74 | add_custom_target(usb-bootstrap ALL DEPENDS "${LIBUSB_CONFIGURE}") | 83 | add_custom_target(usb-bootstrap DEPENDS "${LIBUSB_CONFIGURE}") |
| 75 | add_custom_target(usb-configure ALL DEPENDS "${LIBUSB_MAKEFILE}" usb-bootstrap) | 84 | add_custom_target(usb-configure DEPENDS "${LIBUSB_MAKEFILE}" usb-bootstrap) |
| 76 | add_custom_target(usb-build ALL DEPENDS "${LIBUSB_LIBRARY}" usb-configure) | 85 | add_custom_target(usb-build ALL DEPENDS "${LIBUSB_LIBRARIES}" usb-configure) |
| 77 | # Workaround since static linking didn't work out -- We need to copy the DLL to the bin directory | 86 | # Workaround since static linking didn't work out -- We need to copy the DLL to the bin directory |
| 78 | add_custom_target(usb-copy ALL DEPENDS "${LIBUSB_SHARED_LIBRARY_DEST}" usb-build) | 87 | add_custom_target(usb-copy ALL DEPENDS "${LIBUSB_SHARED_LIBRARY_DEST}" usb-build) |
| 79 | 88 | ||
| 80 | # Make `usb` alias to LIBUSB_LIBRARY | ||
| 81 | add_library(usb INTERFACE) | 89 | add_library(usb INTERFACE) |
| 82 | target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARY}") | 90 | add_dependencies(usb usb-copy) |
| 83 | else() # MINGW | 91 | target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}") |
| 92 | target_include_directories(usb INTERFACE "${LIBUSB_INCLUDE_DIRS}") | ||
| 93 | |||
| 94 | if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
| 95 | Include(FindPkgConfig) | ||
| 96 | pkg_check_modules(LIBUDEV REQUIRED libudev) | ||
| 97 | |||
| 98 | if (LIBUDEV_FOUND) | ||
| 99 | target_include_directories(usb INTERFACE "${LIBUDEV_INCLUDE_DIRS}") | ||
| 100 | target_link_libraries(usb INTERFACE "${LIBUDEV_STATIC_LIBRARIES}") | ||
| 101 | endif() | ||
| 102 | endif() | ||
| 103 | else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
| 84 | # Ensure libusb compiles with UTF-8 encoding on MSVC | 104 | # Ensure libusb compiles with UTF-8 encoding on MSVC |
| 85 | if(MSVC) | 105 | if(MSVC) |
| 86 | add_compile_options(/utf-8) | 106 | add_compile_options(/utf-8) |
| @@ -236,4 +256,4 @@ else() # MINGW | |||
| 236 | 256 | ||
| 237 | 257 | ||
| 238 | configure_file(config.h.in config.h) | 258 | configure_file(config.h.in config.h) |
| 239 | endif() # MINGW | 259 | endif() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 83b83a044..01ae1a567 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -150,7 +150,9 @@ void ProgramMetadata::Print() const { | |||
| 150 | LOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); | 150 | LOG_DEBUG(Service_FS, " > Is Retail: {}", acid_header.is_retail ? "YES" : "NO"); |
| 151 | LOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); | 151 | LOG_DEBUG(Service_FS, "Title ID Min: 0x{:016X}", acid_header.title_id_min); |
| 152 | LOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); | 152 | LOG_DEBUG(Service_FS, "Title ID Max: 0x{:016X}", acid_header.title_id_max); |
| 153 | LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", acid_file_access.permissions); | 153 | u64_le permissions_l; // local copy to fix alignment error |
| 154 | std::memcpy(&permissions_l, &acid_file_access.permissions, sizeof(permissions_l)); | ||
| 155 | LOG_DEBUG(Service_FS, "Filesystem Access: 0x{:016X}\n", permissions_l); | ||
| 154 | 156 | ||
| 155 | // Begin ACI0 printing (actual perms, unsigned) | 157 | // Begin ACI0 printing (actual perms, unsigned) |
| 156 | LOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); | 158 | LOG_DEBUG(Service_FS, "Magic: {:.4}", aci_header.magic.data()); |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index de53e1fda..7c5763f9c 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -71,8 +71,7 @@ if (ENABLE_SDL2) | |||
| 71 | target_compile_definitions(input_common PRIVATE HAVE_SDL2) | 71 | target_compile_definitions(input_common PRIVATE HAVE_SDL2) |
| 72 | endif() | 72 | endif() |
| 73 | 73 | ||
| 74 | target_include_directories(input_common SYSTEM PRIVATE ${LIBUSB_INCLUDE_DIR}) | 74 | target_link_libraries(input_common PRIVATE usb) |
| 75 | target_link_libraries(input_common PRIVATE ${LIBUSB_LIBRARIES}) | ||
| 76 | 75 | ||
| 77 | create_target_directory_groups(input_common) | 76 | create_target_directory_groups(input_common) |
| 78 | target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) | 77 | target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) |
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 0c00ae280..a39505903 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h | |||
| @@ -476,6 +476,9 @@ private: | |||
| 476 | current_size = 0; | 476 | current_size = 0; |
| 477 | on_going = false; | 477 | on_going = false; |
| 478 | } | 478 | } |
| 479 | if (empty_bits == PAGES_PER_WORD) { | ||
| 480 | break; | ||
| 481 | } | ||
| 479 | page += empty_bits; | 482 | page += empty_bits; |
| 480 | 483 | ||
| 481 | const int continuous_bits = std::countr_one(word >> page); | 484 | const int continuous_bits = std::countr_one(word >> page); |
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 8c4a5523b..906604a39 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -647,6 +647,9 @@ u32 CalculateLayerSize(const ImageInfo& info) noexcept { | |||
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | LevelArray CalculateMipLevelOffsets(const ImageInfo& info) noexcept { | 649 | LevelArray CalculateMipLevelOffsets(const ImageInfo& info) noexcept { |
| 650 | if (info.type == ImageType::Linear) { | ||
| 651 | return {}; | ||
| 652 | } | ||
| 650 | ASSERT(info.resources.levels <= static_cast<s32>(MAX_MIP_LEVELS)); | 653 | ASSERT(info.resources.levels <= static_cast<s32>(MAX_MIP_LEVELS)); |
| 651 | const LevelInfo level_info = MakeLevelInfo(info); | 654 | const LevelInfo level_info = MakeLevelInfo(info); |
| 652 | LevelArray offsets{}; | 655 | LevelArray offsets{}; |