Compare commits
1 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92824da63b |
@@ -40,8 +40,6 @@ option(YUZU_TESTS "Compile tests" ON)
|
||||
|
||||
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
||||
|
||||
option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON)
|
||||
|
||||
if (YUZU_USE_BUNDLED_VCPKG)
|
||||
if (YUZU_TESTS)
|
||||
list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests")
|
||||
@@ -83,17 +81,12 @@ function(check_submodules_present)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules AND YUZU_CHECK_SUBMODULES)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules)
|
||||
check_submodules_present()
|
||||
endif()
|
||||
configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc
|
||||
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
|
||||
COPYONLY)
|
||||
if (EXISTS ${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.json)
|
||||
configure_file("${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.json"
|
||||
"${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json"
|
||||
COPYONLY)
|
||||
endif()
|
||||
if (ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
|
||||
message(STATUS "Downloading compatibility list for yuzu...")
|
||||
file(DOWNLOAD
|
||||
@@ -535,6 +528,11 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
)
|
||||
endif()
|
||||
|
||||
# Set __FILE__ macro value to a relative path for reproducible builds
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
add_compile_options("-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(externals)
|
||||
add_subdirectory(src)
|
||||
|
||||
23
SECURITY.md
23
SECURITY.md
@@ -1,23 +0,0 @@
|
||||
# Security Policy
|
||||
# google policy
|
||||
# microsoft security
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
||||
2
externals/CMakeLists.txt
vendored
2
externals/CMakeLists.txt
vendored
@@ -128,7 +128,7 @@ endif()
|
||||
if (YUZU_USE_BUNDLED_OPUS)
|
||||
add_subdirectory(opus EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
find_package(Opus 1.3 REQUIRED)
|
||||
find_package(opus 1.3 REQUIRED)
|
||||
endif()
|
||||
|
||||
# FFMpeg
|
||||
|
||||
51
externals/find-modules/FindCatch2.cmake
vendored
Normal file
51
externals/find-modules/FindCatch2.cmake
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_Catch2 QUIET Catch2)
|
||||
|
||||
find_path(Catch2_INCLUDE_DIR
|
||||
NAMES catch.hpp
|
||||
PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT}
|
||||
PATH_SUFFIXES catch2
|
||||
)
|
||||
|
||||
if(Catch2_INCLUDE_DIR)
|
||||
file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
|
||||
REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
|
||||
string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
|
||||
string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
|
||||
string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
|
||||
set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
|
||||
unset(_Catch2_version_major)
|
||||
unset(_Catch2_version_minor)
|
||||
unset(_Catch2_version_patch)
|
||||
unset(_Catch2_version_lines)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Catch2
|
||||
FOUND_VAR Catch2_FOUND
|
||||
REQUIRED_VARS
|
||||
Catch2_INCLUDE_DIR
|
||||
Catch2_VERSION
|
||||
VERSION_VAR Catch2_VERSION
|
||||
)
|
||||
|
||||
if(Catch2_FOUND)
|
||||
set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR})
|
||||
set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(Catch2_FOUND AND NOT TARGET Catch2::Catch2)
|
||||
add_library(Catch2::Catch2 UNKNOWN IMPORTED)
|
||||
set_target_properties(Catch2::Catch2 PROPERTIES
|
||||
IMPORTED_LOCATION "${Catch2_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
Catch2_INCLUDE_DIR
|
||||
)
|
||||
19
externals/find-modules/FindOpus.cmake
vendored
19
externals/find-modules/FindOpus.cmake
vendored
@@ -1,19 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module(opus IMPORTED_TARGET GLOBAL opus)
|
||||
if (opus_FOUND)
|
||||
add_library(Opus::opus ALIAS PkgConfig::opus)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Opus
|
||||
REQUIRED_VARS
|
||||
opus_LINK_LIBRARIES
|
||||
opus_FOUND
|
||||
VERSION_VAR opus_VERSION
|
||||
)
|
||||
71
externals/find-modules/Findfmt.cmake
vendored
Normal file
71
externals/find-modules/Findfmt.cmake
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_fmt QUIET fmt)
|
||||
|
||||
find_path(fmt_INCLUDE_DIR
|
||||
NAMES format.h
|
||||
PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt}
|
||||
PATH_SUFFIXES fmt
|
||||
)
|
||||
|
||||
find_library(fmt_LIBRARY
|
||||
NAMES fmt
|
||||
PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
|
||||
)
|
||||
|
||||
if(fmt_INCLUDE_DIR)
|
||||
set(_fmt_version_file "${fmt_INCLUDE_DIR}/core.h")
|
||||
if(NOT EXISTS "${_fmt_version_file}")
|
||||
set(_fmt_version_file "${fmt_INCLUDE_DIR}/format.h")
|
||||
endif()
|
||||
if(EXISTS "${_fmt_version_file}")
|
||||
# parse "#define FMT_VERSION 60200" to 6.2.0
|
||||
file(STRINGS "${_fmt_version_file}" fmt_VERSION_LINE
|
||||
REGEX "^#define[ \t]+FMT_VERSION[ \t]+[0-9]+$")
|
||||
string(REGEX REPLACE "^#define[ \t]+FMT_VERSION[ \t]+([0-9]+)$"
|
||||
"\\1" fmt_VERSION "${fmt_VERSION_LINE}")
|
||||
foreach(ver "fmt_VERSION_PATCH" "fmt_VERSION_MINOR" "fmt_VERSION_MAJOR")
|
||||
math(EXPR ${ver} "${fmt_VERSION} % 100")
|
||||
math(EXPR fmt_VERSION "(${fmt_VERSION} - ${${ver}}) / 100")
|
||||
endforeach()
|
||||
set(fmt_VERSION
|
||||
"${fmt_VERSION_MAJOR}.${fmt_VERSION_MINOR}.${fmt_VERSION_PATCH}")
|
||||
endif()
|
||||
unset(_fmt_version_file)
|
||||
unset(fmt_VERSION_LINE)
|
||||
unset(fmt_VERSION_MAJOR)
|
||||
unset(fmt_VERSION_MINOR)
|
||||
unset(fmt_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(fmt
|
||||
FOUND_VAR fmt_FOUND
|
||||
REQUIRED_VARS
|
||||
fmt_LIBRARY
|
||||
fmt_INCLUDE_DIR
|
||||
fmt_VERSION
|
||||
VERSION_VAR fmt_VERSION
|
||||
)
|
||||
|
||||
if(fmt_FOUND)
|
||||
set(fmt_LIBRARIES ${fmt_LIBRARY})
|
||||
set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
|
||||
set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(fmt_FOUND AND NOT TARGET fmt::fmt)
|
||||
add_library(fmt::fmt UNKNOWN IMPORTED)
|
||||
set_target_properties(fmt::fmt PROPERTIES
|
||||
IMPORTED_LOCATION "${fmt_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_fmt_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
fmt_INCLUDE_DIR
|
||||
fmt_LIBRARY
|
||||
)
|
||||
59
externals/find-modules/Findlz4.cmake
vendored
59
externals/find-modules/Findlz4.cmake
vendored
@@ -1,19 +1,56 @@
|
||||
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_lz4 QUIET lz4)
|
||||
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module(liblz4 IMPORTED_TARGET GLOBAL liblz4)
|
||||
if (liblz4_FOUND)
|
||||
add_library(lz4::lz4 ALIAS PkgConfig::liblz4)
|
||||
endif()
|
||||
find_path(lz4_INCLUDE_DIR
|
||||
NAMES lz4.h
|
||||
PATHS ${PC_lz4_INCLUDE_DIRS}
|
||||
)
|
||||
find_library(lz4_LIBRARY
|
||||
NAMES lz4
|
||||
PATHS ${PC_lz4_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(lz4_INCLUDE_DIR)
|
||||
file(STRINGS "${lz4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
|
||||
REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
|
||||
set(lz4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
|
||||
unset(_lz4_version_major)
|
||||
unset(_lz4_version_minor)
|
||||
unset(_lz4_version_release)
|
||||
unset(_lz4_version_lines)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(lz4
|
||||
REQUIRED_VARS
|
||||
liblz4_LINK_LIBRARIES
|
||||
liblz4_FOUND
|
||||
VERSION_VAR liblz4_VERSION
|
||||
FOUND_VAR lz4_FOUND
|
||||
REQUIRED_VARS
|
||||
lz4_LIBRARY
|
||||
lz4_INCLUDE_DIR
|
||||
VERSION_VAR lz4_VERSION
|
||||
)
|
||||
|
||||
if(lz4_FOUND)
|
||||
set(lz4_LIBRARIES ${lz4_LIBRARY})
|
||||
set(lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
|
||||
set(lz4_DEFINITIONS ${PC_lz4_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(lz4_FOUND AND NOT TARGET lz4::lz4)
|
||||
add_library(lz4::lz4 UNKNOWN IMPORTED)
|
||||
set_target_properties(lz4::lz4 PROPERTIES
|
||||
IMPORTED_LOCATION "${lz4_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
lz4_INCLUDE_DIR
|
||||
lz4_LIBRARY
|
||||
)
|
||||
|
||||
51
externals/find-modules/Findnlohmann_json.cmake
vendored
Normal file
51
externals/find-modules/Findnlohmann_json.cmake
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
|
||||
|
||||
find_path(nlohmann_json_INCLUDE_DIR
|
||||
NAMES json.hpp
|
||||
PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES nlohmann
|
||||
)
|
||||
|
||||
if(nlohmann_json_INCLUDE_DIR)
|
||||
file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
|
||||
REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
|
||||
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
|
||||
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
|
||||
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
|
||||
set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
|
||||
unset(_nlohmann_json_version_major)
|
||||
unset(_nlohmann_json_version_minor)
|
||||
unset(_nlohmann_json_version_patch)
|
||||
unset(_nlohmann_json_version_lines)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(nlohmann_json
|
||||
FOUND_VAR nlohmann_json_FOUND
|
||||
REQUIRED_VARS
|
||||
nlohmann_json_INCLUDE_DIR
|
||||
nlohmann_json_VERSION
|
||||
VERSION_VAR nlohmann_json_VERSION
|
||||
)
|
||||
|
||||
if(nlohmann_json_FOUND)
|
||||
set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
|
||||
set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
|
||||
add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
|
||||
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
|
||||
IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
nlohmann_json_INCLUDE_DIR
|
||||
)
|
||||
44
externals/find-modules/Findopus.cmake
vendored
Normal file
44
externals/find-modules/Findopus.cmake
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_opus QUIET opus)
|
||||
|
||||
find_path(opus_INCLUDE_DIR
|
||||
NAMES opus.h
|
||||
PATHS ${PC_opus_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES opus
|
||||
)
|
||||
find_library(opus_LIBRARY
|
||||
NAMES opus
|
||||
PATHS ${PC_opus_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(opus
|
||||
FOUND_VAR opus_FOUND
|
||||
REQUIRED_VARS
|
||||
opus_LIBRARY
|
||||
opus_INCLUDE_DIR
|
||||
VERSION_VAR opus_VERSION
|
||||
)
|
||||
|
||||
if(opus_FOUND)
|
||||
set(Opus_LIBRARIES ${opus_LIBRARY})
|
||||
set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR})
|
||||
set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(opus_FOUND AND NOT TARGET Opus::Opus)
|
||||
add_library(Opus::Opus UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(Opus::Opus PROPERTIES
|
||||
IMPORTED_LOCATION "${opus_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
opus_INCLUDE_DIR
|
||||
opus_LIBRARY
|
||||
)
|
||||
60
externals/find-modules/Findzstd.cmake
vendored
60
externals/find-modules/Findzstd.cmake
vendored
@@ -1,19 +1,57 @@
|
||||
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_zstd QUIET libzstd)
|
||||
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module(libzstd IMPORTED_TARGET GLOBAL libzstd)
|
||||
if (libzstd_FOUND)
|
||||
add_library(zstd::zstd ALIAS PkgConfig::libzstd)
|
||||
endif()
|
||||
find_path(zstd_INCLUDE_DIR
|
||||
NAMES zstd.h
|
||||
PATHS ${PC_zstd_INCLUDE_DIRS}
|
||||
)
|
||||
find_library(zstd_LIBRARY
|
||||
NAMES zstd
|
||||
PATHS ${PC_zstd_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(zstd_INCLUDE_DIR)
|
||||
file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
|
||||
REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
|
||||
string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
|
||||
string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
|
||||
string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
|
||||
set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
|
||||
unset(_zstd_version_major)
|
||||
unset(_zstd_version_minor)
|
||||
unset(_zstd_version_release)
|
||||
unset(_zstd_version_lines)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(zstd
|
||||
REQUIRED_VARS
|
||||
libzstd_LINK_LIBRARIES
|
||||
libzstd_FOUND
|
||||
VERSION_VAR libzstd_VERSION
|
||||
FOUND_VAR zstd_FOUND
|
||||
REQUIRED_VARS
|
||||
zstd_LIBRARY
|
||||
zstd_INCLUDE_DIR
|
||||
zstd_VERSION
|
||||
VERSION_VAR zstd_VERSION
|
||||
)
|
||||
|
||||
if(zstd_FOUND)
|
||||
set(zstd_LIBRARIES ${zstd_LIBRARY})
|
||||
set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
|
||||
set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
if(zstd_FOUND AND NOT TARGET zstd::zstd)
|
||||
add_library(zstd::zstd UNKNOWN IMPORTED)
|
||||
set_target_properties(zstd::zstd PROPERTIES
|
||||
IMPORTED_LOCATION "${zstd_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
zstd_INCLUDE_DIR
|
||||
zstd_LIBRARY
|
||||
)
|
||||
|
||||
2
externals/opus/CMakeLists.txt
vendored
2
externals/opus/CMakeLists.txt
vendored
@@ -256,4 +256,4 @@ PRIVATE
|
||||
opus/src
|
||||
)
|
||||
|
||||
add_library(Opus::opus ALIAS opus)
|
||||
add_library(Opus::Opus ALIAS opus)
|
||||
|
||||
@@ -22,3 +22,12 @@ typedef void* HANDLE;
|
||||
#include <microprofile.h>
|
||||
|
||||
#define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0)
|
||||
|
||||
// On OS X, some Mach header included by MicroProfile defines these as macros, conflicting with
|
||||
// identifiers we use.
|
||||
#ifdef PAGE_SIZE
|
||||
#undef PAGE_SIZE
|
||||
#endif
|
||||
#ifdef PAGE_MASK
|
||||
#undef PAGE_MASK
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#pragma intrinsic(_udiv128)
|
||||
#else
|
||||
#include <cstring>
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
@@ -786,7 +786,7 @@ endif()
|
||||
create_target_directory_groups(core)
|
||||
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus)
|
||||
if (MINGW)
|
||||
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
|
||||
endif()
|
||||
|
||||
@@ -190,8 +190,8 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
|
||||
config.callbacks = cb.get();
|
||||
config.coprocessors[15] = cp15;
|
||||
config.define_unpredictable_behaviour = true;
|
||||
static constexpr std::size_t YUZU_PAGEBITS = 12;
|
||||
static constexpr std::size_t NUM_PAGE_TABLE_ENTRIES = 1 << (32 - YUZU_PAGEBITS);
|
||||
static constexpr std::size_t PAGE_BITS = 12;
|
||||
static constexpr std::size_t NUM_PAGE_TABLE_ENTRIES = 1 << (32 - PAGE_BITS);
|
||||
if (page_table) {
|
||||
config.page_table = reinterpret_cast<std::array<std::uint8_t*, NUM_PAGE_TABLE_ENTRIES>*>(
|
||||
page_table->pointers.data());
|
||||
|
||||
@@ -217,7 +217,9 @@ void IPSwitchCompiler::Parse() {
|
||||
break;
|
||||
} else if (StartsWith(line, "@nsobid-")) {
|
||||
// NSO Build ID Specifier
|
||||
const auto raw_build_id = fmt::format("{:0<64}", line.substr(8));
|
||||
auto raw_build_id = line.substr(8);
|
||||
if (raw_build_id.size() != 0x40)
|
||||
raw_build_id.resize(0x40, '0');
|
||||
nso_build_id = Common::HexStringToArray<0x20>(raw_build_id);
|
||||
} else if (StartsWith(line, "#")) {
|
||||
// Mandatory Comment
|
||||
|
||||
@@ -191,7 +191,6 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||
std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualDir>& patch_dirs,
|
||||
const std::string& build_id) const {
|
||||
const auto& disabled = Settings::values.disabled_addons[title_id];
|
||||
const auto nso_build_id = fmt::format("{:0<64}", build_id);
|
||||
|
||||
std::vector<VirtualFile> out;
|
||||
out.reserve(patch_dirs.size());
|
||||
@@ -204,18 +203,21 @@ std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualD
|
||||
for (const auto& file : exefs_dir->GetFiles()) {
|
||||
if (file->GetExtension() == "ips") {
|
||||
auto name = file->GetName();
|
||||
const auto p1 = name.substr(0, name.find('.'));
|
||||
const auto this_build_id = p1.substr(0, p1.find_last_not_of('0') + 1);
|
||||
|
||||
const auto this_build_id =
|
||||
fmt::format("{:0<64}", name.substr(0, name.find('.')));
|
||||
if (nso_build_id == this_build_id)
|
||||
if (build_id == this_build_id)
|
||||
out.push_back(file);
|
||||
} else if (file->GetExtension() == "pchtxt") {
|
||||
IPSwitchCompiler compiler{file};
|
||||
if (!compiler.IsValid())
|
||||
continue;
|
||||
|
||||
const auto this_build_id = Common::HexToString(compiler.GetBuildID());
|
||||
if (nso_build_id == this_build_id)
|
||||
auto this_build_id = Common::HexToString(compiler.GetBuildID());
|
||||
this_build_id =
|
||||
this_build_id.substr(0, this_build_id.find_last_not_of('0') + 1);
|
||||
|
||||
if (build_id == this_build_id)
|
||||
out.push_back(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,10 +101,8 @@ void EmulatedController::ReloadFromSettings() {
|
||||
// Other or debug controller should always be a pro controller
|
||||
if (npad_id_type != NpadIdType::Other) {
|
||||
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
||||
original_npad_type = npad_type;
|
||||
} else {
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
original_npad_type = npad_type;
|
||||
}
|
||||
|
||||
if (player.connected) {
|
||||
@@ -356,7 +354,6 @@ void EmulatedController::DisableConfiguration() {
|
||||
Disconnect();
|
||||
}
|
||||
SetNpadStyleIndex(tmp_npad_type);
|
||||
original_npad_type = tmp_npad_type;
|
||||
}
|
||||
|
||||
// Apply temporary connected status to the real controller
|
||||
@@ -1007,27 +1004,13 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
|
||||
if (!is_connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Attempt to reconnect with the original type
|
||||
if (npad_type != original_npad_type) {
|
||||
Disconnect();
|
||||
const auto current_npad_type = npad_type;
|
||||
SetNpadStyleIndex(original_npad_type);
|
||||
if (IsControllerSupported()) {
|
||||
Connect();
|
||||
return;
|
||||
}
|
||||
SetNpadStyleIndex(current_npad_type);
|
||||
Connect();
|
||||
}
|
||||
|
||||
if (IsControllerSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Disconnect();
|
||||
|
||||
// Fallback Fullkey controllers to Pro controllers
|
||||
// Fallback fullkey controllers to Pro controllers
|
||||
if (IsControllerFullkey() && supported_style_tag.fullkey) {
|
||||
LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
@@ -1035,22 +1018,6 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback Dual joycon controllers to Pro controllers
|
||||
if (npad_type == NpadStyleIndex::JoyconDual && supported_style_tag.fullkey) {
|
||||
LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
Connect();
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback Pro controllers to Dual joycon
|
||||
if (npad_type == NpadStyleIndex::ProController && supported_style_tag.joycon_dual) {
|
||||
LOG_WARNING(Service_HID, "Reconnecting controller type {} as Dual Joycons", npad_type);
|
||||
SetNpadStyleIndex(NpadStyleIndex::JoyconDual);
|
||||
Connect();
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
|
||||
npad_type);
|
||||
}
|
||||
|
||||
@@ -440,7 +440,6 @@ private:
|
||||
|
||||
const NpadIdType npad_id_type;
|
||||
NpadStyleIndex npad_type{NpadStyleIndex::None};
|
||||
NpadStyleIndex original_npad_type{NpadStyleIndex::None};
|
||||
NpadStyleTag supported_style_tag{NpadStyleSet::All};
|
||||
bool is_connected{false};
|
||||
bool is_configuring{false};
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
{7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"},
|
||||
{8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"},
|
||||
{9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"},
|
||||
{10, &IAudioRenderer::RequestUpdate, "RequestUpdateAuto"},
|
||||
{10, nullptr, "RequestUpdateAuto"},
|
||||
{11, nullptr, "ExecuteAudioRendererRendering"},
|
||||
};
|
||||
// clang-format on
|
||||
@@ -113,30 +113,15 @@ private:
|
||||
|
||||
// These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
|
||||
// checking size 0. Performance size is 0 for most games.
|
||||
|
||||
std::vector<u8> output{};
|
||||
std::vector<u8> performance{};
|
||||
auto is_buffer_b{ctx.BufferDescriptorB()[0].Size() != 0};
|
||||
if (is_buffer_b) {
|
||||
const auto buffersB{ctx.BufferDescriptorB()};
|
||||
output.resize(buffersB[0].Size(), 0);
|
||||
performance.resize(buffersB[1].Size(), 0);
|
||||
} else {
|
||||
const auto buffersC{ctx.BufferDescriptorC()};
|
||||
output.resize(buffersC[0].Size(), 0);
|
||||
performance.resize(buffersC[1].Size(), 0);
|
||||
}
|
||||
const auto buffers{ctx.BufferDescriptorB()};
|
||||
std::vector<u8> output(buffers[0].Size(), 0);
|
||||
std::vector<u8> performance(buffers[1].Size(), 0);
|
||||
|
||||
auto result = impl->RequestUpdate(input, performance, output);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
if (is_buffer_b) {
|
||||
ctx.WriteBufferB(output.data(), output.size(), 0);
|
||||
ctx.WriteBufferB(performance.data(), performance.size(), 1);
|
||||
} else {
|
||||
ctx.WriteBufferC(output.data(), output.size(), 0);
|
||||
ctx.WriteBufferC(performance.data(), performance.size(), 1);
|
||||
}
|
||||
ctx.WriteBufferB(output.data(), output.size(), 0);
|
||||
ctx.WriteBufferB(performance.data(), performance.size(), 1);
|
||||
} else {
|
||||
LOG_ERROR(Service_Audio, "RequestUpdate failed error 0x{:02X}!", result.description);
|
||||
}
|
||||
|
||||
@@ -246,8 +246,7 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
|
||||
entries.reserve(entries.size() + new_data.size());
|
||||
|
||||
for (const auto& new_entry : new_data) {
|
||||
entries.emplace_back(new_entry->GetName(), type,
|
||||
type == FileSys::EntryType::Directory ? 0 : new_entry->GetSize());
|
||||
entries.emplace_back(new_entry->GetName(), type, new_entry->GetSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2146,18 +2146,12 @@ public:
|
||||
{324, nullptr, "GetUniquePadButtonSet"},
|
||||
{325, nullptr, "GetUniquePadColor"},
|
||||
{326, nullptr, "GetUniquePadAppletDetailedUiType"},
|
||||
{327, nullptr, "GetAbstractedPadIdDataFromNpad"},
|
||||
{328, nullptr, "AttachAbstractedPadToNpad"},
|
||||
{329, nullptr, "DetachAbstractedPadAll"},
|
||||
{330, nullptr, "CheckAbstractedPadConnection"},
|
||||
{500, nullptr, "SetAppletResourceUserId"},
|
||||
{501, nullptr, "RegisterAppletResourceUserId"},
|
||||
{502, nullptr, "UnregisterAppletResourceUserId"},
|
||||
{503, nullptr, "EnableAppletToGetInput"},
|
||||
{504, nullptr, "SetAruidValidForVibration"},
|
||||
{505, nullptr, "EnableAppletToGetSixAxisSensor"},
|
||||
{506, nullptr, "EnableAppletToGetPadInput"},
|
||||
{507, nullptr, "EnableAppletToGetTouchScreen"},
|
||||
{510, nullptr, "SetVibrationMasterVolume"},
|
||||
{511, nullptr, "GetVibrationMasterVolume"},
|
||||
{512, nullptr, "BeginPermitVibrationSession"},
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/service/pcv/pcv.h"
|
||||
#include "core/hle/service/service.h"
|
||||
#include "core/hle/service/sm/sm.h"
|
||||
@@ -78,102 +77,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class IClkrstSession final : public ServiceFramework<IClkrstSession> {
|
||||
public:
|
||||
explicit IClkrstSession(Core::System& system_, DeviceCode deivce_code_)
|
||||
: ServiceFramework{system_, "IClkrstSession"}, deivce_code(deivce_code_) {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "SetClockEnabled"},
|
||||
{1, nullptr, "SetClockDisabled"},
|
||||
{2, nullptr, "SetResetAsserted"},
|
||||
{3, nullptr, "SetResetDeasserted"},
|
||||
{4, nullptr, "SetPowerEnabled"},
|
||||
{5, nullptr, "SetPowerDisabled"},
|
||||
{6, nullptr, "GetState"},
|
||||
{7, &IClkrstSession::SetClockRate, "SetClockRate"},
|
||||
{8, &IClkrstSession::GetClockRate, "GetClockRate"},
|
||||
{9, nullptr, "SetMinVClockRate"},
|
||||
{10, nullptr, "GetPossibleClockRates"},
|
||||
{11, nullptr, "GetDvfsTable"},
|
||||
};
|
||||
// clang-format on
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
private:
|
||||
void SetClockRate(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
clock_rate = rp.Pop<u32>();
|
||||
LOG_DEBUG(Service_PCV, "(STUBBED) called, clock_rate={}", clock_rate);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void GetClockRate(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_PCV, "(STUBBED) called");
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u32>(clock_rate);
|
||||
}
|
||||
|
||||
DeviceCode deivce_code;
|
||||
u32 clock_rate{};
|
||||
};
|
||||
|
||||
class CLKRST final : public ServiceFramework<CLKRST> {
|
||||
public:
|
||||
explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &CLKRST::OpenSession, "OpenSession"},
|
||||
{1, nullptr, "GetTemperatureThresholds"},
|
||||
{2, nullptr, "SetTemperature"},
|
||||
{3, nullptr, "GetModuleStateTable"},
|
||||
{4, nullptr, "GetModuleStateTableEvent"},
|
||||
{5, nullptr, "GetModuleStateTableMaxCount"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
private:
|
||||
void OpenSession(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto device_code = static_cast<DeviceCode>(rp.Pop<u32>());
|
||||
const auto unkonwn_input = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service_PCV, "called, device_code={}, input={}", device_code, unkonwn_input);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushIpcInterface<IClkrstSession>(system, device_code);
|
||||
}
|
||||
};
|
||||
|
||||
class CLKRST_A final : public ServiceFramework<CLKRST_A> {
|
||||
public:
|
||||
explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "ReleaseControl"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
};
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
||||
std::make_shared<PCV>(system)->InstallAsService(sm);
|
||||
std::make_shared<PCV_ARB>(system)->InstallAsService(sm);
|
||||
std::make_shared<PCV_IMM>(system)->InstallAsService(sm);
|
||||
std::make_shared<CLKRST>(system, "clkrst")->InstallAsService(sm);
|
||||
std::make_shared<CLKRST>(system, "clkrst:i")->InstallAsService(sm);
|
||||
std::make_shared<CLKRST_A>(system)->InstallAsService(sm);
|
||||
}
|
||||
|
||||
} // namespace Service::PCV
|
||||
|
||||
@@ -13,97 +13,6 @@ class ServiceManager;
|
||||
|
||||
namespace Service::PCV {
|
||||
|
||||
enum class DeviceCode : u32 {
|
||||
Cpu = 0x40000001,
|
||||
Gpu = 0x40000002,
|
||||
I2s1 = 0x40000003,
|
||||
I2s2 = 0x40000004,
|
||||
I2s3 = 0x40000005,
|
||||
Pwm = 0x40000006,
|
||||
I2c1 = 0x02000001,
|
||||
I2c2 = 0x02000002,
|
||||
I2c3 = 0x02000003,
|
||||
I2c4 = 0x02000004,
|
||||
I2c5 = 0x02000005,
|
||||
I2c6 = 0x02000006,
|
||||
Spi1 = 0x07000000,
|
||||
Spi2 = 0x07000001,
|
||||
Spi3 = 0x07000002,
|
||||
Spi4 = 0x07000003,
|
||||
Disp1 = 0x40000011,
|
||||
Disp2 = 0x40000012,
|
||||
Isp = 0x40000013,
|
||||
Vi = 0x40000014,
|
||||
Sdmmc1 = 0x40000015,
|
||||
Sdmmc2 = 0x40000016,
|
||||
Sdmmc3 = 0x40000017,
|
||||
Sdmmc4 = 0x40000018,
|
||||
Owr = 0x40000019,
|
||||
Csite = 0x4000001A,
|
||||
Tsec = 0x4000001B,
|
||||
Mselect = 0x4000001C,
|
||||
Hda2codec2x = 0x4000001D,
|
||||
Actmon = 0x4000001E,
|
||||
I2cSlow = 0x4000001F,
|
||||
Sor1 = 0x40000020,
|
||||
Sata = 0x40000021,
|
||||
Hda = 0x40000022,
|
||||
XusbCoreHostSrc = 0x40000023,
|
||||
XusbFalconSrc = 0x40000024,
|
||||
XusbFsSrc = 0x40000025,
|
||||
XusbCoreDevSrc = 0x40000026,
|
||||
XusbSsSrc = 0x40000027,
|
||||
UartA = 0x03000001,
|
||||
UartB = 0x35000405,
|
||||
UartC = 0x3500040F,
|
||||
UartD = 0x37000001,
|
||||
Host1x = 0x4000002C,
|
||||
Entropy = 0x4000002D,
|
||||
SocTherm = 0x4000002E,
|
||||
Vic = 0x4000002F,
|
||||
Nvenc = 0x40000030,
|
||||
Nvjpg = 0x40000031,
|
||||
Nvdec = 0x40000032,
|
||||
Qspi = 0x40000033,
|
||||
ViI2c = 0x40000034,
|
||||
Tsecb = 0x40000035,
|
||||
Ape = 0x40000036,
|
||||
AudioDsp = 0x40000037,
|
||||
AudioUart = 0x40000038,
|
||||
Emc = 0x40000039,
|
||||
Plle = 0x4000003A,
|
||||
PlleHwSeq = 0x4000003B,
|
||||
Dsi = 0x4000003C,
|
||||
Maud = 0x4000003D,
|
||||
Dpaux1 = 0x4000003E,
|
||||
MipiCal = 0x4000003F,
|
||||
UartFstMipiCal = 0x40000040,
|
||||
Osc = 0x40000041,
|
||||
SysBus = 0x40000042,
|
||||
SorSafe = 0x40000043,
|
||||
XusbSs = 0x40000044,
|
||||
XusbHost = 0x40000045,
|
||||
XusbDevice = 0x40000046,
|
||||
Extperiph1 = 0x40000047,
|
||||
Ahub = 0x40000048,
|
||||
Hda2hdmicodec = 0x40000049,
|
||||
Gpuaux = 0x4000004A,
|
||||
UsbD = 0x4000004B,
|
||||
Usb2 = 0x4000004C,
|
||||
Pcie = 0x4000004D,
|
||||
Afi = 0x4000004E,
|
||||
PciExClk = 0x4000004F,
|
||||
PExUsbPhy = 0x40000050,
|
||||
XUsbPadCtl = 0x40000051,
|
||||
Apbdma = 0x40000052,
|
||||
Usb2TrkClk = 0x40000053,
|
||||
XUsbIoPll = 0x40000054,
|
||||
XUsbIoPllHwSeq = 0x40000055,
|
||||
Cec = 0x40000056,
|
||||
Extperiph2 = 0x40000057,
|
||||
OscClk = 0x40000080
|
||||
};
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
||||
|
||||
} // namespace Service::PCV
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Loader {
|
||||
|
||||
namespace {
|
||||
constexpr u32 PageAlignSize(u32 size) {
|
||||
return static_cast<u32>((size + Core::Memory::YUZU_PAGEMASK) & ~Core::Memory::YUZU_PAGEMASK);
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& nro_file) {
|
||||
}
|
||||
|
||||
static constexpr u32 PageAlignSize(u32 size) {
|
||||
return static_cast<u32>((size + Core::Memory::YUZU_PAGEMASK) & ~Core::Memory::YUZU_PAGEMASK);
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
|
||||
static bool LoadNroImpl(Kernel::KProcess& process, const std::vector<u8>& data) {
|
||||
|
||||
@@ -45,7 +45,7 @@ std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
||||
}
|
||||
|
||||
constexpr u32 PageAlignSize(u32 size) {
|
||||
return static_cast<u32>((size + Core::Memory::YUZU_PAGEMASK) & ~Core::Memory::YUZU_PAGEMASK);
|
||||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
||||
@@ -36,11 +36,10 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
void MapMemoryRegion(Common::PageTable& page_table, VAddr base, u64 size, PAddr target) {
|
||||
ASSERT_MSG((size & YUZU_PAGEMASK) == 0, "non-page aligned size: {:016X}", size);
|
||||
ASSERT_MSG((base & YUZU_PAGEMASK) == 0, "non-page aligned base: {:016X}", base);
|
||||
ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
|
||||
ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
|
||||
ASSERT_MSG(target >= DramMemoryMap::Base, "Out of bounds target: {:016X}", target);
|
||||
MapPages(page_table, base / YUZU_PAGESIZE, size / YUZU_PAGESIZE, target,
|
||||
Common::PageType::Memory);
|
||||
MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, Common::PageType::Memory);
|
||||
|
||||
if (Settings::IsFastmemEnabled()) {
|
||||
system.DeviceMemory().buffer.Map(base, target - DramMemoryMap::Base, size);
|
||||
@@ -48,10 +47,9 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
void UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) {
|
||||
ASSERT_MSG((size & YUZU_PAGEMASK) == 0, "non-page aligned size: {:016X}", size);
|
||||
ASSERT_MSG((base & YUZU_PAGEMASK) == 0, "non-page aligned base: {:016X}", base);
|
||||
MapPages(page_table, base / YUZU_PAGESIZE, size / YUZU_PAGESIZE, 0,
|
||||
Common::PageType::Unmapped);
|
||||
ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
|
||||
ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
|
||||
MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, 0, Common::PageType::Unmapped);
|
||||
|
||||
if (Settings::IsFastmemEnabled()) {
|
||||
system.DeviceMemory().buffer.Unmap(base, size);
|
||||
@@ -59,7 +57,7 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
[[nodiscard]] u8* GetPointerFromRasterizerCachedMemory(VAddr vaddr) const {
|
||||
const PAddr paddr{current_page_table->backing_addr[vaddr >> YUZU_PAGEBITS]};
|
||||
const PAddr paddr{current_page_table->backing_addr[vaddr >> PAGE_BITS]};
|
||||
|
||||
if (!paddr) {
|
||||
return {};
|
||||
@@ -69,7 +67,7 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
[[nodiscard]] u8* GetPointerFromDebugMemory(VAddr vaddr) const {
|
||||
const PAddr paddr{current_page_table->backing_addr[vaddr >> YUZU_PAGEBITS]};
|
||||
const PAddr paddr{current_page_table->backing_addr[vaddr >> PAGE_BITS]};
|
||||
|
||||
if (paddr == 0) {
|
||||
return {};
|
||||
@@ -178,14 +176,13 @@ struct Memory::Impl {
|
||||
auto on_unmapped, auto on_memory, auto on_rasterizer, auto increment) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
std::size_t remaining_size = size;
|
||||
std::size_t page_index = addr >> YUZU_PAGEBITS;
|
||||
std::size_t page_offset = addr & YUZU_PAGEMASK;
|
||||
std::size_t page_index = addr >> PAGE_BITS;
|
||||
std::size_t page_offset = addr & PAGE_MASK;
|
||||
|
||||
while (remaining_size) {
|
||||
const std::size_t copy_amount =
|
||||
std::min(static_cast<std::size_t>(YUZU_PAGESIZE) - page_offset, remaining_size);
|
||||
const auto current_vaddr =
|
||||
static_cast<VAddr>((page_index << YUZU_PAGEBITS) + page_offset);
|
||||
std::min(static_cast<std::size_t>(PAGE_SIZE) - page_offset, remaining_size);
|
||||
const auto current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
|
||||
|
||||
const auto [pointer, type] = page_table.pointers[page_index].PointerType();
|
||||
switch (type) {
|
||||
@@ -195,7 +192,7 @@ struct Memory::Impl {
|
||||
}
|
||||
case Common::PageType::Memory: {
|
||||
DEBUG_ASSERT(pointer);
|
||||
u8* mem_ptr = pointer + page_offset + (page_index << YUZU_PAGEBITS);
|
||||
u8* mem_ptr = pointer + page_offset + (page_index << PAGE_BITS);
|
||||
on_memory(copy_amount, mem_ptr);
|
||||
break;
|
||||
}
|
||||
@@ -342,10 +339,10 @@ struct Memory::Impl {
|
||||
// Iterate over a contiguous CPU address space, marking/unmarking the region.
|
||||
// The region is at a granularity of CPU pages.
|
||||
|
||||
const u64 num_pages = ((vaddr + size - 1) >> YUZU_PAGEBITS) - (vaddr >> YUZU_PAGEBITS) + 1;
|
||||
for (u64 i = 0; i < num_pages; ++i, vaddr += YUZU_PAGESIZE) {
|
||||
const u64 num_pages = ((vaddr + size - 1) >> PAGE_BITS) - (vaddr >> PAGE_BITS) + 1;
|
||||
for (u64 i = 0; i < num_pages; ++i, vaddr += PAGE_SIZE) {
|
||||
const Common::PageType page_type{
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Type()};
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Type()};
|
||||
if (debug) {
|
||||
// Switch page type to debug if now debug
|
||||
switch (page_type) {
|
||||
@@ -357,7 +354,7 @@ struct Memory::Impl {
|
||||
// Page is already marked.
|
||||
break;
|
||||
case Common::PageType::Memory:
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Store(
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Store(
|
||||
nullptr, Common::PageType::DebugMemory);
|
||||
break;
|
||||
default:
|
||||
@@ -374,9 +371,9 @@ struct Memory::Impl {
|
||||
// Don't mess with already non-debug or rasterizer memory.
|
||||
break;
|
||||
case Common::PageType::DebugMemory: {
|
||||
u8* const pointer{GetPointerFromDebugMemory(vaddr & ~YUZU_PAGEMASK)};
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Store(
|
||||
pointer - (vaddr & ~YUZU_PAGEMASK), Common::PageType::Memory);
|
||||
u8* const pointer{GetPointerFromDebugMemory(vaddr & ~PAGE_MASK)};
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Store(
|
||||
pointer - (vaddr & ~PAGE_MASK), Common::PageType::Memory);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -401,10 +398,10 @@ struct Memory::Impl {
|
||||
// granularity of CPU pages, hence why we iterate on a CPU page basis (note: GPU page size
|
||||
// is different). This assumes the specified GPU address region is contiguous as well.
|
||||
|
||||
const u64 num_pages = ((vaddr + size - 1) >> YUZU_PAGEBITS) - (vaddr >> YUZU_PAGEBITS) + 1;
|
||||
for (u64 i = 0; i < num_pages; ++i, vaddr += YUZU_PAGESIZE) {
|
||||
const u64 num_pages = ((vaddr + size - 1) >> PAGE_BITS) - (vaddr >> PAGE_BITS) + 1;
|
||||
for (u64 i = 0; i < num_pages; ++i, vaddr += PAGE_SIZE) {
|
||||
const Common::PageType page_type{
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Type()};
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Type()};
|
||||
if (cached) {
|
||||
// Switch page type to cached if now cached
|
||||
switch (page_type) {
|
||||
@@ -414,7 +411,7 @@ struct Memory::Impl {
|
||||
break;
|
||||
case Common::PageType::DebugMemory:
|
||||
case Common::PageType::Memory:
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Store(
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Store(
|
||||
nullptr, Common::PageType::RasterizerCachedMemory);
|
||||
break;
|
||||
case Common::PageType::RasterizerCachedMemory:
|
||||
@@ -437,16 +434,16 @@ struct Memory::Impl {
|
||||
// that this area is already unmarked as cached.
|
||||
break;
|
||||
case Common::PageType::RasterizerCachedMemory: {
|
||||
u8* const pointer{GetPointerFromRasterizerCachedMemory(vaddr & ~YUZU_PAGEMASK)};
|
||||
u8* const pointer{GetPointerFromRasterizerCachedMemory(vaddr & ~PAGE_MASK)};
|
||||
if (pointer == nullptr) {
|
||||
// It's possible that this function has been called while updating the
|
||||
// pagetable after unmapping a VMA. In that case the underlying VMA will no
|
||||
// longer exist, and we should just leave the pagetable entry blank.
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Store(
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Store(
|
||||
nullptr, Common::PageType::Unmapped);
|
||||
} else {
|
||||
current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Store(
|
||||
pointer - (vaddr & ~YUZU_PAGEMASK), Common::PageType::Memory);
|
||||
current_page_table->pointers[vaddr >> PAGE_BITS].Store(
|
||||
pointer - (vaddr & ~PAGE_MASK), Common::PageType::Memory);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -468,8 +465,8 @@ struct Memory::Impl {
|
||||
*/
|
||||
void MapPages(Common::PageTable& page_table, VAddr base, u64 size, PAddr target,
|
||||
Common::PageType type) {
|
||||
LOG_DEBUG(HW_Memory, "Mapping {:016X} onto {:016X}-{:016X}", target, base * YUZU_PAGESIZE,
|
||||
(base + size) * YUZU_PAGESIZE);
|
||||
LOG_DEBUG(HW_Memory, "Mapping {:016X} onto {:016X}-{:016X}", target, base * PAGE_SIZE,
|
||||
(base + size) * PAGE_SIZE);
|
||||
|
||||
// During boot, current_page_table might not be set yet, in which case we need not flush
|
||||
if (system.IsPoweredOn()) {
|
||||
@@ -477,7 +474,7 @@ struct Memory::Impl {
|
||||
for (u64 i = 0; i < size; i++) {
|
||||
const auto page = base + i;
|
||||
if (page_table.pointers[page].Type() == Common::PageType::RasterizerCachedMemory) {
|
||||
gpu.FlushAndInvalidateRegion(page << YUZU_PAGEBITS, YUZU_PAGESIZE);
|
||||
gpu.FlushAndInvalidateRegion(page << PAGE_BITS, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -488,7 +485,7 @@ struct Memory::Impl {
|
||||
|
||||
if (!target) {
|
||||
ASSERT_MSG(type != Common::PageType::Memory,
|
||||
"Mapping memory page without a pointer @ {:016x}", base * YUZU_PAGESIZE);
|
||||
"Mapping memory page without a pointer @ {:016x}", base * PAGE_SIZE);
|
||||
|
||||
while (base != end) {
|
||||
page_table.pointers[base].Store(nullptr, type);
|
||||
@@ -499,14 +496,14 @@ struct Memory::Impl {
|
||||
} else {
|
||||
while (base != end) {
|
||||
page_table.pointers[base].Store(
|
||||
system.DeviceMemory().GetPointer(target) - (base << YUZU_PAGEBITS), type);
|
||||
page_table.backing_addr[base] = target - (base << YUZU_PAGEBITS);
|
||||
system.DeviceMemory().GetPointer(target) - (base << PAGE_BITS), type);
|
||||
page_table.backing_addr[base] = target - (base << PAGE_BITS);
|
||||
|
||||
ASSERT_MSG(page_table.pointers[base].Pointer(),
|
||||
"memory mapping base yield a nullptr within the table");
|
||||
|
||||
base += 1;
|
||||
target += YUZU_PAGESIZE;
|
||||
target += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -521,7 +518,7 @@ struct Memory::Impl {
|
||||
}
|
||||
|
||||
// Avoid adding any extra logic to this fast-path block
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Raw();
|
||||
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> PAGE_BITS].Raw();
|
||||
if (u8* const pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
|
||||
return &pointer[vaddr];
|
||||
}
|
||||
@@ -660,7 +657,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) {
|
||||
bool Memory::IsValidVirtualAddress(const VAddr vaddr) const {
|
||||
const Kernel::KProcess& process = *system.CurrentProcess();
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
const size_t page = vaddr >> YUZU_PAGEBITS;
|
||||
const size_t page = vaddr >> PAGE_BITS;
|
||||
if (page >= page_table.pointers.size()) {
|
||||
return false;
|
||||
}
|
||||
@@ -671,9 +668,9 @@ bool Memory::IsValidVirtualAddress(const VAddr vaddr) const {
|
||||
|
||||
bool Memory::IsValidVirtualAddressRange(VAddr base, u64 size) const {
|
||||
VAddr end = base + size;
|
||||
VAddr page = Common::AlignDown(base, YUZU_PAGESIZE);
|
||||
VAddr page = Common::AlignDown(base, PAGE_SIZE);
|
||||
|
||||
for (; page < end; page += YUZU_PAGESIZE) {
|
||||
for (; page < end; page += PAGE_SIZE) {
|
||||
if (!IsValidVirtualAddress(page)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Core::Memory {
|
||||
* Page size used by the ARM architecture. This is the smallest granularity with which memory can
|
||||
* be mapped.
|
||||
*/
|
||||
constexpr std::size_t YUZU_PAGEBITS = 12;
|
||||
constexpr u64 YUZU_PAGESIZE = 1ULL << YUZU_PAGEBITS;
|
||||
constexpr u64 YUZU_PAGEMASK = YUZU_PAGESIZE - 1;
|
||||
constexpr std::size_t PAGE_BITS = 12;
|
||||
constexpr u64 PAGE_SIZE = 1ULL << PAGE_BITS;
|
||||
constexpr u64 PAGE_MASK = PAGE_SIZE - 1;
|
||||
|
||||
/// Virtual user-space memory regions
|
||||
enum : VAddr {
|
||||
|
||||
@@ -22,9 +22,8 @@ constexpr VAddr c = 0x1328914000;
|
||||
class RasterizerInterface {
|
||||
public:
|
||||
void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
|
||||
const u64 page_start{addr >> Core::Memory::YUZU_PAGEBITS};
|
||||
const u64 page_end{(addr + size + Core::Memory::YUZU_PAGESIZE - 1) >>
|
||||
Core::Memory::YUZU_PAGEBITS};
|
||||
const u64 page_start{addr >> Core::Memory::PAGE_BITS};
|
||||
const u64 page_end{(addr + size + Core::Memory::PAGE_SIZE - 1) >> Core::Memory::PAGE_BITS};
|
||||
for (u64 page = page_start; page < page_end; ++page) {
|
||||
int& value = page_table[page];
|
||||
value += delta;
|
||||
@@ -38,7 +37,7 @@ public:
|
||||
}
|
||||
|
||||
[[nodiscard]] int Count(VAddr addr) const noexcept {
|
||||
const auto it = page_table.find(addr >> Core::Memory::YUZU_PAGEBITS);
|
||||
const auto it = page_table.find(addr >> Core::Memory::PAGE_BITS);
|
||||
return it == page_table.end() ? 0 : it->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ struct NullBufferParams {};
|
||||
template <class RasterizerInterface>
|
||||
class BufferBase {
|
||||
static constexpr u64 PAGES_PER_WORD = 64;
|
||||
static constexpr u64 BYTES_PER_PAGE = Core::Memory::YUZU_PAGESIZE;
|
||||
static constexpr u64 BYTES_PER_PAGE = Core::Memory::PAGE_SIZE;
|
||||
static constexpr u64 BYTES_PER_WORD = PAGES_PER_WORD * BYTES_PER_PAGE;
|
||||
|
||||
/// Vector tracking modified pages tightly packed with small vector optimization
|
||||
|
||||
@@ -60,8 +60,8 @@ class BufferCache {
|
||||
|
||||
// Page size for caching purposes.
|
||||
// This is unrelated to the CPU page size and it can be changed as it seems optimal.
|
||||
static constexpr u32 YUZU_PAGEBITS = 16;
|
||||
static constexpr u64 YUZU_PAGESIZE = u64{1} << YUZU_PAGEBITS;
|
||||
static constexpr u32 PAGE_BITS = 16;
|
||||
static constexpr u64 PAGE_SIZE = u64{1} << PAGE_BITS;
|
||||
|
||||
static constexpr bool IS_OPENGL = P::IS_OPENGL;
|
||||
static constexpr bool HAS_PERSISTENT_UNIFORM_BUFFER_BINDINGS =
|
||||
@@ -216,8 +216,8 @@ private:
|
||||
|
||||
template <typename Func>
|
||||
void ForEachBufferInRange(VAddr cpu_addr, u64 size, Func&& func) {
|
||||
const u64 page_end = Common::DivCeil(cpu_addr + size, YUZU_PAGESIZE);
|
||||
for (u64 page = cpu_addr >> YUZU_PAGEBITS; page < page_end;) {
|
||||
const u64 page_end = Common::DivCeil(cpu_addr + size, PAGE_SIZE);
|
||||
for (u64 page = cpu_addr >> PAGE_BITS; page < page_end;) {
|
||||
const BufferId buffer_id = page_table[page];
|
||||
if (!buffer_id) {
|
||||
++page;
|
||||
@@ -227,7 +227,7 @@ private:
|
||||
func(buffer_id, buffer);
|
||||
|
||||
const VAddr end_addr = buffer.CpuAddr() + buffer.SizeBytes();
|
||||
page = Common::DivCeil(end_addr, YUZU_PAGESIZE);
|
||||
page = Common::DivCeil(end_addr, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,8 +262,8 @@ private:
|
||||
}
|
||||
|
||||
static bool IsRangeGranular(VAddr cpu_addr, size_t size) {
|
||||
return (cpu_addr & ~Core::Memory::YUZU_PAGEMASK) ==
|
||||
((cpu_addr + size) & ~Core::Memory::YUZU_PAGEMASK);
|
||||
return (cpu_addr & ~Core::Memory::PAGE_MASK) ==
|
||||
((cpu_addr + size) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
|
||||
void RunGarbageCollector();
|
||||
@@ -439,7 +439,7 @@ private:
|
||||
u64 minimum_memory = 0;
|
||||
u64 critical_memory = 0;
|
||||
|
||||
std::array<BufferId, ((1ULL << 39) >> YUZU_PAGEBITS)> page_table;
|
||||
std::array<BufferId, ((1ULL << 39) >> PAGE_BITS)> page_table;
|
||||
};
|
||||
|
||||
template <class P>
|
||||
@@ -926,8 +926,8 @@ void BufferCache<P>::PopAsyncFlushes() {}
|
||||
|
||||
template <class P>
|
||||
bool BufferCache<P>::IsRegionGpuModified(VAddr addr, size_t size) {
|
||||
const u64 page_end = Common::DivCeil(addr + size, YUZU_PAGESIZE);
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page < page_end;) {
|
||||
const u64 page_end = Common::DivCeil(addr + size, PAGE_SIZE);
|
||||
for (u64 page = addr >> PAGE_BITS; page < page_end;) {
|
||||
const BufferId image_id = page_table[page];
|
||||
if (!image_id) {
|
||||
++page;
|
||||
@@ -938,7 +938,7 @@ bool BufferCache<P>::IsRegionGpuModified(VAddr addr, size_t size) {
|
||||
return true;
|
||||
}
|
||||
const VAddr end_addr = buffer.CpuAddr() + buffer.SizeBytes();
|
||||
page = Common::DivCeil(end_addr, YUZU_PAGESIZE);
|
||||
page = Common::DivCeil(end_addr, PAGE_SIZE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -946,8 +946,8 @@ bool BufferCache<P>::IsRegionGpuModified(VAddr addr, size_t size) {
|
||||
template <class P>
|
||||
bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) {
|
||||
const VAddr end_addr = addr + size;
|
||||
const u64 page_end = Common::DivCeil(end_addr, YUZU_PAGESIZE);
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page < page_end;) {
|
||||
const u64 page_end = Common::DivCeil(end_addr, PAGE_SIZE);
|
||||
for (u64 page = addr >> PAGE_BITS; page < page_end;) {
|
||||
const BufferId buffer_id = page_table[page];
|
||||
if (!buffer_id) {
|
||||
++page;
|
||||
@@ -959,15 +959,15 @@ bool BufferCache<P>::IsRegionRegistered(VAddr addr, size_t size) {
|
||||
if (buf_start_addr < end_addr && addr < buf_end_addr) {
|
||||
return true;
|
||||
}
|
||||
page = Common::DivCeil(end_addr, YUZU_PAGESIZE);
|
||||
page = Common::DivCeil(end_addr, PAGE_SIZE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class P>
|
||||
bool BufferCache<P>::IsRegionCpuModified(VAddr addr, size_t size) {
|
||||
const u64 page_end = Common::DivCeil(addr + size, YUZU_PAGESIZE);
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page < page_end;) {
|
||||
const u64 page_end = Common::DivCeil(addr + size, PAGE_SIZE);
|
||||
for (u64 page = addr >> PAGE_BITS; page < page_end;) {
|
||||
const BufferId image_id = page_table[page];
|
||||
if (!image_id) {
|
||||
++page;
|
||||
@@ -978,7 +978,7 @@ bool BufferCache<P>::IsRegionCpuModified(VAddr addr, size_t size) {
|
||||
return true;
|
||||
}
|
||||
const VAddr end_addr = buffer.CpuAddr() + buffer.SizeBytes();
|
||||
page = Common::DivCeil(end_addr, YUZU_PAGESIZE);
|
||||
page = Common::DivCeil(end_addr, PAGE_SIZE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1472,7 +1472,7 @@ BufferId BufferCache<P>::FindBuffer(VAddr cpu_addr, u32 size) {
|
||||
if (cpu_addr == 0) {
|
||||
return NULL_BUFFER_ID;
|
||||
}
|
||||
const u64 page = cpu_addr >> YUZU_PAGEBITS;
|
||||
const u64 page = cpu_addr >> PAGE_BITS;
|
||||
const BufferId buffer_id = page_table[page];
|
||||
if (!buffer_id) {
|
||||
return CreateBuffer(cpu_addr, size);
|
||||
@@ -1493,9 +1493,8 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
|
||||
VAddr end = cpu_addr + wanted_size;
|
||||
int stream_score = 0;
|
||||
bool has_stream_leap = false;
|
||||
for (; cpu_addr >> YUZU_PAGEBITS < Common::DivCeil(end, YUZU_PAGESIZE);
|
||||
cpu_addr += YUZU_PAGESIZE) {
|
||||
const BufferId overlap_id = page_table[cpu_addr >> YUZU_PAGEBITS];
|
||||
for (; cpu_addr >> PAGE_BITS < Common::DivCeil(end, PAGE_SIZE); cpu_addr += PAGE_SIZE) {
|
||||
const BufferId overlap_id = page_table[cpu_addr >> PAGE_BITS];
|
||||
if (!overlap_id) {
|
||||
continue;
|
||||
}
|
||||
@@ -1521,11 +1520,11 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
|
||||
// as a stream buffer. Increase the size to skip constantly recreating buffers.
|
||||
has_stream_leap = true;
|
||||
if (expands_right) {
|
||||
begin -= YUZU_PAGESIZE * 256;
|
||||
begin -= PAGE_SIZE * 256;
|
||||
cpu_addr = begin;
|
||||
}
|
||||
if (expands_left) {
|
||||
end += YUZU_PAGESIZE * 256;
|
||||
end += PAGE_SIZE * 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1599,8 +1598,8 @@ void BufferCache<P>::ChangeRegister(BufferId buffer_id) {
|
||||
}
|
||||
const VAddr cpu_addr_begin = buffer.CpuAddr();
|
||||
const VAddr cpu_addr_end = cpu_addr_begin + size;
|
||||
const u64 page_begin = cpu_addr_begin / YUZU_PAGESIZE;
|
||||
const u64 page_end = Common::DivCeil(cpu_addr_end, YUZU_PAGESIZE);
|
||||
const u64 page_begin = cpu_addr_begin / PAGE_SIZE;
|
||||
const u64 page_end = Common::DivCeil(cpu_addr_end, PAGE_SIZE);
|
||||
for (u64 page = page_begin; page != page_end; ++page) {
|
||||
if constexpr (insert) {
|
||||
page_table[page] = buffer_id;
|
||||
|
||||
@@ -369,8 +369,8 @@ bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const {
|
||||
if (!cpu_addr) {
|
||||
return false;
|
||||
}
|
||||
const std::size_t page{(*cpu_addr & Core::Memory::YUZU_PAGEMASK) + size};
|
||||
return page <= Core::Memory::YUZU_PAGESIZE;
|
||||
const std::size_t page{(*cpu_addr & Core::Memory::PAGE_MASK) + size};
|
||||
return page <= Core::Memory::PAGE_SIZE;
|
||||
}
|
||||
|
||||
bool MemoryManager::IsContinousRange(GPUVAddr gpu_addr, std::size_t size) const {
|
||||
|
||||
@@ -214,8 +214,8 @@ private:
|
||||
return cache_begin < addr_end && addr_begin < cache_end;
|
||||
};
|
||||
|
||||
const u64 page_end = addr_end >> YUZU_PAGEBITS;
|
||||
for (u64 page = addr_begin >> YUZU_PAGEBITS; page <= page_end; ++page) {
|
||||
const u64 page_end = addr_end >> PAGE_BITS;
|
||||
for (u64 page = addr_begin >> PAGE_BITS; page <= page_end; ++page) {
|
||||
const auto& it = cached_queries.find(page);
|
||||
if (it == std::end(cached_queries)) {
|
||||
continue;
|
||||
@@ -235,14 +235,14 @@ private:
|
||||
/// Registers the passed parameters as cached and returns a pointer to the stored cached query.
|
||||
CachedQuery* Register(VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr, bool timestamp) {
|
||||
rasterizer.UpdatePagesCachedCount(cpu_addr, CachedQuery::SizeInBytes(timestamp), 1);
|
||||
const u64 page = static_cast<u64>(cpu_addr) >> YUZU_PAGEBITS;
|
||||
const u64 page = static_cast<u64>(cpu_addr) >> PAGE_BITS;
|
||||
return &cached_queries[page].emplace_back(static_cast<QueryCache&>(*this), type, cpu_addr,
|
||||
host_ptr);
|
||||
}
|
||||
|
||||
/// Tries to a get a cached query. Returns nullptr on failure.
|
||||
CachedQuery* TryGet(VAddr addr) {
|
||||
const u64 page = static_cast<u64>(addr) >> YUZU_PAGEBITS;
|
||||
const u64 page = static_cast<u64>(addr) >> PAGE_BITS;
|
||||
const auto it = cached_queries.find(page);
|
||||
if (it == std::end(cached_queries)) {
|
||||
return nullptr;
|
||||
@@ -260,8 +260,8 @@ private:
|
||||
uncommitted_flushes->push_back(addr);
|
||||
}
|
||||
|
||||
static constexpr std::uintptr_t YUZU_PAGESIZE = 4096;
|
||||
static constexpr unsigned YUZU_PAGEBITS = 12;
|
||||
static constexpr std::uintptr_t PAGE_SIZE = 4096;
|
||||
static constexpr unsigned PAGE_BITS = 12;
|
||||
|
||||
VideoCore::RasterizerInterface& rasterizer;
|
||||
Tegra::Engines::Maxwell3D& maxwell3d;
|
||||
|
||||
@@ -24,8 +24,8 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del
|
||||
u64 cache_bytes = 0;
|
||||
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
const u64 page_end = Common::DivCeil(addr + size, YUZU_PAGESIZE);
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page != page_end; ++page) {
|
||||
const u64 page_end = Common::DivCeil(addr + size, PAGE_SIZE);
|
||||
for (u64 page = addr >> PAGE_BITS; page != page_end; ++page) {
|
||||
std::atomic_uint16_t& count = cached_pages.at(page >> 2).Count(page);
|
||||
|
||||
if (delta > 0) {
|
||||
@@ -44,27 +44,26 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del
|
||||
if (uncache_bytes == 0) {
|
||||
uncache_begin = page;
|
||||
}
|
||||
uncache_bytes += YUZU_PAGESIZE;
|
||||
uncache_bytes += PAGE_SIZE;
|
||||
} else if (uncache_bytes > 0) {
|
||||
cpu_memory.RasterizerMarkRegionCached(uncache_begin << YUZU_PAGEBITS, uncache_bytes,
|
||||
false);
|
||||
cpu_memory.RasterizerMarkRegionCached(uncache_begin << PAGE_BITS, uncache_bytes, false);
|
||||
uncache_bytes = 0;
|
||||
}
|
||||
if (count.load(std::memory_order::relaxed) == 1 && delta > 0) {
|
||||
if (cache_bytes == 0) {
|
||||
cache_begin = page;
|
||||
}
|
||||
cache_bytes += YUZU_PAGESIZE;
|
||||
cache_bytes += PAGE_SIZE;
|
||||
} else if (cache_bytes > 0) {
|
||||
cpu_memory.RasterizerMarkRegionCached(cache_begin << YUZU_PAGEBITS, cache_bytes, true);
|
||||
cpu_memory.RasterizerMarkRegionCached(cache_begin << PAGE_BITS, cache_bytes, true);
|
||||
cache_bytes = 0;
|
||||
}
|
||||
}
|
||||
if (uncache_bytes > 0) {
|
||||
cpu_memory.RasterizerMarkRegionCached(uncache_begin << YUZU_PAGEBITS, uncache_bytes, false);
|
||||
cpu_memory.RasterizerMarkRegionCached(uncache_begin << PAGE_BITS, uncache_bytes, false);
|
||||
}
|
||||
if (cache_bytes > 0) {
|
||||
cpu_memory.RasterizerMarkRegionCached(cache_begin << YUZU_PAGEBITS, cache_bytes, true);
|
||||
cpu_memory.RasterizerMarkRegionCached(cache_begin << PAGE_BITS, cache_bytes, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -478,16 +478,13 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_MSG(framebuffer_crop_rect.top == 0, "Unimplemented");
|
||||
ASSERT_MSG(framebuffer_crop_rect.left == 0, "Unimplemented");
|
||||
|
||||
f32 left_start{};
|
||||
if (framebuffer_crop_rect.Top() > 0) {
|
||||
left_start = static_cast<f32>(framebuffer_crop_rect.Top()) /
|
||||
static_cast<f32>(framebuffer_crop_rect.Bottom());
|
||||
}
|
||||
f32 scale_u = static_cast<f32>(framebuffer_width) / static_cast<f32>(screen_info.texture.width);
|
||||
f32 scale_v =
|
||||
static_cast<f32>(framebuffer_height) / static_cast<f32>(screen_info.texture.height);
|
||||
|
||||
// Scale the output by the crop width/height. This is commonly used with 1280x720 rendering
|
||||
// (e.g. handheld mode) on a 1920x1080 framebuffer.
|
||||
if (framebuffer_crop_rect.GetWidth() > 0) {
|
||||
@@ -506,14 +503,10 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
||||
|
||||
const auto& screen = layout.screen;
|
||||
const std::array vertices = {
|
||||
ScreenRectVertex(screen.left, screen.top, texcoords.top * scale_u,
|
||||
left_start + left * scale_v),
|
||||
ScreenRectVertex(screen.right, screen.top, texcoords.bottom * scale_u,
|
||||
left_start + left * scale_v),
|
||||
ScreenRectVertex(screen.left, screen.bottom, texcoords.top * scale_u,
|
||||
left_start + right * scale_v),
|
||||
ScreenRectVertex(screen.right, screen.bottom, texcoords.bottom * scale_u,
|
||||
left_start + right * scale_v),
|
||||
ScreenRectVertex(screen.left, screen.top, texcoords.top * scale_u, left * scale_v),
|
||||
ScreenRectVertex(screen.right, screen.top, texcoords.bottom * scale_u, left * scale_v),
|
||||
ScreenRectVertex(screen.left, screen.bottom, texcoords.top * scale_u, right * scale_v),
|
||||
ScreenRectVertex(screen.right, screen.bottom, texcoords.bottom * scale_u, right * scale_v),
|
||||
};
|
||||
glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), std::data(vertices));
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ struct FormatTuple {
|
||||
{VK_FORMAT_R8G8_SINT, Attachable | Storage}, // R8G8_SINT
|
||||
{VK_FORMAT_R8G8_UINT, Attachable | Storage}, // R8G8_UINT
|
||||
{VK_FORMAT_R32G32_UINT, Attachable | Storage}, // R32G32_UINT
|
||||
{VK_FORMAT_R16G16B16A16_SFLOAT, Attachable | Storage}, // R16G16B16X16_FLOAT
|
||||
{VK_FORMAT_UNDEFINED}, // R16G16B16X16_FLOAT
|
||||
{VK_FORMAT_R32_UINT, Attachable | Storage}, // R32_UINT
|
||||
{VK_FORMAT_R32_SINT, Attachable | Storage}, // R32_SINT
|
||||
{VK_FORMAT_ASTC_8x8_UNORM_BLOCK}, // ASTC_2D_8X8_UNORM
|
||||
|
||||
@@ -1402,15 +1402,12 @@ void BlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig&
|
||||
break;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED_IF(framebuffer_crop_rect.top != 0);
|
||||
UNIMPLEMENTED_IF(framebuffer_crop_rect.left != 0);
|
||||
|
||||
f32 left_start{};
|
||||
if (framebuffer_crop_rect.Top() > 0) {
|
||||
left_start = static_cast<f32>(framebuffer_crop_rect.Top()) /
|
||||
static_cast<f32>(framebuffer_crop_rect.Bottom());
|
||||
}
|
||||
f32 scale_u = static_cast<f32>(framebuffer.width) / static_cast<f32>(screen_info.width);
|
||||
f32 scale_v = static_cast<f32>(framebuffer.height) / static_cast<f32>(screen_info.height);
|
||||
|
||||
// Scale the output by the crop width/height. This is commonly used with 1280x720 rendering
|
||||
// (e.g. handheld mode) on a 1920x1080 framebuffer.
|
||||
if (!fsr) {
|
||||
@@ -1429,13 +1426,10 @@ void BlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfig&
|
||||
const auto y = static_cast<f32>(screen.top);
|
||||
const auto w = static_cast<f32>(screen.GetWidth());
|
||||
const auto h = static_cast<f32>(screen.GetHeight());
|
||||
data.vertices[0] = ScreenRectVertex(x, y, texcoords.top * scale_u, left_start + left * scale_v);
|
||||
data.vertices[1] =
|
||||
ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left_start + left * scale_v);
|
||||
data.vertices[2] =
|
||||
ScreenRectVertex(x, y + h, texcoords.top * scale_u, left_start + right * scale_v);
|
||||
data.vertices[3] =
|
||||
ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, left_start + right * scale_v);
|
||||
data.vertices[0] = ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v);
|
||||
data.vertices[1] = ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v);
|
||||
data.vertices[2] = ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v);
|
||||
data.vertices[3] = ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v);
|
||||
}
|
||||
|
||||
void BlitScreen::CreateFSR() {
|
||||
|
||||
@@ -69,17 +69,10 @@ VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t in
|
||||
const float width = conv(src.scale_x * 2.0f);
|
||||
float y = conv(src.translate_y - src.scale_y);
|
||||
float height = conv(src.scale_y * 2.0f);
|
||||
bool y_negate = regs.screen_y_control.y_negate;
|
||||
|
||||
if (!device.IsNvViewportSwizzleSupported()) {
|
||||
y_negate = y_negate != (src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY);
|
||||
}
|
||||
|
||||
if (y_negate) {
|
||||
if (regs.screen_y_control.y_negate) {
|
||||
y += height;
|
||||
height = -height;
|
||||
}
|
||||
|
||||
const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f;
|
||||
VkViewport viewport{
|
||||
.x = x,
|
||||
|
||||
@@ -123,8 +123,8 @@ void ShaderCache::Register(std::unique_ptr<ShaderInfo> data, VAddr addr, size_t
|
||||
const VAddr addr_end = addr + size;
|
||||
Entry* const entry = NewEntry(addr, addr_end, data.get());
|
||||
|
||||
const u64 page_end = (addr_end + YUZU_PAGESIZE - 1) >> YUZU_PAGEBITS;
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page < page_end; ++page) {
|
||||
const u64 page_end = (addr_end + PAGE_SIZE - 1) >> PAGE_BITS;
|
||||
for (u64 page = addr >> PAGE_BITS; page < page_end; ++page) {
|
||||
invalidation_cache[page].push_back(entry);
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ void ShaderCache::Register(std::unique_ptr<ShaderInfo> data, VAddr addr, size_t
|
||||
|
||||
void ShaderCache::InvalidatePagesInRegion(VAddr addr, size_t size) {
|
||||
const VAddr addr_end = addr + size;
|
||||
const u64 page_end = (addr_end + YUZU_PAGESIZE - 1) >> YUZU_PAGEBITS;
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page < page_end; ++page) {
|
||||
const u64 page_end = (addr_end + PAGE_SIZE - 1) >> PAGE_BITS;
|
||||
for (u64 page = addr >> PAGE_BITS; page < page_end; ++page) {
|
||||
auto it = invalidation_cache.find(page);
|
||||
if (it == invalidation_cache.end()) {
|
||||
continue;
|
||||
@@ -189,8 +189,8 @@ void ShaderCache::InvalidatePageEntries(std::vector<Entry*>& entries, VAddr addr
|
||||
}
|
||||
|
||||
void ShaderCache::RemoveEntryFromInvalidationCache(const Entry* entry) {
|
||||
const u64 page_end = (entry->addr_end + YUZU_PAGESIZE - 1) >> YUZU_PAGEBITS;
|
||||
for (u64 page = entry->addr_start >> YUZU_PAGEBITS; page < page_end; ++page) {
|
||||
const u64 page_end = (entry->addr_end + PAGE_SIZE - 1) >> PAGE_BITS;
|
||||
for (u64 page = entry->addr_start >> PAGE_BITS; page < page_end; ++page) {
|
||||
const auto entries_it = invalidation_cache.find(page);
|
||||
ASSERT(entries_it != invalidation_cache.end());
|
||||
std::vector<Entry*>& entries = entries_it->second;
|
||||
|
||||
@@ -29,8 +29,8 @@ struct ShaderInfo {
|
||||
};
|
||||
|
||||
class ShaderCache {
|
||||
static constexpr u64 YUZU_PAGEBITS = 14;
|
||||
static constexpr u64 YUZU_PAGESIZE = u64(1) << YUZU_PAGEBITS;
|
||||
static constexpr u64 PAGE_BITS = 14;
|
||||
static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;
|
||||
|
||||
static constexpr size_t NUM_PROGRAMS = 6;
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ void TextureCache<P>::BlitImage(const Tegra::Engines::Fermi2D::Surface& dst,
|
||||
template <class P>
|
||||
typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_addr) {
|
||||
// TODO: Properly implement this
|
||||
const auto it = page_table.find(cpu_addr >> YUZU_PAGEBITS);
|
||||
const auto it = page_table.find(cpu_addr >> PAGE_BITS);
|
||||
if (it == page_table.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1485,14 +1485,14 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
||||
std::unordered_map<u64, std::vector<ImageId>, IdentityHash<u64>>& selected_page_table) {
|
||||
const auto page_it = selected_page_table.find(page);
|
||||
if (page_it == selected_page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageId>& image_ids = page_it->second;
|
||||
const auto vector_it = std::ranges::find(image_ids, image_id);
|
||||
if (vector_it == image_ids.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}",
|
||||
page << YUZU_PAGEBITS);
|
||||
page << PAGE_BITS);
|
||||
return;
|
||||
}
|
||||
image_ids.erase(vector_it);
|
||||
@@ -1504,14 +1504,14 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
||||
ForEachCPUPage(image.cpu_addr, image.guest_size_bytes, [this, map_id](u64 page) {
|
||||
const auto page_it = page_table.find(page);
|
||||
if (page_it == page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageMapId>& image_map_ids = page_it->second;
|
||||
const auto vector_it = std::ranges::find(image_map_ids, map_id);
|
||||
if (vector_it == image_map_ids.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}",
|
||||
page << YUZU_PAGEBITS);
|
||||
page << PAGE_BITS);
|
||||
return;
|
||||
}
|
||||
image_map_ids.erase(vector_it);
|
||||
@@ -1532,7 +1532,7 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
||||
ForEachCPUPage(cpu_addr, size, [this, image_id](u64 page) {
|
||||
const auto page_it = page_table.find(page);
|
||||
if (page_it == page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageMapId>& image_map_ids = page_it->second;
|
||||
|
||||
@@ -47,7 +47,7 @@ struct ImageViewInOut {
|
||||
template <class P>
|
||||
class TextureCache {
|
||||
/// Address shift for caching images into a hash table
|
||||
static constexpr u64 YUZU_PAGEBITS = 20;
|
||||
static constexpr u64 PAGE_BITS = 20;
|
||||
|
||||
/// Enables debugging features to the texture cache
|
||||
static constexpr bool ENABLE_VALIDATION = P::ENABLE_VALIDATION;
|
||||
@@ -178,8 +178,8 @@ private:
|
||||
template <typename Func>
|
||||
static void ForEachCPUPage(VAddr addr, size_t size, Func&& func) {
|
||||
static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>;
|
||||
const u64 page_end = (addr + size - 1) >> YUZU_PAGEBITS;
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page <= page_end; ++page) {
|
||||
const u64 page_end = (addr + size - 1) >> PAGE_BITS;
|
||||
for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) {
|
||||
if constexpr (RETURNS_BOOL) {
|
||||
if (func(page)) {
|
||||
break;
|
||||
@@ -193,8 +193,8 @@ private:
|
||||
template <typename Func>
|
||||
static void ForEachGPUPage(GPUVAddr addr, size_t size, Func&& func) {
|
||||
static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>;
|
||||
const u64 page_end = (addr + size - 1) >> YUZU_PAGEBITS;
|
||||
for (u64 page = addr >> YUZU_PAGEBITS; page <= page_end; ++page) {
|
||||
const u64 page_end = (addr + size - 1) >> PAGE_BITS;
|
||||
for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) {
|
||||
if constexpr (RETURNS_BOOL) {
|
||||
if (func(page)) {
|
||||
break;
|
||||
|
||||
@@ -815,12 +815,6 @@ void GRenderWindow::InitializeCamera() {
|
||||
if (Settings::values.ir_sensor_device.GetValue() == cameraInfo.deviceName().toStdString() ||
|
||||
Settings::values.ir_sensor_device.GetValue() == "Auto") {
|
||||
camera = std::make_unique<QCamera>(cameraInfo);
|
||||
if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
|
||||
!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
|
||||
LOG_ERROR(Frontend,
|
||||
"Camera doesn't support CaptureViewfinder or CaptureStillImage");
|
||||
continue;
|
||||
}
|
||||
camera_found = true;
|
||||
break;
|
||||
}
|
||||
@@ -831,22 +825,10 @@ void GRenderWindow::InitializeCamera() {
|
||||
}
|
||||
|
||||
camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
|
||||
|
||||
if (!camera_capture->isCaptureDestinationSupported(
|
||||
QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
|
||||
LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
|
||||
connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
|
||||
&GRenderWindow::OnCameraCapture);
|
||||
camera->unload();
|
||||
if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
|
||||
camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
} else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
|
||||
camera->setCaptureMode(QCamera::CaptureStillImage);
|
||||
}
|
||||
camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
camera->load();
|
||||
camera->start();
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@ void ConfigureCamera::PreviewCamera() {
|
||||
LOG_INFO(Frontend, "Selected Camera {} {}", cameraInfo.description().toStdString(),
|
||||
cameraInfo.deviceName().toStdString());
|
||||
camera = std::make_unique<QCamera>(cameraInfo);
|
||||
if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
|
||||
!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
|
||||
LOG_ERROR(Frontend,
|
||||
"Camera doesn't support CaptureViewfinder or CaptureStillImage");
|
||||
continue;
|
||||
}
|
||||
camera_found = true;
|
||||
break;
|
||||
}
|
||||
@@ -63,22 +57,10 @@ void ConfigureCamera::PreviewCamera() {
|
||||
}
|
||||
|
||||
camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
|
||||
|
||||
if (!camera_capture->isCaptureDestinationSupported(
|
||||
QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
|
||||
LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
|
||||
connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
|
||||
&ConfigureCamera::DisplayCapturedFrame);
|
||||
camera->unload();
|
||||
if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
|
||||
camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
} else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
|
||||
camera->setCaptureMode(QCamera::CaptureStillImage);
|
||||
}
|
||||
camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
camera->load();
|
||||
camera->start();
|
||||
|
||||
|
||||
@@ -1475,7 +1475,7 @@ void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
|
||||
|
||||
void ConfigureInputPlayer::CreateProfile() {
|
||||
const auto profile_name =
|
||||
LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 30,
|
||||
LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 20,
|
||||
LimitableInputDialog::InputLimiter::Filesystem);
|
||||
|
||||
if (profile_name.isEmpty()) {
|
||||
|
||||
@@ -126,8 +126,10 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
|
||||
layout_filter = new QHBoxLayout;
|
||||
layout_filter->setContentsMargins(8, 8, 8, 8);
|
||||
label_filter = new QLabel;
|
||||
label_filter->setText(tr("Filter:"));
|
||||
edit_filter = new QLineEdit;
|
||||
edit_filter->clear();
|
||||
edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
|
||||
edit_filter->installEventFilter(key_release_eater);
|
||||
edit_filter->setClearButtonEnabled(true);
|
||||
connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::OnTextChanged);
|
||||
@@ -147,7 +149,6 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
|
||||
layout_filter->addWidget(label_filter_result);
|
||||
layout_filter->addWidget(button_filter_close);
|
||||
setLayout(layout_filter);
|
||||
RetranslateUI();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,9 +333,13 @@ GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvid
|
||||
tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));
|
||||
|
||||
item_model->insertColumns(0, COLUMN_COUNT);
|
||||
RetranslateUI();
|
||||
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
|
||||
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
|
||||
|
||||
item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons"));
|
||||
tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons);
|
||||
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
|
||||
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
|
||||
item_model->setSortRole(GameListItemPath::SortRole);
|
||||
|
||||
connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons);
|
||||
@@ -748,35 +753,6 @@ void GameList::LoadCompatibilityList() {
|
||||
}
|
||||
}
|
||||
|
||||
void GameList::changeEvent(QEvent* event) {
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
RetranslateUI();
|
||||
}
|
||||
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
||||
void GameList::RetranslateUI() {
|
||||
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
|
||||
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
|
||||
item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons"));
|
||||
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
|
||||
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
|
||||
}
|
||||
|
||||
void GameListSearchField::changeEvent(QEvent* event) {
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
RetranslateUI();
|
||||
}
|
||||
|
||||
QWidget::changeEvent(event);
|
||||
}
|
||||
|
||||
void GameListSearchField::RetranslateUI() {
|
||||
label_filter->setText(tr("Filter:"));
|
||||
edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
|
||||
}
|
||||
|
||||
QStandardItemModel* GameList::GetModel() const {
|
||||
return item_model;
|
||||
}
|
||||
|
||||
@@ -140,9 +140,6 @@ private:
|
||||
void AddPermDirPopup(QMenu& context_menu, QModelIndex selected);
|
||||
void AddFavoritesPopup(QMenu& context_menu);
|
||||
|
||||
void changeEvent(QEvent*) override;
|
||||
void RetranslateUI();
|
||||
|
||||
std::shared_ptr<FileSys::VfsFilesystem> vfs;
|
||||
FileSys::ManualContentProvider* provider;
|
||||
GameListSearchField* search_field;
|
||||
|
||||
@@ -353,9 +353,6 @@ public:
|
||||
void setFocus();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent*) override;
|
||||
void RetranslateUI();
|
||||
|
||||
class KeyReleaseEater : public QObject {
|
||||
public:
|
||||
explicit KeyReleaseEater(GameList* gamelist_, QObject* parent = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user