mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-30 19:30:17 +00:00
Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115)
This commit is contained in:
parent
90b418fd1a
commit
cbd5d1c15c
67 changed files with 6837 additions and 7475 deletions
|
@ -10,6 +10,8 @@ export CCACHE_SLOPPINESS=time_macros
|
||||||
|
|
||||||
export CC="ccache clang"
|
export CC="ccache clang"
|
||||||
export CXX="ccache clang++"
|
export CXX="ccache clang++"
|
||||||
|
export OBJC="clang"
|
||||||
|
export ASM="clang"
|
||||||
|
|
||||||
ccache -s
|
ccache -s
|
||||||
|
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
# Build directory
|
# Build directory
|
||||||
[Bb]uild/
|
[Bb]uild*/
|
||||||
doc-build/
|
doc-build/
|
||||||
build-*/
|
build-*/
|
||||||
|
|
||||||
|
|
11
.gitmodules
vendored
11
.gitmodules
vendored
|
@ -7,9 +7,9 @@
|
||||||
[submodule "soundtouch"]
|
[submodule "soundtouch"]
|
||||||
path = externals/soundtouch
|
path = externals/soundtouch
|
||||||
url = https://github.com/citra-emu/ext-soundtouch.git
|
url = https://github.com/citra-emu/ext-soundtouch.git
|
||||||
[submodule "catch"]
|
[submodule "catch2"]
|
||||||
path = externals/catch
|
path = externals/catch2
|
||||||
url = https://github.com/philsquared/Catch.git
|
url = https://github.com/catchorg/Catch2
|
||||||
[submodule "dynarmic"]
|
[submodule "dynarmic"]
|
||||||
path = externals/dynarmic
|
path = externals/dynarmic
|
||||||
url = https://github.com/citra-emu/dynarmic.git
|
url = https://github.com/citra-emu/dynarmic.git
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
url = https://github.com/libusb/libusb.git
|
url = https://github.com/libusb/libusb.git
|
||||||
[submodule "cubeb"]
|
[submodule "cubeb"]
|
||||||
path = externals/cubeb
|
path = externals/cubeb
|
||||||
url = https://github.com/kinetiknz/cubeb.git
|
url = https://github.com/mozilla/cubeb
|
||||||
[submodule "discord-rpc"]
|
[submodule "discord-rpc"]
|
||||||
path = externals/discord-rpc
|
path = externals/discord-rpc
|
||||||
url = https://github.com/discord/discord-rpc.git
|
url = https://github.com/discord/discord-rpc.git
|
||||||
|
@ -55,3 +55,6 @@
|
||||||
[submodule "libyuv"]
|
[submodule "libyuv"]
|
||||||
path = externals/libyuv
|
path = externals/libyuv
|
||||||
url = https://github.com/lemenkov/libyuv.git
|
url = https://github.com/lemenkov/libyuv.git
|
||||||
|
[submodule "sdl2"]
|
||||||
|
path = externals/sdl2/SDL
|
||||||
|
url = https://github.com/libsdl-org/SDL
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
# CMake 3.8 required for 17 to be a valid value for CXX_STANDARD
|
# CMake 3.12 required for 20 to be a valid value for CXX_STANDARD
|
||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15)
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15)
|
||||||
# Don't override the warning flags in MSVC:
|
# Don't override the warning flags in MSVC:
|
||||||
cmake_policy(SET CMP0092 NEW)
|
cmake_policy(SET CMP0092 NEW)
|
||||||
endif ()
|
# Enforce new LTO setting
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
|
||||||
include(DownloadExternals)
|
include(DownloadExternals)
|
||||||
|
@ -11,11 +14,16 @@ include(CMakeDependentOption)
|
||||||
|
|
||||||
project(citra LANGUAGES C CXX ASM)
|
project(citra LANGUAGES C CXX ASM)
|
||||||
|
|
||||||
# Set bundled sdl2/qt as dependent options.
|
if (APPLE)
|
||||||
# OFF by default, but if ENABLE_SDL2 and MSVC are true then ON
|
enable_language(OBJC)
|
||||||
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
endif()
|
||||||
CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
|
|
||||||
|
|
||||||
|
option(ENABLE_LTO "Enable link time optimization" OFF)
|
||||||
|
|
||||||
|
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
||||||
|
option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OFF)
|
||||||
|
|
||||||
|
# Set bundled qt as dependent options.
|
||||||
option(ENABLE_QT "Enable the Qt frontend" ON)
|
option(ENABLE_QT "Enable the Qt frontend" ON)
|
||||||
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
||||||
CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF)
|
CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF)
|
||||||
|
@ -57,6 +65,22 @@ if (NOT $ENV{NDK_CCACHE} EQUAL "")
|
||||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE})
|
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Check for LTO support
|
||||||
|
# =======================================================================
|
||||||
|
if (ENABLE_LTO)
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT supported OUTPUT error_msg)
|
||||||
|
|
||||||
|
if (supported)
|
||||||
|
message(STATUS "LTO enabled")
|
||||||
|
else()
|
||||||
|
message(STATUS "LTO enabled but is unavailable, disabling: ${error_msg}")
|
||||||
|
set(ENABLE_LTO OFF)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "LTO disabled")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Sanity check : Check that all submodules are present
|
# Sanity check : Check that all submodules are present
|
||||||
# =======================================================================
|
# =======================================================================
|
||||||
|
|
||||||
|
@ -134,7 +158,7 @@ message(STATUS "Target architecture: ${ARCHITECTURE}")
|
||||||
# Configure C++ standard
|
# Configure C++ standard
|
||||||
# ===========================
|
# ===========================
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# set up output paths for executable binaries
|
# set up output paths for executable binaries
|
||||||
|
@ -148,41 +172,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (ENABLE_SDL2)
|
|
||||||
if (CITRA_USE_BUNDLED_SDL2)
|
|
||||||
# Detect toolchain and platform
|
|
||||||
if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
|
|
||||||
set(SDL2_VER "SDL2-2.0.16")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable CITRA_USE_BUNDLED_SDL2 and provide your own.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (DEFINED SDL2_VER)
|
|
||||||
download_bundled_external("sdl2/" ${SDL2_VER} SDL2_PREFIX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SDL2_FOUND YES)
|
|
||||||
set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers")
|
|
||||||
set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library")
|
|
||||||
set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll")
|
|
||||||
else()
|
|
||||||
find_package(SDL2 REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (SDL2_FOUND)
|
|
||||||
# TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead
|
|
||||||
add_library(SDL2 INTERFACE)
|
|
||||||
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
|
|
||||||
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(SDL2_FOUND NO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ENABLE_QT)
|
if (ENABLE_QT)
|
||||||
if (CITRA_USE_BUNDLED_QT)
|
if (CITRA_USE_BUNDLED_QT)
|
||||||
if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
|
if (MSVC_VERSION GREATER_EQUAL 1930 AND ARCHITECTURE_x86_64)
|
||||||
set(QT_VER qt-5.10.0-msvc2017_64)
|
set(QT_VER qt-5.15.5-msvc2022_64)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
||||||
endif()
|
endif()
|
||||||
|
@ -260,7 +253,7 @@ if (APPLE)
|
||||||
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
|
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
# WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista)
|
# WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista)
|
||||||
add_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600)
|
add_definitions(-D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
|
||||||
set(PLATFORM_LIBRARIES winmm ws2_32)
|
set(PLATFORM_LIBRARIES winmm ws2_32)
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
# PSAPI is the Process Status API
|
# PSAPI is the Process Status API
|
||||||
|
@ -374,6 +367,11 @@ else()
|
||||||
add_library(Boost::serialization ALIAS boost_serialization)
|
add_library(Boost::serialization ALIAS boost_serialization)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# SDL2
|
||||||
|
if (ENABLE_SDL2 AND USE_SYSTEM_SDL2)
|
||||||
|
find_package(SDL2 REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(dist/installer)
|
add_subdirectory(dist/installer)
|
||||||
|
|
||||||
|
|
16
externals/CMakeLists.txt
vendored
16
externals/CMakeLists.txt
vendored
|
@ -23,9 +23,10 @@ target_link_libraries(boost_serialization PUBLIC boost)
|
||||||
|
|
||||||
# Add additional boost libs here; remember to ALIAS them in the root CMakeLists!
|
# Add additional boost libs here; remember to ALIAS them in the root CMakeLists!
|
||||||
|
|
||||||
# Catch
|
# Catch2
|
||||||
add_library(catch-single-include INTERFACE)
|
set(CATCH_INSTALL_DOCS OFF)
|
||||||
target_include_directories(catch-single-include INTERFACE catch/single_include)
|
set(CATCH_INSTALL_EXTRAS OFF)
|
||||||
|
add_subdirectory(catch2)
|
||||||
|
|
||||||
# Crypto++
|
# Crypto++
|
||||||
add_subdirectory(cryptopp)
|
add_subdirectory(cryptopp)
|
||||||
|
@ -47,7 +48,6 @@ endif()
|
||||||
|
|
||||||
# libfmt
|
# libfmt
|
||||||
add_subdirectory(fmt)
|
add_subdirectory(fmt)
|
||||||
add_library(fmt::fmt ALIAS fmt)
|
|
||||||
|
|
||||||
# getopt
|
# getopt
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -79,7 +79,15 @@ target_include_directories(SoundTouch INTERFACE ./soundtouch/include)
|
||||||
# Teakra
|
# Teakra
|
||||||
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
# SDL2
|
||||||
|
if (ENABLE_SDL2 AND NOT USE_SYSTEM_SDL2)
|
||||||
|
add_subdirectory(sdl2)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Zstandard
|
# Zstandard
|
||||||
|
set(ZSTD_LEGACY_SUPPORT OFF)
|
||||||
|
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||||
|
set(ZSTD_BUILD_SHARED OFF)
|
||||||
add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
|
add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
|
||||||
target_include_directories(libzstd_static INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/externals/zstd/lib>)
|
target_include_directories(libzstd_static INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/externals/zstd/lib>)
|
||||||
|
|
||||||
|
|
2
externals/boost
vendored
2
externals/boost
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 36603a1e665e849d29b1735a12c0a51284a10dd0
|
Subproject commit 66937ea62d126a92b5057e3fd9ceac7c44daf4f5
|
1
externals/catch
vendored
1
externals/catch
vendored
|
@ -1 +0,0 @@
|
||||||
Subproject commit c4e3767e265808590986d5db6ca1b5532a7f3d13
|
|
1
externals/catch2
vendored
Submodule
1
externals/catch2
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit dc001fa935d71b4b77f263fce405c9dbdfcbfe28
|
2
externals/cubeb
vendored
2
externals/cubeb
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1d66483ad2b93f0e00e175f9480c771af90003a7
|
Subproject commit dc511c6b3597b6384d28949285b9289e009830ea
|
2
externals/dynarmic
vendored
2
externals/dynarmic
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9f88f234a180a5e8d5620b4803c971fb6dc2d9f2
|
Subproject commit 460617901965ef7cd73cfbcf289fe367bf11c99e
|
2
externals/enet
vendored
2
externals/enet
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 498b9e3571c2e096d7143c3c76852c5ec28d7885
|
Subproject commit 4f8e9bdc4ce6d1f61a6274b0e557065a38190952
|
2
externals/fmt
vendored
2
externals/fmt
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit cc09f1a6798c085c325569ef466bcdcffdc266d4
|
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50
|
2
externals/inih/inih
vendored
2
externals/inih/inih
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1e80a47dffbda813604f0913e2ad68c7054c14e4
|
Subproject commit 5e1d9e2625842dddb3f9c086a50f22e4f45dfc2b
|
13855
externals/json/json.hpp
vendored
13855
externals/json/json.hpp
vendored
File diff suppressed because it is too large
Load diff
2
externals/libyuv
vendored
2
externals/libyuv
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 19d71f6b351fe992ae34b114eebd872c383a6bdb
|
Subproject commit 6900494d90ae095d44405cd4cc3f346971fa69c9
|
2
externals/lodepng/lodepng
vendored
2
externals/lodepng/lodepng
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 31d9704fdcca0b68fb9656d4764fa0fb60e460c2
|
Subproject commit 18964554bc769255401942e0e6dfd09f2fab2093
|
52
externals/sdl2/CMakeLists.txt
vendored
Normal file
52
externals/sdl2/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# Disable building the stuff we don't need.
|
||||||
|
set(SDL_DISKAUDIO OFF CACHE BOOL "")
|
||||||
|
set(SDL_OPENGL ON CACHE BOOL "")
|
||||||
|
set(SDL_OPENGLES ON CACHE BOOL "")
|
||||||
|
set(SDL_OSS OFF CACHE BOOL "")
|
||||||
|
set(SDL_ALSA OFF CACHE BOOL "")
|
||||||
|
set(SDL_JACK OFF CACHE BOOL "")
|
||||||
|
set(SDL_ESD OFF CACHE BOOL "")
|
||||||
|
set(SDL_PIPEWIRE OFF CACHE BOOL "")
|
||||||
|
set(SDL_PULSEAUDIO OFF CACHE BOOL "")
|
||||||
|
set(SDL_ARTS OFF CACHE BOOL "")
|
||||||
|
set(SDL_NAS OFF CACHE BOOL "")
|
||||||
|
set(SDL_SNDIO OFF CACHE BOOL "")
|
||||||
|
set(SDL_FUSIONSOUND OFF CACHE BOOL "")
|
||||||
|
set(SDL_LIBSAMPLERATE OFF CACHE BOOL "")
|
||||||
|
set(SDL_X11 OFF CACHE BOOL "")
|
||||||
|
set(SDL_WAYLAND OFF CACHE BOOL "")
|
||||||
|
set(SDL_RPI OFF CACHE BOOL "")
|
||||||
|
set(SDL_COCOA ON CACHE BOOL "")
|
||||||
|
set(SDL_DIRECTX OFF CACHE BOOL "")
|
||||||
|
set(SDL_WASAPI OFF CACHE BOOL "")
|
||||||
|
set(SDL_RENDER_D3D OFF CACHE BOOL "")
|
||||||
|
set(SDL_RENDER_METAL OFF CACHE BOOL "")
|
||||||
|
set(SDL_VIVANTE OFF CACHE BOOL "")
|
||||||
|
set(SDL_VULKAN OFF CACHE BOOL "")
|
||||||
|
set(SDL_METAL OFF CACHE BOOL "")
|
||||||
|
set(SDL_KMSDRM OFF CACHE BOOL "")
|
||||||
|
set(SDL_OFFSCREEN OFF CACHE BOOL "")
|
||||||
|
set(SDL_SHARED ON CACHE BOOL "")
|
||||||
|
set(SDL_STATIC OFF CACHE BOOL "")
|
||||||
|
|
||||||
|
# Subsystems
|
||||||
|
set(SDL_ATOMIC ON CACHE BOOL "")
|
||||||
|
set(SDL_AUDIO ON CACHE BOOL "")
|
||||||
|
set(SDL_VIDEO ON CACHE BOOL "")
|
||||||
|
set(SDL_RENDER OFF CACHE BOOL "")
|
||||||
|
set(SDL_EVENTS ON CACHE BOOL "")
|
||||||
|
set(SDL_JOYSTICK ON CACHE BOOL "")
|
||||||
|
set(SDL_HAPTIC OFF CACHE BOOL "")
|
||||||
|
set(SDL_HIDAPI ON CACHE BOOL "")
|
||||||
|
set(SDL_POWER OFF CACHE BOOL "")
|
||||||
|
set(SDL_THREADS ON CACHE BOOL "")
|
||||||
|
set(SDL_TIMERS ON CACHE BOOL "")
|
||||||
|
set(SDL_FILE ON CACHE BOOL "")
|
||||||
|
set(SDL_LOADSO ON CACHE BOOL "")
|
||||||
|
set(SDL_CPUINFO OFF CACHE BOOL "")
|
||||||
|
set(SDL_FILESYSTEM OFF CACHE BOOL "")
|
||||||
|
set(SDL_DLOPEN ON CACHE BOOL "")
|
||||||
|
set(SDL_SENSOR OFF CACHE BOOL "")
|
||||||
|
set(SDL_LOCALE OFF CACHE BOOL "")
|
||||||
|
|
||||||
|
add_subdirectory(SDL)
|
1
externals/sdl2/SDL
vendored
Submodule
1
externals/sdl2/SDL
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9d77945d366fb29320929254cba79c279e36e167
|
2
externals/zstd
vendored
2
externals/zstd
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 97a3da1df009d4dc67251de0c4b1c9d7fe286fc1
|
Subproject commit e47e674cd09583ff0503f0f6defd6d23d8b718d3
|
|
@ -32,23 +32,41 @@ if (MSVC)
|
||||||
# /Zc:inline - Let codegen omit inline functions in object files
|
# /Zc:inline - Let codegen omit inline functions in object files
|
||||||
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
|
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
|
||||||
# /external:* - Suppress warnings from external headers
|
# /external:* - Suppress warnings from external headers
|
||||||
add_compile_options(
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
/MP
|
# Ignore /Zc:externConstexpr /Zc:throwingNew /experimental:external when using clang-cl
|
||||||
/permissive-
|
add_compile_options(
|
||||||
/EHsc
|
/MP
|
||||||
/volatile:iso
|
/permissive-
|
||||||
/Zc:externConstexpr
|
/EHsc
|
||||||
/Zc:inline
|
/volatile:iso
|
||||||
/Zc:throwingNew
|
/Zc:inline
|
||||||
/experimental:external
|
/external:I "${CMAKE_SOURCE_DIR}/externals"
|
||||||
/external:I "${CMAKE_SOURCE_DIR}/externals"
|
/external:anglebrackets
|
||||||
/external:anglebrackets
|
/external:W0
|
||||||
/external:W0
|
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
/W3
|
/W3
|
||||||
/we4267 # 'var': conversion from 'size_t' to 'type', possible loss of data
|
/we4267 # 'var': conversion from 'size_t' to 'type', possible loss of data
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
add_compile_options(
|
||||||
|
/MP
|
||||||
|
/permissive-
|
||||||
|
/EHsc
|
||||||
|
/volatile:iso
|
||||||
|
/Zc:externConstexpr
|
||||||
|
/Zc:inline
|
||||||
|
/Zc:throwingNew
|
||||||
|
/experimental:external
|
||||||
|
/external:I "${CMAKE_SOURCE_DIR}/externals"
|
||||||
|
/external:anglebrackets
|
||||||
|
/external:W0
|
||||||
|
|
||||||
|
# Warnings
|
||||||
|
/W3
|
||||||
|
/we4267 # 'var': conversion from 'size_t' to 'type', possible loss of data
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Since MSVC's debugging information is not very deterministic, so we have to disable it
|
# Since MSVC's debugging information is not very deterministic, so we have to disable it
|
||||||
# when using ccache or other caching tools
|
# when using ccache or other caching tools
|
||||||
|
|
|
@ -31,7 +31,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO If this is ever modified, change application_id in strings.xml
|
// TODO If this is ever modified, change application_id in strings.xml
|
||||||
applicationId "org.citra.citra_emu"
|
applicationId "org.citra.citra_emu"
|
||||||
minSdkVersion 26
|
minSdkVersion 28
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode autoVersion
|
versionCode autoVersion
|
||||||
versionName getVersion()
|
versionName getVersion()
|
||||||
|
|
|
@ -29,7 +29,7 @@ add_library(audio_core STATIC
|
||||||
time_stretch.cpp
|
time_stretch.cpp
|
||||||
time_stretch.h
|
time_stretch.h
|
||||||
|
|
||||||
$<$<BOOL:${SDL2_FOUND}>:sdl2_sink.cpp sdl2_sink.h>
|
$<$<BOOL:${ENABLE_SDL2}>:sdl2_sink.cpp sdl2_sink.h>
|
||||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h cubeb_input.cpp cubeb_input.h>
|
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h cubeb_input.cpp cubeb_input.h>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ create_target_directory_groups(audio_core)
|
||||||
|
|
||||||
target_link_libraries(audio_core PUBLIC common)
|
target_link_libraries(audio_core PUBLIC common)
|
||||||
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
||||||
|
set_target_properties(audio_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if(ENABLE_MF)
|
if(ENABLE_MF)
|
||||||
target_sources(audio_core PRIVATE
|
target_sources(audio_core PRIVATE
|
||||||
|
@ -79,8 +80,8 @@ if(ANDROID)
|
||||||
target_link_libraries(audio_core PRIVATE mediandk)
|
target_link_libraries(audio_core PRIVATE mediandk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(ENABLE_SDL2)
|
||||||
target_link_libraries(audio_core PRIVATE SDL2)
|
target_link_libraries(audio_core PRIVATE SDL2::SDL2)
|
||||||
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// AAC decoder related APIs are only available with WIN7+
|
|
||||||
#define WINVER _WIN32_WINNT_WIN7
|
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
|
@ -450,7 +450,7 @@ void DspLle::SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) {
|
||||||
return;
|
return;
|
||||||
if (pipe == 0) {
|
if (pipe == 0) {
|
||||||
// pipe 0 is for debug. 3DS automatically drains this pipe and discards the data
|
// pipe 0 is for debug. 3DS automatically drains this pipe and discards the data
|
||||||
impl->ReadPipe(pipe, impl->GetPipeReadableSize(pipe));
|
impl->ReadPipe(static_cast<u8>(pipe), impl->GetPipeReadableSize(pipe));
|
||||||
} else {
|
} else {
|
||||||
std::lock_guard lock(HLE::g_hle_lock);
|
std::lock_guard lock(HLE::g_hle_lock);
|
||||||
if (auto locked = dsp.lock()) {
|
if (auto locked = dsp.lock()) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ target_link_libraries(citra PRIVATE inih glad lodepng)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(citra PRIVATE getopt)
|
target_link_libraries(citra PRIVATE getopt)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads)
|
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2::SDL2 Threads::Threads)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
|
|
@ -360,7 +360,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
|
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
|
||||||
Frontend::ScopeAcquireContext scope(*emu_window);
|
Frontend::ScopeAcquireContext scope(*emu_window);
|
||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system = Core::System::GetInstance();
|
||||||
|
|
||||||
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
|
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ int main(int argc, char** argv) {
|
||||||
std::thread render_thread([&emu_window] { emu_window->Present(); });
|
std::thread render_thread([&emu_window] { emu_window->Present(); });
|
||||||
|
|
||||||
std::atomic_bool stop_run;
|
std::atomic_bool stop_run;
|
||||||
Core::System::GetInstance().Renderer().Rasterizer()->LoadDiskResources(
|
system.Renderer().Rasterizer()->LoadDiskResources(
|
||||||
stop_run, [](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
|
stop_run, [](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
|
||||||
LOG_DEBUG(Frontend, "Loading stage {} progress {} {}", static_cast<u32>(stage), value,
|
LOG_DEBUG(Frontend, "Loading stage {} progress {} {}", static_cast<u32>(stage), value,
|
||||||
total);
|
total);
|
||||||
|
|
|
@ -66,12 +66,13 @@ void EmuThread::run() {
|
||||||
// so that the DebugModeLeft signal can be emitted before the
|
// so that the DebugModeLeft signal can be emitted before the
|
||||||
// next execution step.
|
// next execution step.
|
||||||
bool was_active = false;
|
bool was_active = false;
|
||||||
|
Core::System& system = Core::System::GetInstance();
|
||||||
while (!stop_run) {
|
while (!stop_run) {
|
||||||
if (running) {
|
if (running) {
|
||||||
if (!was_active)
|
if (!was_active)
|
||||||
emit DebugModeLeft();
|
emit DebugModeLeft();
|
||||||
|
|
||||||
Core::System::ResultStatus result = Core::System::GetInstance().RunLoop();
|
const Core::System::ResultStatus result = system.RunLoop();
|
||||||
if (result == Core::System::ResultStatus::ShutdownRequested) {
|
if (result == Core::System::ResultStatus::ShutdownRequested) {
|
||||||
// Notify frontend we shutdown
|
// Notify frontend we shutdown
|
||||||
emit ErrorThrown(result, "");
|
emit ErrorThrown(result, "");
|
||||||
|
@ -91,7 +92,7 @@ void EmuThread::run() {
|
||||||
emit DebugModeLeft();
|
emit DebugModeLeft();
|
||||||
|
|
||||||
exec_step = false;
|
exec_step = false;
|
||||||
Core::System::GetInstance().SingleStep();
|
[[maybe_unused]] const Core::System::ResultStatus result = system.SingleStep();
|
||||||
emit DebugModeEntered();
|
emit DebugModeEntered();
|
||||||
yieldCurrentThread();
|
yieldCurrentThread();
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ void EmuThread::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown the core emulation
|
// Shutdown the core emulation
|
||||||
Core::System::GetInstance().Shutdown();
|
system.Shutdown();
|
||||||
|
|
||||||
#if MICROPROFILE_ENABLED
|
#if MICROPROFILE_ENABLED
|
||||||
MicroProfileOnThreadExit();
|
MicroProfileOnThreadExit();
|
||||||
|
|
|
@ -574,8 +574,8 @@ void GameList::AddCustomDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||||
void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||||
const int game_dir_index = selected.data(GameListDir::GameDirRole).toInt();
|
const int game_dir_index = selected.data(GameListDir::GameDirRole).toInt();
|
||||||
|
|
||||||
QAction* move_up = context_menu.addAction(tr(u8"\U000025b2 Move Up"));
|
QAction* move_up = context_menu.addAction(tr("\u25b2 Move Up"));
|
||||||
QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down "));
|
QAction* move_down = context_menu.addAction(tr("\u25bc Move Down "));
|
||||||
QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location"));
|
QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location"));
|
||||||
|
|
||||||
const int row = selected.row();
|
const int row = selected.row();
|
||||||
|
|
|
@ -137,8 +137,10 @@ endif()
|
||||||
|
|
||||||
create_target_directory_groups(common)
|
create_target_directory_groups(common)
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC fmt microprofile Boost::boost Boost::serialization)
|
target_link_libraries(common PUBLIC fmt::fmt microprofile Boost::boost Boost::serialization)
|
||||||
target_link_libraries(common PRIVATE libzstd_static)
|
target_link_libraries(common PRIVATE libzstd_static)
|
||||||
|
set_target_properties(common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
target_link_libraries(common PRIVATE xbyak)
|
target_link_libraries(common PRIVATE xbyak)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,6 +33,14 @@ static inline u64 ComputeStructHash64(const T& data) noexcept {
|
||||||
return ComputeHash64(&data, sizeof(data));
|
return ComputeHash64(&data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combines the seed parameter with the provided hash, producing a new unique hash
|
||||||
|
* Implementation from: http://boost.sourceforge.net/doc/html/boost/hash_combine.html
|
||||||
|
*/
|
||||||
|
inline u64 HashCombine(std::size_t& seed, const u64 hash) {
|
||||||
|
return seed ^= hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||||
|
}
|
||||||
|
|
||||||
/// A helper template that ensures the padding in a struct is initialized by memsetting to 0.
|
/// A helper template that ensures the padding in a struct is initialized by memsetting to 0.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct HashableStruct {
|
struct HashableStruct {
|
||||||
|
|
22
src/common/logging/formatter.h
Normal file
22
src/common/logging/formatter.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2022 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
// adapted from https://github.com/fmtlib/fmt/issues/2704
|
||||||
|
// a generic formatter for enum classes
|
||||||
|
#if FMT_VERSION >= 80100
|
||||||
|
template <typename T>
|
||||||
|
struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
|
||||||
|
: formatter<std::underlying_type_t<T>> {
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) {
|
||||||
|
return fmt::formatter<std::underlying_type_t<T>>::format(
|
||||||
|
static_cast<std::underlying_type_t<T>>(value), ctx);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <fmt/format.h>
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/logging/formatter.h"
|
||||||
namespace Log {
|
namespace Log {
|
||||||
|
|
||||||
// trims up to and including the last of ../, ..\, src/, src\ in a string
|
// trims up to and including the last of ../, ..\, src/, src\ in a string
|
||||||
|
|
|
@ -35,7 +35,7 @@ std::vector<u8> CompressDataZSTDDefault(const u8* source, std::size_t source_siz
|
||||||
|
|
||||||
std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed) {
|
std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed) {
|
||||||
const std::size_t decompressed_size =
|
const std::size_t decompressed_size =
|
||||||
ZSTD_getDecompressedSize(compressed.data(), compressed.size());
|
ZSTD_getFrameContentSize(compressed.data(), compressed.size());
|
||||||
std::vector<u8> decompressed(decompressed_size);
|
std::vector<u8> decompressed(decompressed_size);
|
||||||
|
|
||||||
const std::size_t uncompressed_result_size = ZSTD_decompress(
|
const std::size_t uncompressed_result_size = ZSTD_decompress(
|
||||||
|
|
|
@ -471,7 +471,8 @@ endif()
|
||||||
create_target_directory_groups(core)
|
create_target_directory_groups(core)
|
||||||
|
|
||||||
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
|
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
|
||||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives Boost::serialization)
|
target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt::fmt open_source_archives Boost::serialization)
|
||||||
|
set_target_properties(core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
|
|
@ -326,7 +326,7 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
|
||||||
m_filepath = filepath;
|
m_filepath = filepath;
|
||||||
|
|
||||||
// Reset counters and set time origin to current frame
|
// Reset counters and set time origin to current frame
|
||||||
GetAndResetPerfStats();
|
[[maybe_unused]] const PerfStats::Results result = GetAndResetPerfStats();
|
||||||
perf_stats->BeginSystemFrame();
|
perf_stats->BeginSystemFrame();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -571,8 +571,9 @@ void System::Reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
|
||||||
// Reload the system with the same setting
|
// Reload the system with the same setting
|
||||||
Load(*m_emu_window, m_filepath);
|
[[maybe_unused]] const System::ResultStatus result = Load(*m_emu_window, m_filepath);
|
||||||
|
|
||||||
// Restore the deliver arg.
|
// Restore the deliver arg.
|
||||||
if (auto apt = Service::APT::GetModule(*this)) {
|
if (auto apt = Service::APT::GetModule(*this)) {
|
||||||
|
@ -597,7 +598,8 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
|
||||||
// Re-initialize everything like it was before
|
// Re-initialize everything like it was before
|
||||||
auto system_mode = this->app_loader->LoadKernelSystemMode();
|
auto system_mode = this->app_loader->LoadKernelSystemMode();
|
||||||
auto n3ds_mode = this->app_loader->LoadKernelN3dsMode();
|
auto n3ds_mode = this->app_loader->LoadKernelN3dsMode();
|
||||||
Init(*m_emu_window, *system_mode.first, *n3ds_mode.first, num_cores);
|
[[maybe_unused]] const System::ResultStatus result =
|
||||||
|
Init(*m_emu_window, *system_mode.first, *n3ds_mode.first, num_cores);
|
||||||
}
|
}
|
||||||
|
|
||||||
// flush on save, don't flush on load
|
// flush on save, don't flush on load
|
||||||
|
|
|
@ -199,7 +199,7 @@ void Timing::Timer::Advance() {
|
||||||
std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
|
std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
|
||||||
event_queue.pop_back();
|
event_queue.pop_back();
|
||||||
if (evt.type->callback != nullptr) {
|
if (evt.type->callback != nullptr) {
|
||||||
evt.type->callback(evt.userdata, executed_ticks - evt.time);
|
evt.type->callback(evt.userdata, static_cast<int>(executed_ticks - evt.time));
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
|
LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ struct ArchiveFormatInfo {
|
||||||
u32_le number_files; ///< The pre-defined number of files in the archive.
|
u32_le number_files; ///< The pre-defined number of files in the archive.
|
||||||
u8 duplicate_data; ///< Whether the archive should duplicate the data.
|
u8 duplicate_data; ///< Whether the archive should duplicate the data.
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
|
static_assert(std::is_trivial_v<ArchiveFormatInfo>, "ArchiveFormatInfo is not POD");
|
||||||
|
|
||||||
class ArchiveBackend : NonCopyable {
|
class ArchiveBackend : NonCopyable {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -58,8 +58,7 @@ bool DiskFile::Close() const {
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DiskDirectory::DiskDirectory(const std::string& path) {
|
DiskDirectory::DiskDirectory(const std::string& path) {
|
||||||
unsigned size = FileUtil::ScanDirectoryTree(path, directory);
|
directory.size = FileUtil::ScanDirectoryTree(path, directory);
|
||||||
directory.size = size;
|
|
||||||
directory.isDirectory = true;
|
directory.isDirectory = true;
|
||||||
children_iterator = directory.children.begin();
|
children_iterator = directory.children.begin();
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ Loader::ResultStatus NCCHContainer::Load() {
|
||||||
exheader_header.arm11_system_local_caps.resource_limit_category;
|
exheader_header.arm11_system_local_caps.resource_limit_category;
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "Name: {}",
|
LOG_DEBUG(Service_FS, "Name: {}",
|
||||||
exheader_header.codeset_info.name);
|
reinterpret_cast<const char*>(exheader_header.codeset_info.name));
|
||||||
LOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
LOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
||||||
LOG_DEBUG(Service_FS, "Code compressed: {}", is_compressed ? "yes" : "no");
|
LOG_DEBUG(Service_FS, "Code compressed: {}", is_compressed ? "yes" : "no");
|
||||||
LOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
LOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
||||||
|
|
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
template <typename ValueType>
|
template <typename ValueType>
|
||||||
std::optional<ValueType> Read() {
|
std::optional<ValueType> Read() {
|
||||||
static_assert(std::is_pod_v<ValueType>);
|
static_assert(std::is_trivial_v<ValueType>);
|
||||||
ValueType val{};
|
ValueType val{};
|
||||||
if (!Read(&val, sizeof(val)))
|
if (!Read(&val, sizeof(val)))
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
@ -534,9 +534,8 @@ static void SendReply(const char* reply) {
|
||||||
|
|
||||||
/// Handle query command from gdb client.
|
/// Handle query command from gdb client.
|
||||||
static void HandleQuery() {
|
static void HandleQuery() {
|
||||||
LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", command_buffer + 1);
|
|
||||||
|
|
||||||
const char* query = reinterpret_cast<const char*>(command_buffer + 1);
|
const char* query = reinterpret_cast<const char*>(command_buffer + 1);
|
||||||
|
LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", query);
|
||||||
|
|
||||||
if (strcmp(query, "TStatus") == 0) {
|
if (strcmp(query, "TStatus") == 0) {
|
||||||
SendReply("T0");
|
SendReply("T0");
|
||||||
|
@ -685,7 +684,8 @@ static void ReadCommand() {
|
||||||
LOG_ERROR(
|
LOG_ERROR(
|
||||||
Debug_GDBStub,
|
Debug_GDBStub,
|
||||||
"gdb: invalid checksum: calculated {:02x} and read {:02x} for ${}# (length: {})\n",
|
"gdb: invalid checksum: calculated {:02x} and read {:02x} for ${}# (length: {})\n",
|
||||||
checksum_calculated, checksum_received, command_buffer, command_length);
|
checksum_calculated, checksum_received, reinterpret_cast<const char*>(command_buffer),
|
||||||
|
command_length);
|
||||||
|
|
||||||
command_length = 0;
|
command_length = 0;
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ void HandlePacket() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer);
|
LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer[0]);
|
||||||
|
|
||||||
switch (command_buffer[0]) {
|
switch (command_buffer[0]) {
|
||||||
case 'q':
|
case 'q':
|
||||||
|
|
|
@ -94,7 +94,7 @@ u64 Handler::GetSystemTime() const {
|
||||||
epoch_tm.tm_mon = 0;
|
epoch_tm.tm_mon = 0;
|
||||||
epoch_tm.tm_year = 100;
|
epoch_tm.tm_year = 100;
|
||||||
epoch_tm.tm_isdst = 0;
|
epoch_tm.tm_isdst = 0;
|
||||||
u64 epoch = std::mktime(&epoch_tm) * 1000;
|
s64 epoch = std::mktime(&epoch_tm) * 1000;
|
||||||
|
|
||||||
// 3DS console time uses Jan 1 1900 as internal epoch,
|
// 3DS console time uses Jan 1 1900 as internal epoch,
|
||||||
// so we use the milliseconds between 1900 and 2000 as base console time
|
// so we use the milliseconds between 1900 and 2000 as base console time
|
||||||
|
|
|
@ -262,8 +262,8 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
||||||
// kernel version and an applet with new kernel version run at the same time, and they both use
|
// kernel version and an applet with new kernel version run at the same time, and they both use
|
||||||
// shared font, different linear heap region would have required shared font to relocate
|
// shared font, different linear heap region would have required shared font to relocate
|
||||||
// according to two different addresses at the same time, which is impossible.
|
// according to two different addresses at the same time, which is impossible.
|
||||||
VAddr target_address =
|
VAddr target_address = static_cast<VAddr>(apt->shared_font_mem->GetLinearHeapPhysicalOffset()) +
|
||||||
apt->shared_font_mem->GetLinearHeapPhysicalOffset() + Memory::LINEAR_HEAP_VADDR;
|
Memory::LINEAR_HEAP_VADDR;
|
||||||
if (!apt->shared_font_relocated) {
|
if (!apt->shared_font_relocated) {
|
||||||
BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address);
|
BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address);
|
||||||
apt->shared_font_relocated = true;
|
apt->shared_font_relocated = true;
|
||||||
|
|
|
@ -150,15 +150,15 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(u32* cmd_buf, const Funct
|
||||||
int num_params = header.normal_params_size + header.translate_params_size;
|
int num_params = header.normal_params_size + header.translate_params_size;
|
||||||
std::string function_name = info == nullptr ? fmt::format("{:#08x}", cmd_buf[0]) : info->name;
|
std::string function_name = info == nullptr ? fmt::format("{:#08x}", cmd_buf[0]) : info->name;
|
||||||
|
|
||||||
fmt::memory_buffer buf;
|
std::string result = fmt::format("function '{}': port='{}' cmd_buf={{[0]={:#x}", function_name,
|
||||||
fmt::format_to(buf, "function '{}': port='{}' cmd_buf={{[0]={:#x}", function_name, service_name,
|
service_name, cmd_buf[0]);
|
||||||
cmd_buf[0]);
|
|
||||||
for (int i = 1; i <= num_params; ++i) {
|
for (int i = 1; i <= num_params; ++i) {
|
||||||
fmt::format_to(buf, ", [{}]={:#x}", i, cmd_buf[i]);
|
result += fmt::format(", [{}]={:#x}", i, cmd_buf[i]);
|
||||||
}
|
}
|
||||||
buf.push_back('}');
|
|
||||||
|
|
||||||
LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf));
|
result.push_back('}');
|
||||||
|
|
||||||
|
LOG_ERROR(Service, "unknown / unimplemented {}", result);
|
||||||
// TODO(bunnei): Hack - ignore error
|
// TODO(bunnei): Hack - ignore error
|
||||||
header.normal_params_size.Assign(1);
|
header.normal_params_size.Assign(1);
|
||||||
header.translate_params_size.Assign(0);
|
header.translate_params_size.Assign(0);
|
||||||
|
|
|
@ -223,10 +223,10 @@ Movie::PlayMode Movie::GetPlayMode() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Movie::GetCurrentInputIndex() const {
|
u64 Movie::GetCurrentInputIndex() const {
|
||||||
return nearbyint(current_input / 234.0 * GPU::SCREEN_REFRESH_RATE);
|
return static_cast<u64>(std::nearbyint(current_input / 234.0 * GPU::SCREEN_REFRESH_RATE));
|
||||||
}
|
}
|
||||||
u64 Movie::GetTotalInputCount() const {
|
u64 Movie::GetTotalInputCount() const {
|
||||||
return nearbyint(total_input / 234.0 * GPU::SCREEN_REFRESH_RATE);
|
return static_cast<u64>(std::nearbyint(total_input / 234.0 * GPU::SCREEN_REFRESH_RATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Movie::CheckInputEnd() {
|
void Movie::CheckInputEnd() {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
|
@ -23,12 +23,12 @@ add_library(input_common STATIC
|
||||||
udp/udp.h
|
udp/udp.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(ENABLE_SDL2)
|
||||||
target_sources(input_common PRIVATE
|
target_sources(input_common PRIVATE
|
||||||
sdl/sdl_impl.cpp
|
sdl/sdl_impl.cpp
|
||||||
sdl/sdl_impl.h
|
sdl/sdl_impl.h
|
||||||
)
|
)
|
||||||
target_link_libraries(input_common PRIVATE SDL2)
|
target_link_libraries(input_common PRIVATE SDL2::SDL2)
|
||||||
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -36,3 +36,4 @@ create_target_directory_groups(input_common)
|
||||||
target_link_libraries(input_common PUBLIC core PRIVATE common ${Boost_LIBRARIES})
|
target_link_libraries(input_common PUBLIC core PRIVATE common ${Boost_LIBRARIES})
|
||||||
target_include_directories(input_common PRIVATE ${LIBUSB_INCLUDE_DIR})
|
target_include_directories(input_common PRIVATE ${LIBUSB_INCLUDE_DIR})
|
||||||
target_link_libraries(input_common PUBLIC ${LIBUSB_LIBRARIES})
|
target_link_libraries(input_common PUBLIC ${LIBUSB_LIBRARIES})
|
||||||
|
set_target_properties(input_common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/threadsafe_queue.h"
|
#include "common/threadsafe_queue.h"
|
||||||
|
|
||||||
|
|
|
@ -26,3 +26,4 @@ if (ENABLE_WEB_SERVICE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(network PRIVATE common enet Boost::serialization)
|
target_link_libraries(network PRIVATE common enet Boost::serialization)
|
||||||
|
set_target_properties(network PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
|
@ -11,7 +11,6 @@ add_executable(tests
|
||||||
core/memory/vm_manager.cpp
|
core/memory/vm_manager.cpp
|
||||||
audio_core/audio_fixures.h
|
audio_core/audio_fixures.h
|
||||||
audio_core/decoder_tests.cpp
|
audio_core/decoder_tests.cpp
|
||||||
tests.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
|
@ -24,6 +23,6 @@ endif()
|
||||||
create_target_directory_groups(tests)
|
create_target_directory_groups(tests)
|
||||||
|
|
||||||
target_link_libraries(tests PRIVATE common core video_core audio_core)
|
target_link_libraries(tests PRIVATE common core video_core audio_core)
|
||||||
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch-single-include nihstro-headers Threads::Threads)
|
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2WithMain nihstro-headers Threads::Threads)
|
||||||
|
|
||||||
add_test(NAME tests COMMAND tests)
|
add_test(NAME tests COMMAND tests)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
|
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/memory.h"
|
#include "core/hle/kernel/memory.h"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
|
|
||||||
TEST_CASE("BitField", "[common]") {
|
TEST_CASE("BitField", "[common]") {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "core/arm/dyncom/arm_dyncom.h"
|
#include "core/arm/dyncom/arm_dyncom.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "core/file_sys/path_parser.h"
|
#include "core/file_sys/path_parser.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "common/archives.h"
|
#include "common/archives.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/memory.h"
|
#include "core/hle/kernel/memory.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "core/hle/kernel/errors.h"
|
#include "core/hle/kernel/errors.h"
|
||||||
#include "core/hle/kernel/memory.h"
|
#include "core/hle/kernel/memory.h"
|
||||||
#include "core/hle/kernel/vm_manager.h"
|
#include "core/hle/kernel/vm_manager.h"
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
// Copyright 2016 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#include <catch2/catch.hpp>
|
|
||||||
|
|
||||||
// Catch provides the main function since we've given it the
|
|
||||||
// CATCH_CONFIG_MAIN preprocessor directive.
|
|
|
@ -5,7 +5,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch_approx.hpp>
|
||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <nihstro/inline_assembly.h>
|
#include <nihstro/inline_assembly.h>
|
||||||
#include "video_core/shader/shader_interpreter.h"
|
#include "video_core/shader/shader_interpreter.h"
|
||||||
#include "video_core/shader/shader_jit_x64_compiler.h"
|
#include "video_core/shader/shader_jit_x64_compiler.h"
|
||||||
|
@ -78,9 +79,9 @@ TEST_CASE("LG2", "[video_core][shader][shader_jit]") {
|
||||||
REQUIRE(std::isnan(shader.Run(NAN)));
|
REQUIRE(std::isnan(shader.Run(NAN)));
|
||||||
REQUIRE(std::isnan(shader.Run(-1.f)));
|
REQUIRE(std::isnan(shader.Run(-1.f)));
|
||||||
REQUIRE(std::isinf(shader.Run(0.f)));
|
REQUIRE(std::isinf(shader.Run(0.f)));
|
||||||
REQUIRE(shader.Run(4.f) == Approx(2.f));
|
REQUIRE(shader.Run(4.f) == Catch::Approx(2.f));
|
||||||
REQUIRE(shader.Run(64.f) == Approx(6.f));
|
REQUIRE(shader.Run(64.f) == Catch::Approx(6.f));
|
||||||
REQUIRE(shader.Run(1.e24f) == Approx(79.7262742773f));
|
REQUIRE(shader.Run(1.e24f) == Catch::Approx(79.7262742773f));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("EX2", "[video_core][shader][shader_jit]") {
|
TEST_CASE("EX2", "[video_core][shader][shader_jit]") {
|
||||||
|
@ -95,11 +96,11 @@ TEST_CASE("EX2", "[video_core][shader][shader_jit]") {
|
||||||
});
|
});
|
||||||
|
|
||||||
REQUIRE(std::isnan(shader.Run(NAN)));
|
REQUIRE(std::isnan(shader.Run(NAN)));
|
||||||
REQUIRE(shader.Run(-800.f) == Approx(0.f));
|
REQUIRE(shader.Run(-800.f) == Catch::Approx(0.f));
|
||||||
REQUIRE(shader.Run(0.f) == Approx(1.f));
|
REQUIRE(shader.Run(0.f) == Catch::Approx(1.f));
|
||||||
REQUIRE(shader.Run(2.f) == Approx(4.f));
|
REQUIRE(shader.Run(2.f) == Catch::Approx(4.f));
|
||||||
REQUIRE(shader.Run(6.f) == Approx(64.f));
|
REQUIRE(shader.Run(6.f) == Catch::Approx(64.f));
|
||||||
REQUIRE(shader.Run(79.7262742773f) == Approx(1.e24f));
|
REQUIRE(shader.Run(79.7262742773f) == Catch::Approx(1.e24f));
|
||||||
REQUIRE(std::isinf(shader.Run(800.f)));
|
REQUIRE(std::isinf(shader.Run(800.f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ TEST_CASE("Nested Loop", "[video_core][shader][shader_jit]") {
|
||||||
shader_test.RunJit(shader_unit_jit, input);
|
shader_test.RunJit(shader_unit_jit, input);
|
||||||
|
|
||||||
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
|
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
|
||||||
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Approx(expected_out));
|
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
shader_test.shader_setup->uniforms.i[0] = {9, 0, 2, 0};
|
shader_test.shader_setup->uniforms.i[0] = {9, 0, 2, 0};
|
||||||
|
@ -154,6 +155,6 @@ TEST_CASE("Nested Loop", "[video_core][shader][shader_jit]") {
|
||||||
shader_test.RunJit(shader_unit_jit, input);
|
shader_test.RunJit(shader_unit_jit, input);
|
||||||
|
|
||||||
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
|
REQUIRE(shader_unit_jit.address_registers[2] == expected_aL);
|
||||||
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Approx(expected_out));
|
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ create_target_directory_groups(video_core)
|
||||||
|
|
||||||
target_link_libraries(video_core PUBLIC common core)
|
target_link_libraries(video_core PUBLIC common core)
|
||||||
target_link_libraries(video_core PRIVATE glad nihstro-headers Boost::serialization)
|
target_link_libraries(video_core PRIVATE glad nihstro-headers Boost::serialization)
|
||||||
|
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
target_link_libraries(video_core PUBLIC xbyak)
|
target_link_libraries(video_core PUBLIC xbyak)
|
||||||
|
|
|
@ -205,7 +205,7 @@ public:
|
||||||
// printing the character '{' is desirable. Ditto for }} and '}',
|
// printing the character '{' is desirable. Ditto for }} and '}',
|
||||||
// etc).
|
// etc).
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void AddLine(std::string_view text, Args&&... args) {
|
void AddLine(fmt::format_string<Args...> text, Args&&... args) {
|
||||||
AddExpression(fmt::format(text, std::forward<Args>(args)...));
|
AddExpression(fmt::format(text, std::forward<Args>(args)...));
|
||||||
AddNewLine();
|
AddNewLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <boost/functional/hash.hpp>
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include "core/frontend/scope_acquire_context.h"
|
#include "core/frontend/scope_acquire_context.h"
|
||||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||||
|
@ -21,12 +20,14 @@ namespace OpenGL {
|
||||||
static u64 GetUniqueIdentifier(const Pica::Regs& regs, const ProgramCode& code) {
|
static u64 GetUniqueIdentifier(const Pica::Regs& regs, const ProgramCode& code) {
|
||||||
std::size_t hash = 0;
|
std::size_t hash = 0;
|
||||||
u64 regs_uid = Common::ComputeHash64(regs.reg_array.data(), Pica::Regs::NUM_REGS * sizeof(u32));
|
u64 regs_uid = Common::ComputeHash64(regs.reg_array.data(), Pica::Regs::NUM_REGS * sizeof(u32));
|
||||||
boost::hash_combine(hash, regs_uid);
|
hash = Common::HashCombine(hash, regs_uid);
|
||||||
|
|
||||||
if (code.size() > 0) {
|
if (code.size() > 0) {
|
||||||
u64 code_uid = Common::ComputeHash64(code.data(), code.size() * sizeof(u32));
|
u64 code_uid = Common::ComputeHash64(code.data(), code.size() * sizeof(u32));
|
||||||
boost::hash_combine(hash, code_uid);
|
hash = Common::HashCombine(hash, code_uid);
|
||||||
}
|
}
|
||||||
return static_cast<u64>(hash);
|
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OGLProgram GeneratePrecompiledProgram(const ShaderDiskCacheDump& dump,
|
static OGLProgram GeneratePrecompiledProgram(const ShaderDiskCacheDump& dump,
|
||||||
|
@ -336,14 +337,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ShaderTuple {
|
struct ShaderTuple {
|
||||||
GLuint vs = 0;
|
|
||||||
GLuint gs = 0;
|
|
||||||
GLuint fs = 0;
|
|
||||||
|
|
||||||
std::size_t vs_hash = 0;
|
std::size_t vs_hash = 0;
|
||||||
std::size_t gs_hash = 0;
|
std::size_t gs_hash = 0;
|
||||||
std::size_t fs_hash = 0;
|
std::size_t fs_hash = 0;
|
||||||
|
|
||||||
|
GLuint vs = 0;
|
||||||
|
GLuint gs = 0;
|
||||||
|
GLuint fs = 0;
|
||||||
|
|
||||||
bool operator==(const ShaderTuple& rhs) const {
|
bool operator==(const ShaderTuple& rhs) const {
|
||||||
return std::tie(vs, gs, fs) == std::tie(rhs.vs, rhs.gs, rhs.fs);
|
return std::tie(vs, gs, fs) == std::tie(rhs.vs, rhs.gs, rhs.fs);
|
||||||
}
|
}
|
||||||
|
@ -353,14 +354,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t GetConfigHash() const {
|
std::size_t GetConfigHash() const {
|
||||||
std::size_t hash = 0;
|
return Common::ComputeHash64(this, sizeof(std::size_t) * 3);
|
||||||
boost::hash_combine(hash, vs_hash);
|
|
||||||
boost::hash_combine(hash, gs_hash);
|
|
||||||
boost::hash_combine(hash, fs_hash);
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(offsetof(ShaderTuple, vs_hash) == 0, "ShaderTuple layout changed!");
|
||||||
|
static_assert(offsetof(ShaderTuple, fs_hash) == sizeof(std::size_t) * 2,
|
||||||
|
"ShaderTuple layout changed!");
|
||||||
|
|
||||||
bool is_amd;
|
bool is_amd;
|
||||||
bool separable;
|
bool separable;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ ASSERT_POS(tc0_w, RasterizerRegs::VSOutputAttributes::TEXCOORD0_W);
|
||||||
ASSERT_POS(view, RasterizerRegs::VSOutputAttributes::VIEW_X);
|
ASSERT_POS(view, RasterizerRegs::VSOutputAttributes::VIEW_X);
|
||||||
ASSERT_POS(tc2, RasterizerRegs::VSOutputAttributes::TEXCOORD2_U);
|
ASSERT_POS(tc2, RasterizerRegs::VSOutputAttributes::TEXCOORD2_U);
|
||||||
#undef ASSERT_POS
|
#undef ASSERT_POS
|
||||||
static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD");
|
static_assert(std::is_trivial_v<OutputVertex>, "Structure is not POD");
|
||||||
static_assert(sizeof(OutputVertex) == 24 * sizeof(float), "OutputVertex has invalid size");
|
static_assert(sizeof(OutputVertex) == 24 * sizeof(float), "OutputVertex has invalid size");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,7 +153,7 @@ struct UnitState {
|
||||||
ar& output;
|
ar& output;
|
||||||
}
|
}
|
||||||
} registers;
|
} registers;
|
||||||
static_assert(std::is_pod<Registers>::value, "Structure is not POD");
|
static_assert(std::is_trivial_v<Registers>, "Structure is not POD");
|
||||||
|
|
||||||
bool conditional_code[2];
|
bool conditional_code[2];
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ std::tuple<Common::Vec4<u8>, Common::Vec4<u8>> ComputeFragmentsColors(
|
||||||
else
|
else
|
||||||
light_vector = position + view;
|
light_vector = position + view;
|
||||||
|
|
||||||
light_vector.Normalize();
|
[[maybe_unused]] float length = light_vector.Normalize();
|
||||||
|
|
||||||
Common::Vec3<float> norm_view = view.Normalized();
|
Common::Vec3<float> norm_view = view.Normalized();
|
||||||
Common::Vec3<float> half_vector = norm_view + light_vector;
|
Common::Vec3<float> half_vector = norm_view + light_vector;
|
||||||
|
|
|
@ -16,6 +16,7 @@ create_target_directory_groups(web_service)
|
||||||
target_compile_definitions(web_service PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
target_compile_definitions(web_service PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
target_link_libraries(web_service PRIVATE common network json-headers httplib cpp-jwt)
|
target_link_libraries(web_service PRIVATE common network json-headers httplib cpp-jwt)
|
||||||
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
||||||
|
set_target_properties(web_service PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
target_link_libraries(web_service PRIVATE ifaddrs)
|
target_link_libraries(web_service PRIVATE ifaddrs)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
|
|
Loading…
Reference in a new issue