gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / emulators.scm
index cfc5039..6ad62c2 100644 (file)
@@ -1,17 +1,18 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
-;;; Copyright © 2015, 2016 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2015, 2016, 2021 Sou Bunnbu <iyzsong@member.fsf.org>
 ;;; Copyright © 2015, 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;; Copyright © 2015, 2018 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
-;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
-;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2019, 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2017, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019 David Wilson <david@daviwil.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
+;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
+  #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autogen)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages cdrom)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages digest)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages fribidi)
   #:use-module (gnu packages game-development)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
@@ -57,7 +64,6 @@
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
-  #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
@@ -88,7 +94,8 @@
   #:use-module (gnu packages web)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system glib-or-gtk)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python))
 
 (define-public desmume
   (package
              version "/desmume-" version ".tar.gz"))
        (sha256
         (base32
-         "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))))
+         "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))
+       (patches (search-patches "desmume-gcc6-fixes.patch"
+                                "desmume-gcc7-fixes.patch"))))
     (build-system gnu-build-system)
     (arguments
      ;; Enable support for WiFi and microphone.
     (license license:gpl2)))
 
 ;; Building from recent Git because the official 5.0 release no longer builds.
+;; Following commits and revision numbers of beta versions listed at
+;; https://dolphin-emu.org/download/.
 (define-public dolphin-emu
-  (let ((commit "a9745400ec5cea7e55d94955afbdc44d1a4982d1")
-        (revision "7"))
+  (let ((commit "a34823df61df65168aa40ef5e82e44defd4a0138")
+        (revision "13178"))
     (package
       (name "dolphin-emu")
       (version (git-version "5.0" revision commit))
        (origin
          (method git-fetch)
          (uri (git-reference
-               (url "https://github.com/dolphin-emu/dolphin.git")
+               (url "https://github.com/dolphin-emu/dolphin")
                (commit commit)))
          (file-name (git-file-name name version))
          (modules '((guix build utils)))
              #t))
          (sha256
           (base32
-           "0ic08ii4vlqlmk2wkfc99jiy6nji2wfq56r7slj23wgvhznnaabk"))))
+           "0j6hnj60iai366kl0kdbn1jkwc183l02g65mp2vq4qb2yd4399l1"))))
       (build-system cmake-build-system)
       (arguments
        '(#:tests? #f
                  (copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin")
                  (chdir "..")
                  (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
-                              (("\"vulkan\", 1") (string-append "\"vulkan\"")))
-                 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
-                              (("\"vulkan\"") (string-append "\"" libvulkan "\"")))
-                 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
-                              (("Common::DynamicLibrary::GetVersionedFilename") ""))
+                   (("\"vulkan\", 1") (string-append "\"vulkan\""))
+                   (("\"vulkan\"") (string-append "\"" libvulkan "\""))
+                   (("Common::DynamicLibrary::GetVersionedFilename") ""))
                  #t))))
 
          ;; The FindGTK2 cmake script only checks hardcoded directories for
                "-DX11_FOUND=1")))
       (native-inputs
        `(("pkg-config" ,pkg-config)
-         ("gettext" ,gnu-gettext)))
+         ("gettext" ,gettext-minimal)))
       (inputs
        `(("alsa-lib" ,alsa-lib)
          ("ao" ,ao)
@@ -264,7 +273,7 @@ turbo speed, networked multiplayer, and graphical enhancements.")
        ("alsa-lib" ,alsa-lib)
        ("glu" ,glu)
        ("mesa" ,mesa)))
-    (home-page "http://www.dosbox.com")
+    (home-page "https://www.dosbox.com")
     (synopsis "X86 emulator with CGA/EGA/VGA/etc. graphics and sound")
     (description "DOSBox is a DOS-emulator that uses the SDL library.  DOSBox
 also emulates CPU:286/386 realmode/protected mode, Directory
@@ -273,20 +282,80 @@ SoundBlaster/Gravis Ultra Sound card for excellent sound compatibility with
 older games.")
     (license license:gpl2+)))
 
+(define-public qtmips
+  (package
+    (name "qtmips")
+    (version "0.7.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cvut/QtMips")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1fal7a8y5g0rqqjrk795jh1l50ihz01ppjnrfjrk9vkjbd59szbp"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "qmake"
+                     (string-append "PREFIX=" (assoc-ref outputs "out"))
+                     "qtmips.pro")))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (substitute* "tests/test.sh"
+               (("qtchooser.*") ""))
+             (substitute* '("tests/cpu_trap/test.sh"
+                            "tests/registers/test.sh")
+               (("sub-qtmips_cli") "qtmips_cli"))
+             (if tests?
+               (invoke "tests/run-all.sh")
+               #t)))
+         (replace 'install
+           ;; There is no install target.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (apps (string-append out "/share/applications"))
+                    (icons (string-append out "/share/icons/hicolor")))
+               (install-file "qtmips_gui/qtmips_gui" bin)
+               (install-file "qtmips_cli/qtmips_cli" bin)
+               (install-file "data/qtmips.desktop" apps)
+               (install-file "data/icons/qtmips_gui.svg"
+                             (string-append icons "/scalable/apps"))
+               (install-file "data/icons/qtmips_gui.png"
+                             (string-append icons "/48x48/apps"))
+               #t))))
+       #:tests? #f))    ; test suite wants mips toolchain
+    (inputs
+     `(("elfutils" ,elfutils)
+       ("qtbase" ,qtbase)))
+    (home-page "https://github.com/cvut/QtMips")
+    (synopsis "MIPS CPU emulator")
+    (description "This package contains a MIPS CPU emulator.  The simulator
+accepts ELF statically linked executables compiled for 32-bit big-endian
+MIPS target, targeting mips-linux-gnu or mips-elf.")
+    (license license:gpl2+)))   ; License file says GPL3
+
 (define-public emulation-station
-  (let ((commit "646bede3d9ec0acf0ae378415edac136774a66c5"))
+  ;; No release for a long time, new commits fix build issues
+  (let ((commit "9cc42adff67946175d2b7e25c6ae69cc374e98a0")
+        (revision "1"))
     (package
       (name "emulation-station")
-      (version "2.0.1")
+      (version (git-version "2.0.1" revision commit))
       (source (origin
                 (method git-fetch) ; no tarball available
                 (uri (git-reference
-                      (url "https://github.com/Aloshi/EmulationStation.git")
+                      (url "https://github.com/Aloshi/EmulationStation")
                       (commit commit))) ; no version tag
-                (file-name (string-append name "-" version "-checkout"))
+                (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "0cm0sq2wri2l9cvab1l0g02za59q7klj0h3p028vr96n6njj4w9v"))))
+                  "1cva0ns650v17lfn8in095zci6lc43d23f1x3mlzc41qfqa6mbd1"))))
       (build-system cmake-build-system)
       (arguments
        '(#:tests? #f)) ; no tests
@@ -304,31 +373,22 @@ older games.")
 number of video game console emulators.  It features an interface that is
 usable with any game controller that has at least 4 buttons, theming support,
 and a game metadata scraper.")
-      (home-page "http://www.emulationstation.org")
+      (home-page "https://emulationstation.org")
       (license license:expat))))
 
-;; Note: higan v107 has been released, but as explained by the dialog that
-;; appears after starting the new version, it's an experimental release. The
-;; author recommends v106 for general use.
-;;
-;; When updating to v107 (or probably beyond), sdl will have to be replaced
-;; with sdl2, and libxrandr will need to be added to inputs. The patch
-;; `higan-remove-march-native-flag.patch' will not be necessary, since the flag
-;; is now being added only for `platform=local', which is not the default.
 (define-public higan
   (package
     (name "higan")
-    (version "106")
+    (version "110")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-              (url "https://github.com/byuu/higan/")
-              (commit (string-append "v" version))))
+             (url "https://github.com/higan-emu/higan")
+             (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1mxivf8124vz4hl0b0xa1yqv0z9m3i12v9psmbpqkprrbq0wbgn1"))
-       (patches (search-patches "higan-remove-march-native-flag.patch"))))
+        (base32 "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
@@ -338,11 +398,12 @@ and a game metadata scraper.")
        ("eudev" ,eudev)
        ("gtk+" ,gtk+-2)
        ("gtksourceview-2" ,gtksourceview-2)
+       ("libxrandr" ,libxrandr)
        ("libxv" ,libxv)
        ("mesa" ,mesa)
        ("openal" ,openal)
        ("pulseaudio" ,pulseaudio)
-       ("sdl" ,sdl)))
+       ("sdl2" ,sdl2)))
     (arguments
      '(#:phases
        (let ((build-phase (assoc-ref %standard-phases 'build))
@@ -401,32 +462,94 @@ and a game metadata scraper.")
              (string-append "prefix=" (assoc-ref %outputs "out")))
        ;; There is no test suite.
        #:tests? #f))
-    (home-page "http://byuu.org/emulation/higan/")
-    (synopsis "Nintendo multi-system emulator")
+    (home-page "https://github.com/higan-emu/higan/")
+    (synopsis "Multi-system emulator")
     (description
-     "higan (formerly bsnes) is an emulator for multiple Nintendo video game
-consoles, including the Nintendo Entertainment System (NES/Famicom), Super
-Nintendo Entertainment System (SNES/Super Famicom), Game Boy, Game Boy
-Color (GBC), and Game Boy Advance (GBA).  It also supports the subsystems
-Super Game Boy, BS-X Satellaview, and Sufami Turbo.")
-    ;; As noted in these files among more:
-    ;; - icarus/icarus.cpp
-    ;; - higan/emulator/emulator.hpp
-    (license license:gpl3)))
+     "higan is a multi-system emulator with an uncompromising focus on
+accuracy and code readability.
+
+It currently emulates the following systems: Famicom, Famicom Disk System,
+Super Famicom, Super Game Boy, Game Boy, Game Boy Color, Game Boy Advance,
+Game Boy Player, SG-1000, SC-3000, Master System, Game Gear, Mega Drive, Mega
+CD, PC Engine, SuperGrafx, MSX, MSX2, ColecoVision, Neo Geo Pocket, Neo Geo
+Pocket Color, WonderSwan, WonderSwan Color, SwanCrystal, Pocket Challenge
+V2.")
+    (license license:gpl3+)))
+
+(define-public mednafen
+  (package
+    (name "mednafen")
+    (version "1.26.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://mednafen.github.io/releases/files/"
+                           "mednafen-" version ".tar.xz"))
+       (sha256
+        (base32 "1x7xhxjhwsdbak8l0iyb497f043xkhibk73w96xck4j2bk10fac4"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        ;; "--with-external-mpcdec"
+        "--with-external-lzo")))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ;; ("libmpcdec" ,libmpcdec) FIXME: not recognized.
+       ("libsndfile" ,libsndfile)
+       ("lzo" ,lzo)
+       ("sdl2" ,sdl2)
+       ("zlib" ,zlib)))
+    (home-page "https://mednafen.github.io/")
+    (synopsis "Multi-system emulator utilizing OpenGL and SDL")
+    (description
+     "Mednafen is a portable, utilizing OpenGL and SDL, argument-driven
+multi-system emulator.  Mednafen has the ability to remap hotkey functions and
+virtual system inputs to a keyboard, a joystick, or both simultaneously.  Save
+states are supported, as is real-time game rewinding.  Screen snapshots may be
+taken, in the PNG file format, at the press of a button.  Mednafen can record
+audiovisual movies in the QuickTime file format, with several different
+lossless codecs supported.
+
+The following systems are supported:
+
+@itemize
+@item Apple II/II+
+@item Atari Lynx
+@item Neo Geo Pocket (Color)
+@item WonderSwan
+@item GameBoy (Color)
+@item GameBoy Advance
+@item Nintendo Entertainment System
+@item Super Nintendo Entertainment System/Super Famicom
+@item Virtual Boy
+@item PC Engine/TurboGrafx 16 (CD)
+@item SuperGrafx
+@item PC-FX
+@item Sega Game Gear
+@item Sega Genesis/Megadrive
+@item Sega Master System
+@item Sega Saturn (experimental, x86_64 only)
+@item Sony PlayStation
+@end itemize")
+    ;; Main license is GPL2+.  Some parts are BSD-3.
+    (license (list license:gpl2+ license:bsd-3))))
 
 (define-public mgba
   (package
     (name "mgba")
-    (version "0.8.0")
+    (version "0.9.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mgba-emu/mgba.git")
+             (url "https://github.com/mgba-emu/mgba")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0m3rgcdv32ms98j7rrmk2hphvn462bwsd6xfz2ssy05398pj4ljh"))
+        (base32 "163azad5y4zxwzxyrb481rwfc2p86v99pf7nvdr6bavzq98x2z8h"))
        (modules '((guix build utils)))
        (snippet
         ;; Make sure we don't use the bundled software.
@@ -443,9 +566,9 @@ Super Game Boy, BS-X Satellaview, and Sufami Turbo.")
        #:configure-flags
        (list "-DUSE_LZMA=OFF"           ;do not use bundled LZMA
              "-DUSE_LIBZIP=OFF")))      ;use "zlib" instead
-    (native-inputs `(("pkg-config" ,pkg-config)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("qttools" ,qttools)))
     (inputs `(("ffmpeg" ,ffmpeg)
-              ("imagemagick" ,imagemagick)
               ("libedit" ,libedit)
               ("libelf" ,libelf)
               ("libepoxy" ,libepoxy)
@@ -455,7 +578,6 @@ Super Game Boy, BS-X Satellaview, and Sufami Turbo.")
               ("ncurses" ,ncurses)
               ("qtbase" ,qtbase)
               ("qtmultimedia" ,qtmultimedia)
-              ("qttools" ,qttools)
               ("sdl2" ,sdl2)
               ("sqlite" ,sqlite)
               ("zlib" ,zlib)))
@@ -466,23 +588,23 @@ Super Game Boy, BS-X Satellaview, and Sufami Turbo.")
 faster and more accurate than many existing Game Boy Advance emulators, as
 well as adding features that other emulators lack.  It also supports Game Boy
 and Game Boy Color games.")
-    ;; Code is mainly MPL 2.0. "blip_buf.c" is LGPL 2.1+ and "inih.c" is
-    ;; BSD-3.
-    (license (list license:mpl2.0 license:lgpl2.1+ license:bsd-3))))
+    ;; Code is mainly MPL 2.0. "blip_buf.c" is LGPL 2.1+, "inih.c" is
+    ;; BSD-3, and "discord-rpc" is Expat.
+    (license (list license:mpl2.0 license:lgpl2.1+ license:bsd-3 license:expat))))
 
 (define-public sameboy
   (package
     (name "sameboy")
-    (version "0.12.3")
+    (version "0.13.6")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/LIJI32/SameBoy.git")
+             (url "https://github.com/LIJI32/SameBoy")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0m5rv2x8qck1kr43xq186pp4kaiay7gd1x775n9qrljcd7z4x6fs"))))
+        (base32 "04w8lybi7ssnax37ka4qw7pmcm7cgnmk90p9m73zbyp5chgpqqzc"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("rgbds" ,rgbds)
@@ -492,7 +614,7 @@ and Game Boy Color games.")
      `(("sdl2" ,sdl2)))
     (arguments
      `(#:tests? #f                      ; There are no tests
-       #:make-flags `("CC=gcc" "CONF=release"
+       #:make-flags `("CC=gcc" "NATIVE_CC=gcc" "CONF=release"
                       ,(string-append "DATA_DIR="
                                       (assoc-ref %outputs "out")
                                       "/share/sameboy/"))
@@ -507,7 +629,8 @@ and Game Boy Color games.")
                (with-directory-excursion "build/bin/SDL"
                  (install-file "sameboy" bin)
                  (delete-file "sameboy")
-                 (copy-recursively "." data))))))))
+                 (copy-recursively "." data))
+               #t))))))
     (home-page "https://sameboy.github.io/")
     (synopsis "Accurate Game Boy, Game Boy Color and Super Game Boy emulator")
     (description "SameBoy is a user friendly Game Boy, Game Boy Color
@@ -524,7 +647,7 @@ from an emulator---from save states to scaling filters.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-core.git")
+             (url "https://github.com/mupen64plus/mupen64plus-core")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -573,7 +696,7 @@ core library.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-audio-sdl.git")
+             (url "https://github.com/mupen64plus/mupen64plus-audio-sdl")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -619,7 +742,7 @@ SDL audio plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-input-sdl.git")
+             (url "https://github.com/mupen64plus/mupen64plus-input-sdl")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -664,7 +787,7 @@ SDL input plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-rsp-hle.git")
+             (url "https://github.com/mupen64plus/mupen64plus-rsp-hle")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -706,7 +829,7 @@ high-level emulation (HLE) RSP processor plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-rsp-z64.git")
+             (url "https://github.com/mupen64plus/mupen64plus-rsp-z64")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -748,7 +871,7 @@ Z64 RSP processor plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid.git")
+             (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -794,7 +917,7 @@ Arachnoid video plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-video-glide64.git")
+             (url "https://github.com/mupen64plus/mupen64plus-video-glide64")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -848,7 +971,7 @@ Glide64 video plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2.git")
+             (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -898,7 +1021,7 @@ Glide64MK2 video plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-video-rice.git")
+             (url "https://github.com/mupen64plus/mupen64plus-video-rice")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -946,7 +1069,7 @@ Rice Video plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-video-z64.git")
+             (url "https://github.com/mupen64plus/mupen64plus-video-z64")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -1001,7 +1124,7 @@ Z64 video plugin.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mupen64plus/mupen64plus-ui-console.git")
+             (url "https://github.com/mupen64plus/mupen64plus-ui-console")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -1066,7 +1189,7 @@ towards a working Mupen64Plus for casual users.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/rdanbrook/nestopia.git")
+             (url "https://github.com/rdanbrook/nestopia")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -1109,30 +1232,59 @@ System (NES/Famicom) emulator Nestopia, with enhancements from members of the
 emulation community.  It provides highly accurate emulation.")
     (license license:gpl2+)))
 
+(define-public libretro-lowresnx
+  (let ((commit "743ab43a6c4a13e0d5363b0d25ac12c7511c6581")
+        (revision "1"))
+    (package
+      (name "libretro-lowresnx")
+      (version (git-version "1.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/timoinutilis/lowres-nx")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0r15kb5p5s2jwky6zy4v1j9i95i4rz36p9wxg0g6xdjksf04b5cf"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f                    ; no tests
+         #:make-flags (list "-C" "platform/LibRetro"
+                            (string-append "CC=" ,(cc-for-target)))
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)          ; no configure script
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (libretrodir (string-append out "/lib/libretro")))
+                 (install-file "platform/LibRetro/lowresnx_libretro.so"
+                               libretrodir)
+                 #t))))))
+      (home-page "https://lowresnx.inutilis.com/")
+      (synopsis "Libretro core for LowRES NX")
+      (description "LowRES NX is a simulated retro game console, which can be
+programmed in the classic BASIC language.  This package provides a libretro
+core allowing the lowRES NX programs to be used with libretro frontends such
+as RetroArch.")
+      (license license:zlib))))
+
 (define-public retroarch
   (package
     (name "retroarch")
-    (version "1.8.1")
+    (version "1.9.0")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/libretro/RetroArch.git")
+             (url "https://github.com/libretro/RetroArch")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0y7rcpz7psf8k3agsrq277jdm651vbnn9xpqvmj2in1a786idya7"))
+        (base32 "1n0dcv85vqrdr79psnf009hi4r2mvsgsjbghrrc9pm5g7ywwwcvp"))
        (patches
-        (search-patches "retroarch-disable-online-updater.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Don't suggest using the Online Updater if available: it never
-           ;; is.  This disables translation of this particular message.
-           (substitute* (find-files "menu/drivers" "\\.c$")
-             (("msg_hash_to_str\\(MSG_MISSING_ASSETS\\)")
-              "\"Warning: Missing assets, go get some\""))
-           #t))))
+        (search-patches "retroarch-LIBRETRO_DIRECTORY.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; no tests
@@ -1167,7 +1319,9 @@ emulation community.  It provides highly accurate emulation.")
                        '("--enable-neon" "--enable-floathard")
                        '())
                  (string-append "--prefix=" out)
-                 (string-append "--global-config-dir=" etc)
+                 ;; Non-free software are available through the core updater,
+                 ;; disable it.  See <https://issues.guix.gnu.org/38360>.
+                 "--disable-update_cores"
                  "--disable-builtinminiupnpc")))))))
     (inputs
      `(("alsa-lib" ,alsa-lib)
@@ -1193,6 +1347,11 @@ emulation community.  It provides highly accurate emulation.")
      `(("pkg-config" ,pkg-config)
        ("wayland-protocols" ,wayland-protocols)
        ("which" ,which)))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "LIBRETRO_DIRECTORY")
+            (separator #f)              ; single entry
+            (files '("lib/libretro")))))
     (home-page "https://www.libretro.com/")
     (synopsis "Reference frontend for the libretro API")
     (description
@@ -1206,34 +1365,20 @@ multi-system game/emulator system.")
 (define-public scummvm
   (package
     (name "scummvm")
-    (version "2.1.1")
+    (version "2.2.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://www.scummvm.org/frs/scummvm/" version
+       (uri (string-append "https://downloads.scummvm.org/frs/scummvm/" version
                            "/scummvm-" version ".tar.xz"))
        (sha256
-        (base32 "1a6waf1ybp91nwva8g650cljlfb1di4l0jv13vg6yfgkas9pclsp"))))
+        (base32 "11vknasm5dna2vqr6gk343qynh7nhsq3kf60zayarn1vb5z6as8l"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                                 ;require "git"
        #:configure-flags (list "--enable-release") ;for optimizations
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'fix-build
-           ;; XXX: The following works around a build failure introduced when
-           ;; Fluidsynth was updated to version 2.1.  It has been applied
-           ;; upstream as 68758a879e0c8ecc0d40962516d4e808aa4e15e5 and can be
-           ;; removed once this commit makes it into a release.
-           (lambda _
-             (substitute* "audio/softsynth/fluidsynth.cpp"
-               (("#include <fluidsynth.h>") "")
-               (("#include \"common/scummsys.h\"") "#include \"config.h\"")
-               (("#include \"common/config-manager.h\"" line)
-                (string-append "#include <fluidsynth.h>\n"
-                               "#include \"common/scummsys.h\"\n"
-                               line)))
-             #t))
          (replace 'configure
            ;; configure does not work followed by both "SHELL=..." and
            ;; "CONFIG_SHELL=..."; set environment variables instead
@@ -1253,6 +1398,7 @@ multi-system game/emulator system.")
        ("faad2" ,faad2)
        ("fluidsynth" ,fluidsynth)
        ("freetype" ,freetype)
+       ("fribidi" ,fribidi)
        ("liba52" ,liba52)
        ("libflac" ,flac)
        ("libjpeg-turbo" ,libjpeg-turbo)
@@ -1273,19 +1419,186 @@ just replaces the executables shipped with the games, allowing you to
 play them on systems for which they were never designed!")
     (license license:gpl2+)))
 
+(define-public libticables2
+  (package
+    (name "libticables2")
+    (version "1.3.5")
+    (source (origin
+              (method url-fetch)
+              (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
+              (sha256
+               (base32
+                "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list "--enable-libusb10")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source #:allow-other-keys)
+             (invoke "tar" "xvkf" source)
+             (invoke "tar" "xvkf"
+                     (string-append "tilibs2/libticables2-"
+                                    ,version ".tar.bz2"))
+             (chdir (string-append "libticables2-" ,version))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autogen" ,autogen)
+       ("automake" ,automake)
+       ("gettext" ,gnu-gettext)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glib" ,glib)
+       ("libusb" ,libusb)))
+    (synopsis "Link cable library for TI calculators")
+    (description
+     "This package contains libticables, a library for operations on
+@acronym{TI, Texas Instruments} calculator link cables.
+
+This is a part of the TiLP project.")
+    (home-page "http://lpg.ticalc.org/prj_tilp/")
+    (license license:gpl2+)))
+
+(define-public libticonv
+  (package
+    (name "libticonv")
+    (version "1.1.5")
+    (source (origin
+              (method url-fetch)
+              (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
+              (sha256
+               (base32
+                "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; build fails with out --enable-iconv (...?)
+     `(#:configure-flags (list "--enable-iconv")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source #:allow-other-keys)
+             (invoke "tar" "xvkf" source)
+             (invoke "tar" "xvkf"
+                     (string-append "tilibs2/libticonv-"
+                                    ,version ".tar.bz2"))
+             (chdir (string-append "libticonv-" ,version))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glib" ,glib)))
+    (synopsis "Character conversion library for TI calculators")
+    (description
+     "This package contains libticonv, a library to support working with
+@acronym{TI, Texas Instruments} calculator charsets.
+
+This is a part of the TiLP project.")
+    (home-page "http://lpg.ticalc.org/prj_tilp/")
+    (license license:gpl2+)))
+
+(define-public libtifiles2
+  (package
+    (name "libtifiles2")
+    (version "1.1.7")
+    (source (origin
+              (method url-fetch)
+              (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
+              (sha256
+               (base32
+                "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source #:allow-other-keys)
+             (invoke "tar" "xvkf" source)
+             (invoke "tar" "xvkf"
+                     (string-append "tilibs2/libtifiles2-"
+                                    ,version ".tar.bz2"))
+             (chdir (string-append "libtifiles2-" ,version))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gnu-gettext)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glib" ,glib)
+       ("libarchive" ,libarchive)
+       ("libticonv" ,libticonv)))
+    (synopsis "File functions library for TI calculators")
+    (description
+     "This package contains libticonv, a library to support working with
+@acronym{TI, Texas Instruments} calculator files.
+
+This is a part of the TiLP project.")
+    (home-page "http://lpg.ticalc.org/prj_tilp/")
+    (license license:gpl2+)))
+
+(define-public libticalcs2
+  (package
+    (name "libticalcs2")
+    (version "1.1.9")
+    (source (origin
+              (method url-fetch)
+              (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
+              (sha256
+               (base32
+                "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key source #:allow-other-keys)
+             (invoke "tar" "xvkf" source)
+             (invoke "tar" "xvkf"
+                     (string-append "tilibs2/libticalcs2-"
+                                    ,version ".tar.bz2"))
+             (chdir (string-append "libticalcs2-" ,version))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gnu-gettext)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glib" ,glib)
+       ("libarchive" ,libarchive)
+       ("libticables2" ,libticables2)
+       ("libticonv" ,libticonv)
+       ("libtifiles2" ,libtifiles2)))
+    (synopsis "Support library for TI calculators")
+    (description
+     "This project aims to develop a multi-platform linking program for use
+with all @acronym{TI, Texas Instruments} graphing calculators (TI73 to
+V200PLT).
+
+This is a part of the TiLP project.")
+    (home-page "http://lpg.ticalc.org/prj_tilp/")
+    (license license:gpl2+)))
+
 (define-public mame
   (package
     (name "mame")
-    (version "0.218")
+    (version "0.230")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mamedev/mame.git")
+             (url "https://github.com/mamedev/mame")
              (commit (apply string-append "mame" (string-split version #\.)))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1c43hqfabc7spkyk5ma4bjdb0yqm93sdg5g13ka8mvi462snrfd7"))
+        (base32 "0dk8q2691pycv9mq77h6sdfwjnwdrfwrblf8nwyykrmdawzi56ks"))
        (modules '((guix build utils)))
        (snippet
         ;; Remove bundled libraries.
@@ -1430,7 +1743,7 @@ play them on systems for which they were never designed!")
        ("texinfo" ,texinfo)))
     (inputs
      `(("alsa-lib" ,alsa-lib)
-       ("asio" ,asio)
+       ("asio" ,asio-1.12)              ;the bundled copy is at 1.11
        ("expat" ,expat)
        ("flac" ,flac)
        ("fontconfig" ,fontconfig)
@@ -1449,7 +1762,7 @@ play them on systems for which they were never designed!")
        ("sqlite" ,sqlite)
        ("utf8proc" ,utf8proc)
        ("zlib" ,zlib)))
-    (home-page "http://mamedev.org/")
+    (home-page "https://www.mamedev.org")
     (synopsis "Multi-purpose emulation framework")
     (description "MAME's purpose is to preserve decades of software
 history.  As electronic technology continues to rush forward, MAME
@@ -1461,6 +1774,69 @@ functions.  The source code to MAME serves as this documentation.")
     ;; keymaps, languages and samples are under CC0.
     (license (list license:gpl2+ license:expat license:cc0))))
 
+(define-public gnome-arcade
+  (package
+    (name "gnome-arcade")
+    (version "0.218.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/strippato/gnome-arcade")
+             (commit (string-append "v." version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1qc01a62p65qb6mwjfmxqsd6n3rglsfwrjhsp25nr7q54107n55l"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ; No tests.
+       #:configure-flags (list
+                          (string-append "-DMAME_BIN=\""
+                                         (assoc-ref %build-inputs "mame")
+                                         "/bin/mame\"")
+                          (string-append "-DAPP_RES=\""
+                                         (assoc-ref %outputs "out")
+                                         "/share/gnome-arcade/\""))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (pk 'cwd (getcwd))
+               (substitute* "../source/src/config.c"
+                 (("/usr/share") (string-append out "/share"))))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (rom (string-append out "/share/gnome-arcade/data/rom"))
+                    (tile (string-append out "/share/gnome-arcade/data/tile")))
+               (mkdir-p bin)
+               (install-file "../gnome-arcade" bin)
+               (copy-recursively "../source/res"
+                                 (string-append out "/share/gnome-arcade/res"))
+               (mkdir-p rom)
+               (install-file "../source/data/rom/ROM.TXT" rom)
+               (mkdir-p tile)
+               (install-file "../source/data/tile/TILE.TXT" tile))
+             #t)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("mame" ,mame)
+       ("gtk" ,gtk+)
+       ("libevdev" ,libevdev)
+       ("libvlc" ,vlc)
+       ("libarchive" ,libarchive)))
+    (home-page "https://github.com/strippato/gnome-arcade")
+    (synopsis "Minimal MAME frontend")
+    (description
+     "A minimal GTK+ frontend for MAME, the multi-purpose arcade and console
+emulator.")
+    (license license:gpl3+)))
+
 (define-public pcsxr
   ;; No release since 2017.
   (let ((commit "6484236cb0281e8040ff6c8078c87899a3407534"))
@@ -1561,3 +1937,355 @@ derived from Gens.  Project goals include clean source code, combined features
 from various forks of Gens, and improved platform portability.")
     (supported-systems '("i686-linux" "x86_64-linux"))
     (license license:gpl2+)))
+
+(define-public bsnes
+  (package
+    (name "bsnes")
+    (version "115")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/bsnes-emu/bsnes")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0j054x38fwai61vj36sc04r3zkzay5acq2cgd9zqv5hs51s36g5b"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list "-C" "bsnes"
+                          (string-append "prefix=" (assoc-ref %outputs "out")))
+       #:tests? #f                      ; No tests.
+       #:phases (modify-phases %standard-phases
+                  (delete 'configure))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("ao" ,ao)
+       ("cairo" ,cairo)
+       ("eudev" ,eudev)
+       ("gtksourceview-2" ,gtksourceview-2)
+       ("libxrandr" ,libxrandr)
+       ("libxv" ,libxv)
+       ("openal" ,openal)
+       ("pulseaudio" ,pulseaudio)
+       ("sdl2" ,sdl2)))
+    (home-page "https://bsnes.dev/")
+    (synopsis "Emulator for the Super Nintendo / Super Famicom systems")
+    (description
+     "bsnes is a Super Nintendo / Super Famicom emulator that focuses on
+performance, features, and ease of use.")
+    (license license:gpl3)))
+
+;; python-pwntools requires a -rc release of unicorn
+(define-public unicorn
+  (let ((unless-x86
+          (lambda (code)
+            (if (member (%current-system) '("x86_64-linux" "i686-linux"))
+              '()
+              code))))
+    (package
+      (name "unicorn")
+      (version "1.0.2-rc4")
+      ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/unicorn-engine/unicorn")
+               (commit version)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
+      (outputs '("out" "python"))
+      ;; The main library is not written in Python, but the build process has
+      ;; little in common with any defined build system, so we might as well
+      ;; build on top of python-build-system and make use of all
+      ;; the Python-specific phases that can be reused.
+      (build-system python-build-system)
+      (arguments
+       `(#:modules ((srfi srfi-26)
+                    (guix build python-build-system)
+                    (guix build utils))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'install-bindings-to-python-output
+             (lambda* (#:key outputs #:allow-other-keys)
+               ;; python-build-system will build the bindings and install them to
+               ;; the "out" output, so change the build-internal names of the
+               ;; outputs.
+               ;;
+               ;; TODO: remove this once #40469 lands, through the core-updates
+               ;; holding zone, on master.
+               (set-car! (assoc "out" outputs) "lib")
+               (set-car! (assoc "python" outputs) "out")
+               #t))
+           (add-before 'build 'build-library
+             (lambda* (#:key inputs #:allow-other-keys)
+               (invoke "make"
+                       "-j" (number->string (parallel-job-count))
+                       "UNICORN_STATIC=no"
+                       "CC=gcc")))
+           (add-after 'build-library 'install-library
+             (lambda* (#:key outputs #:allow-other-keys)
+               (invoke "make" "install"
+                       "UNICORN_STATIC=no"
+                       (string-append
+                        "PREFIX="
+                        (assoc-ref outputs "lib")))))
+           (add-before 'build 'prepare-bindings
+             (lambda* (#:key outputs #:allow-other-keys)
+               (chdir "bindings/python")
+               ;; Set this environment variable so that the Python bindings
+               ;; don't build their own copy of the shared object, but use
+               ;; a dummy value such that the bindings test suite uses the
+               ;; same mechanism for loading the library as any other user.
+               (setenv "LIBUNICORN_PATH" "1")
+               (substitute* "unicorn/unicorn.py"
+                 (("_path_list = \\[.*")
+                  (string-append
+                   "_path_list = [\""
+                   (assoc-ref outputs "lib")
+                   ;; eat the rest of the list
+                   "/lib\"] + 0*[")))
+               #t))
+           (add-before 'check 'check-library
+             (lambda* (#:key outputs #:allow-other-keys)
+               (for-each
+                 (lambda (suite)
+                   (with-directory-excursion
+                     (string-append "../../tests/" suite)
+                     (invoke "make" "test" "CC=gcc"
+                             ,@(unless-x86
+                                '("AS=i686-unknown-linux-gnu-as"
+                                  "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
+                 '("unit" "regress"))
+               #t))
+           (add-after 'install 'install-samples
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((python-samples (find-files "." "sample_.*"))
+                      (c-samples (find-files "../../samples" ".*\\.c"))
+                      (python-docdir
+                        (string-append (assoc-ref outputs "out")
+                                       "/share/doc/unicorn/samples"))
+                      (c-docdir
+                        (string-append (assoc-ref outputs "lib")
+                                       "/share/doc/unicorn/samples")))
+                 (for-each (cut install-file <> c-docdir) c-samples)
+                 (for-each (cut install-file <> python-docdir) python-samples)
+                 #t))))))
+      (native-inputs
+       ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
+       ;; the linker provided by the package will be used, circumventing the ld-wrapper.
+       `(,@(unless-x86
+            `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
+         ("cmocka" ,cmocka)
+         ("hexdump-for-tests" ,util-linux)))
+      (home-page "https://www.unicorn-engine.org")
+      (synopsis "Unicorn CPU emulator framework")
+      (description
+       "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
+framework based on QEMU.")
+      (license license:gpl2+))))
+
+(define-public ppsspp
+  (package
+    (name "ppsspp")
+    (version "1.11.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hrydgard/ppsspp")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "1dpxnwvl6jq7z67lbjws4lqc1bxc31xi6ddlmg5n3aig008yi2fp"))
+       (file-name (git-file-name name version))
+       (patches
+        (search-patches "ppsspp-disable-upgrade-and-gold.patch"))
+       (modules '((guix build utils)))
+       (snippet
+        `(begin
+           ;; The following is quite a heavy-handed way of unbundling PPSSPP.
+           ;; There are still a number of external sources, that we don't
+           ;; remove here.  Some may be packaged, others are not.
+           ;; First, we patch existing sources to include the right headers.
+           (substitute* (append (find-files "Common" ".*\\.(h|cpp)")
+                                (find-files "Core" ".*\\.(h|cpp)")
+                                (find-files "GPU" ".*\\.(h|cpp)")
+                                (find-files "SDL" ".*\\.(h|cpp)")
+                                (find-files "UI" ".*\\.(h|cpp)"))
+             ;; These headers are all hard-coded in the original source.
+             (("ext/cityhash/") "")
+             (("ext/glslang/glslang/") "glslang/")
+             (("ext/glslang/") "glslang/")
+             (("ext/miniupnp/") "")
+             (("ext/SPIRV-Cross/") "spirv_cross/")
+             (("ext/vulkan/") "vulkan/")
+             (("ext/xxhash.h") "xxhash.h")
+             ;; These definitions do not actually exist in the Vulkan headers,
+             ;; but PPSSPP defines them in ext/vulkan.
+             (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED")
+             (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK"))
+           ;; Next, we patch CMakeLists.
+           (substitute* "CMakeLists.txt"
+             ;; Drop unnecessary includes and targets.
+             (("include_directories\\(ext/glslang\\)") "")
+             (("include_directories\\(ext/xxhash\\)") "")
+             (("include_directories\\(ext/cityhash\\)") "")
+             (("set_target_properties\\(cityhash .*\\)") "")
+             ;; Fix linking to GLEW.
+             (("TARGET Ext::GLEW") "true")
+             (("target_link_libraries\\(native Ext::GLEW\\)")
+              "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)")
+             (("Ext::Snappy") "snappy")
+             ;; Don't search for cityhash/xxhash, we already have them.
+             (("add_library\\((city|xx)hash STATIC") "if()\nendif(")
+             (("ext/xxhash\\.[ch]") "")
+             (("ext/cityhash/.*\\.(cpp|h)") "")
+             (("if\\(USE_MINIUPNPC\\)" all)
+              (string-append all "
+find_package(miniupnpc)
+target_link_libraries(${CoreLibName} miniupnpc ${LDLIBS})
+elseif(FALSE)"))
+             ;; Link all of spirv-cross.
+             (("spirv-cross-glsl" all)
+              (string-append all
+                             " spirv-cross-core spirv-cross-cpp"
+                             " spirv-cross-reflect spirv-cross-util")))
+           (substitute* "ext/CMakeLists.txt"
+             (("add_subdirectory\\(glew\\)") "")
+             (("add_subdirectory\\(glslang( [A-Z_]*)*\\)") "")
+             (("add_subdirectory\\(snappy\\)") "")
+             (("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
+           ;; Finally, we can delete the bundled sources.
+           (for-each delete-file-recursively
+                     '("MoltenVK"
+                       "ext/cmake"
+                       "ext/glew"
+                       "ext/glslang" "ext/glslang-build"
+                       "ext/miniupnp" "ext/miniupnp-build"
+                       "ext/native"
+                       "ext/snappy"
+                       "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
+                       "ext/vulkan"
+                       "ext/xxhash.c"
+                       "ext/xxhash.h"
+                       "ext/zlib"))
+           ;; Since we are not including git as an input, PPSSPP is confused
+           ;; about its version.  Let's fix that here.
+           (substitute* "git-version.cmake"
+             (("unknown") ,version))))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python)))
+    (inputs
+     `(("cityhash" ,cityhash)
+       ("ffmpeg" ,ffmpeg)
+       ("glew" ,glew)
+       ("glslang" ,glslang)
+       ("libpng" ,libpng)
+       ("libzip" ,libzip)
+       ("mesa" ,mesa)
+       ("miniupnpc" ,miniupnpc)
+       ("sdl2" ,sdl2)
+       ("snappy" ,snappy)
+       ("spirv-cross" ,spirv-cross)
+       ("vulkan-headers" ,vulkan-headers)
+       ("vulkan-loader" ,vulkan-loader)
+       ("xxhash" ,xxhash)
+       ("zlib" ,zlib)
+       ;; TODO: unbundle armips.
+       ("armips-source" ,(package-source armips))
+       ("lang"
+        ,(let ((commit "6bd5b4bc983917ea8402f73c726b46e36f3de0b4"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/hrydgard/ppsspp-lang")
+                   (commit commit)))
+             (sha256
+              (base32 "08npr3a4xskf85gnlxidl4ksc3rhc7m5rgnj7vsbjvhvw5ap02qx"))
+             (file-name (git-file-name "ppsspp-lang" commit)))))
+       ("tests"
+        ,(let ((commit "1047400eaec6bcbdb2a64d326375ef6a6617c4ac"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/hrydgard/pspautotests")
+                   (commit commit)))
+             (sha256
+              (base32 "0nxv1lskcr8zbg6nrfai21mxsw0n5vaqhbsa41c3cxfyx5c4w2pg"))
+             (file-name (git-file-name "pspautotests" commit)))))))
+    (arguments
+     `(#:out-of-source? #f
+       #:configure-flags (list "-DUSE_DISCORD=OFF"
+                               "-DUSE_SYSTEM_FFMPEG=ON"
+                               "-DUSE_SYSTEM_LIBZIP=ON"
+                               ;; for testing
+                               "-DUNITTEST=ON" "-DHEADLESS=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'add-external-sources
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; TODO: unbundle armips.
+             (copy-recursively (assoc-ref inputs "armips-source")
+                               "ext/armips")
+             ;; Some tests are externalised, so we add them here.
+             (copy-recursively (assoc-ref inputs "tests")
+                               "pspautotests")
+             ;; i18n is externalised, so we add it here.
+             (copy-recursively (assoc-ref inputs "lang")
+                               "assets/lang")
+             #t))
+         (add-after 'unpack 'fix-unittest-build
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               (("unittest/TestVertexJit.cpp" all)
+                (string-append all " unittest/TestShaderGenerators.cpp")))
+             (substitute* "unittest/TestVertexJit.cpp"
+               (("#include \"unittest/UnitTest.h\"" all)
+                (string-append all "\n#include <cmath>")))
+             #t))
+         (replace 'check
+           (lambda _
+             (for-each
+              (lambda (t) (invoke "./unitTest" t))
+              '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin"
+                "SinCos" #|"VFPUSinCos" SIGSEGV|# "MathUtil" "Parsers" "Jit"
+                "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ"
+                #|"ShaderGenerators"|#))
+             (invoke "python3" "test.py" "-g")
+             #t))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin/ppsspp (string-append out "/bin/ppsspp"))
+                    (share (string-append out "/share/ppsspp")))
+               (copy-recursively "icons/hicolor"
+                                 (string-append out "/share/icons/hicolor"))
+               (install-file "PPSSPPSDL" share)
+               (copy-recursively "assets" (string-append share "/assets"))
+
+               (make-desktop-entry-file
+                (string-append out "/share/applications/ppsspp.desktop")
+                #:name "PPSSPP"
+                #:exec (string-append share "/PPSSPPSDL")
+                #:icon "ppsspp")
+               (mkdir-p (string-append out "/bin"))
+               (with-output-to-file bin/ppsspp
+                 (lambda ()
+                   (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\""
+                           (which "sh") share)))
+               (chmod bin/ppsspp #o755)
+               #t))))))
+    (home-page "https://www.ppsspp.org/")
+    (synopsis "PSP emulator")
+    (description
+     "PPSSPP is a ``high-level'' emulator simulating the PSP operating
+system.")
+    (license license:gpl2+)))