git: 47a713a505c4 - main - emulators/pcsx2: Update to 1.7.4075

From: Ganael LAPLANCHE <martymac_at_FreeBSD.org>
Date: Tue, 14 Feb 2023 11:27:56 UTC
The branch main has been updated by martymac:

URL: https://cgit.FreeBSD.org/ports/commit/?id=47a713a505c4386d91c1a32825fc638b5f201597

commit 47a713a505c4386d91c1a32825fc638b5f201597
Author:     Ganael LAPLANCHE <martymac@FreeBSD.org>
AuthorDate: 2023-02-14 11:26:55 +0000
Commit:     Ganael LAPLANCHE <martymac@FreeBSD.org>
CommitDate: 2023-02-14 11:27:46 +0000

    emulators/pcsx2: Update to 1.7.4075
    
    Also, switch to qt build as wx is not supported upstream anymore
---
 emulators/pcsx2/Makefile                           | 45 +++++++++------
 emulators/pcsx2/distinfo                           |  6 +-
 .../pcsx2/files/patch-common-Linux-LnxHostSys.cpp  | 29 +++-------
 .../pcsx2/files/patch-common-Linux-LnxMisc.cpp     | 11 ----
 .../pcsx2/files/patch-pcsx2-DEV9-ConfigUI.cpp      | 13 -----
 .../files/patch-pcsx2-Frontend-CommonHost.cpp      | 13 +++++
 emulators/pcsx2/files/patch-relocate-resources.txt | 36 ++++++++++++
 emulators/pcsx2/pkg-plist                          | 66 +++-------------------
 8 files changed, 96 insertions(+), 123 deletions(-)

diff --git a/emulators/pcsx2/Makefile b/emulators/pcsx2/Makefile
index 0348e11f5fdb..0f2b85b0774b 100644
--- a/emulators/pcsx2/Makefile
+++ b/emulators/pcsx2/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	pcsx2
-PORTVERSION=	1.7.3465
-PORTREVISION=	1
+PORTVERSION=	1.7.4075
 CATEGORIES=	emulators
 
 MAINTAINER=	martymac@FreeBSD.org
@@ -16,6 +15,7 @@ ONLY_FOR_ARCHS=	amd64
 # - rapidyaml (and c4core) come from 3rdparty/ (0.4.0 is needed)
 # - glad comes from 3rdparty/ (conflicts with libglvnd)
 # - zstd comes from 3rdparty/ (not detected yet)
+# - zydis comes from 3rdparty/
 LIB_DEPENDS=	libpng.so:graphics/png \
 		libpulse.so:audio/pulseaudio \
 		libSoundTouch.so:audio/soundtouch \
@@ -24,12 +24,13 @@ LIB_DEPENDS=	libpng.so:graphics/png \
 		libzip.so:archivers/libzip \
 		libpulse.so:audio/pulseaudio \
 		libjack.so:audio/jack \
-		libsndio.so:audio/sndio
+		libsndio.so:audio/sndio \
+		libcurl.so:ftp/curl
 #		libryml.so:devel/rapidyaml \
 #		libglad.so:graphics/glad \
 #		libzstd.so:archivers/zstd
 
-USES=		cmake desktop-file-utils gl gnome pkgconfig sdl xorg
+USES=		cmake desktop-file-utils gl pkgconfig qt:6 sdl xorg
 
 USE_GITHUB=	yes
 GH_PROJECT=	pcsx2
@@ -37,29 +38,39 @@ GH_TAGNAME=	v${PORTVERSION}
 .include "${.CURDIR}/Makefile.tuples"
 
 USE_GL=		egl
-USE_GNOME=	glib20 gtk30
 USE_SDL=	sdl2
 USE_XORG=	ice x11 xcb xext xpm xrandr
-USE_WX=		3.0+
+USE_QT=		base tools
 
 # See: cmake/BuildParameters.cmake
 CMAKE_ARGS+=	\
 		-DCMAKE_REQUIRED_INCLUDES:STRING=${LOCALBASE}/include/ \
-		-DCMAKE_INSTALL_DOCDIR=${DOCSDIR} \
-		-DPACKAGE_MODE:BOOL=ON \
-		-DQT_BUILD:BOOL=OFF \
+		-DQT_BUILD:BOOL=ON \
 		-DUSE_VTUNE:BOOL=OFF \
 		-DUSE_VULKAN:BOOL=OFF \
 		-DENABLE_TESTS:BOOL=OFF \
-		-DDISABLE_PCSX2_WRAPPER:BOOL=ON \
-		-DDISABLE_SETCAP:BOOL=ON
-DATADIR=	${PREFIX}/share/PCSX2
+		-DPCSX2_RESOURCES_PATH:STRING=${DATADIR}/resources
 
-OPTIONS_DEFINE=	DOCS NLS
-OPTIONS_SUB=	yes
-NLS_USES=	gettext
-NLS_CMAKE_ON=	-DNO_TRANSLATION:BOOL=OFF
-NLS_CMAKE_OFF=	-DNO_TRANSLATION:BOOL=ON
+OPTIONS_DEFINE=	DOCS
+PORTDOCS=	Debugger.pdf GameIndex.pdf PCSX2_FAQ.pdf
+
+# - Program and resources are copied from target dir ${CONFIGURE_WRKSRC}/bin
+#   because only necessary resources are installed there (e.g. no dx11 stuff)
+do-install:
+	cd ${CONFIGURE_WRKSRC}/bin && \
+		${COPYTREE_SHARE} resources/ ${STAGEDIR}${DATADIR}/
+	${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/bin/pcsx2-qt \
+		${STAGEDIR}${PREFIX}/bin/
+	${INSTALL_DATA} ${WRKSRC}/pcsx2/Resources/AppIcon64.png \
+		${STAGEDIR}${PREFIX}/share/pixmaps/PCSX2.png
+	${INSTALL_DATA} ${WRKSRC}/.github/workflows/scripts/linux/pcsx2-qt.desktop \
+		${STAGEDIR}${PREFIX}/share/applications/PCSX2.desktop
+	${INSTALL_MAN} ${WRKSRC}/bin/docs/PCSX2.1 ${STAGEDIR}${MANPREFIX}/man/man1/
+
+post-install-DOCS-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR} && \
+		${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/bin/docs/|} \
+			${STAGEDIR}${DOCSDIR}
 
 # For maintainer (do not forget to clean up Makefile.tuples afterwards to
 # remove useless submodules)
diff --git a/emulators/pcsx2/distinfo b/emulators/pcsx2/distinfo
index ee4f71df4910..46af9a781096 100644
--- a/emulators/pcsx2/distinfo
+++ b/emulators/pcsx2/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1666812447
-SHA256 (pcsx2-pcsx2-1.7.3465-v1.7.3465_GH0.tar.gz) = 749cc1b10d5bffe41ecf56b7765e008a6b166e38f016480b8fd570b8eedd88bb
-SIZE (pcsx2-pcsx2-1.7.3465-v1.7.3465_GH0.tar.gz) = 19918248
+TIMESTAMP = 1676320977
+SHA256 (pcsx2-pcsx2-1.7.4075-v1.7.4075_GH0.tar.gz) = f4101a0fa703ebc0ff52c4d4bb017c536f97af6ef6907a429512e47f1cc593b6
+SIZE (pcsx2-pcsx2-1.7.4075-v1.7.4075_GH0.tar.gz) = 9193940
 SHA256 (rtissera-libchdr-5de1a59019815ccdbba0fe07c71b31406d023248_GH0.tar.gz) = e0df9f88cd93e673d384cbf7cf28ea396aba96c769b41ec149a259768b27b00c
 SIZE (rtissera-libchdr-5de1a59019815ccdbba0fe07c71b31406d023248_GH0.tar.gz) = 414409
 SHA256 (biojppm-rapidyaml-213b201d264139cd1b887790197e08850af628e3_GH0.tar.gz) = c206d4565ccfa721991a8df90821d1a1f747e68385a0f3f5b9ab995e191c06be
diff --git a/emulators/pcsx2/files/patch-common-Linux-LnxHostSys.cpp b/emulators/pcsx2/files/patch-common-Linux-LnxHostSys.cpp
index 726f5dd334f7..848b8a424690 100644
--- a/emulators/pcsx2/files/patch-common-Linux-LnxHostSys.cpp
+++ b/emulators/pcsx2/files/patch-common-Linux-LnxHostSys.cpp
@@ -1,24 +1,11 @@
---- common/Linux/LnxHostSys.cpp.orig	2022-10-20 13:57:30 UTC
+--- common/Linux/LnxHostSys.cpp.orig	2023-02-10 03:43:10 UTC
 +++ common/Linux/LnxHostSys.cpp
-@@ -153,7 +153,12 @@ void HostSys::MemProtect(void* baseaddr, size_t size, 
- std::string HostSys::GetFileMappingName(const char* prefix)
- {
- 	const unsigned pid = static_cast<unsigned>(getpid());
-+#if defined(__FreeBSD__)
-+	// FreeBSD's shm_open(3) requires name to be absolute
-+	return fmt::format("/tmp/{}_{}", prefix, pid);
-+#else
- 	return fmt::format("{}_{}", prefix, pid);
-+#endif
- }
+@@ -100,6 +100,8 @@ static void SysPageFaultSignalFilter(int signal, sigin
  
- void* HostSys::CreateSharedMemory(const char* name, size_t size)
-@@ -169,7 +174,7 @@ void* HostSys::CreateSharedMemory(const char* name, si
- 	shm_unlink(name);
- 
- 	// ensure it's the correct size
--#ifndef __APPLE__
-+#if !defined(__APPLE__) && !defined(__FreeBSD__)
- 	if (ftruncate64(fd, static_cast<off64_t>(size)) < 0)
+ #if defined(__APPLE__) && defined(__x86_64__)
+ 	void* const exception_pc = reinterpret_cast<void*>(static_cast<ucontext_t*>(ctx)->uc_mcontext->__ss.__rip);
++#elif defined(__FreeBSD__) && defined(__x86_64__)
++	void* const exception_pc = reinterpret_cast<void*>(static_cast<ucontext_t*>(ctx)->uc_mcontext.mc_rip);
+ #elif defined(__x86_64__)
+ 	void* const exception_pc = reinterpret_cast<void*>(static_cast<ucontext_t*>(ctx)->uc_mcontext.gregs[REG_RIP]);
  #else
- 	if (ftruncate(fd, static_cast<off_t>(size)) < 0)
diff --git a/emulators/pcsx2/files/patch-common-Linux-LnxMisc.cpp b/emulators/pcsx2/files/patch-common-Linux-LnxMisc.cpp
deleted file mode 100644
index 95208b965839..000000000000
--- a/emulators/pcsx2/files/patch-common-Linux-LnxMisc.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- common/Linux/LnxMisc.cpp.orig	2022-10-20 13:57:30 UTC
-+++ common/Linux/LnxMisc.cpp
-@@ -72,6 +72,8 @@ std::string GetOSVersionString()
- 
- static bool SetScreensaverInhibitX11(const WindowInfo& wi, bool inhibit)
- {
-+	extern char **environ;
-+
- 	const char* command = "xdg-screensaver";
- 	const char* operation = inhibit ? "suspend" : "resume";
- 	std::string id = fmt::format("0x{:X}", static_cast<u64>(reinterpret_cast<uintptr_t>(wi.window_handle)));
diff --git a/emulators/pcsx2/files/patch-pcsx2-DEV9-ConfigUI.cpp b/emulators/pcsx2/files/patch-pcsx2-DEV9-ConfigUI.cpp
deleted file mode 100644
index 4a8f5c3b5f60..000000000000
--- a/emulators/pcsx2/files/patch-pcsx2-DEV9-ConfigUI.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-Fix crash when clicking on "Network and HDD Settings"
-
---- pcsx2/DEV9/ConfigUI.cpp.orig	2022-10-20 13:57:30 UTC
-+++ pcsx2/DEV9/ConfigUI.cpp
-@@ -366,7 +366,7 @@ class DEV9Dialog : public wxDialog (public)
- 		m_eth_adapter->SetSelection(selection);
- 		// Update minimum sizes for the possibly increased dropdown size
- 		// Nothing else seems to update the minimum size of the window
--		SetSizerAndFit(GetSizer(), false);
-+		// SetSizerAndFit(GetSizer(), false);
- 	}
- 
- 	void OnCheck(wxCommandEvent&)
diff --git a/emulators/pcsx2/files/patch-pcsx2-Frontend-CommonHost.cpp b/emulators/pcsx2/files/patch-pcsx2-Frontend-CommonHost.cpp
new file mode 100644
index 000000000000..f6516815a51e
--- /dev/null
+++ b/emulators/pcsx2/files/patch-pcsx2-Frontend-CommonHost.cpp
@@ -0,0 +1,13 @@
+Handle config path on FreeBSD
+
+--- pcsx2/Frontend/CommonHost.cpp.orig	2023-02-10 03:43:10 UTC
++++ pcsx2/Frontend/CommonHost.cpp
+@@ -160,7 +160,7 @@ void CommonHost::SetDataDirectory()
+ 			EmuFolders::DataRoot = Path::Combine(StringUtil::WideStringToUTF8String(documents_directory), "PCSX2");
+ 		CoTaskMemFree(documents_directory);
+ 	}
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(__FreeBSD__)
+ 	// Use $XDG_CONFIG_HOME/PCSX2 if it exists.
+ 	const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
+ 	if (xdg_config_home && Path::IsAbsolute(xdg_config_home))
diff --git a/emulators/pcsx2/files/patch-relocate-resources.txt b/emulators/pcsx2/files/patch-relocate-resources.txt
new file mode 100644
index 000000000000..1339fab26c1d
--- /dev/null
+++ b/emulators/pcsx2/files/patch-relocate-resources.txt
@@ -0,0 +1,36 @@
+Allow relocation of resource files
+
+--- cmake/BuildParameters.cmake.orig	2023-02-10 03:43:10 UTC
++++ cmake/BuildParameters.cmake
+@@ -260,6 +260,10 @@
+ 	list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE)
+ endif()
+ 
++if(DEFINED PCSX2_RESOURCES_PATH)
++    add_compile_definitions(PCSX2_RESOURCES_PATH="${PCSX2_RESOURCES_PATH}")
++endif()
++
+ #-------------------------------------------------------------------------------
+ # MacOS-specific things
+ #-------------------------------------------------------------------------------
+--- pcsx2/Frontend/CommonHost.cpp.orig	2023-02-10 03:43:10 UTC
++++ pcsx2/Frontend/CommonHost.cpp
+@@ -128,6 +128,10 @@
+ 
+ void CommonHost::SetResourcesDirectory()
+ {
++#ifdef PCSX2_RESOURCES_PATH
++	// Resources' path specified at compile time
++	EmuFolders::Resources = Path::Canonicalize(PCSX2_RESOURCES_PATH);
++#else
+ #ifndef __APPLE__
+ 	// On Windows/Linux, these are in the binary directory.
+ 	EmuFolders::Resources = Path::Combine(EmuFolders::AppRoot, "resources");
+@@ -135,6 +139,7 @@
+ 	// On macOS, this is in the bundle resources directory.
+ 	EmuFolders::Resources = Path::Canonicalize(Path::Combine(EmuFolders::AppRoot, "../Resources"));
+ #endif
++#endif // PCSX2_RESOURCES_PATH
+ }
+ 
+ bool CommonHost::ShouldUsePortableMode()
diff --git a/emulators/pcsx2/pkg-plist b/emulators/pcsx2/pkg-plist
index f965d9edcde4..b9a4c78bf633 100644
--- a/emulators/pcsx2/pkg-plist
+++ b/emulators/pcsx2/pkg-plist
@@ -1,4 +1,7 @@
-bin/pcsx2
+bin/pcsx2-qt
+man/man1/PCSX2.1.gz
+share/applications/PCSX2.desktop
+share/pixmaps/PCSX2.png
 %%DATADIR%%/resources/GameIndex.yaml
 %%DATADIR%%/resources/cover-placeholder.png
 %%DATADIR%%/resources/fonts/Roboto-Regular-copyright
@@ -45,59 +48,10 @@ bin/pcsx2
 %%DATADIR%%/resources/icons/star-3.png
 %%DATADIR%%/resources/icons/star-4.png
 %%DATADIR%%/resources/icons/star-5.png
-%%NLS%%%%DATADIR%%/resources/locale/ar_SA/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ar_SA/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/ca_ES/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ca_ES/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/cs_CZ/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/cs_CZ/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/da_DK/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/da_DK/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/de_DE/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/de_DE/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/es_ES/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/es_ES/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/fi_FI/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/fi_FI/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/fr_FR/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/fr_FR/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/hr_HR/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/hr_HR/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/hu_HU/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/hu_HU/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/id_ID/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/id_ID/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/it_IT/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/it_IT/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/ja_JP/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ja_JP/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/ko_KR/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ko_KR/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/lt_LT/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/lt_LT/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/ms_MY/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ms_MY/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/nb_NO/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/nb_NO/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/nl_NL/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/nl_NL/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/pl_PL/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/pl_PL/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/pt_BR/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/pt_BR/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/ru_RU/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/ru_RU/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/sv_SE/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/sv_SE/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/th_TH/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/th_TH/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/tr_TR/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/tr_TR/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/zh_CN/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/zh_CN/pcsx2_Main.mo
-%%NLS%%%%DATADIR%%/resources/locale/zh_TW/pcsx2_Iconized.mo
-%%NLS%%%%DATADIR%%/resources/locale/zh_TW/pcsx2_Main.mo
+%%DATADIR%%/resources/shaders/common/ffx_a.h
+%%DATADIR%%/resources/shaders/common/ffx_cas.h
 %%DATADIR%%/resources/shaders/common/fxaa.fx
+%%DATADIR%%/resources/shaders/opengl/cas.glsl
 %%DATADIR%%/resources/shaders/opengl/common_header.glsl
 %%DATADIR%%/resources/shaders/opengl/convert.glsl
 %%DATADIR%%/resources/shaders/opengl/interlace.glsl
@@ -106,6 +60,7 @@ bin/pcsx2
 %%DATADIR%%/resources/shaders/opengl/shadeboost.glsl
 %%DATADIR%%/resources/shaders/opengl/tfx_fs.glsl
 %%DATADIR%%/resources/shaders/opengl/tfx_vgs.glsl
+%%DATADIR%%/resources/shaders/vulkan/cas.glsl
 %%DATADIR%%/resources/shaders/vulkan/convert.glsl
 %%DATADIR%%/resources/shaders/vulkan/interlace.glsl
 %%DATADIR%%/resources/shaders/vulkan/merge.glsl
@@ -116,8 +71,3 @@ bin/pcsx2
 %%DATADIR%%/resources/sounds/achievements/lbsubmit.wav
 %%DATADIR%%/resources/sounds/achievements/message.wav
 %%DATADIR%%/resources/sounds/achievements/unlock.wav
-share/applications/PCSX2.desktop
-%%PORTDOCS%%%%DOCSDIR%%/Configuration_Guide.pdf
-%%PORTDOCS%%%%DOCSDIR%%/PCSX2_FAQ.pdf
-share/man/man1/PCSX2.1.gz
-share/pixmaps/PCSX2.xpm