Subject: [bug#75702] [PATCH v3 11/11] gnu: dolphin-emu: Patch data.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 20 Jan 2025 23:28:33 +0900

This resolves a hang in the menu of the WaveRace game.

* gnu/packages/patches/dolphin-emu-data.patch: New file.
* gnu/packages/patches/libretro-dolphin-emu-data.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/packages/emulators.scm (dolphin-emu) [source]: Apply dolphin-emu patch.
(libretro-dolphin-emu) [source]: Apply libretro-dolphin-emu patch.

Change-Id: Ie22a7bba527724179f5296a44f1874d2efdbd94c
---
New commit in v3.

 gnu/local.mk                                  |  4 +++-
 gnu/packages/emulators.scm                    |  6 ++++--
 gnu/packages/patches/dolphin-emu-data.patch   | 16 ++++++++++++++++
 .../patches/libretro-dolphin-emu-data.patch   | 19 +++++++++++++++++++
 4 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/dolphin-emu-data.patch
 create mode 100644 gnu/packages/patches/libretro-dolphin-emu-data.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8f5dcaf7fb..5e4dae4ffb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -19,7 +19,7 @@
 # Copyright © 2018 Amirouche Boubekki <[email-masked]>
 # Copyright © 2018, 2019, 2020, 2021, 2022, 2024 Oleg Pykhalov <[email-masked]>
 # Copyright © 2018 Stefan Stefanović <[email-masked]>
-# Copyright © 2018, 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer <[email-masked]>
+# Copyright © 2018, 2020-2025 Maxim Cournoyer <[email-masked]>
 # Copyright © 2019, 2020, 2021, 2022, 2024 Guillaume Le Vaillant <[email-masked]>
 # Copyright © 2019, 2020 John Soo <[email-masked]>
 # Copyright © 2019 Jonathan Brielmaier <[email-masked]>
@@ -1182,6 +1182,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/docbook2x-static-datadir-evaluation.patch	\
   %D%/packages/patches/doc++-include-directives.patch		\
   %D%/packages/patches/doc++-segfault-fix.patch			\
+  %D%/packages/patches/dolphin-emu-data.patch			\
   %D%/packages/patches/dovecot-opensslv3.patch			\
   %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch	\
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch	\
@@ -1659,6 +1660,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libgeotiff-fix-tests-on-i386.patch	\
   %D%/packages/patches/libguestfs-syms.patch            	\
   %D%/packages/patches/libobjc2-unbundle-robin-map.patch	\
+  %D%/packages/patches/libretro-dolphin-emu-data.patch		\
   %D%/packages/patches/librewolf-use-system-wide-dir.patch	\
   %D%/packages/patches/libvirt-add-install-prefix.patch	\
   %D%/packages/patches/libziparchive-add-includes.patch		\
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index ac838bdecc..3f2a31fdfe 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -336,7 +336,8 @@ (define-public dolphin-emu
              (substitute* "CMakeLists.txt"
                ((".*add_subdirectory.*Externals/enet.*") "")
                ((".*add_subdirectory.*Externals/soundtouch.*") "")
-               ((".*add_subdirectory.*Externals/xxhash.*") ""))))))
+               ((".*add_subdirectory.*Externals/xxhash.*") ""))))
+         (patches (search-patches "dolphin-emu-data.patch"))))
       (build-system cmake-build-system)
       (arguments
        (list
@@ -498,7 +499,8 @@ (define-public libretro-dolphin-emu
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "1fvm6hy0ihc0j3sgv88a7ak08c0kyikmmiif827j981fy7zvglvz"))))
+                  "1fvm6hy0ihc0j3sgv88a7ak08c0kyikmmiif827j981fy7zvglvz"))
+                (patches (search-patches "libretro-dolphin-emu-data.patch"))))
       (arguments
        (substitute-keyword-arguments (package-arguments dolphin-emu)
          ((#:configure-flags flags ''())
diff --git a/gnu/packages/patches/dolphin-emu-data.patch b/gnu/packages/patches/dolphin-emu-data.patch
new file mode 100644
index 0000000000..5ff1bcfe98
--- /dev/null
+++ b/gnu/packages/patches/dolphin-emu-data.patch
@@ -0,0 +1,16 @@
+Resolve a hang in the menu of this game.
+
+Upstream-status: https://github.com/dolphin-emu/dolphin/pull/13285
+
+diff --git a/Data/Sys/GameSettings/GWRE01.ini b/Data/Sys/GameSettings/GWRE01.ini
+index ec292da619..1f9f445901 100644
+--- a/Data/Sys/GameSettings/GWRE01.ini
++++ b/Data/Sys/GameSettings/GWRE01.ini
+@@ -2,6 +2,7 @@
+ 
+ [Core]
+ # Values set here will override the main Dolphin settings.
++CPUThread = False
+ 
+ [OnFrame]
+ # Add memory patches to be applied every frame here.
diff --git a/gnu/packages/patches/libretro-dolphin-emu-data.patch b/gnu/packages/patches/libretro-dolphin-emu-data.patch
new file mode 100644
index 0000000000..a49feabbf8
--- /dev/null
+++ b/gnu/packages/patches/libretro-dolphin-emu-data.patch
@@ -0,0 +1,19 @@
+Resolve a hang in the menu of this game.
+
+Upstream-status: https://github.com/libretro/dolphin/pull/337
+
+diff --git a/Data/Sys/GameSettings/GWRE01.ini b/Data/Sys/GameSettings/GWRE01.ini
+index b789141fcf..4d19779c9c 100644
+--- a/Data/Sys/GameSettings/GWRE01.ini
++++ b/Data/Sys/GameSettings/GWRE01.ini
+@@ -3,6 +3,10 @@
+ [Core]
+ # Values set here will override the main Dolphin settings.
+ 
++# TODO: Change to 'CPUThread = False' after rebasing to latest
++# upstream (see commit 869edd5a66).
++SyncGPU = True
++
+ [OnLoad]
+ # Add memory patches to be loaded once on boot here.
+ 
-- 
2.47.1