Subject: [bug#77272] [PATCH 2/2] gnu: dolphin-emu: Update to 2503.

From: msglm <[email-masked]>
Date: Wed, 26 Mar 2025 03:03:28 -0500

* gnu/packages/emulators.scm (dolphin-emu): Update to 2503, Fix netplay
* gnu/packages/game-development.scm (sfml-3): New Package
* gnu/packages/game-development.scm (miniaudio): New Package
* gnu/packages/networking.scm (enet): Update to 2.30.9

Change-Id: I5242f46e457db6552663c03c19dc0f227efb80cc
---
 gnu/packages/emulators.scm        | 50 ++++++++++++++++--------
 gnu/packages/game-development.scm | 65 +++++++++++++++++++++++++++++++
 gnu/packages/networking.scm       |  4 +-
 gnu/packages/sdl.scm              |  4 +-
 4 files changed, 103 insertions(+), 20 deletions(-)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index e71c2803a3..83ae89c172 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -278,20 +278,19 @@ (define-public desmume
 ;; Following commits and revision numbers of beta versions listed at
 ;; https://dolphin-emu.org/download/.
 (define-public dolphin-emu
-  (let ((commit "f9deb68aee962564b1495ff04c54c015e58d086f")
-        (revision "13669"))
     (package
       (name "dolphin-emu")
-      (version (git-version "5.0" revision commit))
+      (version "2503")
       (source
        (origin
          (method git-fetch)
          (uri (git-reference
                (url "https://github.com/dolphin-emu/dolphin")
-               (commit commit)))
+               (recursive? #t)
+               (commit version)))
          (file-name (git-file-name name version))
          (sha256
-          (base32 "1p8qsxlabgmz3nic0a9ghh9d3lzl5f8i3kmdrrvx6w8kdlp33018"))
+          (base32 "0yyl91sb8w422zfdml9hmwwn3088gxv977aailc0l5icaxf4m8m2"))
          (modules '((guix build utils)
                     (ice-9 regex)))
          (snippet
@@ -300,14 +299,19 @@ (define-public dolphin-emu
              (for-each (lambda (dir)
                          (delete-file-recursively
                           (string-append "Externals/" dir)))
-                       '("LZO" "OpenAL" "Qt" "SFML" "bzip2"
+                       '(
+                         ;"LZO" "OpenAL" "Qt" "SFML" "bzip2"
+
+                         "LZO" "OpenAL" "Qt" "bzip2" ;;TODO: Ensure SFML is removed and update the package to make it happen
+
                          ;; XXX: Attempting to use the vulkan-headers package
                          ;; results in "error:
                          ;; ‘VK_PRESENT_MODE_RANGE_SIZE_KHR’ was not declared
                          ;; in this scope".
                          ;;"Vulkan"
                          "cubeb" "curl" "enet"
-                         "ffmpeg" "fmt" "gettext"
+                         ;"ffmpeg" "fmt" "gettext"
+                         "fmt" "gettext"
                          ;; XXX: Attempting to use an unbundled glslang at the
                          ;; exact commit used by Dolphin still results in
                          ;; "error: ‘DefaultTBuiltInResource’ is not a member
@@ -317,10 +321,14 @@ (define-public dolphin-emu
                          ;; unbundled, as there are missing linking
                          ;; directives.
                          ;;"gtest"
-                         "hidapi" "libpng" "libusb" "mbedtls"
-                         "miniupnpc" "minizip" "MoltenVK" "pugixml"
+                         ;"hidapi" "libpng" "libusb" "mbedtls"
+                         "hidapi" "libusb" "mbedtls"
+                         ;"miniupnpc" "minizip" "MoltenVK" "pugixml"
+                         "miniupnpc" "MoltenVK" "pugixml"
                          "soundtouch"
-                         "xxhash" "zlib" "zstd"))
+                         ;"xxhash" "zlib" "zstd"
+                         "xxhash" "zstd"
+                         ))
              ;; Clean up the source.
              (for-each delete-file
                        (find-files
@@ -339,12 +347,21 @@ (define-public dolphin-emu
                ((".*add_subdirectory.*Externals/enet.*") "")
                ((".*add_subdirectory.*Externals/soundtouch.*") "")
                ((".*add_subdirectory.*Externals/xxhash.*") ""))))
-         (patches (search-patches "dolphin-emu-data.patch"))))
+         ))
       (build-system cmake-build-system)
       (arguments
        (list
         #:phases
         #~(modify-phases %standard-phases
+            (add-before 'configure 'set-scm-desc-str
+                        (lambda _
+                          ;;For netplay to work, the SCM_REV_STR must match the
+                          ;;commit hash of whatever version we're on.
+                          ;;THIS MUST BE UPDATED EVERY UPDATE SO THAT NETPLAY
+                          ;;CONTINUES TO FUNCTION!
+                          (substitute* "Source/Core/Common/scmrev.h.in" (("#define SCM_REV_STR \"\\$\\{DOLPHIN_WC_REVISION\\}\"") "#define SCM_REV_STR \"9763c0a1e2b9db0c3861d25bc2f5a0ace6a15ee3\""))
+                          ))
+
             (add-before 'configure 'remove-unittests-target-post-build-command
               (lambda _
                 ;; To skip a few problematic tests, CTest will be manually
@@ -442,8 +459,8 @@ (define-public dolphin-emu
              curl
              enet
              eudev
-             ffmpeg-4
-             fmt-7
+             ffmpeg
+             fmt-10
              font-wqy-microhei
              freetype
              glew
@@ -465,9 +482,10 @@ (define-public dolphin-emu
              openal
              pugixml
              pulseaudio
-             qtbase-5
+             qtbase
+             qtsvg
              sdl2
-             sfml
+             sfml-3
              soil
              soundtouch-1/integer-samples
              vulkan-loader
@@ -482,7 +500,7 @@ (define-public dolphin-emu
 turbo speed, networked multiplayer, and graphical enhancements.")
       (supported-systems '("x86_64-linux" "aarch64-linux"))
       ;; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
-      (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
+      (license (list license:gpl2+ license:asl2.0 license:fdl1.2+))))
 
 (define-public libretro-dolphin-emu
   ;; There are no tag or release; use the latest commit.
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 91369089b9..bb1ae5bc2f 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1115,6 +1115,71 @@ (define-public sfml
 of five modules: system, window, graphics, audio and network.")
     (license license:zlib)))
 
+(define-public sfml-3 ;;For dolphin-emu
+               (package
+                 (inherit sfml)
+                 (name "sfml-3")
+                 (version "3.0.0")
+                 (inputs (modify-inputs (package-inputs sfml)
+                                        (prepend libxcursor libxi miniaudio)))
+                 (source (origin
+                           (method git-fetch)
+                           (uri (git-reference
+                                  (url "https://github.com/SFML/SFML")
+                                  (recursive? #t)
+                                  (commit version)))
+                           (file-name (git-file-name name version))
+                           (sha256
+                             (base32
+                               "0y37cmpp490gcibajigxsbjc6icggqv40jrhzj2kwygpc0ppzb3v"))
+                           (modules '((guix build utils)))
+                           ;(snippet
+                           ;  '(begin
+                           ;     ;; Ensure system libraries are used.
+                           ;     (delete-file-recursively "extlibs")
+                           ;     #t))
+                           ))
+                 ))
+
+;; For sfml-3
+(define-public miniaudio
+               (package
+                 (name "miniaudio")
+                 (version "0.11.22")
+                 (source (origin
+                           (method git-fetch)
+                           (uri (git-reference
+                                  (url "https://github.com/mackron/miniaudio")
+                                  (commit version)))
+                           (file-name (git-file-name name version))
+                           (sha256
+                             (base32
+                               "1pjaiq71x24n9983vkhjxrsbraa24053h727db22b1rb2xyfrzm3"))))
+                 (build-system cmake-build-system)
+                 (arguments
+                   (list
+                     #:tests? #f
+                     #:phases
+                     #~(modify-phases %standard-phases
+                                      (replace 'install
+                                               (lambda _
+                                                 (let ((out #$output))
+                                                   ;; Ensure the output directory exists
+                                                   (mkdir-p (string-append out "/lib"))
+                                                   ;; Copy the static libraries to the output directory
+                                                   (for-each (lambda (file)
+                                                               (copy-file file (string-append out "/lib/" file))) ; Ensure the destination is a file
+                                                             '("libminiaudio.a"
+                                                               "libminiaudio_channel_combiner_node.a"
+                                                               "libminiaudio_channel_separator_node.a"
+                                                               "libminiaudio_ltrim_node.a"
+                                                               "libminiaudio_reverb_node.a"
+                                                               "libminiaudio_vocoder_node.a"))))))))
+                 (synopsis "Audio playback and capture library written in C, in a single source file.")
+                 (description "miniaudio is written in C with no dependencies except the standard library and should compile clean on all major compilers without the need to install any additional development packages. All major desktop and mobile platforms are supported.")
+                 (home-page "https://miniaud.io/")
+                 (license license:expat)))
+
 (define-public csfml
   (package
     (name "csfml")
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 65d44e975a..ff3e032a2b 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -2627,14 +2627,14 @@ (define-public proxychains-ng
 (define-public enet
   (package
     (name "enet")
-    (version "1.3.17")
+    (version "1.3.18")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "http://enet.bespin.org/download/"
                            "enet-" version ".tar.gz"))
        (sha256
-        (base32 "1p6f9mby86af6cs7pv6h48032ip9g32c05cb7d9mimam8lchz3x3"))))
+        (base32 "0djxz2j8248bsvbrs42vr39fhxlrqr3lqbhzs7yb92ync19hr2ia"))))
     (build-system gnu-build-system)
     (native-inputs
      (list pkg-config))
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 80de707819..3a736107c8 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -72,7 +72,7 @@ (define-module (gnu packages sdl)
 (define-public sdl2
   (package
     (name "sdl2")
-    (version "2.30.8")
+    (version "2.30.9")
     (source (origin
               (method url-fetch)
               (uri
@@ -80,7 +80,7 @@ (define-public sdl2
                               version ".tar.gz"))
               (sha256
                (base32
-                "0n006l1zds2av8a9p6m6l0mj7jwb3jbr6mq7j0nxg6vblxg2j31q"))))
+                "197bdcfnnsd4k7q91y518kari0p3rcqbdfq40zsn79w73kvp9d94"))))
     (build-system gnu-build-system)
     (arguments
      (list
-- 
2.48.1