diff --git a/emulators/pcsx2/Makefile b/emulators/pcsx2/Makefile index ea43ee6b415c..800442c1f95e 100644 --- a/emulators/pcsx2/Makefile +++ b/emulators/pcsx2/Makefile @@ -1,7 +1,6 @@ PORTNAME= pcsx2 -PORTVERSION= 1.7.4970 +PORTVERSION= 1.7.5698 DISTVERSIONPREFIX= v -PORTREVISION= 2 CATEGORIES= emulators MAINTAINER= martymac@FreeBSD.org @@ -15,15 +14,20 @@ ONLY_FOR_ARCHS= amd64 # Notes on dependencies (see cmake/SearchForStuff.cmake): # - glad comes from 3rdparty/ (conflicts with libglvnd) -# - fmt, rapidyaml, soundtouch, zydis, zstd, libzip +# - fmt, rapidyaml, soundtouch, zydis, libzip # are always included from 3rdparty/ LIB_DEPENDS= libpng.so:graphics/png \ + libzstd.so:archivers/zstd \ + liblz4.so:archivers/liblz4 \ + libwebp.so:graphics/webp \ + libfreetype.so:print/freetype2 \ libdbus-1.so:devel/dbus \ libavcodec.so:multimedia/ffmpeg \ libavformat.so:multimedia/ffmpeg \ libavutil.so:multimedia/ffmpeg \ libswresample.so:multimedia/ffmpeg \ libswscale.so:multimedia/ffmpeg \ + libshaderc_shared.so:graphics/shaderc \ libcurl.so:ftp/curl \ libpulse.so:audio/pulseaudio \ libjack.so:audio/jack \ @@ -34,7 +38,7 @@ LIB_DEPENDS= libpng.so:graphics/png \ BUILD_DEPENDS= vulkan-headers>0:graphics/vulkan-headers USES= cmake compiler:c++20-lang \ - desktop-file-utils elfctl gl pkgconfig qt:6 sdl xorg + desktop-file-utils elfctl gl jpeg pkgconfig qt:6 sdl xorg USE_GITHUB= yes GH_PROJECT= pcsx2 @@ -42,7 +46,7 @@ GH_PROJECT= pcsx2 USE_GL= egl USE_SDL= sdl2 -USE_XORG= ice x11 xcb xext xpm xrandr +USE_XORG= ice x11 xcb xext xpm xrandr xrender USE_QT= base tools ELF_FEATURES= +wxneeded:bin/pcsx2-qt @@ -71,7 +75,8 @@ PORTDOCS= Debugger.pdf GameIndex.pdf # because only necessary resources are installed there (e.g. no dx11 stuff) do-install: cd ${CONFIGURE_WRKSRC}/bin && \ - ${COPYTREE_SHARE} resources/ ${STAGEDIR}${DATADIR}/ + ${COPYTREE_SHARE} resources/ ${STAGEDIR}${DATADIR}/ && \ + ${RM} -rf ${STAGEDIR}${DATADIR}/resources/docs/ ${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/bin/pcsx2-qt \ ${STAGEDIR}${PREFIX}/bin/ ${INSTALL_DATA} ${WRKSRC}/pcsx2-qt/resources/icons/AppIcon64.png \ @@ -81,7 +86,7 @@ do-install: post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} && \ - ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/bin/docs/|} \ + ${INSTALL_DATA} ${PORTDOCS:S|^|${CONFIGURE_WRKSRC}/bin/resources/docs/|} \ ${STAGEDIR}${DOCSDIR} # For maintainer (do not forget to clean up Makefile.tuples afterwards to diff --git a/emulators/pcsx2/Makefile.tuples b/emulators/pcsx2/Makefile.tuples index e04f9da14434..247a817f4bc5 100644 --- a/emulators/pcsx2/Makefile.tuples +++ b/emulators/pcsx2/Makefile.tuples @@ -1,11 +1,7 @@ GH_TUPLE= \ - fmtlib:fmt:b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9:fmt/3rdparty/fmt/fmt \ - rtissera:libchdr:fec8ab94212cc65d9d9a62cb3da924f5830c04b0:libchdr/3rdparty/libchdr/libchdr \ + fmtlib:fmt:5cfd28d476c6859617878f951931b8ce7d36b9df:fmt/3rdparty/fmt/fmt \ biojppm:rapidyaml:213b201d264139cd1b887790197e08850af628e3:rapidyaml/3rdparty/rapidyaml/rapidyaml \ - KhronosGroup:glslang:c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5:glslang/3rdparty/glslang/glslang \ - KhronosGroup:Vulkan-Headers:9f4c61a31435a7a90a314fc68aeb386c92a09c0f:VulkanHeaders/3rdparty/vulkan-headers \ - facebook:zstd:e47e674cd09583ff0503f0f6defd6d23d8b718d3:zstd/3rdparty/zstd/zstd \ - RetroAchievements:rcheevos:3af1e2fc5188d6e932ee379942f4049ea877e648:rcheevos/3rdparty/rcheevos/rcheevos \ + KhronosGroup:Vulkan-Headers:19a863ccce773ff393b186329478b1eb1a519fd3:VulkanHeaders/3rdparty/vulkan-headers \ biojppm:c4core:d35c7c9bf370134595699d791e6ff8db018ddc8d:c4core/3rdparty/rapidyaml/rapidyaml/ext/c4core \ biojppm:cmake:371982300ff5a076d7c3199057ebed77bbe3472f:cmake/3rdparty/rapidyaml/rapidyaml/ext/c4core/cmake \ biojppm:debugbreak:5dcbe41d2bd4712c8014aa7e843723ad7b40fd74:debugbreak/3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/debugbreak \ diff --git a/emulators/pcsx2/distinfo b/emulators/pcsx2/distinfo index c1d43fa38f75..936f13913d5d 100644 --- a/emulators/pcsx2/distinfo +++ b/emulators/pcsx2/distinfo @@ -1,20 +1,12 @@ -TIMESTAMP = 1693509549 -SHA256 (pcsx2-pcsx2-v1.7.4970_GH0.tar.gz) = bfbb6ea26d749b5fe80d9275f33de5912f67c259bb255ad73df240fd5632c57c -SIZE (pcsx2-pcsx2-v1.7.4970_GH0.tar.gz) = 12536525 -SHA256 (fmtlib-fmt-b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9_GH0.tar.gz) = de3061d275cb5c09c30dd809fcb425dce5bfd1dededcb272231263c95de05c61 -SIZE (fmtlib-fmt-b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9_GH0.tar.gz) = 826246 -SHA256 (rtissera-libchdr-fec8ab94212cc65d9d9a62cb3da924f5830c04b0_GH0.tar.gz) = 8b87f1a2b22de38c9fb1675137c8f19743105b8373ad8ca70ecf03a639e04fcf -SIZE (rtissera-libchdr-fec8ab94212cc65d9d9a62cb3da924f5830c04b0_GH0.tar.gz) = 1748513 +TIMESTAMP = 1712866618 +SHA256 (pcsx2-pcsx2-v1.7.5698_GH0.tar.gz) = f99cf06c78f96b540bc7a27d13d830fe048b110a6202e78e8ec6a9987b0045f7 +SIZE (pcsx2-pcsx2-v1.7.5698_GH0.tar.gz) = 13889267 +SHA256 (fmtlib-fmt-5cfd28d476c6859617878f951931b8ce7d36b9df_GH0.tar.gz) = e15cac38b42b4c6800a03b9a21fc3c461fb631cc312e60b04b96ee441bd7bf92 +SIZE (fmtlib-fmt-5cfd28d476c6859617878f951931b8ce7d36b9df_GH0.tar.gz) = 849171 SHA256 (biojppm-rapidyaml-213b201d264139cd1b887790197e08850af628e3_GH0.tar.gz) = c206d4565ccfa721991a8df90821d1a1f747e68385a0f3f5b9ab995e191c06be SIZE (biojppm-rapidyaml-213b201d264139cd1b887790197e08850af628e3_GH0.tar.gz) = 446070 -SHA256 (KhronosGroup-glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5_GH0.tar.gz) = 9ed562b906c3480b29730e46eb1536af2c82ae6a59d4d2ac93b7e764a2896372 -SIZE (KhronosGroup-glslang-c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5_GH0.tar.gz) = 3433325 -SHA256 (KhronosGroup-Vulkan-Headers-9f4c61a31435a7a90a314fc68aeb386c92a09c0f_GH0.tar.gz) = 682e0be6805949da18c5cacbad878493984d3aaf5ac1fbd968d285da78d44ae5 -SIZE (KhronosGroup-Vulkan-Headers-9f4c61a31435a7a90a314fc68aeb386c92a09c0f_GH0.tar.gz) = 1554220 -SHA256 (facebook-zstd-e47e674cd09583ff0503f0f6defd6d23d8b718d3_GH0.tar.gz) = 2a7b7e5d3f8c759894f0fea9917a590733600574d20cb53f3be827c7c62862e1 -SIZE (facebook-zstd-e47e674cd09583ff0503f0f6defd6d23d8b718d3_GH0.tar.gz) = 1952167 -SHA256 (RetroAchievements-rcheevos-3af1e2fc5188d6e932ee379942f4049ea877e648_GH0.tar.gz) = 2350d4479a9ca725a269eee5c1aeccf3e54ea2cf7bf9dd82bd0f07c59f96f5bd -SIZE (RetroAchievements-rcheevos-3af1e2fc5188d6e932ee379942f4049ea877e648_GH0.tar.gz) = 541818 +SHA256 (KhronosGroup-Vulkan-Headers-19a863ccce773ff393b186329478b1eb1a519fd3_GH0.tar.gz) = a3ea48206d391a182ebcf5532e889706b5003b0b3a8d2cfed355eb59ae715ead +SIZE (KhronosGroup-Vulkan-Headers-19a863ccce773ff393b186329478b1eb1a519fd3_GH0.tar.gz) = 2172059 SHA256 (biojppm-c4core-d35c7c9bf370134595699d791e6ff8db018ddc8d_GH0.tar.gz) = b768c8fb5dd4740317b7e1a3e43a0b32615d4d4e1e974d7ab515a80d2f1f318d SIZE (biojppm-c4core-d35c7c9bf370134595699d791e6ff8db018ddc8d_GH0.tar.gz) = 262210 SHA256 (biojppm-cmake-371982300ff5a076d7c3199057ebed77bbe3472f_GH0.tar.gz) = 1d3ded3a552a5993c8ebe5059a9829e0e26ae4f4780c179a11882d25da203de6 diff --git a/emulators/pcsx2/files/extra-patch-no-march-minimum-req b/emulators/pcsx2/files/extra-patch-no-march-minimum-req index 6e560dbe56c1..2053af67eee4 100644 --- a/emulators/pcsx2/files/extra-patch-no-march-minimum-req +++ b/emulators/pcsx2/files/extra-patch-no-march-minimum-req @@ -1,11 +1,11 @@ ---- cmake/BuildParameters.cmake.orig 2023-06-25 15:34:40 UTC +--- cmake/BuildParameters.cmake.orig 2024-04-10 06:59:09 UTC +++ cmake/BuildParameters.cmake -@@ -120,7 +120,7 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64") - endif() +@@ -95,7 +95,7 @@ if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64" else() - #set(ARCH_FLAG "-march=native -fabi-version=6") -- set(ARCH_FLAG "-march=native") -+ set(ARCH_FLAG "-march=penryn") + # Can't use march=native on Apple Silicon. + if(NOT APPLE OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64") +- add_compile_options("-march=native") ++ add_compile_options("-march=penryn") + endif() endif() endif() - list(APPEND PCSX2_DEFS _ARCH_64=1 _M_X86=1) diff --git a/emulators/pcsx2/files/extra-patch-no-march-native b/emulators/pcsx2/files/extra-patch-no-march-native index ea0b7c821181..7aca6fd847bb 100644 --- a/emulators/pcsx2/files/extra-patch-no-march-native +++ b/emulators/pcsx2/files/extra-patch-no-march-native @@ -1,11 +1,11 @@ ---- cmake/BuildParameters.cmake.orig 2023-06-25 15:34:40 UTC +--- cmake/BuildParameters.cmake.orig 2024-04-10 06:59:09 UTC +++ cmake/BuildParameters.cmake -@@ -120,7 +120,7 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64") - endif() +@@ -95,7 +95,7 @@ if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64" else() - #set(ARCH_FLAG "-march=native -fabi-version=6") -- set(ARCH_FLAG "-march=native") -+ #set(ARCH_FLAG "-march=native") + # Can't use march=native on Apple Silicon. + if(NOT APPLE OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64") +- add_compile_options("-march=native") ++ #add_compile_options("-march=native") + endif() endif() endif() - list(APPEND PCSX2_DEFS _ARCH_64=1 _M_X86=1) diff --git a/emulators/pcsx2/files/patch-3rdparty-cpuinfo.txt b/emulators/pcsx2/files/patch-3rdparty-cpuinfo.txt new file mode 100644 index 000000000000..33793354456d --- /dev/null +++ b/emulators/pcsx2/files/patch-3rdparty-cpuinfo.txt @@ -0,0 +1,609 @@ +From: https://github.com/pytorch/cpuinfo/pull/230 + +--- 3rdparty/cpuinfo/CMakeLists.txt.orig 2024-04-10 11:18:05 UTC ++++ 3rdparty/cpuinfo/CMakeLists.txt +@@ -67,6 +67,9 @@ SET(CPUINFO_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR + + # -- [ Determine target processor + SET(CPUINFO_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") ++IF(CPUINFO_TARGET_PROCESSOR STREQUAL "amd64") ++ SET(CPUINFO_TARGET_PROCESSOR "AMD64") ++ENDIF() + IF(IS_APPLE_OS AND CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64.*)$") + SET(CPUINFO_TARGET_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}") + ELSEIF(CMAKE_GENERATOR MATCHES "^Visual Studio " AND CMAKE_VS_PLATFORM_NAME) +@@ -105,7 +108,7 @@ IF(NOT CMAKE_SYSTEM_NAME) + "Target operating system is not specified. " + "cpuinfo will compile, but cpuinfo_initialize() will always fail.") + SET(CPUINFO_SUPPORTED_PLATFORM FALSE) +-ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS|Darwin|Linux|Android)$") ++ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS|Darwin|Linux|Android|FreeBSD)$") + IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14" AND NOT IS_APPLE_OS) + MESSAGE(WARNING + "Target operating system \"${CMAKE_SYSTEM_NAME}\" is not supported in cpuinfo. " +@@ -178,6 +181,8 @@ IF(CPUINFO_SUPPORTED_PLATFORM) + LIST(APPEND CPUINFO_SRCS src/x86/mach/init.c) + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS)$") + LIST(APPEND CPUINFO_SRCS src/x86/windows/init.c) ++ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ LIST(APPEND CPUINFO_SRCS src/x86/freebsd/init.c) + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^Windows" AND CPUINFO_TARGET_PROCESSOR MATCHES "^(ARM64|arm64)$") + LIST(APPEND CPUINFO_SRCS +@@ -234,9 +239,11 @@ IF(CPUINFO_SUPPORTED_PLATFORM) + src/linux/processors.c) + ELSEIF(IS_APPLE_OS) + LIST(APPEND CPUINFO_SRCS src/mach/topology.c) ++ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ LIST(APPEND CPUINFO_SRCS src/freebsd/topology.c) + ENDIF() + +- IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") ++ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) + SET(THREADS_PREFER_PTHREAD_FLAG TRUE) + FIND_PACKAGE(Threads REQUIRED) +@@ -301,6 +308,9 @@ IF(CPUINFO_SUPPORTED_PLATFORM) + TARGET_LINK_LIBRARIES(cpuinfo_internals PUBLIC ${CMAKE_THREAD_LIBS_INIT}) + TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE _GNU_SOURCE=1) + TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE _GNU_SOURCE=1) ++ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ TARGET_LINK_LIBRARIES(cpuinfo PUBLIC ${CMAKE_THREAD_LIBS_INIT}) ++ TARGET_LINK_LIBRARIES(cpuinfo_internals PUBLIC ${CMAKE_THREAD_LIBS_INIT}) + ENDIF() + ELSE() + TARGET_COMPILE_DEFINITIONS(cpuinfo INTERFACE CPUINFO_SUPPORTED_PLATFORM=0) +--- 3rdparty/cpuinfo/src/cpuinfo/internal-api.h.orig 2024-04-10 11:18:05 UTC ++++ 3rdparty/cpuinfo/src/cpuinfo/internal-api.h +@@ -50,6 +50,7 @@ CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void); + + CPUINFO_PRIVATE void cpuinfo_x86_mach_init(void); + CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void); ++CPUINFO_PRIVATE void cpuinfo_x86_freebsd_init(void); + #if defined(_WIN32) || defined(__CYGWIN__) + #if CPUINFO_ARCH_ARM64 + CPUINFO_PRIVATE BOOL CALLBACK cpuinfo_arm_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context); +--- 3rdparty/cpuinfo/src/freebsd/api.h.orig 2024-04-18 10:56:32 UTC ++++ 3rdparty/cpuinfo/src/freebsd/api.h +@@ -0,0 +1,12 @@ ++#pragma once ++ ++#include ++ ++struct cpuinfo_freebsd_topology { ++ uint32_t packages; ++ uint32_t cores; ++ uint32_t threads; ++ uint32_t threads_per_core; ++}; ++ ++struct cpuinfo_freebsd_topology cpuinfo_freebsd_detect_topology(void); +--- 3rdparty/cpuinfo/src/freebsd/topology.c.orig 2024-04-18 10:56:32 UTC ++++ 3rdparty/cpuinfo/src/freebsd/topology.c +@@ -0,0 +1,110 @@ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++static int sysctl_int(const char *name) { ++ int value = 0; ++ size_t value_size = sizeof(value); ++ if (sysctlbyname(name, &value, &value_size, NULL, 0) != 0) { ++ cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, ++ strerror(errno)); ++ } else if (value <= 0) { ++ cpuinfo_log_error( ++ "sysctlbyname(\"%s\") returned invalid value %d %zu", name, ++ value, value_size); ++ value = 0; ++ } ++ return value; ++} ++ ++static char *sysctl_str(const char *name) { ++ size_t value_size = 0; ++ if (sysctlbyname(name, NULL, &value_size, NULL, 0) != 0) { ++ cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, ++ strerror(errno)); ++ } else if (value_size <= 0) { ++ cpuinfo_log_error( ++ "sysctlbyname(\"%s\") returned invalid value size %zu", ++ name, value_size); ++ } ++ value_size += 1; ++ char *value = calloc(value_size, 1); ++ if (!value) { ++ cpuinfo_log_error("calloc %zu bytes failed", value_size); ++ return NULL; ++ } ++ if (sysctlbyname(name, value, &value_size, NULL, 0) != 0) { ++ cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", name, ++ strerror(errno)); ++ free(value); ++ return NULL; ++ } ++ return value; ++} ++ ++struct cpuinfo_freebsd_topology cpuinfo_freebsd_detect_topology(void) { ++ struct cpuinfo_freebsd_topology topology = { ++ .packages = 0, ++ .cores = 0, ++ .threads_per_core = 0, ++ .threads = 0, ++ }; ++ char *topology_spec = sysctl_str("kern.sched.topology_spec"); ++ if (!topology_spec) { ++ return topology; ++ } ++ const char *group_tag = ""; ++ char *p = strstr(topology_spec, group_tag); ++ while (p) { ++ const char *cpu_tag = "cpu count=\""; ++ char *q = strstr(p, cpu_tag); ++ if (q) { ++ p = q + strlen(cpu_tag); ++ topology.packages += atoi(p); ++ } else { ++ break; ++ } ++ } ++ if (topology.packages == 0) { ++ const char *group_tag = " ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++static inline uint32_t max(uint32_t a, uint32_t b) { return a > b ? a : b; } ++ ++static inline uint32_t bit_mask(uint32_t bits) { ++ return (UINT32_C(1) << bits) - UINT32_C(1); ++} ++ ++void cpuinfo_x86_freebsd_init(void) { ++ struct cpuinfo_processor *processors = NULL; ++ struct cpuinfo_core *cores = NULL; ++ struct cpuinfo_cluster *clusters = NULL; ++ struct cpuinfo_package *packages = NULL; ++ struct cpuinfo_cache *l1i = NULL; ++ struct cpuinfo_cache *l1d = NULL; ++ struct cpuinfo_cache *l2 = NULL; ++ struct cpuinfo_cache *l3 = NULL; ++ struct cpuinfo_cache *l4 = NULL; ++ ++ struct cpuinfo_freebsd_topology freebsd_topology = ++ cpuinfo_freebsd_detect_topology(); ++ if (freebsd_topology.packages == 0) { ++ cpuinfo_log_error("failed to detect topology"); ++ goto cleanup; ++ } ++ processors = ++ calloc(freebsd_topology.threads, sizeof(struct cpuinfo_processor)); ++ if (processors == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of %" PRIu32 ++ " logical processors", ++ freebsd_topology.threads * sizeof(struct cpuinfo_processor), ++ freebsd_topology.threads); ++ goto cleanup; ++ } ++ cores = calloc(freebsd_topology.cores, sizeof(struct cpuinfo_core)); ++ if (cores == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of %" PRIu32 ++ " cores", ++ freebsd_topology.cores * sizeof(struct cpuinfo_core), ++ freebsd_topology.cores); ++ goto cleanup; ++ } ++ /* On x86 a cluster of cores is the biggest group of cores that shares a ++ * cache. */ ++ clusters = ++ calloc(freebsd_topology.packages, sizeof(struct cpuinfo_cluster)); ++ if (clusters == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of %" PRIu32 ++ " core clusters", ++ freebsd_topology.packages * sizeof(struct cpuinfo_cluster), ++ freebsd_topology.packages); ++ goto cleanup; ++ } ++ packages = ++ calloc(freebsd_topology.packages, sizeof(struct cpuinfo_package)); ++ if (packages == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of %" PRIu32 ++ " physical packages", ++ freebsd_topology.packages * sizeof(struct cpuinfo_package), ++ freebsd_topology.packages); ++ goto cleanup; ++ } ++ ++ struct cpuinfo_x86_processor x86_processor; ++ memset(&x86_processor, 0, sizeof(x86_processor)); ++ cpuinfo_x86_init_processor(&x86_processor); ++ char brand_string[48]; ++ cpuinfo_x86_normalize_brand_string(x86_processor.brand_string, ++ brand_string); ++ ++ const uint32_t threads_per_core = freebsd_topology.threads_per_core; ++ const uint32_t threads_per_package = ++ freebsd_topology.threads / freebsd_topology.packages; ++ const uint32_t cores_per_package = ++ freebsd_topology.cores / freebsd_topology.packages; ++ for (uint32_t i = 0; i < freebsd_topology.packages; i++) { ++ clusters[i] = (struct cpuinfo_cluster){ ++ .processor_start = i * threads_per_package, ++ .processor_count = threads_per_package, ++ .core_start = i * cores_per_package, ++ .core_count = cores_per_package, ++ .cluster_id = 0, ++ .package = packages + i, ++ .vendor = x86_processor.vendor, ++ .uarch = x86_processor.uarch, ++ .cpuid = x86_processor.cpuid, ++ }; ++ packages[i].processor_start = i * threads_per_package; ++ packages[i].processor_count = threads_per_package; ++ packages[i].core_start = i * cores_per_package; ++ packages[i].core_count = cores_per_package; ++ packages[i].cluster_start = i; ++ packages[i].cluster_count = 1; ++ cpuinfo_x86_format_package_name(x86_processor.vendor, ++ brand_string, packages[i].name); ++ } ++ for (uint32_t i = 0; i < freebsd_topology.cores; i++) { ++ cores[i] = (struct cpuinfo_core){ ++ .processor_start = i * threads_per_core, ++ .processor_count = threads_per_core, ++ .core_id = i % cores_per_package, ++ .cluster = clusters + i / cores_per_package, ++ .package = packages + i / cores_per_package, ++ .vendor = x86_processor.vendor, ++ .uarch = x86_processor.uarch, ++ .cpuid = x86_processor.cpuid, ++ }; ++ } ++ for (uint32_t i = 0; i < freebsd_topology.threads; i++) { ++ const uint32_t smt_id = i % threads_per_core; ++ const uint32_t core_id = i / threads_per_core; ++ const uint32_t package_id = i / threads_per_package; ++ ++ /* Reconstruct APIC IDs from topology components */ ++ const uint32_t thread_bits_mask = ++ bit_mask(x86_processor.topology.thread_bits_length); ++ const uint32_t core_bits_mask = ++ bit_mask(x86_processor.topology.core_bits_length); ++ const uint32_t package_bits_offset = ++ max(x86_processor.topology.thread_bits_offset + ++ x86_processor.topology.thread_bits_length, ++ x86_processor.topology.core_bits_offset + ++ x86_processor.topology.core_bits_length); ++ const uint32_t apic_id = ++ ((smt_id & thread_bits_mask) ++ << x86_processor.topology.thread_bits_offset) | ++ ((core_id & core_bits_mask) ++ << x86_processor.topology.core_bits_offset) | ++ (package_id << package_bits_offset); ++ cpuinfo_log_debug("reconstructed APIC ID 0x%08" PRIx32 ++ " for thread %" PRIu32, ++ apic_id, i); ++ ++ processors[i].smt_id = smt_id; ++ processors[i].core = cores + i / threads_per_core; ++ processors[i].cluster = clusters + i / threads_per_package; ++ processors[i].package = packages + i / threads_per_package; ++ processors[i].apic_id = apic_id; ++ } ++ ++ uint32_t threads_per_l1 = 0, l1_count = 0; ++ if (x86_processor.cache.l1i.size != 0 || ++ x86_processor.cache.l1d.size != 0) { ++ /* Assume that threads on the same core share L1 */ ++ threads_per_l1 = ++ freebsd_topology.threads / freebsd_topology.cores; ++ cpuinfo_log_warning("freebsd kernel did not report number of " ++ "threads sharing L1 cache; assume %" PRIu32, ++ threads_per_l1); ++ l1_count = freebsd_topology.threads / threads_per_l1; ++ cpuinfo_log_debug("detected %" PRIu32 " L1 caches", l1_count); ++ } ++ ++ uint32_t threads_per_l2 = 0, l2_count = 0; ++ if (x86_processor.cache.l2.size != 0) { ++ if (x86_processor.cache.l3.size != 0) { ++ /* This is not a last-level cache; assume that threads ++ * on the same core share L2 */ ++ threads_per_l2 = ++ freebsd_topology.threads / freebsd_topology.cores; ++ } else { ++ /* This is a last-level cache; assume that threads on ++ * the same package share L2 */ ++ threads_per_l2 = freebsd_topology.threads / ++ freebsd_topology.packages; ++ } ++ cpuinfo_log_warning("freebsd kernel did not report number of " ++ "threads sharing L2 cache; assume %" PRIu32, ++ threads_per_l2); ++ l2_count = freebsd_topology.threads / threads_per_l2; ++ cpuinfo_log_debug("detected %" PRIu32 " L2 caches", l2_count); ++ } ++ ++ uint32_t threads_per_l3 = 0, l3_count = 0; ++ if (x86_processor.cache.l3.size != 0) { ++ /* ++ * Assume that threads on the same package share L3. ++ * However, is it not necessarily the last-level cache (there ++ * may be L4 cache as well) ++ */ ++ threads_per_l3 = ++ freebsd_topology.threads / freebsd_topology.packages; ++ cpuinfo_log_warning("freebsd kernel did not report number of " ++ "threads sharing L3 cache; assume %" PRIu32, ++ threads_per_l3); ++ l3_count = freebsd_topology.threads / threads_per_l3; ++ cpuinfo_log_debug("detected %" PRIu32 " L3 caches", l3_count); ++ } ++ ++ uint32_t threads_per_l4 = 0, l4_count = 0; ++ if (x86_processor.cache.l4.size != 0) { ++ /* ++ * Assume that all threads share this L4. ++ * As of now, L4 cache exists only on notebook x86 CPUs, which ++ * are single-package, but multi-socket systems could have ++ * shared L4 (like on IBM POWER8). ++ */ ++ threads_per_l4 = freebsd_topology.threads; ++ cpuinfo_log_warning("freebsd kernel did not report number of " ++ "threads sharing L4 cache; assume %" PRIu32, ++ threads_per_l4); ++ l4_count = freebsd_topology.threads / threads_per_l4; ++ cpuinfo_log_debug("detected %" PRIu32 " L4 caches", l4_count); ++ } ++ ++ if (x86_processor.cache.l1i.size != 0) { ++ l1i = calloc(l1_count, sizeof(struct cpuinfo_cache)); ++ if (l1i == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of " ++ "%" PRIu32 " L1I caches", ++ l1_count * sizeof(struct cpuinfo_cache), l1_count); ++ return; ++ } ++ for (uint32_t c = 0; c < l1_count; c++) { ++ l1i[c] = (struct cpuinfo_cache){ ++ .size = x86_processor.cache.l1i.size, ++ .associativity = ++ x86_processor.cache.l1i.associativity, ++ .sets = x86_processor.cache.l1i.sets, ++ .partitions = x86_processor.cache.l1i.partitions, ++ .line_size = x86_processor.cache.l1i.line_size, ++ .flags = x86_processor.cache.l1i.flags, ++ .processor_start = c * threads_per_l1, ++ .processor_count = threads_per_l1, ++ }; ++ } ++ for (uint32_t t = 0; t < freebsd_topology.threads; t++) { ++ processors[t].cache.l1i = &l1i[t / threads_per_l1]; ++ } ++ } ++ ++ if (x86_processor.cache.l1d.size != 0) { ++ l1d = calloc(l1_count, sizeof(struct cpuinfo_cache)); ++ if (l1d == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of " ++ "%" PRIu32 " L1D caches", ++ l1_count * sizeof(struct cpuinfo_cache), l1_count); ++ return; ++ } ++ for (uint32_t c = 0; c < l1_count; c++) { ++ l1d[c] = (struct cpuinfo_cache){ ++ .size = x86_processor.cache.l1d.size, ++ .associativity = ++ x86_processor.cache.l1d.associativity, ++ .sets = x86_processor.cache.l1d.sets, ++ .partitions = x86_processor.cache.l1d.partitions, ++ .line_size = x86_processor.cache.l1d.line_size, ++ .flags = x86_processor.cache.l1d.flags, ++ .processor_start = c * threads_per_l1, ++ .processor_count = threads_per_l1, ++ }; ++ } ++ for (uint32_t t = 0; t < freebsd_topology.threads; t++) { ++ processors[t].cache.l1d = &l1d[t / threads_per_l1]; ++ } ++ } ++ ++ if (l2_count != 0) { ++ l2 = calloc(l2_count, sizeof(struct cpuinfo_cache)); ++ if (l2 == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of " ++ "%" PRIu32 " L2 caches", ++ l2_count * sizeof(struct cpuinfo_cache), l2_count); ++ return; ++ } ++ for (uint32_t c = 0; c < l2_count; c++) { ++ l2[c] = (struct cpuinfo_cache){ ++ .size = x86_processor.cache.l2.size, ++ .associativity = ++ x86_processor.cache.l2.associativity, ++ .sets = x86_processor.cache.l2.sets, ++ .partitions = x86_processor.cache.l2.partitions, ++ .line_size = x86_processor.cache.l2.line_size, ++ .flags = x86_processor.cache.l2.flags, ++ .processor_start = c * threads_per_l2, ++ .processor_count = threads_per_l2, ++ }; ++ } ++ for (uint32_t t = 0; t < freebsd_topology.threads; t++) { ++ processors[t].cache.l2 = &l2[t / threads_per_l2]; ++ } ++ } ++ ++ if (l3_count != 0) { ++ l3 = calloc(l3_count, sizeof(struct cpuinfo_cache)); ++ if (l3 == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of " ++ "%" PRIu32 " L3 caches", ++ l3_count * sizeof(struct cpuinfo_cache), l3_count); ++ return; ++ } ++ for (uint32_t c = 0; c < l3_count; c++) { ++ l3[c] = (struct cpuinfo_cache){ ++ .size = x86_processor.cache.l3.size, ++ .associativity = ++ x86_processor.cache.l3.associativity, ++ .sets = x86_processor.cache.l3.sets, ++ .partitions = x86_processor.cache.l3.partitions, ++ .line_size = x86_processor.cache.l3.line_size, ++ .flags = x86_processor.cache.l3.flags, ++ .processor_start = c * threads_per_l3, ++ .processor_count = threads_per_l3, ++ }; ++ } ++ for (uint32_t t = 0; t < freebsd_topology.threads; t++) { ++ processors[t].cache.l3 = &l3[t / threads_per_l3]; ++ } ++ } ++ ++ if (l4_count != 0) { ++ l4 = calloc(l4_count, sizeof(struct cpuinfo_cache)); ++ if (l4 == NULL) { ++ cpuinfo_log_error( ++ "failed to allocate %zu bytes for descriptions of " ++ "%" PRIu32 " L4 caches", ++ l4_count * sizeof(struct cpuinfo_cache), l4_count); ++ return; ++ } ++ for (uint32_t c = 0; c < l4_count; c++) { ++ l4[c] = (struct cpuinfo_cache){ ++ .size = x86_processor.cache.l4.size, ++ .associativity = ++ x86_processor.cache.l4.associativity, ++ .sets = x86_processor.cache.l4.sets, ++ .partitions = x86_processor.cache.l4.partitions, ++ .line_size = x86_processor.cache.l4.line_size, ++ .flags = x86_processor.cache.l4.flags, ++ .processor_start = c * threads_per_l4, ++ .processor_count = threads_per_l4, ++ }; ++ } ++ for (uint32_t t = 0; t < freebsd_topology.threads; t++) { ++ processors[t].cache.l4 = &l4[t / threads_per_l4]; ++ } ++ } ++ ++ /* Commit changes */ ++ cpuinfo_processors = processors; ++ cpuinfo_cores = cores; ++ cpuinfo_clusters = clusters; ++ cpuinfo_packages = packages; ++ cpuinfo_cache[cpuinfo_cache_level_1i] = l1i; ++ cpuinfo_cache[cpuinfo_cache_level_1d] = l1d; ++ cpuinfo_cache[cpuinfo_cache_level_2] = l2; ++ cpuinfo_cache[cpuinfo_cache_level_3] = l3; ++ cpuinfo_cache[cpuinfo_cache_level_4] = l4; ++ ++ cpuinfo_processors_count = freebsd_topology.threads; ++ cpuinfo_cores_count = freebsd_topology.cores; ++ cpuinfo_clusters_count = freebsd_topology.packages; ++ cpuinfo_packages_count = freebsd_topology.packages; ++ cpuinfo_cache_count[cpuinfo_cache_level_1i] = l1_count; ++ cpuinfo_cache_count[cpuinfo_cache_level_1d] = l1_count; ++ cpuinfo_cache_count[cpuinfo_cache_level_2] = l2_count; ++ cpuinfo_cache_count[cpuinfo_cache_level_3] = l3_count; ++ cpuinfo_cache_count[cpuinfo_cache_level_4] = l4_count; ++ cpuinfo_max_cache_size = cpuinfo_compute_max_cache_size(&processors[0]); ++ ++ cpuinfo_global_uarch = (struct cpuinfo_uarch_info){ ++ .uarch = x86_processor.uarch, ++ .cpuid = x86_processor.cpuid, ++ .processor_count = freebsd_topology.threads, ++ .core_count = freebsd_topology.cores, ++ }; ++ ++ __sync_synchronize(); ++ ++ cpuinfo_is_initialized = true; ++ ++ processors = NULL; ++ cores = NULL; ++ clusters = NULL; ++ packages = NULL; ++ l1i = l1d = l2 = l3 = l4 = NULL; ++ ++cleanup: ++ free(processors); ++ free(cores); ++ free(clusters); ++ free(packages); ++ free(l1i); ++ free(l1d); ++ free(l2); ++ free(l3); ++ free(l4); ++} diff --git a/emulators/pcsx2/files/patch-3rdparty_glad_CMakeLists.txt b/emulators/pcsx2/files/patch-3rdparty_glad_CMakeLists.txt deleted file mode 100644 index 9d1c1702a30f..000000000000 --- a/emulators/pcsx2/files/patch-3rdparty_glad_CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -Help glad find local headers: -3rdparty/glad/include/glad_egl.h:212:10: fatal error: 'KHR/khrplatform.h' file not found - ---- 3rdparty/glad/CMakeLists.txt.orig 2022-09-02 10:21:30 UTC -+++ 3rdparty/glad/CMakeLists.txt -@@ -12,6 +12,7 @@ elseif(X11_API OR WAYLAND_API) - ) - endif() - -+target_include_directories(glad PRIVATE "${CMAKE_INSTALL_PREFIX}/include") - target_include_directories(glad PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") - target_include_directories(glad INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") - target_link_libraries(glad PRIVATE Threads::Threads "${CMAKE_DL_LIBS}") diff --git a/emulators/pcsx2/files/patch-pcsx2-qt-AutoUpdaterDialog.cpp b/emulators/pcsx2/files/patch-pcsx2-qt-AutoUpdaterDialog.cpp new file mode 100644 index 000000000000..1f1d3b91cdbb --- /dev/null +++ b/emulators/pcsx2/files/patch-pcsx2-qt-AutoUpdaterDialog.cpp @@ -0,0 +1,11 @@ +--- pcsx2-qt/AutoUpdaterDialog.cpp.orig 2024-04-11 09:34:32 UTC ++++ pcsx2-qt/AutoUpdaterDialog.cpp +@@ -892,7 +892,7 @@ void AutoUpdaterDialog::cleanupAfterUpdate() + + #else + +-bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data, QProgressDialog& progress) ++bool AutoUpdaterDialog::processUpdate(const std::vector& data, QProgressDialog&) + { + return false; + } diff --git a/emulators/pcsx2/files/patch-relocate-resources.txt b/emulators/pcsx2/files/patch-relocate-resources.txt index 316626ecb61f..f4b790db6a4c 100644 --- a/emulators/pcsx2/files/patch-relocate-resources.txt +++ b/emulators/pcsx2/files/patch-relocate-resources.txt @@ -1,23 +1,23 @@ Allow relocation of resource files ---- cmake/BuildParameters.cmake.orig 2023-11-10 10:14:25 UTC +--- cmake/BuildParameters.cmake.orig 2024-04-07 18:04:50 UTC +++ cmake/BuildParameters.cmake -@@ -259,6 +259,10 @@ endif() - list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE) - endif() +@@ -228,6 +228,10 @@ if(USE_CLANG AND TIMETRACE) -+if(DEFINED PCSX2_RESOURCES_PATH) -+ add_compile_definitions(PCSX2_RESOURCES_PATH="${PCSX2_RESOURCES_PATH}") + if(USE_CLANG AND TIMETRACE) + add_compile_options(-ftime-trace) +endif() + - #------------------------------------------------------------------------------- - # MacOS-specific things - #------------------------------------------------------------------------------- ---- pcsx2/Pcsx2Config.cpp.orig 2023-08-31 07:45:23 UTC -+++ pcsx2/Pcsx2Config.cpp -@@ -1676,6 +1676,10 @@ void EmuFolders::SetResourcesDirectory() ++if(DEFINED PCSX2_RESOURCES_PATH) ++ add_compile_definitions(PCSX2_RESOURCES_PATH="${PCSX2_RESOURCES_PATH}") + endif() - void EmuFolders::SetResourcesDirectory() + set(PCSX2_WARNINGS ${DEFAULT_WARNINGS}) +--- pcsx2/Pcsx2Config.cpp.orig 2024-04-10 11:22:25 UTC ++++ pcsx2/Pcsx2Config.cpp +@@ -1855,6 +1855,10 @@ bool EmuFolders::SetResourcesDirectory() + + bool EmuFolders::SetResourcesDirectory() { +#ifdef PCSX2_RESOURCES_PATH + // Resources' path specified at compile time @@ -26,11 +26,11 @@ Allow relocation of resource files #ifndef __APPLE__ // On Windows/Linux, these are in the binary directory. Resources = Path::Combine(AppRoot, "resources"); -@@ -1683,6 +1687,7 @@ void EmuFolders::SetResourcesDirectory() +@@ -1862,6 +1866,7 @@ bool EmuFolders::SetResourcesDirectory() // On macOS, this is in the bundle resources directory. Resources = Path::Canonicalize(Path::Combine(AppRoot, "../Resources")); #endif +#endif // PCSX2_RESOURCES_PATH - } - bool EmuFolders::ShouldUsePortableMode() + Console.WriteLnFmt("Resources Directory: {}", Resources); + diff --git a/emulators/pcsx2/pkg-plist b/emulators/pcsx2/pkg-plist index a41ea40a0052..eb1cef2681ba 100644 --- a/emulators/pcsx2/pkg-plist +++ b/emulators/pcsx2/pkg-plist @@ -1,6 +1,5 @@ bin/pcsx2-qt share/applications/PCSX2.desktop -share/pixmaps/PCSX2.png %%DATADIR%%/resources/GameIndex.yaml %%DATADIR%%/resources/RedumpDatabase.yaml %%DATADIR%%/resources/cover-placeholder.png @@ -8,8 +7,11 @@ share/pixmaps/PCSX2.png %%DATADIR%%/resources/fonts/Roboto-Regular.ttf %%DATADIR%%/resources/fonts/RobotoMono-Medium.ttf %%DATADIR%%/resources/fonts/fa-solid-900.ttf +%%DATADIR%%/resources/fonts/promptfont-license +%%DATADIR%%/resources/fonts/promptfont.otf %%DATADIR%%/resources/fullscreenui/applications-system.png %%DATADIR%%/resources/fullscreenui/media-cdrom.png +%%DATADIR%%/resources/fullscreenui/no-save.png %%DATADIR%%/resources/fullscreenui/placeholder.png %%DATADIR%%/resources/game_controller_db.txt %%DATADIR%%/resources/icons/AppIconLarge.png @@ -73,3 +75,4 @@ share/pixmaps/PCSX2.png %%DATADIR%%/resources/sounds/achievements/lbsubmit.wav %%DATADIR%%/resources/sounds/achievements/message.wav %%DATADIR%%/resources/sounds/achievements/unlock.wav +share/pixmaps/PCSX2.png