mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-28 19:38:47 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ccf9addc9 | |||
| 75b3bba0d6 | |||
| d2d426b82b | |||
| 763248bf9b | |||
| 0cfb9b5d75 | |||
| cd7eb3cfe0 | |||
| d8d2d0fb25 | |||
| dfc36bdae7 | |||
| dd40b7c955 | |||
| 16ea5f6ab9 | |||
| f40e520869 | |||
| 4a9da34dc2 | |||
| 644dc705df | |||
| 815325ccec |
@@ -333,6 +333,11 @@
|
|||||||
"repo": "herumi/xbyak",
|
"repo": "herumi/xbyak",
|
||||||
"version": "v7.40.1"
|
"version": "v7.40.1"
|
||||||
},
|
},
|
||||||
|
"zbic": {
|
||||||
|
"hash": "fbe2f37986377d7f0d96ae3224c80b5971df6e8b6961f68061f1975ebb2e8cb78f07b90f014b007be4023dbf5513581504e7f7d61a5237cb2a8a7a61ae11e482",
|
||||||
|
"repo": "kinnay/zbic",
|
||||||
|
"version": "11b08f2712264bbed731545085cbd9702096ceb7"
|
||||||
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
"hash": "16fea4df307a68cf0035858abe2fd550250618a97590e202037acd18a666f57afc10f8836cbbd472d54a0e76539d0e558cb26f059d53de52ff90634bbf4f47d4",
|
"hash": "16fea4df307a68cf0035858abe2fd550250618a97590e202037acd18a666f57afc10f8836cbbd472d54a0e76539d0e558cb26f059d53de52ff90634bbf4f47d4",
|
||||||
"min_version": "1.2",
|
"min_version": "1.2",
|
||||||
|
|||||||
Vendored
+5
@@ -48,6 +48,11 @@ if (NOT TARGET stb::headers)
|
|||||||
add_library(stb::headers ALIAS stb)
|
add_library(stb::headers ALIAS stb)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
AddJsonPackage(NAME zbic DOWNLOAD_ONLY)
|
||||||
|
set(ZBIC_INCLUDE_DIR
|
||||||
|
"${zbic_SOURCE_DIR}/src"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
|
||||||
# ItaniumDemangle (Windows only)
|
# ItaniumDemangle (Windows only)
|
||||||
if (WIN32 AND NOT TARGET LLVM::Demangle)
|
if (WIN32 AND NOT TARGET LLVM::Demangle)
|
||||||
add_library(demangle demangle/ItaniumDemangle.cpp)
|
add_library(demangle demangle/ItaniumDemangle.cpp)
|
||||||
|
|||||||
Vendored
+212
-171
@@ -11,110 +11,149 @@ set(FFmpeg_HWACCEL_LDFLAGS)
|
|||||||
|
|
||||||
if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
||||||
set(FFmpeg_CROSS_COMPILE_FLAGS "")
|
set(FFmpeg_CROSS_COMPILE_FLAGS "")
|
||||||
if (ANDROID)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
message(STATUS "ffmpeg: Enabling cross compilation ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
# TODO: Maybe use CMAKE_SYSROOT? and probably provide a toolchain file for android
|
# TODO: Maybe use CMAKE_SYSROOT? and probably provide a toolchain file for android
|
||||||
# I mean isn't that the "proper" way anyways?
|
# I mean isn't that the "proper" way anyways?
|
||||||
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" FFmpeg_HOST_SYSTEM_NAME)
|
if (ANDROID)
|
||||||
set(TOOLCHAIN "${ANDROID_NDK}/toolchains/llvm/prebuilt/${FFmpeg_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" FFmpeg_HOST_SYSTEM_NAME)
|
||||||
set(SYSROOT "${TOOLCHAIN}/sysroot")
|
set(TOOLCHAIN "${ANDROID_NDK}/toolchains/llvm/prebuilt/${FFmpeg_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||||
set(FFmpeg_CPU "armv8-a")
|
set(SYSROOT "${TOOLCHAIN}/sysroot")
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
set(FFmpeg_CPU "armv8-a")
|
||||||
--enable-cross-compile
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
||||||
--arch=arm64
|
--enable-cross-compile
|
||||||
#--cpu=${FFmpeg_CPU}
|
--arch=arm64
|
||||||
--cross-prefix="${TOOLCHAIN}/bin/aarch64-linux-android-"
|
#--cpu=${FFmpeg_CPU}
|
||||||
--sysroot="${SYSROOT}"
|
--cross-prefix="${TOOLCHAIN}/bin/aarch64-linux-android-"
|
||||||
--target-os=android
|
--sysroot="${SYSROOT}"
|
||||||
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
--target-os=android
|
||||||
--extra-ldflags="-nostdlib"
|
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
||||||
)
|
--extra-ldflags="-nostdlib")
|
||||||
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
||||||
# User attempts to do a FFmpeg cross compilation because...
|
|
||||||
# Here we just quickly test against host/system processors not matching
|
|
||||||
# TODO: Test for versions not matching as well?
|
|
||||||
elseif (NOT (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES CMAKE_SYSTEM_PROCESSOR
|
|
||||||
AND CMAKE_HOST_SYSTEM_NAME MATCHES CMAKE_SYSTEM_NAME))
|
|
||||||
string(TOLOWER "${CMAKE_SYSTEM_NAME}" FFmpeg_SYSTEM_NAME)
|
|
||||||
if (FFmpeg_SYSTEM_NAME STREQUAL "openorbis" OR FFmpeg_SYSTEM_NAME STREQUAL "managarm")
|
|
||||||
set(FFmpeg_SYSTEM_NAME "none")
|
|
||||||
endif()
|
|
||||||
# TODO: Can we really do better? Auto-detection? Something clever?
|
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
|
||||||
--enable-cross-compile
|
|
||||||
--arch="${CMAKE_SYSTEM_PROCESSOR}"
|
|
||||||
--target-os="${FFmpeg_SYSTEM_NAME}"
|
|
||||||
--sysroot="${CMAKE_SYSROOT}"
|
|
||||||
)
|
|
||||||
if (DEFINED FFmpeg_CROSS_PREFIX)
|
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --cross-prefix="${FFmpeg_CROSS_PREFIX}")
|
|
||||||
else()
|
else()
|
||||||
message(WARNING "Please set FFmpeg_CROSS_PREFIX to your cross toolchain prefix, for example: \${CMAKE_STAGING_PREFIX}/bin/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}-")
|
string(TOLOWER "${CMAKE_SYSTEM_NAME}" FFmpeg_SYSTEM_NAME)
|
||||||
|
# systems FFmpeg natively supports
|
||||||
|
if (NOT (NETBSD OR SOLARIS OR FREEBSD
|
||||||
|
OR OPENBSD OR DRAGONFLYBSD OR HAIKU
|
||||||
|
OR LINUX OR MSYS OR WIN32 OR ANDROID OR APPLE))
|
||||||
|
set(FFmpeg_SYSTEM_NAME "none")
|
||||||
|
endif()
|
||||||
|
# TODO: Can we really do better? Auto-detection? Something clever?
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
||||||
|
--enable-cross-compile
|
||||||
|
--arch="${CMAKE_SYSTEM_PROCESSOR}"
|
||||||
|
--target-os="${FFmpeg_SYSTEM_NAME}"
|
||||||
|
--sysroot="${CMAKE_SYSROOT}")
|
||||||
|
if (DEFINED FFmpeg_CROSS_PREFIX)
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --cross-prefix="${FFmpeg_CROSS_PREFIX}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Please set FFmpeg_CROSS_PREFIX to your cross toolchain prefix, for example: \${CMAKE_STAGING_PREFIX}/bin/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}-")
|
||||||
|
endif()
|
||||||
|
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
||||||
endif()
|
endif()
|
||||||
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (OPENORBIS OR MANAGARM)
|
if (WIN32)
|
||||||
# Doesn't support VA-API, don't go thru the embarrassment of trying to enable it
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
--enable-d3d11va
|
||||||
|
--enable-d3d12va
|
||||||
|
--enable-dxva2
|
||||||
|
--enable-hwaccel=d3d11va_h264
|
||||||
|
--enable-hwaccel=d3d11va2_h264
|
||||||
|
--enable-hwaccel=d3d12va_h264
|
||||||
|
--enable-hwaccel=dxva2_h264
|
||||||
|
--enable-hwaccel=d3d11va_vp9
|
||||||
|
--enable-hwaccel=d3d11va2_vp9
|
||||||
|
--enable-hwaccel=d3d12va_vp9
|
||||||
|
--enable-hwaccel=dxva2_vp9)
|
||||||
elseif (ANDROID)
|
elseif (ANDROID)
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
--enable-mediacodec
|
--enable-mediacodec
|
||||||
--enable-jni
|
--enable-jni
|
||||||
)
|
--enable-decoder=h264_mediacodec
|
||||||
elseif (UNIX AND NOT DEFINED FFmpeg_IS_CROSS_COMPILING AND NOT ANDROID)
|
--enable-decoder=vp8_mediacodec
|
||||||
find_package(PkgConfig REQUIRED)
|
--enable-decoder=vp9_mediacodec)
|
||||||
pkg_check_modules(LIBVA libva)
|
elseif (APPLE)
|
||||||
pkg_check_modules(CUDA cuda)
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
pkg_check_modules(FFNVCODEC ffnvcodec)
|
--enable-videotoolbox
|
||||||
pkg_check_modules(VDPAU vdpau)
|
--enable-hwaccel=videotoolbox_h264
|
||||||
|
--enable-hwaccel=videotoolbox_vp9)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(X11)
|
find_package(X11)
|
||||||
if(X11_FOUND)
|
if(X11_FOUND)
|
||||||
if (NOT APPLE)
|
# Include X11 if possible, VDPAU lists it as complementary
|
||||||
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${X11_LIBRARIES})
|
||||||
if(SOLARIS)
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${X11_INCLUDE_DIRS})
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${X11_LDFLAGS})
|
||||||
X11
|
else()
|
||||||
"${CMAKE_SYSROOT}/usr/lib/xorg/amd64/libdrm.so")
|
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
||||||
else()
|
endif()
|
||||||
pkg_check_modules(LIBDRM libdrm REQUIRED)
|
message(STATUS "ffmpeg: X11 ${X11_FOUND} ${X11_VERSION}")
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
|
||||||
${LIBDRM_LIBRARIES})
|
find_package(PkgConfig)
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
if (PkgConfig_FOUND)
|
||||||
${LIBDRM_INCLUDE_DIRS})
|
pkg_check_modules(LIBDRM libdrm)
|
||||||
endif()
|
if (LIBDRM_FOUND)
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
# Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
||||||
--enable-libdrm)
|
if(SOLARIS)
|
||||||
endif()
|
|
||||||
if(LIBVA_FOUND)
|
|
||||||
pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
|
|
||||||
pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
||||||
${X11_LIBRARIES}
|
X11
|
||||||
${LIBVA-DRM_LIBRARIES}
|
"${CMAKE_SYSROOT}/usr/lib/xorg/amd64/libdrm.so")
|
||||||
${LIBVA-X11_LIBRARIES}
|
|
||||||
${LIBVA_LIBRARIES})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--enable-hwaccel=h264_vaapi
|
|
||||||
--enable-hwaccel=vp8_vaapi
|
|
||||||
--enable-hwaccel=vp9_vaapi)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
|
||||||
${X11_INCLUDE_DIRS}
|
|
||||||
${LIBVA-DRM_INCLUDE_DIRS}
|
|
||||||
${LIBVA-X11_INCLUDE_DIRS}
|
|
||||||
${LIBVA_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
message(STATUS "ffmpeg: va-api libraries version ${LIBVA_VERSION} found")
|
|
||||||
else()
|
else()
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${LIBDRM_LIBRARIES})
|
||||||
message(WARNING "ffmpeg: libva-dev not found, disabling Video Acceleration API (VA-API)...")
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${LIBDRM_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${LIBDRM_LDFLAGS})
|
||||||
endif()
|
endif()
|
||||||
else()
|
list(APPEND FFmpeg_HWACCEL_FLAGS --enable-libdrm)
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
|
||||||
message(WARNING "ffmpeg: X11 libraries not found, disabling VA-API...")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
pkg_check_modules(LIBVA libva)
|
||||||
|
if(LIBVA_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${LIBVA_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${LIBVA_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${LIBVA_LDFLAGS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-vaapi
|
||||||
|
--enable-hwaccel=h264_vaapi
|
||||||
|
--enable-hwaccel=vp8_vaapi
|
||||||
|
--enable-hwaccel=vp9_vaapi)
|
||||||
|
# Logically, they can only exist if libva itself exists
|
||||||
|
pkg_check_modules(LIBVA-DRM libva-drm)
|
||||||
|
if (LIBVA-DRM_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${LIBVA-DRM_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${LIBVA-DRM_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${LIBVA-DRM_LDFLAGS})
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: LIBVA-DRM ${LIBVA-DRM_FOUND} ${LIBVA-DRM_VERSION}")
|
||||||
|
pkg_check_modules(LIBVA-X11 libva-x11)
|
||||||
|
if (LIBVA-X11_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${LIBVA-X11_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${LIBVA-X11_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${LIBVA-X11_LDFLAGS})
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: LIBVA-X11 ${LIBVA-X11_FOUND} ${LIBVA-X11_VERSION}")
|
||||||
|
else()
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: LIBVA ${LIBVA_FOUND} ${LIBVA_VERSION}")
|
||||||
|
|
||||||
|
pkg_check_modules(VDPAU vdpau)
|
||||||
|
if (VDPAU_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-vdpau
|
||||||
|
--enable-hwaccel=h264_vdpau
|
||||||
|
--enable-hwaccel=vp9_vdpau)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
|
||||||
|
else()
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau)
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: VDPAU ${VDPAU_FOUND} ${VDPAU_VERSION}")
|
||||||
|
|
||||||
|
pkg_check_modules(FFNVCODEC ffnvcodec)
|
||||||
if (FFNVCODEC_FOUND)
|
if (FFNVCODEC_FOUND)
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
--enable-cuvid
|
--enable-cuvid
|
||||||
@@ -122,39 +161,42 @@ elseif (UNIX AND NOT DEFINED FFmpeg_IS_CROSS_COMPILING AND NOT ANDROID)
|
|||||||
--enable-nvdec
|
--enable-nvdec
|
||||||
--enable-hwaccel=h264_nvdec
|
--enable-hwaccel=h264_nvdec
|
||||||
--enable-hwaccel=vp8_nvdec
|
--enable-hwaccel=vp8_nvdec
|
||||||
--enable-hwaccel=vp9_nvdec
|
--enable-hwaccel=vp9_nvdec)
|
||||||
)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
|
||||||
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${FFNVCODEC_LDFLAGS})
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${FFNVCODEC_LDFLAGS})
|
||||||
message(STATUS "ffmpeg: ffnvcodec libraries version ${FFNVCODEC_VERSION} found")
|
|
||||||
# ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress
|
# ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress
|
||||||
# here we handle the hard-linking scenario where CUDA is linked during compilation
|
# here we handle the hard-linking scenario where CUDA is linked during compilation
|
||||||
if (CUDA_FOUND)
|
find_package(CUDAToolkit)
|
||||||
# This line causes build error if CUDA_INCLUDE_DIRS is anything but a single non-empty value
|
if (CUDAToolkit_FOUND)
|
||||||
#list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS})
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDAToolkit_LIBRARIES})
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES})
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIRS})
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDAToolkit_LDFLAGS})
|
||||||
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS})
|
endif()
|
||||||
message(STATUS "ffmpeg: CUDA libraries version ${CUDA_VERSION} found, hard-linking will be performed")
|
message(STATUS "ffmpeg: CUDAToolkit ${CUDAToolkit_FOUND} ${CUDAToolkit_VERSION}")
|
||||||
endif(CUDA_FOUND)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (VDPAU_FOUND AND NOT APPLE)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--enable-vdpau
|
|
||||||
--enable-hwaccel=h264_vdpau
|
|
||||||
--enable-hwaccel=vp9_vdpau
|
|
||||||
)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
|
|
||||||
message(STATUS "ffmpeg: vdpau libraries version ${VDPAU_VERSION} found")
|
|
||||||
else()
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau)
|
|
||||||
message(WARNING "ffmpeg: libvdpau-dev not found, disabling Video Decode and Presentation API for Unix (VDPAU)...")
|
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "ffmpeg: FFNVCODEC ${FFNVCODEC_FOUND} ${FFNVCODEC_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "ffmpeg: PkgConfig ${PkgConfig_FOUND} ${PkgConfig_VERSION}")
|
||||||
|
|
||||||
|
find_package(Vulkan)
|
||||||
|
if (Vulkan_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-vulkan
|
||||||
|
--enable-hwaccel=h264_vulkan
|
||||||
|
--enable-hwaccel=vp9_vulkan)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${Vulkan_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${Vulkan_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: Vulkan ${Vulkan_FOUND} ${Vulkan_VERSION}")
|
||||||
|
|
||||||
|
find_package(spirv-headers)
|
||||||
|
if (spirv-headers_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${spirv-headers_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${spirv-headers_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${spirv-headers_LDFLAGS})
|
||||||
|
endif()
|
||||||
|
message(STATUS "ffmpeg: spirv-headers ${spirv-headers_FOUND} ${spirv-headers_VERSION}")
|
||||||
|
|
||||||
if (OPENORBIS)
|
if (OPENORBIS)
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_LIBS
|
list(APPEND FFmpeg_CROSS_COMPILE_LIBS
|
||||||
@@ -162,20 +204,28 @@ if (OPENORBIS)
|
|||||||
-lSceUserService
|
-lSceUserService
|
||||||
-lSceSysmodule
|
-lSceSysmodule
|
||||||
-lSceNet
|
-lSceNet
|
||||||
-lSceLibcInternal
|
-lSceLibcInternal)
|
||||||
)
|
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
||||||
--disable-pthreads
|
--disable-pthreads
|
||||||
--extra-cflags=${CMAKE_SYSROOT}/usr/include
|
--extra-cflags=${CMAKE_SYSROOT}/usr/include
|
||||||
--extra-cxxflags=${CMAKE_SYSROOT}/usr/include
|
--extra-cxxflags=${CMAKE_SYSROOT}/usr/include
|
||||||
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}"
|
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}")
|
||||||
)
|
|
||||||
elseif (MANAGARM)
|
elseif (MANAGARM)
|
||||||
# Required for proper stuff
|
# Required for proper stuff
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
||||||
--disable-pthreads
|
--disable-pthreads
|
||||||
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}"
|
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}")
|
||||||
)
|
endif()
|
||||||
|
|
||||||
|
# Usually used by Emscripten
|
||||||
|
if (DEFINED CMAKE_AR)
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --ar=${CMAKE_AR})
|
||||||
|
endif()
|
||||||
|
if (DEFINED CMAKE_NM)
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --nm=${CMAKE_NM})
|
||||||
|
endif()
|
||||||
|
if (DEFINED CMAKE_RANLIB)
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --ranlib=${CMAKE_RANLIB})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (YUZU_USE_BUNDLED_FFMPEG)
|
if (YUZU_USE_BUNDLED_FFMPEG)
|
||||||
@@ -183,44 +233,33 @@ if (YUZU_USE_BUNDLED_FFMPEG)
|
|||||||
|
|
||||||
set(FFmpeg_INCLUDE_DIR
|
set(FFmpeg_INCLUDE_DIR
|
||||||
"${FFmpeg_SOURCE_DIR}/include;${FFmpeg_HWACCEL_INCLUDE_DIRS}"
|
"${FFmpeg_SOURCE_DIR}/include;${FFmpeg_HWACCEL_INCLUDE_DIRS}"
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE)
|
||||||
)
|
|
||||||
|
|
||||||
set(FFmpeg_PATH
|
set(FFmpeg_PATH
|
||||||
"${FFmpeg_SOURCE_DIR}"
|
"${FFmpeg_SOURCE_DIR}"
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE)
|
||||||
)
|
|
||||||
|
|
||||||
set(FFmpeg_LIBRARY_DIR
|
set(FFmpeg_LIBRARY_DIR
|
||||||
"${FFmpeg_SOURCE_DIR}/bin"
|
"${FFmpeg_SOURCE_DIR}/bin"
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE)
|
||||||
)
|
|
||||||
|
|
||||||
set(FFmpeg_LIBRARIES
|
set(FFmpeg_LIBRARIES
|
||||||
FFmpeg::FFmpeg
|
FFmpeg::FFmpeg
|
||||||
${FFmpeg_HWACCEL_LIBRARIES}
|
${FFmpeg_HWACCEL_LIBRARIES}
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE)
|
||||||
)
|
|
||||||
|
set(FFmpeg_FOUND YES)
|
||||||
else()
|
else()
|
||||||
# Build FFmpeg from externals
|
# Build FFmpeg from externals
|
||||||
message(STATUS "Using FFmpeg from externals")
|
message(STATUS "Using FFmpeg from externals")
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
|
|
||||||
# FFmpeg has source that requires one of nasm or yasm to assemble it.
|
|
||||||
# REQUIRED throws an error if not found here during configuration rather than during compilation.
|
|
||||||
find_program(ASSEMBLER NAMES nasm yasm)
|
|
||||||
if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND")
|
|
||||||
message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(AUTOCONF autoconf)
|
|
||||||
if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND")
|
|
||||||
message(FATAL_ERROR "Required program `autoconf` not found.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
AddJsonPackage(ffmpeg)
|
AddJsonPackage(ffmpeg)
|
||||||
|
|
||||||
|
# FFmpeg has source that requires one of nasm or yasm to assemble it.
|
||||||
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
|
||||||
|
find_program(ASSEMBLER NAMES nasm yasm REQUIRED)
|
||||||
|
endif()
|
||||||
|
find_program(AUTOCONF autoconf REQUIRED)
|
||||||
|
|
||||||
set(FFmpeg_PREFIX ${ffmpeg_SOURCE_DIR})
|
set(FFmpeg_PREFIX ${ffmpeg_SOURCE_DIR})
|
||||||
set(FFmpeg_BUILD_DIR ${ffmpeg_BINARY_DIR})
|
set(FFmpeg_BUILD_DIR ${ffmpeg_BINARY_DIR})
|
||||||
set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
|
set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
|
||||||
@@ -250,8 +289,15 @@ else()
|
|||||||
|
|
||||||
# `configure` parameters builds only exactly what yuzu needs from FFmpeg
|
# `configure` parameters builds only exactly what yuzu needs from FFmpeg
|
||||||
# `--disable-vdpau` is needed to avoid linking issues
|
# `--disable-vdpau` is needed to avoid linking issues
|
||||||
set(FFmpeg_CC ${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER})
|
set(FFmpeg_CC ${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER})
|
||||||
set(FFmpeg_CXX ${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER})
|
set(FFmpeg_CXX ${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER})
|
||||||
|
set(FFmpeg_HOST_CC ${CMAKE_C_HOST_COMPILER})
|
||||||
|
if (FFmpeg_IS_CROSS_COMPILING)
|
||||||
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS --ld=${CMAKE_LINKER})
|
||||||
|
endif ()
|
||||||
|
# TODO: This is a bit fragile, it depends on FFmpeg_HWACCEL_LDFLAGS being a list
|
||||||
|
# whereas CMAKE_C_FLAGS (and likewise) is meant to NOT be a list, but rather
|
||||||
|
# an elongated piece of string
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${FFmpeg_MAKEFILE}
|
${FFmpeg_MAKEFILE}
|
||||||
@@ -261,10 +307,12 @@ else()
|
|||||||
--disable-avformat
|
--disable-avformat
|
||||||
--disable-doc
|
--disable-doc
|
||||||
--disable-everything
|
--disable-everything
|
||||||
|
--disable-autodetect
|
||||||
--disable-ffmpeg
|
--disable-ffmpeg
|
||||||
--disable-ffprobe
|
--disable-ffprobe
|
||||||
--disable-network
|
--disable-network
|
||||||
--disable-swresample
|
--disable-swresample
|
||||||
|
--disable-iconv
|
||||||
--enable-decoder=h264
|
--enable-decoder=h264
|
||||||
--enable-decoder=vp8
|
--enable-decoder=vp8
|
||||||
--enable-decoder=vp9
|
--enable-decoder=vp9
|
||||||
@@ -272,45 +320,40 @@ else()
|
|||||||
--enable-pic
|
--enable-pic
|
||||||
--cc=${FFmpeg_CC}
|
--cc=${FFmpeg_CC}
|
||||||
--cxx=${FFmpeg_CXX}
|
--cxx=${FFmpeg_CXX}
|
||||||
--ld=${CMAKE_LINKER}
|
|
||||||
--extra-cflags=${CMAKE_C_FLAGS}
|
--extra-cflags=${CMAKE_C_FLAGS}
|
||||||
--extra-cxxflags=${CMAKE_CXX_FLAGS}
|
--extra-cxxflags=${CMAKE_CXX_FLAGS}
|
||||||
--extra-ldflags=${CMAKE_C_LINK_FLAGS}
|
--extra-ldflags="${FFmpeg_HWACCEL_LDFLAGS}"
|
||||||
|
--host-cc=${FFmpeg_HOST_CC}
|
||||||
${FFmpeg_HWACCEL_FLAGS}
|
${FFmpeg_HWACCEL_FLAGS}
|
||||||
${FFmpeg_CROSS_COMPILE_FLAGS}
|
${FFmpeg_CROSS_COMPILE_FLAGS}
|
||||||
WORKING_DIRECTORY
|
WORKING_DIRECTORY
|
||||||
${FFmpeg_BUILD_DIR}
|
${FFmpeg_BUILD_DIR})
|
||||||
)
|
|
||||||
unset(FFmpeg_CC)
|
unset(FFmpeg_CC)
|
||||||
unset(FFmpeg_CXX)
|
unset(FFmpeg_CXX)
|
||||||
|
unset(FFmpeg_HOST_CC)
|
||||||
|
unset(FFmpeg_LD)
|
||||||
unset(FFmpeg_HWACCEL_FLAGS)
|
unset(FFmpeg_HWACCEL_FLAGS)
|
||||||
unset(FFmpeg_CROSS_COMPILE_FLAGS)
|
unset(FFmpeg_CROSS_COMPILE_FLAGS)
|
||||||
|
|
||||||
# Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
|
# Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
|
||||||
# with context of the jobserver. Also helps ninja users.
|
# with context of the jobserver. Also helps ninja users.
|
||||||
execute_process(
|
cmake_host_system_information(RESULT SYSTEM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
|
||||||
COMMAND
|
set(FFmpeg_MAKE_ARGS "")
|
||||||
nproc
|
if (DEFINED SYSTEM_THREADS)
|
||||||
OUTPUT_VARIABLE
|
set(FFmpeg_MAKE_ARGS -j ${SYSTEM_THREADS})
|
||||||
SYSTEM_THREADS)
|
endif()
|
||||||
|
|
||||||
set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
|
set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
|
||||||
|
|
||||||
# BSD make or Solaris make don't support ffmpeg make-j8
|
# Most distros use 'gmake', Arch uses 'make'
|
||||||
if (LINUX OR ANDROID OR APPLE OR WIN32 OR FREEBSD)
|
find_program(MAKE NAMES gmake make REQUIRED)
|
||||||
set(FFmpeg_MAKE_ARGS -j${SYSTEM_THREADS})
|
|
||||||
else()
|
|
||||||
set(FFmpeg_MAKE_ARGS "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${FFmpeg_BUILD_LIBRARIES}
|
${FFmpeg_BUILD_LIBRARIES}
|
||||||
COMMAND
|
COMMAND
|
||||||
gmake ${FFmpeg_MAKE_ARGS}
|
${MAKE} ${FFmpeg_MAKE_ARGS}
|
||||||
WORKING_DIRECTORY
|
WORKING_DIRECTORY
|
||||||
${FFmpeg_BUILD_DIR}
|
${FFmpeg_BUILD_DIR})
|
||||||
)
|
|
||||||
|
|
||||||
set(FFmpeg_INCLUDE_DIR
|
set(FFmpeg_INCLUDE_DIR
|
||||||
"${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}"
|
"${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}"
|
||||||
@@ -332,12 +375,10 @@ else()
|
|||||||
unset(FFmpeg_HWACCEL_INCLUDE_DIRS)
|
unset(FFmpeg_HWACCEL_INCLUDE_DIRS)
|
||||||
unset(FFmpeg_HWACCEL_LDFLAGS)
|
unset(FFmpeg_HWACCEL_LDFLAGS)
|
||||||
unset(FFmpeg_HWACCEL_LIBRARIES)
|
unset(FFmpeg_HWACCEL_LIBRARIES)
|
||||||
|
|
||||||
if (FFmpeg_FOUND)
|
|
||||||
message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "FFmpeg not found")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(FFmpeg_COMPONENTS)
|
unset(FFmpeg_COMPONENTS)
|
||||||
|
|
||||||
|
if (NOT FFmpeg_FOUND)
|
||||||
|
message(FATAL_ERROR "FFmpeg not found")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ add_library(
|
|||||||
uuid.cpp
|
uuid.cpp
|
||||||
uuid.h
|
uuid.h
|
||||||
vector_math.h
|
vector_math.h
|
||||||
|
zbic_compression.cpp
|
||||||
|
zbic_compression.h
|
||||||
zstd_compression.cpp
|
zstd_compression.cpp
|
||||||
zstd_compression.h
|
zstd_compression.h
|
||||||
fs/ryujinx_compat.h fs/ryujinx_compat.cpp
|
fs/ryujinx_compat.h fs/ryujinx_compat.cpp
|
||||||
@@ -147,6 +149,10 @@ add_library(
|
|||||||
net/net.h net/net.cpp
|
net/net.h net/net.cpp
|
||||||
container/unordered_map.h container/unordered_set.h)
|
container/unordered_map.h container/unordered_set.h)
|
||||||
|
|
||||||
|
set_source_files_properties(zbic_compression.cpp PROPERTIES
|
||||||
|
INCLUDE_DIRECTORIES "${ZBIC_INCLUDE_DIR}"
|
||||||
|
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:Clang,GNU>:-Wno-unused-function;-Wno-missing-declarations;-Wno-shadow>")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(common PRIVATE windows/timer_resolution.cpp
|
target_sources(common PRIVATE windows/timer_resolution.cpp
|
||||||
windows/timer_resolution.h)
|
windows/timer_resolution.h)
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "common/zbic_compression.h"
|
||||||
|
|
||||||
|
#define ZSTD_ZBIC_SUPPORT 1
|
||||||
|
#define ZSTDLIB_VISIBLE static
|
||||||
|
#define ZSTDLIB_HIDDEN static
|
||||||
|
#define ZSTDERRORLIB_VISIBLE static
|
||||||
|
#define ZSTDERRORLIB_HIDDEN static
|
||||||
|
#undef ZSTD_MULTITHREAD
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#undef _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "zstd.h"
|
||||||
|
#define g_ZSTD_threading_useless_symbol g_ZSTD_zbic_threading_useless_symbol
|
||||||
|
#include "zstd.c"
|
||||||
|
#undef g_ZSTD_threading_useless_symbol
|
||||||
|
|
||||||
|
namespace Common::Compression {
|
||||||
|
|
||||||
|
bool IsZBIC(std::span<const u8> src) {
|
||||||
|
if (src.size() < sizeof(u32)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
u32 magic = 0;
|
||||||
|
std::memcpy(&magic, src.data(), sizeof(u32));
|
||||||
|
return magic == ZSTD_MAGICNUMBER; // 0x4349425A ("ZBIC")
|
||||||
|
}
|
||||||
|
|
||||||
|
int DecompressDataZBIC(std::span<u8> dst, std::span<const u8> src) {
|
||||||
|
if (dst.empty() || src.empty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
const size_t res = ZSTD_decompress(dst.data(), dst.size(), src.data(), src.size());
|
||||||
|
if (ZSTD_isError(res)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return static_cast<int>(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Common::Compression
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <span>
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Common::Compression {
|
||||||
|
|
||||||
|
[[nodiscard]] bool IsZBIC(std::span<const u8> src);
|
||||||
|
|
||||||
|
[[nodiscard]] int DecompressDataZBIC(std::span<u8> dst, std::span<const u8> src);
|
||||||
|
|
||||||
|
} // namespace Common::Compression
|
||||||
+31
-4
@@ -7,12 +7,14 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <span>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "common/lz4_compression.h"
|
#include "common/lz4_compression.h"
|
||||||
|
#include "common/zbic_compression.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
@@ -104,11 +106,36 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::
|
|||||||
for (std::size_t i = 0; i < nso_header.segments.size(); ++i) {
|
for (std::size_t i = 0; i < nso_header.segments.size(); ++i) {
|
||||||
nso_file.Read(compressed_data.data(), nso_header.segments_compressed_size[i], nso_header.segments[i].offset);
|
nso_file.Read(compressed_data.data(), nso_header.segments_compressed_size[i], nso_header.segments[i].offset);
|
||||||
if (nso_header.IsSegmentCompressed(i)) {
|
if (nso_header.IsSegmentCompressed(i)) {
|
||||||
int r = Common::Compression::DecompressDataLZ4(decompressed_size.data(), nso_header.segments[i].size, compressed_data.data(), nso_header.segments_compressed_size[i]);
|
if (nso_header.IsZBICCompressed()) {
|
||||||
ASSERT(r == int(nso_header.segments[i].size));
|
// ZBIC compression
|
||||||
std::memcpy(codeset.memory.data() + module_start + nso_header.segments[i].location, decompressed_size.data(), nso_header.segments[i].size);
|
const int r = Common::Compression::DecompressDataZBIC(
|
||||||
|
std::span<u8>{decompressed_size}.first(nso_header.segments[i].size),
|
||||||
|
std::span<const u8>{compressed_data}.first(nso_header.segments_compressed_size[i])
|
||||||
|
);
|
||||||
|
ASSERT(r > 0);
|
||||||
|
} else {
|
||||||
|
// LZ4 compression
|
||||||
|
int r = Common::Compression::DecompressDataLZ4(
|
||||||
|
decompressed_size.data(),
|
||||||
|
nso_header.segments[i].size,
|
||||||
|
compressed_data.data(),
|
||||||
|
nso_header.segments_compressed_size[i]
|
||||||
|
);
|
||||||
|
ASSERT(r == int(nso_header.segments[i].size));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::memcpy(
|
||||||
|
codeset.memory.data() + module_start + nso_header.segments[i].location,
|
||||||
|
decompressed_size.data(),
|
||||||
|
nso_header.segments[i].size
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
std::memcpy(codeset.memory.data() + module_start + nso_header.segments[i].location, compressed_data.data(), nso_header.segments[i].size);
|
// Not compressed
|
||||||
|
std::memcpy(
|
||||||
|
codeset.memory.data() + module_start + nso_header.segments[i].location,
|
||||||
|
compressed_data.data(),
|
||||||
|
nso_header.segments[i].size
|
||||||
|
);
|
||||||
}
|
}
|
||||||
codeset.segments[i].addr = module_start + nso_header.segments[i].location;
|
codeset.segments[i].addr = module_start + nso_header.segments[i].location;
|
||||||
codeset.segments[i].offset = module_start + nso_header.segments[i].location;
|
codeset.segments[i].offset = module_start + nso_header.segments[i].location;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -58,6 +61,9 @@ struct NSOHeader {
|
|||||||
std::array<SHA256Hash, 3> segment_hashes;
|
std::array<SHA256Hash, 3> segment_hashes;
|
||||||
|
|
||||||
bool IsSegmentCompressed(size_t segment_num) const;
|
bool IsSegmentCompressed(size_t segment_num) const;
|
||||||
|
bool IsZBICCompressed() const {
|
||||||
|
return ((flags >> 7) & 1) != 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size.");
|
static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size.");
|
||||||
static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable.");
|
static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable.");
|
||||||
|
|||||||
+1
-1
@@ -757,7 +757,7 @@ struct Memory::Impl {
|
|||||||
};
|
};
|
||||||
auto& gpu = system.GPU();
|
auto& gpu = system.GPU();
|
||||||
gpu_device_memory->ApplyOpOnPointer(
|
gpu_device_memory->ApplyOpOnPointer(
|
||||||
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size, true); });
|
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size); });
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
|
|||||||
+3
-13
@@ -226,17 +226,7 @@ struct GPU::Impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Notify rasterizer that any caches of the specified region should be invalidated
|
/// Notify rasterizer that any caches of the specified region should be invalidated
|
||||||
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) {
|
void InvalidateRegion(DAddr addr, u64 size) {
|
||||||
VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer();
|
|
||||||
if (preserve_gpu_writes && rasterizer->MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) {
|
|
||||||
const u64 fence = RequestSyncOperation([rasterizer, addr, size] {
|
|
||||||
rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache);
|
|
||||||
rasterizer->OnCacheInvalidation(addr, size);
|
|
||||||
});
|
|
||||||
gpu_thread.TickGPU(is_async);
|
|
||||||
WaitForSyncOperation(fence);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gpu_thread.InvalidateRegion(addr, size);
|
gpu_thread.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,8 +518,8 @@ void GPU::FlushRegion(DAddr addr, u64 size) {
|
|||||||
impl->FlushRegion(addr, size);
|
impl->FlushRegion(addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) {
|
void GPU::InvalidateRegion(DAddr addr, u64 size) {
|
||||||
impl->InvalidateRegion(addr, size, preserve_gpu_writes);
|
impl->InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPU::OnCPUWrite(DAddr addr, u64 size) {
|
bool GPU::OnCPUWrite(DAddr addr, u64 size) {
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public:
|
|||||||
void FlushRegion(DAddr addr, u64 size);
|
void FlushRegion(DAddr addr, u64 size);
|
||||||
|
|
||||||
/// Notify rasterizer that any caches of the specified region should be invalidated
|
/// Notify rasterizer that any caches of the specified region should be invalidated
|
||||||
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes = false);
|
void InvalidateRegion(DAddr addr, u64 size);
|
||||||
|
|
||||||
/// Notify rasterizer that CPU is trying to write this area. It returns true if the area is
|
/// Notify rasterizer that CPU is trying to write this area. It returns true if the area is
|
||||||
/// sensible, false otherwise, addr and size must be a valid combination
|
/// sensible, false otherwise, addr and size must be a valid combination
|
||||||
|
|||||||
Reference in New Issue
Block a user