This commit is contained in:
Nayla Hanegan 2023-06-30 19:21:07 -04:00
commit 69ef86856d
No known key found for this signature in database
GPG key ID: 3075216CED0DB01D
100 changed files with 40756 additions and 25691 deletions

View file

@ -1,29 +0,0 @@
# When packaging Dolphin for an OS distribution, distro vendors usually prefer
# to limit vendored ("Externals") dependencies as much as possible, in favor of
# using system provided libraries. This modules provides an option to allow
# only specific vendored dependencies and error-out at configuration time for
# non-approved ones.
#
# Usage:
# $ cmake -D APPROVED_VENDORED_DEPENDENCIES="a;b;c;..."
#
# Unless the option is explicitly used, vendored dependencies control is
# disabled.
#
# If you want to disallow all vendored dependencies, put "none" in the approved
# dependencies list.
set(APPROVED_VENDORED_DEPENDENCIES "" CACHE STRING "\
Semicolon separated list of approved vendored dependencies. See docstring in \
CMake/CheckVendoringApproved.cmake.")
function(check_vendoring_approved dep)
if(APPROVED_VENDORED_DEPENDENCIES)
if(NOT dep IN_LIST APPROVED_VENDORED_DEPENDENCIES)
message(SEND_ERROR "\
Library ${dep} was not found systemwide and was not approved for vendoring. \
Vendored dependencies control is enabled. Add \"${dep}\" to the \
APPROVED_VENDORED_DEPENDENCIES list to bypass this error.")
endif()
endif()
endfunction()

View file

@ -18,3 +18,78 @@ function(dolphin_make_imported_target_if_missing target lib)
add_library(${target} ALIAS _${lib})
endif()
endfunction()
function(dolphin_optional_system_library library)
string(TOUPPER ${library} upperlib)
set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS. Default is blank.")
if("${USE_SYSTEM_${upperlib}}" STREQUAL "")
if(APPROVED_VENDORED_DEPENDENCIES)
string(TOLOWER ${library} lowerlib)
if(lowerlib IN_LIST APPROVED_VENDORED_DEPENDENCIES)
set(RESOLVED_USE_SYSTEM_${upperlib} AUTO PARENT_SCOPE)
else()
set(RESOLVED_USE_SYSTEM_${upperlib} ON PARENT_SCOPE)
endif()
else()
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
endif()
else()
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE)
endif()
endfunction()
function(dolphin_add_bundled_library library bundled_path)
string(TOUPPER ${library} upperlib)
if (${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO")
message(STATUS "No system ${library} was found. Using static ${library} from Externals.")
else()
message(STATUS "Using static ${library} from Externals")
endif()
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${bundled_path}/CMakeLists.txt")
message(FATAL_ERROR "No bundled ${library} was found. Did you forget to checkout submodules?")
endif()
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
endfunction()
function(dolphin_find_optional_system_library library bundled_path)
dolphin_optional_system_library(${library})
string(TOUPPER ${library} upperlib)
if(RESOLVED_USE_SYSTEM_${upperlib})
find_package(${library} ${ARGN})
# Yay for cmake packages being inconsistent
if(DEFINED ${library}_FOUND)
set(prefix ${library})
else()
set(prefix ${upperlib})
endif()
if((NOT ${found}) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
endif()
endif()
if(${prefix}_FOUND)
message(STATUS "Using system ${library}")
set(${prefix}_TYPE "System" PARENT_SCOPE)
else()
dolphin_add_bundled_library(${library} ${bundled_path})
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
endif()
endfunction()
function(dolphin_find_optional_system_library_pkgconfig library search alias bundled_path)
dolphin_optional_system_library(${library})
string(TOUPPER ${library} upperlib)
if(RESOLVED_USE_SYSTEM_${upperlib})
pkg_check_modules(${library} ${search} ${ARGN} IMPORTED_TARGET)
if((NOT ${library}_FOUND) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
endif()
endif()
if(${library}_FOUND)
message(STATUS "Using system ${library}")
dolphin_alias_library(${alias} PkgConfig::${library})
set(${library}_TYPE "System" PARENT_SCOPE)
else()
dolphin_add_bundled_library(${library} ${bundled_path})
set(${library}_TYPE "Bundled" PARENT_SCOPE)
endif()
endfunction()

View file

@ -6,7 +6,7 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUBEB DEFAULT_MSG
CUBEB_INCLUDE_DIR CUBEB_LIBRARY)
if(CUBEB_FOUND AND NOT TARGET CUBEB)
if(CUBEB_FOUND AND NOT TARGET cubeb::cubeb)
add_library(cubeb::cubeb UNKNOWN IMPORTED)
set_target_properties(cubeb::cubeb PROPERTIES
IMPORTED_LOCATION "${CUBEB_LIBRARY}"

15
CMake/FindLZO.cmake Normal file
View file

@ -0,0 +1,15 @@
find_path(LZO_INCLUDE_DIR lzo/lzo1x.h)
find_library(LZO_LIBRARY lzo2)
mark_as_advanced(LZO_INCLUDE_DIR LZO_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZO DEFAULT_MSG
LZO_INCLUDE_DIR LZO_LIBRARY)
if(LZO_FOUND AND NOT TARGET LZO::LZO)
add_library(LZO::LZO UNKNOWN IMPORTED)
set_target_properties(LZO::LZO PROPERTIES
IMPORTED_LOCATION "${LZO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LZO_INCLUDE_DIR}"
)
endif()

View file

@ -40,4 +40,11 @@ elseif (NOT LIBUSB_FOUND)
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
endif ()
if(LIBUSB_FOUND AND NOT TARGET LibUSB::LibUSB)
add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
set_target_properties(LibUSB::LibUSB PROPERTIES
IMPORTED_LOCATION "${LIBUSB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
)
endif()

View file

@ -7,18 +7,53 @@ find_library(MBEDCRYPTO_LIBRARY mbedcrypto PATH_SUFFIXES mbedtls2)
set(MBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS})
check_cxx_source_compiles("
#include <mbedtls/version.h>
#if MBEDTLS_VERSION_NUMBER < 0x021C0000
#error \"Your mbed TLS version is too old.\"
#endif
int main() {}"
MBEDTLS_VERSION_OK)
unset(CMAKE_REQUIRED_INCLUDES)
if(NOT MBEDTLS_INCLUDE_DIR STREQUAL "MBEDTLS_INCLUDE_DIR-NOTFOUND")
if(EXISTS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h)
file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h MBEDTLS_VERSION_STR REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*")
else()
file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLS_VERSION_STR REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*")
endif()
string(REGEX REPLACE "^#define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"([.0-9]+)\".*" "\\1" MBEDTLS_VERSION ${MBEDTLS_VERSION_STR})
endif()
if(NOT MBEDTLS_INCLUDE_DIR STREQUAL "MBEDTLS_INCLUDE_DIR-NOTFOUND" AND MBEDTLS_VERSION VERSION_GREATER_EQUAL 3)
# Once CMake 3.19 is required, we can enable HANDLE_VERSION_RANGE and use that
if(MBEDTLS_FIND_REQUIRED)
set(type FATAL_ERROR)
else()
set(type STATUS)
endif()
if(MBEDTLS_FIND_REQUIRED OR NOT MBEDTLS_FIND_QUIETLY)
message(${type} "Could NOT find MBEDTLS: Found unsuitable version \"${MBEDTLS_VERSION}\", but a 2.x version is required (found ${MBEDTLS_INCLUDE_DIR})")
endif()
set(MBEDTLS_FOUND FALSE)
else()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY MBEDTLS_VERSION_OK)
find_package_handle_standard_args(MBEDTLS
REQUIRED_VARS MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY
VERSION_VAR MBEDTLS_VERSION)
endif()
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
if(MBEDTLS_FOUND)
add_library(MbedTLS::mbedcrypto UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedcrypto PROPERTIES
IMPORTED_LOCATION "${MBEDCRYPTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
)
add_library(MbedTLS::mbedx509 UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedx509 PROPERTIES
IMPORTED_LOCATION "${MBEDX509_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES MbedTLS::mbedcrypto
)
add_library(MbedTLS::mbedtls UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedtls PROPERTIES
IMPORTED_LOCATION "${MBEDTLS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES MbedTLS::mbedx509
)
endif()

View file

@ -5,14 +5,17 @@ find_path(MINIUPNPC_INCLUDE_DIR miniupnpc.h PATH_SUFFIXES miniupnpc)
find_library(MINIUPNPC_LIBRARY miniupnpc)
if(MINIUPNPC_INCLUDE_DIR)
file(STRINGS "${MINIUPNPC_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
if(MINIUPNPC_API_VERSION_STR)
string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)" "\\1" MINIUPNPC_API_VERSION ${MINIUPNPC_API_VERSION_STR})
file(STRINGS "${MINIUPNPC_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_VERSION[\t ]+.*")
if(MINIUPNPC_VERSION_STR)
string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_VERSION[\t ]+\"([.0-9]+)\"" "\\1" MINIUPNPC_VERSION ${MINIUPNPC_VERSION_STR})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MINIUPNPC DEFAULT_MSG MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY MINIUPNPC_API_VERSION)
find_package_handle_standard_args(MINIUPNPC
REQUIRED_VARS MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY
VERSION_VAR MINIUPNPC_VERSION
)
set(MINIUPNPC_LIBRARIES ${MINIUPNPC_LIBRARY})
set(MINIUPNPC_INCLUDE_DIRS ${MINIUPNPC_INCLUDE_DIR})

View file

@ -206,4 +206,20 @@ endif()
# handle success
if(SFML_FOUND)
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}")
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
if(NOT TARGET sfml-${FIND_SFML_COMPONENT_LOWER})
add_library(sfml-${FIND_SFML_COMPONENT_LOWER} UNKNOWN IMPORTED)
set_target_properties(sfml-${FIND_SFML_COMPONENT_LOWER} PROPERTIES
IMPORTED_LOCATION "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}"
)
if(NOT ${FIND_SFML_COMPONENT_LOWER} STREQUAL system)
set_target_properties(sfml-${FIND_SFML_COMPONENT_LOWER} PROPERTIES
INTERFACE_LINK_LIBRARIES sfml-system
)
endif()
endif()
endforeach()
endif()

53
CMake/ScmRevGen.cmake Normal file
View file

@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.13)
# for revision info
if(GIT_FOUND)
# defines DOLPHIN_WC_REVISION
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines DOLPHIN_WC_DESCRIBE
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty
OUTPUT_VARIABLE DOLPHIN_WC_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE)
# remove hash (and trailing "-0" if needed) from description
string(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" DOLPHIN_WC_DESCRIBE "${DOLPHIN_WC_DESCRIBE}")
# defines DOLPHIN_WC_BRANCH
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# version number
set(DOLPHIN_VERSION_MAJOR "5")
set(DOLPHIN_VERSION_MINOR "0")
if(DOLPHIN_WC_BRANCH STREQUAL "stable")
set(DOLPHIN_VERSION_PATCH "0")
else()
set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})
endif()
# If Dolphin is not built from a Git repository, default the version info to
# reasonable values.
if(NOT DOLPHIN_WC_REVISION)
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
set(DOLPHIN_WC_BRANCH "master")
endif()
if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
set(DOLPHIN_WC_IS_STABLE "1")
else()
set(DOLPHIN_WC_IS_STABLE "0")
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h.in"
"${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp"
)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp" "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h")
file(REMOVE "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp")

View file

@ -85,7 +85,11 @@ if(NOT ANDROID)
option(ENABLE_CLI_TOOL "Enable dolphin-tool, a CLI-based utility for functions such as managing disc images" ON)
endif()
option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
set(USE_SYSTEM_LIBS "AUTO" CACHE STRING "Use system libraries instead of bundled libraries. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled. Default is AUTO")
if(APPROVED_VENDORED_DEPENDENCIES)
message(WARNING "APPROVED_VENDORED_DEPENDENCIES is deprecated. Please migrate to setting USE_SYSTEM_LIBS to ON and setting USE_SYSTEM_<dependency> to either AUTO or OFF to allow bundled libs.")
endif()
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(ENABLE_NOGUI "Enable NoGUI frontend" ON)
option(ENABLE_QT "Enable Qt (Default)" ON)
@ -158,7 +162,6 @@ list(APPEND CMAKE_MODULE_PATH
# Support functions
include(CheckAndAddFlag)
include(CheckCCompilerFlag)
include(CheckVendoringApproved)
include(DolphinCompileDefinitions)
include(DolphinDisableWarningsMSVC)
include(DolphinLibraryTools)
@ -196,59 +199,6 @@ endif()
# setup CCache
include(CCache)
# for revision info
find_package(Git)
if(GIT_FOUND)
# make sure version information gets re-run when the current Git HEAD changes
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
OUTPUT_VARIABLE dolphin_git_head_filename
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dolphin_git_head_filename}")
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
OUTPUT_VARIABLE dolphin_git_head_symbolic
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${dolphin_git_head_symbolic}
OUTPUT_VARIABLE dolphin_git_head_symbolic_filename
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dolphin_git_head_symbolic_filename}")
# defines DOLPHIN_WC_REVISION
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines DOLPHIN_WC_DESCRIBE
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty
OUTPUT_VARIABLE DOLPHIN_WC_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE)
# remove hash (and trailing "-0" if needed) from description
string(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" DOLPHIN_WC_DESCRIBE "${DOLPHIN_WC_DESCRIBE}")
# defines DOLPHIN_WC_BRANCH
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# version number
set(DOLPHIN_VERSION_MAJOR "5")
set(DOLPHIN_VERSION_MINOR "0")
if(DOLPHIN_WC_BRANCH STREQUAL "stable")
set(DOLPHIN_VERSION_PATCH "0")
else()
set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})
endif()
# If Dolphin is not built from a Git repository, default the version info to
# reasonable values.
if(NOT DOLPHIN_WC_REVISION)
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
set(DOLPHIN_WC_BRANCH "master")
endif()
# Architecture detection and arch specific settings
message(STATUS "Detected architecture: ${CMAKE_SYSTEM_PROCESSOR}")
@ -639,32 +589,7 @@ if(UNIX)
endif()
if(ENABLE_SDL)
find_package(SDL2)
if(SDL2_FOUND)
message(STATUS "Using system SDL2")
else()
message(STATUS "Using static SDL2 from Externals")
option(SDL2_DISABLE_SDL2MAIN "" ON)
option(SDL2_DISABLE_INSTALL "" ON)
option(SDL2_DISABLE_UNINSTALL "" ON)
set(SDL_SHARED OFF)
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
set(SDL_STATIC ON)
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
set(SDL_TEST OFF)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(OPT_DEF_LIBC ON)
add_subdirectory(Externals/SDL/SDL)
if (TARGET SDL2)
dolphin_disable_warnings_msvc(SDL2)
endif()
if (TARGET SDL2-static)
dolphin_disable_warnings_msvc(SDL2-static)
endif()
set(SDL2_FOUND TRUE)
endif()
add_definitions(-DHAVE_SDL2=1)
dolphin_find_optional_system_library(SDL2 Externals/SDL)
endif()
if(ENABLE_ANALYTICS)
@ -705,14 +630,8 @@ if (_M_X86)
endif()
add_subdirectory(Externals/cpp-optparse)
find_package(fmt 8)
if(fmt_FOUND)
message(STATUS "Using shared fmt ${fmt_VERSION}")
else()
check_vendoring_approved(fmt)
message(STATUS "Using static fmt from Externals")
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
endif()
dolphin_find_optional_system_library(fmt Externals/fmt 8)
add_subdirectory(Externals/imgui)
add_subdirectory(Externals/implot)
add_subdirectory(Externals/glslang)
@ -740,111 +659,30 @@ if(NOT WIN32 OR (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")))
add_definitions(-DHAS_OPENGL)
endif()
find_package(pugixml)
if(NOT pugixml_FOUND)
check_vendoring_approved(pugixml)
message(STATUS "Using static pugixml from Externals")
add_subdirectory(Externals/pugixml)
endif()
dolphin_find_optional_system_library(pugixml Externals/pugixml)
if(USE_SHARED_ENET)
check_lib(ENET libenet enet enet/enet.h QUIET)
include(CheckSymbolExists)
if (ENET_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${ENET_INCLUDE_DIRS})
# hack: LDFLAGS already contains -lenet but all flags but the first are
# dropped; ugh, cmake
set(CMAKE_REQUIRED_FLAGS ${ENET_LDFLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${ENET_LIBRARIES})
check_symbol_exists(enet_socket_get_address enet/enet.h ENET_HAVE_SGA)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
if (NOT ENET_HAVE_SGA)
# enet is too old
set(ENET_FOUND FALSE)
endif()
endif()
endif()
if (ENET_FOUND)
message(STATUS "Using shared enet")
else()
check_vendoring_approved(enet)
message(STATUS "Using static enet from Externals")
include_directories(Externals/enet/include)
add_subdirectory(Externals/enet)
endif()
dolphin_find_optional_system_library_pkgconfig(ENET libenet>=1.3.8 enet::enet Externals/enet)
if(NOT XXHASH_FOUND)
message(STATUS "Using static xxhash from Externals")
add_subdirectory(Externals/xxhash)
endif()
find_package(BZip2)
if(BZIP2_FOUND)
message(STATUS "Using shared bzip2")
else()
check_vendoring_approved(bzip2)
message(STATUS "Shared bzip2 not found, falling back to the static library")
add_subdirectory(Externals/bzip2)
endif()
dolphin_find_optional_system_library(BZip2 Externals/bzip2)
# macOS ships with liblzma.dylib but no headers, so check for the headers too
find_package(LibLZMA)
if(LIBLZMA_FOUND)
dolphin_find_optional_system_library(LibLZMA Externals/liblzma)
# Imported target added in CMake 3.14
dolphin_make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
message(STATUS "Using shared lzma")
else()
check_vendoring_approved(lzma)
message(STATUS "Shared lzma not found, falling back to the static library")
add_subdirectory(Externals/liblzma)
endif()
pkg_check_modules(ZSTD QUIET libzstd>=1.4.0 IMPORTED_TARGET)
if(ZSTD_FOUND)
message(STATUS "Using shared zstd version: " ${ZSTD_VERSION})
dolphin_alias_library(zstd::zstd PkgConfig::ZSTD)
else()
check_vendoring_approved(zstd)
message(STATUS "Shared zstd not found, falling back to the static library")
add_subdirectory(Externals/zstd)
endif()
dolphin_find_optional_system_library_pkgconfig(ZSTD libzstd>=1.4.0 zstd::zstd Externals/zstd)
add_subdirectory(Externals/zlib-ng)
pkg_check_modules(MINIZIP minizip>=3.0.0)
if(MINIZIP_FOUND)
message(STATUS "Using shared minizip")
include_directories(${MINIZIP_INCLUDE_DIRS})
else()
check_vendoring_approved(minizip)
message(STATUS "Shared minizip not found, falling back to the static library")
add_subdirectory(Externals/minizip)
include_directories(External/minizip)
endif()
dolphin_find_optional_system_library_pkgconfig(MINIZIP minizip>=3.0.0 minizip::minizip Externals/minizip)
if(NOT APPLE)
check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
endif()
if(LZO_FOUND)
message(STATUS "Using shared lzo")
else()
check_vendoring_approved(lzo)
message(STATUS "Using static lzo from Externals")
add_subdirectory(Externals/LZO)
set(LZO lzo2)
endif()
dolphin_find_optional_system_library(LZO Externals/LZO)
pkg_check_modules(pc_spng IMPORTED_TARGET spng)
if (pc_spng_FOUND AND TARGET PkgConfig::pc_spng)
message(STATUS "Using the system libspng")
set(spng_target PkgConfig::pc_spng)
else()
message(STATUS "Using static libspng from Externals")
add_subdirectory(Externals/libspng)
set(spng_target spng)
endif()
dolphin_find_optional_system_library_pkgconfig(SPNG spng spng::spng Externals/libspng)
# Using static FreeSurround from Externals
# There is no system FreeSurround library.
@ -862,105 +700,33 @@ endif()
add_subdirectory(Externals/soundtouch)
include_directories(Externals/soundtouch)
find_package(CUBEB)
if(CUBEB_FOUND)
message(STATUS "Using the system cubeb")
else()
check_vendoring_approved(cubeb)
message(STATUS "Using static cubeb from Externals")
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL)
endif()
dolphin_find_optional_system_library(CUBEB Externals/cubeb)
if(NOT ANDROID)
dolphin_find_optional_system_library(LibUSB Externals/libusb)
add_definitions(-D__LIBUSB__)
if(NOT APPLE)
find_package(LibUSB)
endif()
if(LIBUSB_FOUND AND NOT APPLE)
message(STATUS "Using shared LibUSB")
include_directories(${LIBUSB_INCLUDE_DIR})
else()
check_vendoring_approved(libusb)
message(STATUS "Using static LibUSB from Externals")
add_subdirectory(Externals/libusb)
set(LIBUSB_LIBRARIES usb)
endif()
set(LIBUSB_FOUND true)
endif()
set(SFML_REQD_VERSION 2.1)
if(NOT APPLE)
find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system)
endif()
if(SFML_FOUND)
message(STATUS "Using shared SFML")
else()
check_vendoring_approved(sfml)
message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals")
add_definitions(-DSFML_STATIC)
add_subdirectory(Externals/SFML)
include_directories(BEFORE Externals/SFML/include)
endif()
dolphin_find_optional_system_library(SFML Externals/SFML 2.1 COMPONENTS network system)
if(USE_UPNP)
if(NOT APPLE)
find_package(MINIUPNPC)
endif()
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
message(STATUS "Using shared miniupnpc")
else()
check_vendoring_approved(miniupnpc)
message(STATUS "Using static miniupnpc from Externals")
add_subdirectory(Externals/miniupnpc)
endif()
dolphin_find_optional_system_library(MINIUPNPC Externals/miniupnpc 1.6)
add_definitions(-DUSE_UPNP)
endif()
if(NOT APPLE)
find_package(MBEDTLS)
endif()
if(MBEDTLS_FOUND)
message(STATUS "Using shared mbed TLS")
include_directories(${MBEDTLS_INCLUDE_DIRS})
else()
check_vendoring_approved(mbedtls)
message(STATUS "Using static mbed TLS from Externals")
set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL)
include_directories(Externals/mbedtls/include)
endif()
dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28)
find_package(CURL)
if(CURL_FOUND)
message(STATUS "Using shared libcurl")
include_directories(${CURL_INCLUDE_DIRS})
else()
check_vendoring_approved(curl)
message(STATUS "Using static libcurl from Externals")
add_subdirectory(Externals/curl)
set(CURL_LIBRARIES curl)
include_directories(BEFORE Externals/curl/include)
endif()
dolphin_find_optional_system_library(CURL Externals/curl)
if(NOT ANDROID)
find_package(Iconv)
endif()
if(TARGET Iconv::Iconv)
message(STATUS "Using shared iconv")
dolphin_find_optional_system_library(Iconv Externals/libiconv-1.14)
else()
check_vendoring_approved(iconv)
message(STATUS "Using static iconv from Externals")
add_subdirectory(Externals/libiconv-1.14)
add_subdirectory(Externals/libiconv-1.14 EXCLUDE_FROM_ALL)
endif()
if(NOT ANDROID)
find_package(HIDAPI)
if(NOT HIDAPI_FOUND)
check_vendoring_approved(hidapi)
message(STATUS "Using static HIDAPI from Externals")
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
endif()
dolphin_find_optional_system_library(HIDAPI Externals/hidapi)
endif()
if(USE_DISCORD_PRESENCE)
@ -973,11 +739,7 @@ if(NOT ENABLE_QT)
set(USE_MGBA 0)
endif()
if(USE_MGBA)
find_package(LIBMGBA)
if(NOT LIBMGBA_FOUND)
message(STATUS "Using static libmgba from Externals")
add_subdirectory(Externals/mGBA)
endif()
dolphin_find_optional_system_library(LIBMGBA Externals/mGBA)
endif()
find_package(SYSTEMD)
@ -1012,20 +774,28 @@ endif()
########################################
# Pre-build events: Define configuration variables and write SCM info header
#
if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
set(DOLPHIN_WC_IS_STABLE "1")
else()
set(DOLPHIN_WC_IS_STABLE "0")
endif()
# Remove in-tree revision information generated by Visual Studio
# This is because the compiler will check in-tree first and use this, even if it is outdated
file(REMOVE "${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h")
configure_file(
"${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h.in"
"${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h"
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common)
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h)
endif()
find_package(Git)
if(NOT GIT_FOUND)
set(GIT_EXECUTABLE "")
endif()
add_custom_target(
dolphin_scmrev
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -P ${CMAKE_SOURCE_DIR}/CMake/ScmRevGen.cmake
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h
VERBATIM
)
# This is here so #include "Common/scmrev.h" finds the generated header.
include_directories("${PROJECT_BINARY_DIR}/Source/Core")
########################################

View file

@ -0,0 +1,8 @@
# HAFE01, HAFJ01, HAFP01 - Forecast Channel
[WC24Patch]
$Main
weather.wapp.wii.com:fore.wiilink24.com:1
[WC24Patch_Enabled]
$Main

View file

@ -1,4 +1,4 @@
# HATE01 - Nintendo Channel
# HATE01, HATJ01, HATP01 - Nintendo Channel
[Core]
# Values set here will override the main Dolphin settings.

View file

@ -0,0 +1,37 @@
# HATE01 - Nintendo Channel (NTSC-U)
[Gecko]
$SSL Patch [Palapeli]
2A35AB5C 00003A2F
80010000 0035AA4D
8A00570F 0035AA4C
80010000 0035AACD
8A00380F 0035AACC
80010000 0035AB0D
8A004A0F 0035AB0C
80010000 0035AB5D
8A00390F 0035AB5C
80010000 0035ABF9
8A00170F 0035ABF8
80010000 0035AC15
8A00170F 0035AC14
E2000001 00000000
[Gecko_Enabled]
$SSL Patch
[WC24Patch]
$Main
a248.e.akamai.net:dol.n.wiinoma.com:0
$Suggestions
entup.wapp.wii.com:post.n.wiinoma.com:0
$Info
entuc.wapp.wii.com:conf.n.wiinoma.com:0
$WC24
entu.wapp.wii.com:ncc.wiilink24.com:1
[WC24Patch_Enabled]
$Main
$Suggestions
$Info
$WC24

View file

@ -0,0 +1,35 @@
# HATJ01 - Nintendo Channel (NTSC-J)
[Gecko]
$SSL Patch [Palapeli]
2A390014 00003A2F
80010000 00390015
8A00570F 00390014
80010000 00390095
8A00380F 00390094
80010000 003900D5
8A00390F 003900D4
80010000 00390171
8A00170F 00390170
80010000 0039018D
8A00170F 0039018C
E2000001 00000000
[Gecko_Enabled]
$SSL Patch
[WC24Patch]
$Main
a248.e.akamai.net:dol.n.wiinoma.com:0
$Suggestions
entjp.wapp.wii.com:post.n.wiinoma.com:0
$Info
entjc.wapp.wii.com:conf.n.wiinoma.com:0
$WC24
entj.wapp.wii.com:ncc.wiilink24.com:1
[WC24Patch_Enabled]
$Main
$Suggestions
$Info
$WC24

View file

@ -0,0 +1,37 @@
# HATP01 - Nintendo Channel (PAL)
[Gecko]
$SSL Patch [Palapeli]
2A357D3C 00003A2F
80010000 00357D3D
8A00570F 00357D3C
80010000 00357DBD
8A00380F 00357DBC
80010000 00357DFD
8A004B0F 00357DFC
80010000 00357E4D
8A00390F 00357E4C
80010000 00357EE9
8A00170F 00357EE8
80010000 00357F05
8A00170F 00357F04
E2000001 00000000
[Gecko_Enabled]
$SSL Patch
[WC24Patch]
$Main
a248.e.akamai.net:dol.n.wiinoma.com:0
$Suggestions
entep.wapp.wii.com:post.n.wiinoma.com:0
$Info
entec.wapp.wii.com:conf.n.wiinoma.com:0
$WC24
ente.wapp.wii.com:ncc.wiilink24.com:1
[WC24Patch_Enabled]
$Main
$Suggestions
$Info
$WC24

View file

@ -46,7 +46,7 @@ void main()
float4 color = Sample();
// Convert to linear space to do any other kind of operation
color.rgb = pow(color.rgb, game_gamma.xxx);
color.rgb = pow(color.rgb, float3(game_gamma));
if (OptionEnabled(correct_color_space))
{
@ -60,7 +60,7 @@ void main()
if (OptionEnabled(hdr_output))
{
const float hdr_paper_white = hdr_paper_white_nits / hdr_sdr_white_nits;
float hdr_paper_white = hdr_paper_white_nits / hdr_sdr_white_nits;
color.rgb *= hdr_paper_white;
}
@ -74,12 +74,12 @@ void main()
if (OptionEnabled(sdr_display_gamma_sRGB))
color.rgb = LinearTosRGBGamma(color.rgb);
else
color.rgb = pow(color.rgb, (1.0 / sdr_display_custom_gamma).xxx);
color.rgb = pow(color.rgb, float3(1.0 / sdr_display_custom_gamma));
}
// Restore the original gamma without changes
else
{
color.rgb = pow(color.rgb, (1.0 / game_gamma).xxx);
color.rgb = pow(color.rgb, float3(1.0 / game_gamma));
}
SetOutput(color);

View file

@ -7,3 +7,4 @@ target_include_directories(lzo2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(LZO::LZO ALIAS lzo2)

17
Externals/SDL/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,17 @@
option(SDL2_DISABLE_SDL2MAIN "" ON)
option(SDL2_DISABLE_INSTALL "" ON)
option(SDL2_DISABLE_UNINSTALL "" ON)
set(SDL_SHARED OFF)
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
set(SDL_STATIC ON)
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
set(SDL_TEST OFF)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(OPT_DEF_LIBC ON)
add_subdirectory(SDL)
if (TARGET SDL2)
dolphin_disable_warnings_msvc(SDL2)
endif()
if (TARGET SDL2-static)
dolphin_disable_warnings_msvc(SDL2-static)
endif()

View file

@ -1,5 +1,3 @@
include_directories(BEFORE include src)
set(SRC_NETWORK
src/SFML/Network/Http.cpp
src/SFML/Network/IPAddress.cpp
@ -23,7 +21,11 @@ set(SRC_SYSTEM
src/SFML/System/Time.cpp
)
add_library(sfml-network ${SRC_NETWORK})
add_library(sfml-system ${SRC_SYSTEM})
add_library(sfml-network STATIC ${SRC_NETWORK})
add_library(sfml-system STATIC ${SRC_SYSTEM})
target_compile_definitions(sfml-system PUBLIC SFML_STATIC)
target_include_directories(sfml-system PUBLIC include PRIVATE src)
target_include_directories(sfml-network PUBLIC include PRIVATE src)
target_link_libraries(sfml-network PUBLIC sfml-system)
dolphin_disable_warnings_msvc(sfml-network)
dolphin_disable_warnings_msvc(sfml-system)

View file

@ -352,3 +352,4 @@ if(USE_AUDIOUNIT AND USE_AUDIOUNIT_RUST)
debug "${PROJECT_SOURCE_DIR}/cubeb/src/cubeb-coreaudio-rs/target/debug/libcubeb_coreaudio.a"
optimized "${PROJECT_SOURCE_DIR}/cubeb/src/cubeb-coreaudio-rs/target/release/libcubeb_coreaudio.a")
endif()
add_library(cubeb::cubeb ALIAS cubeb)

View file

@ -4,8 +4,6 @@ else()
add_definitions(-DHAVE_CONFIG_H)
endif()
include_directories(.)
file(GLOB SRCS *.c vauth/*.c vtls/*.c)
add_library(
curl
@ -14,5 +12,7 @@ add_library(
)
dolphin_disable_warnings_msvc(curl)
target_link_libraries(curl ${MBEDTLS_LIBRARIES} zlibstatic)
target_include_directories(curl PRIVATE . INTERFACE ../include)
target_link_libraries(curl MbedTLS::mbedtls zlibstatic)
target_compile_definitions(curl PUBLIC CURL_STATICLIB PRIVATE CURL_DISABLE_LDAP)
add_library(CURL::libcurl ALIAS curl)

View file

@ -59,8 +59,6 @@ if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
set(INCLUDE_FILES_PREFIX include/enet)
set(INCLUDE_FILES
${INCLUDE_FILES_PREFIX}/callbacks.h
@ -92,8 +90,10 @@ add_library(enet STATIC
${INCLUDE_FILES}
${SOURCE_FILES}
)
target_include_directories(enet PUBLIC include)
dolphin_disable_warnings_msvc(enet)
add_library(enet::enet ALIAS enet)
if (MINGW)
target_link_libraries(enet winmm ws2_32)

View file

@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.0)
project(spng C)
add_library(spng STATIC ${CMAKE_CURRENT_LIST_DIR}/libspng/spng/spng.c)
add_library(spng STATIC libspng/spng/spng.c)
target_compile_definitions(spng PUBLIC SPNG_STATIC)
target_link_libraries(spng PUBLIC ZLIB::ZLIB)
target_include_directories(spng PUBLIC ${CMAKE_CURRENT_LIST_DIR}/libspng/spng/)
target_include_directories(spng PUBLIC libspng/spng)
dolphin_disable_warnings_msvc(spng)
add_library(spng::spng ALIAS spng)

View file

@ -125,3 +125,4 @@ check_include_files(sys/timerfd.h HAVE_TIMERFD)
check_include_files(unistd.h HAVE_UNISTD_H)
configure_file(config.h.in config.h)
add_library(LibUSB::LibUSB ALIAS usb)

View file

@ -222,6 +222,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
endif(USE_SHARED_MBEDTLS_LIBRARY)
foreach(target IN LISTS target_libraries)
add_library(MbedTLS::${target} ALIAS ${target}) # add_subdirectory support
# Include public header files from /include and other directories
# declared by /3rdparty/**/CMakeLists.txt. Include private header files
# from /library and others declared by /3rdparty/**/CMakeLists.txt.

View file

@ -67,4 +67,4 @@ endif()
target_link_libraries(minizip PUBLIC ZLIB::ZLIB)
add_library(minizip-ng ALIAS minizip)
add_library(minizip::minizip ALIAS minizip)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization' version "1.7.20"
id 'org.jetbrains.kotlin.plugin.serialization' version "1.8.21"
}
task copyProfile (type: Copy) {
@ -22,12 +22,12 @@ android {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = "17"
targetCompatibility = "17"
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
lint {
@ -135,26 +135,26 @@ android {
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.0'
implementation 'androidx.fragment:fragment:1.5.5'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.1'
implementation 'androidx.fragment:fragment:1.6.0'
implementation 'androidx.slidingpanelayout:slidingpanelayout:1.2.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.profileinstaller:profileinstaller:1.2.2'
implementation 'androidx.profileinstaller:profileinstaller:1.3.1'
// Kotlin extensions for lifecycle components
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
// Android TV UI libraries.
implementation 'androidx.leanback:leanback:1.0.0'
@ -167,7 +167,7 @@ dependencies {
implementation 'io.coil-kt:coil:2.2.2'
// For loading custom GPU drivers
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
implementation 'com.nononsenseapps:filepicker:4.2.1'
}

View file

@ -41,3 +41,14 @@
# If there is no `java.lang.ClassValue` (for example, in Android), then R8/ProGuard will print a warning.
# However, since in this case they will not be used, we can disable these warnings
-dontwarn kotlinx.serialization.internal.ClassValueReferences
# Required for R8 full mode
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

View file

@ -234,9 +234,14 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
menuToastShown = true
}
try {
title = NativeLibrary.GetCurrentTitleDescription()
emulationFragment?.refreshInputOverlay()
} catch (_: IllegalStateException) {
// Most likely the core delivered an onTitleChanged while emulation was shutting down.
// Let's just ignore it, since we're about to shut down anyway.
}
}
override fun onDestroy() {

View file

@ -65,7 +65,12 @@ class SettingsFragmentPresenter(
controllerNumber = menuTag.subType
} else if (menuTag.isSerialPort1Menu) {
serialPort1Type = extras.getInt(ARG_SERIALPORT1_TYPE)
} else if (menuTag == MenuTag.GRAPHICS) {
} else if (
menuTag == MenuTag.GRAPHICS
&& this.gameId.isNullOrEmpty()
&& !NativeLibrary.IsRunning()
&& GpuDriverHelper.supportsCustomDriverLoading()
) {
this.gpuDriver =
GpuDriverHelper.getInstalledDriverMetadata() ?: GpuDriverHelper.getSystemDriverMetadata(
context.applicationContext
@ -1265,7 +1270,11 @@ class SettingsFragmentPresenter(
)
)
if (GpuDriverHelper.supportsCustomDriverLoading() && this.gpuDriver != null) {
if (
this.gpuDriver != null && this.gameId.isNullOrEmpty()
&& !NativeLibrary.IsRunning()
&& GpuDriverHelper.supportsCustomDriverLoading()
) {
sl.add(
SubmenuSetting(
context,

View file

@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
}

View file

@ -14,3 +14,6 @@ android.enableJetifier=true
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View file

@ -83,7 +83,7 @@ PUBLIC
common
PRIVATE
cubeb
cubeb::cubeb
SoundTouch
FreeSurround)

View file

@ -7,12 +7,6 @@
namespace Common
{
template <typename T>
constexpr T AlignUp(T value, size_t size)
{
static_assert(std::is_unsigned<T>(), "T must be an unsigned value.");
return static_cast<T>(value + (size - value % size) % size);
}
template <typename T>
constexpr T AlignDown(T value, size_t size)
@ -21,4 +15,11 @@ constexpr T AlignDown(T value, size_t size)
return static_cast<T>(value - value % size);
}
template <typename T>
constexpr T AlignUp(T value, size_t size)
{
static_assert(std::is_unsigned<T>(), "T must be an unsigned value.");
return AlignDown<T>(static_cast<T>(value + (size - 1)), size);
}
} // namespace Common

View file

@ -135,6 +135,8 @@ add_library(common
WorkQueueThread.h
)
add_dependencies(common dolphin_scmrev)
if(NOT MSVC AND _M_ARM_64)
set_source_files_properties(
Crypto/AES.cpp
@ -145,16 +147,17 @@ endif()
target_link_libraries(common
PUBLIC
${CMAKE_THREAD_LIBS_INIT}
enet
enet::enet
fmt::fmt
${MBEDTLS_LIBRARIES}
minizip-ng
MbedTLS::mbedtls
minizip::minizip
sfml-network
PRIVATE
${CURL_LIBRARIES}
CURL::libcurl
FatFs
Iconv::Iconv
${spng_target}
spng::spng
${VTUNE_LIBRARIES}
)

View file

@ -90,7 +90,8 @@ bool IsTitlePath(const std::string& path, std::optional<FromWhichRoot> from, u64
}
u32 title_id_high, title_id_low;
if (!AsciiToHex(components[0], title_id_high) || !AsciiToHex(components[1], title_id_low))
if (Common::FromChars(components[0], title_id_high, 16).ec != std::errc{} ||
Common::FromChars(components[1], title_id_low, 16).ec != std::errc{})
{
return false;
}
@ -155,8 +156,11 @@ std::string UnescapeFileName(const std::string& filename)
{
u32 character;
if (pos + 6 <= result.size() && result[pos + 4] == '_' && result[pos + 5] == '_')
if (AsciiToHex(result.substr(pos + 2, 2), character))
if (Common::FromChars(std::string_view{result}.substr(pos + 2, 2), character, 16).ec ==
std::errc{})
{
result.replace(pos, 6, {static_cast<char>(character)});
}
++pos;
}

View file

@ -85,25 +85,6 @@ std::string HexDump(const u8* data, size_t size)
return out;
}
// faster than sscanf
bool AsciiToHex(const std::string& _szValue, u32& result)
{
// Set errno to a good state.
errno = 0;
char* endptr = nullptr;
const u32 value = strtoul(_szValue.c_str(), &endptr, 16);
if (!endptr || *endptr)
return false;
if (errno == ERANGE)
return false;
result = value;
return true;
}
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args)
{
int writtenCount;

View file

@ -3,6 +3,7 @@
#pragma once
#include <charconv>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
@ -17,6 +18,22 @@
#include "Common/CommonTypes.h"
namespace detail
{
template <typename T>
constexpr bool IsBooleanEnum()
{
if constexpr (std::is_enum_v<T>)
{
return std::is_same_v<std::underlying_type_t<T>, bool>;
}
else
{
return false;
}
}
} // namespace detail
std::string StringFromFormatV(const char* format, va_list args);
std::string StringFromFormat(const char* format, ...)
@ -54,8 +71,10 @@ void TruncateToCString(std::string* s);
bool TryParse(const std::string& str, bool* output);
template <typename T, std::enable_if_t<std::is_integral_v<T> || std::is_enum_v<T>>* = nullptr>
bool TryParse(const std::string& str, T* output, int base = 0)
template <typename T>
requires(std::is_integral_v<T> ||
(std::is_enum_v<T> && !detail::IsBooleanEnum<T>())) bool TryParse(const std::string& str,
T* output, int base = 0)
{
char* end_ptr = nullptr;
@ -92,6 +111,17 @@ bool TryParse(const std::string& str, T* output, int base = 0)
return true;
}
template <typename T>
requires(detail::IsBooleanEnum<T>()) bool TryParse(const std::string& str, T* output)
{
bool value;
if (!TryParse(str, &value))
return false;
*output = static_cast<T>(value);
return true;
}
template <typename T, std::enable_if_t<std::is_floating_point_v<T>>* = nullptr>
bool TryParse(std::string str, T* const output)
{
@ -147,8 +177,24 @@ std::string ValueToString(T value)
// Generates an hexdump-like representation of a binary data blob.
std::string HexDump(const u8* data, size_t size);
// TODO: kill this
bool AsciiToHex(const std::string& _szValue, u32& result);
namespace Common
{
template <typename T, typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
std::from_chars_result FromChars(std::string_view sv, T& value, int base = 10)
{
const char* const first = sv.data();
const char* const last = first + sv.size();
return std::from_chars(first, last, value, base);
}
template <typename T, typename std::enable_if_t<std::is_floating_point_v<T>>* = nullptr>
std::from_chars_result FromChars(std::string_view sv, T& value,
std::chars_format fmt = std::chars_format::general)
{
const char* const first = sv.data();
const char* const last = first + sv.size();
return std::from_chars(first, last, value, fmt);
}
}; // namespace Common
std::string TabsToSpaces(int tab_size, std::string str);

View file

@ -520,6 +520,8 @@ add_library(core
System.h
TitleDatabase.cpp
TitleDatabase.h
WC24PatchEngine.cpp
WC24PatchEngine.h
WiiRoot.cpp
WiiRoot.h
WiiUtils.cpp
@ -607,24 +609,23 @@ target_link_libraries(core
PUBLIC
audiocommon
common
cubeb
discio
enet
enet::enet
expr
inputcommon
${MBEDTLS_LIBRARIES}
MbedTLS::mbedtls
pugixml
RangeSet::RangeSet
sfml-network
sfml-system
videonull
videoogl
videosoftware
PRIVATE
cubeb::cubeb
FatFs
fmt::fmt
${LZO}
LZO::LZO
ZLIB::ZLIB
)
@ -648,9 +649,8 @@ elseif (ANDROID)
)
endif()
if(LIBUSB_FOUND)
# Using shared LibUSB
target_link_libraries(core PUBLIC ${LIBUSB_LIBRARIES})
if(TARGET LibUSB::LibUSB)
target_link_libraries(core PUBLIC LibUSB::LibUSB)
target_sources(core PRIVATE
IOS/USB/LibusbDevice.cpp
IOS/USB/LibusbDevice.h

View file

@ -15,6 +15,30 @@ constexpr u64 SHOP = 0x0001000248414241;
constexpr u64 KOREAN_SHOP = 0x000100024841424b;
constexpr u64 FORECAST_CHANNEL_NTSC_U = 0x0001000248414645;
constexpr u64 FORECAST_CHANNEL_NTSC_J = 0x000100024841464a;
constexpr u64 FORECAST_CHANNEL_PAL = 0x0001000248414650;
constexpr u64 NINTENDO_CHANNEL_NTSC_U = 0x0001000148415445;
constexpr u64 NINTENDO_CHANNEL_NTSC_J = 0x000100014841544a;
constexpr u64 NINTENDO_CHANNEL_PAL = 0x0001000148415450;
constexpr u64 NEWS_CHANNEL_NTSC_U = 0x0001000248414745;
constexpr u64 NEWS_CHANNEL_NTSC_J = 0x000100024841474a;
constexpr u64 NEWS_CHANNEL_PAL = 0x0001000248414750;
constexpr u64 EVERYBODY_VOTES_CHANNEL_NTSC_U = 0x0001000148414a45;
constexpr u64 EVERYBODY_VOTES_CHANNEL_NTSC_J = 0x0001000148414a4a;
constexpr u64 EVERYBODY_VOTES_CHANNEL_PAL = 0x0001000148414a50;
constexpr u64 IOS(u32 major_version)
{
return 0x0000000100000000 | major_version;

View file

@ -241,6 +241,7 @@ const Info<bool> MAIN_ALLOW_SD_WRITES{{System::Main, "Core", "WiiSDCardAllowWrit
const Info<bool> MAIN_ENABLE_SAVESTATES{{System::Main, "Core", "EnableSaveStates"}, false};
const Info<bool> MAIN_REAL_WII_REMOTE_REPEAT_REPORTS{
{System::Main, "Core", "RealWiiRemoteRepeatReports"}, true};
const Info<bool> MAIN_WII_WIILINK_ENABLE{{System::Main, "Core", "EnableWiiLink"}, false};
// Empty means use the Dolphin default URL
const Info<std::string> MAIN_WII_NUS_SHOP_URL{{System::Main, "Core", "WiiNusShopUrl"}, ""};

View file

@ -150,6 +150,7 @@ extern const Info<DiscIO::Region> MAIN_FALLBACK_REGION;
extern const Info<bool> MAIN_REAL_WII_REMOTE_REPEAT_REPORTS;
extern const Info<s32> MAIN_OVERRIDE_BOOT_IOS;
extern const Info<std::string> MAIN_WII_NUS_SHOP_URL;
extern const Info<bool> MAIN_WII_WIILINK_ENABLE;
// Main.DSP

View file

@ -52,6 +52,8 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
#include "Core/TitleDatabase.h"
#include "Core/WC24PatchEngine.h"
#include "VideoCommon/HiresTextures.h"
#include "DiscIO/Enums.h"
@ -206,6 +208,7 @@ void SConfig::OnNewTitleLoad(const Core::CPUThreadGuard& guard)
HLE::Reload(system);
PatchEngine::Reload();
HiresTexture::Update();
WC24PatchEngine::Reload();
}
void SConfig::LoadDefaults()

View file

@ -812,7 +812,7 @@ static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unl
system.GetExpansionInterface().PauseAndLock(do_lock, false);
// audio has to come after CPU, because CPU thread can wait for audio thread (m_throttle).
system.GetDSP().GetDSPEmulator()->PauseAndLock(do_lock, false);
system.GetDSP().GetDSPEmulator()->PauseAndLock(do_lock);
// video has to come after CPU, because CPU thread can wait for video thread
// (s_efbAccessRequested).

View file

@ -18,7 +18,7 @@ public:
virtual void Shutdown() = 0;
virtual void DoState(PointerWrap& p) = 0;
virtual void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) = 0;
virtual void PauseAndLock(bool do_lock) = 0;
virtual void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) = 0;
virtual void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) = 0;

View file

@ -14,6 +14,7 @@
#include "Common/Align.h"
#include "Common/GekkoDisassembler.h"
#include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
@ -451,22 +452,23 @@ PPCDebugInterface::GetMemoryAddressFromInstruction(const std::string& instructio
if (!std::regex_search(instruction, match, re))
return std::nullopt;
// Output: match.str(1): negative sign for offset or no match. match.str(2): 0xNNNN, 0, or
// rNN. Check next for 'r' to see if a gpr needs to be loaded. match.str(3): will either be p,
// toc, or NN. Always a gpr.
const std::string offset_match = match.str(2);
const std::string register_match = match.str(3);
// match[1]: negative sign for offset or no match.
// match[2]: 0xNNNN, 0, or rNN. Check next for 'r' to see if a gpr needs to be loaded.
// match[3]: will either be p, toc, or NN. Always a gpr.
const std::string_view offset_match{&*match[2].first, size_t(match[2].length())};
const std::string_view register_match{&*match[3].first, size_t(match[3].length())};
constexpr char is_reg = 'r';
u32 offset = 0;
if (is_reg == offset_match[0])
{
const int register_index = std::stoi(offset_match.substr(1), nullptr, 10);
unsigned register_index;
Common::FromChars(offset_match.substr(1), register_index, 10);
offset = (register_index == 0 ? 0 : m_system.GetPPCState().gpr[register_index]);
}
else
{
offset = static_cast<u32>(std::stoi(offset_match, nullptr, 16));
Common::FromChars(offset_match, offset, 16);
}
// sp and rtoc need to be converted to 1 and 2.
@ -479,11 +481,11 @@ PPCDebugInterface::GetMemoryAddressFromInstruction(const std::string& instructio
else if (is_rtoc == register_match[0])
i = 2;
else
i = std::stoi(register_match, nullptr, 10);
Common::FromChars(register_match, i, 10);
const u32 base_address = m_system.GetPPCState().gpr[i];
if (!match.str(1).empty())
if (std::string_view sign{&*match[1].first, size_t(match[1].length())}; !sign.empty())
return base_address - offset;
return base_address + offset;

View file

@ -240,7 +240,7 @@ u16 DSPHLE::DSP_ReadControlRegister()
return m_dsp_control.Hex;
}
void DSPHLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
void DSPHLE::PauseAndLock(bool do_lock)
{
}
} // namespace DSP::HLE

View file

@ -26,7 +26,7 @@ public:
void Shutdown() override;
bool IsLLE() const override { return false; }
void DoState(PointerWrap& p) override;
void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) override;
void PauseAndLock(bool do_lock) override;
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;

View file

@ -288,7 +288,7 @@ u32 DSPLLE::DSP_UpdateRate()
return 12600; // TO BE TWEAKED
}
void DSPLLE::PauseAndLock(bool do_lock, bool unpause_on_unlock)
void DSPLLE::PauseAndLock(bool do_lock)
{
if (do_lock)
{

View file

@ -26,7 +26,7 @@ public:
void Shutdown() override;
bool IsLLE() const override { return true; }
void DoState(PointerWrap& p) override;
void PauseAndLock(bool do_lock, bool unpause_on_unlock = true) override;
void PauseAndLock(bool do_lock) override;
void DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value) override;
void DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value) override;

View file

@ -298,8 +298,17 @@ int IOWritePerWriteFile(HANDLE& dev_handle, OVERLAPPED& hid_overlap_write,
// Pending is no error!
break;
default:
if (FAILED(error))
{
WARN_LOG_FMT(WIIMOTE, "IOWrite[WWM_WRITE_FILE]: Error on WriteFile: {}",
Common::HRWrap(error));
}
else
{
WARN_LOG_FMT(WIIMOTE,
"IOWrite[WWM_WRITE_FILE]: Unexpected error code from WriteFile: 0x{:08x}",
error);
}
CancelIo(dev_handle);
return 0;
}

View file

@ -32,6 +32,7 @@
#include "Core/IOS/Network/MACUtils.h"
#include "Core/IOS/Network/Socket.h"
#include "Core/System.h"
#include "Core/WC24PatchEngine.h"
#ifdef _WIN32
#include <iphlpapi.h>
@ -1056,6 +1057,11 @@ IPCReply NetIPTopDevice::HandleGetAddressInfoRequest(const IOCtlVRequest& reques
if (!request.in_vectors.empty() && request.in_vectors[0].size > 0)
{
nodeNameStr = memory.GetString(request.in_vectors[0].address, request.in_vectors[0].size);
if (std::optional<std::string> patch =
WC24PatchEngine::GetNetworkPatch(nodeNameStr, WC24PatchEngine::IsKD{false}))
{
nodeNameStr = patch.value();
}
pNodeName = nodeNameStr.c_str();
}

View file

@ -139,5 +139,4 @@ void NWC24Dl::SetVersion(u32 version)
{
m_data.header.version = Common::swap32(version);
}
} // namespace IOS::HLE::NWC24

View file

@ -24,6 +24,7 @@
#include "Core/IOS/Network/Socket.h"
#include "Core/IOS/Uids.h"
#include "Core/System.h"
#include "Core/WC24PatchEngine.h"
namespace IOS::HLE
{
@ -217,7 +218,23 @@ NWC24::ErrorCode NetKDRequestDevice::KDDownload(const u16 entry_index,
// Content metadata
const std::string content_name = m_dl_list.GetVFFContentName(entry_index, subtask_id);
const std::string url = m_dl_list.GetDownloadURL(entry_index, subtask_id);
std::string url = m_dl_list.GetDownloadURL(entry_index, subtask_id);
// Reroute to custom server if enabled.
const std::vector<std::string> parts = SplitString(url, '/');
if (parts.size() < 3)
{
// Invalid URL
LogError(ErrorType::KD_Download, NWC24::WC24_ERR_SERVER);
return NWC24::WC24_ERR_SERVER;
}
if (std::optional<std::string> patch =
WC24PatchEngine::GetNetworkPatch(parts[2], WC24PatchEngine::IsKD{true}))
{
const size_t index = url.find(parts[2]);
url.replace(index, parts[2].size(), patch.value());
}
INFO_LOG_FMT(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_DOWNLOAD_NOW_EX - NI - URL: {}", url);

View file

@ -27,6 +27,7 @@
#include "Core/IOS/IOS.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/System.h"
#include "Core/WC24PatchEngine.h"
#ifdef _WIN32
#define ERRORCODE(name) WSA##name
@ -580,7 +581,14 @@ void WiiSocket::Update(bool read, bool write, bool except)
u32 has_destaddr = memory.Read_U32(BufferIn2 + 0x08);
// Not a string, Windows requires a const char* for sendto
const char* data = (const char*)memory.GetPointer(BufferIn);
const char* data = (const char*)memory.GetPointerForRange(BufferIn, BufferInSize);
const std::optional<std::string> patch =
WC24PatchEngine::GetNetworkPatchByPayload(std::string_view{data, BufferInSize});
if (patch)
{
data = patch->c_str();
BufferInSize = static_cast<u32>(patch->size());
}
// Act as non blocking when SO_MSG_NONBLOCK is specified
forceNonBlock = ((flags & SO_MSG_NONBLOCK) == SO_MSG_NONBLOCK);

View file

@ -469,28 +469,42 @@ static bool isCror(const CodeOp& a)
void PPCAnalyzer::ReorderInstructionsCore(u32 instructions, CodeOp* code, bool reverse,
ReorderType type) const
{
// Bubbling an instruction sometimes reveals another opportunity to bubble an instruction, so do
// multiple passes.
while (true)
{
// Instruction Reordering Pass
// Carry pass: bubble carry-using instructions as close to each other as possible, so we can
// avoid
// Carry pass: bubble carry-using instructions as close to each other as possible, so we can avoid
// storing the carry flag.
// Compare pass: bubble compare instructions next to branches, so they can be merged.
bool swapped = false;
int increment = reverse ? -1 : 1;
int start = reverse ? instructions - 1 : 0;
int end = reverse ? 0 : instructions - 1;
for (int i = start; i != end; i += increment)
const int start = reverse ? instructions - 1 : 0;
const int end = reverse ? 0 : instructions - 1;
const int increment = reverse ? -1 : 1;
int i = start;
int next = start;
bool go_backwards = false;
while (true)
{
if (go_backwards)
{
i -= increment;
go_backwards = false;
}
else
{
i = next;
next += increment;
}
if (i == end)
break;
CodeOp& a = code[i];
CodeOp& b = code[i + increment];
// Reorder integer compares, rlwinm., and carry-affecting ops
// (if we add more merged branch instructions, add them here!)
if ((type == ReorderType::CROR && isCror(a)) ||
(type == ReorderType::Carry && isCarryOp(a)) ||
if ((type == ReorderType::CROR && isCror(a)) || (type == ReorderType::Carry && isCarryOp(a)) ||
(type == ReorderType::CMP && (isCmp(a) || a.outputCR[0])))
{
// once we're next to a carry instruction, don't move away!
@ -499,23 +513,31 @@ void PPCAnalyzer::ReorderInstructionsCore(u32 instructions, CodeOp* code, bool r
// if we read the CA flag, and the previous instruction sets it, don't move away.
if (!reverse && (a.opinfo->flags & FL_READ_CA) &&
(code[i - increment].opinfo->flags & FL_SET_CA))
{
continue;
}
// if we set the CA flag, and the next instruction reads it, don't move away.
if (reverse && (a.opinfo->flags & FL_SET_CA) &&
(code[i - increment].opinfo->flags & FL_READ_CA))
{
continue;
}
}
if (CanSwapAdjacentOps(a, b))
{
// Alright, let's bubble it!
std::swap(a, b);
swapped = true;
if (i != start)
{
// Bubbling an instruction sometimes reveals another opportunity to bubble an instruction,
// so go one step backwards and check if we have such an opportunity.
go_backwards = true;
}
}
}
if (!swapped)
return;
}
}

View file

@ -0,0 +1,161 @@
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// WC24PatchEngine
// Allows for replacing URLs used in WC24 requests
#include <algorithm>
#include <array>
#include <fmt/format.h>
#include "Common/StringUtil.h"
#include "Core/CheatCodes.h"
#include "Core/CommonTitles.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/WC24PatchEngine.h"
namespace WC24PatchEngine
{
static std::array<u64, 12> s_wc24_channels{
// Nintendo Channel
Titles::NINTENDO_CHANNEL_NTSC_U,
Titles::NINTENDO_CHANNEL_NTSC_J,
Titles::NINTENDO_CHANNEL_PAL,
Titles::FORECAST_CHANNEL_NTSC_U,
Titles::FORECAST_CHANNEL_NTSC_J,
Titles::FORECAST_CHANNEL_PAL,
Titles::NEWS_CHANNEL_NTSC_U,
Titles::NEWS_CHANNEL_NTSC_J,
Titles::NEWS_CHANNEL_PAL,
Titles::EVERYBODY_VOTES_CHANNEL_NTSC_U,
Titles::EVERYBODY_VOTES_CHANNEL_NTSC_J,
Titles::EVERYBODY_VOTES_CHANNEL_PAL,
};
static std::vector<NetworkPatch> s_patches;
bool DeserializeLine(const std::string& line, NetworkPatch* patch)
{
const std::vector<std::string> items = SplitString(line, ':');
if (items.size() != 3)
return false;
patch->source = items[0];
patch->replacement = items[1];
if (!TryParse(items[2], &patch->is_kd))
return false;
return patch;
}
void LoadPatchSection(const Common::IniFile& ini)
{
std::vector<std::string> lines;
NetworkPatch patch;
ini.GetLines("WC24Patch", &lines);
for (std::string& line : lines)
{
if (line.empty())
continue;
if (line[0] == '$')
{
patch.name = line.substr(1, line.size() - 1);
}
else
{
if (DeserializeLine(line, &patch))
{
s_patches.push_back(patch);
}
}
}
ReadEnabledAndDisabled(ini, "WC24Patch", &s_patches);
}
void LoadPatches()
{
const auto& sconfig = SConfig::GetInstance();
// We can only load WC24 Channels.
if (!IsWC24Channel())
return;
Common::IniFile ini;
// If WiiLink is enabled then we load the Default Ini as that has the WiiLink URLs.
if (Config::Get(Config::MAIN_WII_WIILINK_ENABLE))
ini = sconfig.LoadDefaultGameIni();
else
ini = sconfig.LoadLocalGameIni();
LoadPatchSection(ini);
}
bool IsWC24Channel()
{
const auto& sconfig = SConfig::GetInstance();
const auto found =
std::find(s_wc24_channels.begin(), s_wc24_channels.end(), sconfig.GetTitleID());
return found != s_wc24_channels.end();
}
void Reload()
{
s_patches.clear();
LoadPatches();
}
std::optional<std::string> GetNetworkPatch(const std::string& source, IsKD is_kd)
{
const auto patch =
std::find_if(s_patches.begin(), s_patches.end(), [&source, &is_kd](NetworkPatch& patch) {
return patch.source == source && patch.is_kd == is_kd && patch.enabled;
});
if (patch == s_patches.end())
return std::nullopt;
return patch->replacement;
}
// When we patch for the Socket, we aren't given the URL. Instead, it is in a Host header
// in the payload that the socket is going to send. We need to manually find which patch to apply.
std::optional<std::string> GetNetworkPatchByPayload(std::string_view source)
{
size_t pos{};
while (pos < source.size())
{
const size_t end_of_line = source.find("\r\n", pos);
if (source.substr(pos).starts_with("Host: "))
{
const std::string_view domain =
source.substr(pos + 6, end_of_line == std::string_view::npos ? std::string_view::npos :
(end_of_line - pos - 6));
for (const WC24PatchEngine::NetworkPatch& patch : s_patches)
{
if (patch.is_kd != WC24PatchEngine::IsKD{true} && domain == patch.source && patch.enabled)
{
return fmt::format("{}Host: {}{}", source.substr(0, pos), patch.replacement,
end_of_line == std::string_view::npos ? "" :
source.substr(end_of_line));
}
}
// No matching patch
return std::nullopt;
}
if (end_of_line == std::string_view::npos)
break;
pos = end_of_line + 2;
}
return std::nullopt;
}
} // namespace WC24PatchEngine

View file

@ -0,0 +1,30 @@
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <optional>
#include <string>
#include "Common/IniFile.h"
namespace WC24PatchEngine
{
enum class IsKD : bool;
struct NetworkPatch final
{
std::string name;
std::string source;
std::string replacement;
bool enabled = false;
IsKD is_kd = IsKD{false};
};
void Reload();
bool DeserializeLine(const std::string& line, NetworkPatch* patch);
bool IsWC24Channel();
void LoadPatchSection(const Common::IniFile& ini);
std::optional<std::string> GetNetworkPatch(const std::string& source, IsKD is_kd);
std::optional<std::string> GetNetworkPatchByPayload(std::string_view source);
} // namespace WC24PatchEngine

View file

@ -75,7 +75,7 @@ PUBLIC
PRIVATE
fmt::fmt
minizip-ng
minizip::minizip
pugixml
ZLIB::ZLIB
)

View file

@ -436,6 +436,7 @@
<ClInclude Include="Core\SysConf.h" />
<ClInclude Include="Core\System.h" />
<ClInclude Include="Core\TitleDatabase.h" />
<ClInclude Include="Core\WC24PatchEngine.h" />
<ClInclude Include="Core\WiiRoot.h" />
<ClInclude Include="Core\WiiUtils.h" />
<ClInclude Include="DiscIO\Blob.h" />
@ -1071,6 +1072,7 @@
<ClCompile Include="Core\TitleDatabase.cpp" />
<ClCompile Include="Core\WiiRoot.cpp" />
<ClCompile Include="Core\WiiUtils.cpp" />
<ClCompile Include="Core\WC24PatchEngine.cpp" />
<ClCompile Include="DiscIO\Blob.cpp" />
<ClCompile Include="DiscIO\CISOBlob.cpp" />
<ClCompile Include="DiscIO\CompressedBlob.cpp" />

View file

@ -83,7 +83,7 @@ void ColorCorrectionConfigWindow::Create()
gamma_layout->addWidget(new QLabel(tr("Game Gamma")), 0, 0);
gamma_layout->addWidget(m_game_gamma, 0, 1);
m_game_gamma->SetDescription(tr(TR_GAME_GAMMA_DESCRIPTION));
m_game_gamma_value = new QLabel(tr(""));
m_game_gamma_value = new QLabel();
gamma_layout->addWidget(m_game_gamma_value, 0, 2);
m_correct_gamma = new ConfigBool(tr("Correct SDR Gamma"), Config::GFX_CC_CORRECT_GAMMA);
@ -99,7 +99,7 @@ void ColorCorrectionConfigWindow::Create()
Config::GFX_CC_SDR_DISPLAY_CUSTOM_GAMMA, 0.01f);
gamma_layout->addWidget(new QLabel(tr("SDR Display Custom Gamma")), 3, 0);
gamma_layout->addWidget(m_sdr_display_custom_gamma, 3, 1);
m_sdr_display_custom_gamma_value = new QLabel(tr(""));
m_sdr_display_custom_gamma_value = new QLabel();
gamma_layout->addWidget(m_sdr_display_custom_gamma_value, 3, 2);
m_sdr_display_gamma_srgb->setEnabled(m_correct_gamma->isChecked());
@ -122,7 +122,7 @@ void ColorCorrectionConfigWindow::Create()
Config::GFX_CC_HDR_PAPER_WHITE_NITS, 1.f);
hdr_layout->addWidget(new QLabel(tr("HDR Paper White Nits")), 0, 0);
hdr_layout->addWidget(m_hdr_paper_white_nits, 0, 1);
m_hdr_paper_white_nits_value = new QLabel(tr(""));
m_hdr_paper_white_nits_value = new QLabel();
hdr_layout->addWidget(m_hdr_paper_white_nits_value, 0, 2);
m_hdr_paper_white_nits_value->setText(

View file

@ -279,7 +279,7 @@ u32 PostProcessingConfigWindow::ConfigGroup::AddInteger(PostProcessingConfigWind
std::ceil(range / static_cast<double>(m_config_option->m_integer_step_values[i]));
const int current_value = std::round(
(m_config_option->m_integer_values[i] - m_config_option->m_integer_min_values[i]) /
static_cast<double>(m_config_option->m_integer_max_values[i]));
static_cast<double>(m_config_option->m_integer_step_values[i]));
auto* const slider = new QSlider(Qt::Orientation::Horizontal);
slider->setMinimum(0);
@ -289,7 +289,7 @@ u32 PostProcessingConfigWindow::ConfigGroup::AddInteger(PostProcessingConfigWind
QObject::connect(slider, &QSlider::valueChanged,
[this, parent](int value) { parent->UpdateInteger(this, value); });
auto* const value_box = new QLineEdit(QString::number(current_value));
auto* const value_box = new QLineEdit(QString::number(m_config_option->m_integer_values[i]));
value_box->setEnabled(false);
grid->addWidget(slider, row, 1);

View file

@ -121,6 +121,7 @@ void WiiPane::ConnectLayout()
&QCheckBox::setChecked);
connect(&Settings::Instance(), &Settings::USBKeyboardConnectionChanged,
m_connect_keyboard_checkbox, &QCheckBox::setChecked);
connect(m_wiilink_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
// SD Card Settings
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
@ -157,6 +158,7 @@ void WiiPane::CreateMisc()
m_main_layout->addWidget(misc_settings_group);
m_pal60_mode_checkbox = new QCheckBox(tr("Use PAL60 Mode (EuRGB60)"));
m_screensaver_checkbox = new QCheckBox(tr("Enable Screen Saver"));
m_wiilink_checkbox = new QCheckBox(tr("Enable WiiConnect24 via WiiLink"));
m_connect_keyboard_checkbox = new QCheckBox(tr("Connect USB Keyboard"));
m_aspect_ratio_choice_label = new QLabel(tr("Aspect Ratio:"));
@ -187,12 +189,17 @@ void WiiPane::CreateMisc()
m_pal60_mode_checkbox->setToolTip(tr("Sets the Wii display mode to 60Hz (480i) instead of 50Hz "
"(576i) for PAL games.\nMay not work for all games."));
m_screensaver_checkbox->setToolTip(tr("Dims the screen after five minutes of inactivity."));
m_wiilink_checkbox->setToolTip(tr(
"Enables the WiiLink service for WiiConnect24 channels.\nWiiLink is an alternate provider "
"for the discontinued WiiConnect24 Channels such as the Forecast and Nintendo Channels\nRead "
"the Terms of Service at: https://www.wiilink24.com/tos"));
m_system_language_choice->setToolTip(tr("Sets the Wii system language."));
m_connect_keyboard_checkbox->setToolTip(tr("May cause slow down in Wii Menu and some games."));
misc_settings_group_layout->addWidget(m_pal60_mode_checkbox, 0, 0, 1, 1);
misc_settings_group_layout->addWidget(m_connect_keyboard_checkbox, 0, 1, 1, 1);
misc_settings_group_layout->addWidget(m_screensaver_checkbox, 1, 0, 1, 1);
misc_settings_group_layout->addWidget(m_wiilink_checkbox, 1, 1, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice_label, 2, 0, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice, 2, 1, 1, 1);
misc_settings_group_layout->addWidget(m_system_language_choice_label, 3, 0, 1, 1);
@ -386,6 +393,7 @@ void WiiPane::OnEmulationStateChanged(bool running)
m_wiimote_speaker_volume->setEnabled(!running);
m_wiimote_ir_sensitivity->setEnabled(!running);
m_wiimote_ir_sensor_position->setEnabled(!running);
m_wiilink_checkbox->setEnabled(!running);
}
void WiiPane::LoadConfig()
@ -396,6 +404,7 @@ void WiiPane::LoadConfig()
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
m_sound_mode_choice->setCurrentIndex(Config::Get(Config::SYSCONF_SOUND_MODE));
m_wiilink_checkbox->setChecked(Config::Get(Config::MAIN_WII_WIILINK_ENABLE));
m_sd_card_checkbox->setChecked(Settings::Instance().IsSDCardInserted());
m_allow_sd_writes_checkbox->setChecked(Config::Get(Config::MAIN_ALLOW_SD_WRITES));
@ -433,6 +442,7 @@ void WiiPane::OnSaveConfig()
Config::SetBase<bool>(Config::SYSCONF_WIDESCREEN, m_aspect_ratio_choice->currentIndex());
Config::SetBase<u32>(Config::SYSCONF_SOUND_MODE, m_sound_mode_choice->currentIndex());
Config::SetBase(Config::SYSCONF_WIIMOTE_MOTOR, m_wiimote_motor->isChecked());
Config::SetBase(Config::MAIN_WII_WIILINK_ENABLE, m_wiilink_checkbox->isChecked());
Settings::Instance().SetSDCardInserted(m_sd_card_checkbox->isChecked());
Config::SetBase(Config::MAIN_ALLOW_SD_WRITES, m_allow_sd_writes_checkbox->isChecked());

View file

@ -51,6 +51,7 @@ private:
QCheckBox* m_screensaver_checkbox;
QCheckBox* m_pal60_mode_checkbox;
QCheckBox* m_connect_keyboard_checkbox;
QCheckBox* m_wiilink_checkbox;
QComboBox* m_system_language_choice;
QLabel* m_system_language_choice_label;
QComboBox* m_aspect_ratio_choice;

View file

@ -259,11 +259,22 @@ QVBoxLayout* SkylanderPortalWindow::CreateFinderLayout()
m_game_filters[i] = checkbox;
search_checkbox_layout->addWidget(checkbox);
}
// i18n: Figures for the game Skylanders: Spyro's Adventure. The game has the same title in all
// countries it was released in, except Japan, where it's named スカイランダーズ スパイロの大冒険.
m_game_filters[GetGameID(IOS::HLE::USB::Game::SpyrosAdv)]->setText(tr("Spyro's Adventure"));
// i18n: Figures for the game Skylanders: Giants. The game has the same title in all countries
// it was released in. It was not released in Japan.
m_game_filters[GetGameID(IOS::HLE::USB::Game::Giants)]->setText(tr("Giants"));
// i18n: Figures for the game Skylanders: Swap Force. The game has the same title in all countries
// it was released in. It was not released in Japan.
m_game_filters[GetGameID(IOS::HLE::USB::Game::SwapForce)]->setText(tr("Swap Force"));
// i18n: Figures for the game Skylanders: Trap Team. The game has the same title in all countries
// it was released in. It was not released in Japan.
m_game_filters[GetGameID(IOS::HLE::USB::Game::TrapTeam)]->setText(tr("Trap Team"));
m_game_filters[GetGameID(IOS::HLE::USB::Game::Superchargers)]->setText(tr("Superchargers"));
// i18n: Figures for the games Skylanders: SuperChargers (not available for the Wii) and
// Skylanders: SuperChargers Racing (available for the Wii). The games have the same titles in
// all countries they were released in. They were not released in Japan.
m_game_filters[GetGameID(IOS::HLE::USB::Game::Superchargers)]->setText(tr("SuperChargers"));
search_checkbox_group->setLayout(search_checkbox_layout);
search_checkbox_scroll_area->setWidget(search_checkbox_group);
search_game_layout->addWidget(search_checkbox_scroll_area);
@ -272,6 +283,9 @@ QVBoxLayout* SkylanderPortalWindow::CreateFinderLayout()
search_filters_layout->addWidget(search_game_group);
// WIDGET: Filter by Element
// i18n: Elements are a trait of Skylanders figures. For official translations of this term,
// check the Skylanders SuperChargers manual at https://support.activision.com/manuals
auto* search_element_group = new QGroupBox(tr("Element"));
auto* search_element_layout = new QVBoxLayout();
auto* search_radio_scroll_area = new QScrollArea();
@ -305,13 +319,30 @@ QVBoxLayout* SkylanderPortalWindow::CreateFinderLayout()
m_element_filter[0]->setText(tr("All"));
m_element_filter[0]->setChecked(true);
// i18n: One of the elements in the Skylanders games. Japanese: まほう. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[1]->setText(tr("Magic"));
// i18n: One of the elements in the Skylanders games. Japanese: 水. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[2]->setText(tr("Water"));
// i18n: One of the elements in the Skylanders games. Japanese: マシン. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[3]->setText(tr("Tech"));
// i18n: One of the elements in the Skylanders games. Japanese: 火. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[4]->setText(tr("Fire"));
// i18n: One of the elements in the Skylanders games. Japanese: 土. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[5]->setText(tr("Earth"));
// i18n: One of the elements in the Skylanders games. Japanese: ライフ. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[6]->setText(tr("Life"));
// i18n: One of the elements in the Skylanders games. Japanese: 風. For official translations
// in other languages, check the SuperChargers manual at https://support.activision.com/manuals
m_element_filter[7]->setText(tr("Air"));
// i18n: One of the elements in the Skylanders games. Japanese: アンデッド. For official
// translations in other languages, check the SuperChargers manual at
// https://support.activision.com/manuals
m_element_filter[8]->setText(tr("Undead"));
m_element_filter[9]->setText(tr("Other"));

View file

@ -81,7 +81,8 @@ PUBLIC
PRIVATE
fmt::fmt
${spng_target}
sfml-network
spng::spng
)
if(WIN32)
@ -146,7 +147,7 @@ elseif(ANDROID)
endif()
if(NOT ANDROID)
target_link_libraries(inputcommon PUBLIC ${LIBUSB_LIBRARIES})
target_link_libraries(inputcommon PUBLIC LibUSB::LibUSB)
endif()
if(LIBEVDEV_FOUND AND LIBUDEV_FOUND)
@ -174,12 +175,13 @@ if(UNIX)
)
endif()
if(SDL2_FOUND)
if(ENABLE_SDL)
target_sources(inputcommon PRIVATE
ControllerInterface/SDL/SDL.cpp
ControllerInterface/SDL/SDL.h
)
target_link_libraries(inputcommon PRIVATE SDL2::SDL2)
target_compile_definitions(inputcommon PUBLIC HAVE_SDL2=1)
endif()
if(MSVC)

View file

@ -29,7 +29,7 @@ target_link_libraries(uicommon
PUBLIC
common
cpp-optparse
minizip-ng
minizip::minizip
pugixml
PRIVATE
@ -48,8 +48,8 @@ if(ENABLE_X11 AND X11_FOUND)
target_link_libraries(uicommon PUBLIC ${XRANDR_LIBRARIES})
endif()
if(LIBUSB_FOUND)
target_link_libraries(uicommon PRIVATE ${LIBUSB_LIBRARIES})
if(TARGET LibUSB::LibUSB)
target_link_libraries(uicommon PRIVATE LibUSB::LibUSB)
endif()
if(ENABLE_LLVM)

View file

@ -6,7 +6,7 @@ add_library(updatercommon
target_link_libraries(updatercommon PRIVATE
uicommon
mbedtls
MbedTLS::mbedtls
ZLIB::ZLIB
ed25519
cpp-optparse

View file

@ -392,14 +392,14 @@ void VKGfx::OnConfigChanged(u32 bits)
g_object_cache->ReloadPipelineCache();
// For vsync, we need to change the present mode, which means recreating the swap chain.
if (m_swap_chain && bits & CONFIG_CHANGE_BIT_VSYNC)
if (m_swap_chain && (bits & CONFIG_CHANGE_BIT_VSYNC))
{
ExecuteCommandBuffer(false, true);
m_swap_chain->SetVSync(g_ActiveConfig.bVSyncActive);
}
// For quad-buffered stereo we need to change the layer count, so recreate the swap chain.
if (m_swap_chain && (bits & CONFIG_CHANGE_BIT_STEREO_MODE) || (bits & CONFIG_CHANGE_BIT_HDR))
if (m_swap_chain && ((bits & CONFIG_CHANGE_BIT_STEREO_MODE) || (bits & CONFIG_CHANGE_BIT_HDR)))
{
ExecuteCommandBuffer(false, true);
m_swap_chain->RecreateSwapChain();

View file

@ -195,7 +195,7 @@ PUBLIC
core
PRIVATE
fmt::fmt
${spng_target}
spng::spng
xxhash
imgui
implot