gnu: Add pcsx2.

* gnu/packages/emulators.scm (pcsx2, pcsx2-patches): New variables.

Change-Id: I200e3d4b3da6d38f258a687c77d5283d2450937d
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Andrew Wong 2025-07-07 23:40:39 -04:00 committed by Liliana Marie Prikler
parent 084df2fae0
commit e4f7118ddd
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -69,6 +69,7 @@
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages containers)
#:use-module (gnu packages cpp)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages curl)
#:use-module (gnu packages digest)
@ -94,12 +95,14 @@
#:use-module (gnu packages libedit)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages lua)
#:use-module (gnu packages maths)
#:use-module (gnu packages mp3)
#:use-module (gnu packages music)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages networking)
#:use-module (gnu packages ninja)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages pretty-print)
#:use-module (gnu packages pulseaudio)
@ -3626,6 +3629,137 @@ assembler, and debugger for the Intel 8085 microprocessor.
improvements.")
(license license:gpl2+))))
(define-public pcsx2-patches
(let ((commit "2fdc835f0725b318efcdaae84db1c73a9139b6f6")
(revision "0"))
(package
(name "pcsx2-patches")
(version (git-version "2025.10.24" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/PCSX2/pcsx2_patches")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0qn9jwk983hxzrf2x550wcb9l782618lm662w5fb6cw81bbrv5is"))))
(build-system copy-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'compress
(lambda _
(with-directory-excursion "patches"
(apply invoke "7z" "a" "-r" "patches.zip"
(find-files "."))))))
#:install-plan #~(list '("patches/patches.zip" "patches.zip"))))
(native-inputs (list 7zip))
(home-page "https://github.com/PCSX2/pcsx2_patches")
(synopsis "PCSX2 widescreen and de-interlacing patches")
(description "This package provides game-specific widescreen and
de-interlacing patches for use with PCSX2.")
(license license:gpl3+)))) ;same as pcsx2
(define-public pcsx2
(package
(name "pcsx2")
(version "2.4.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/PCSX2/pcsx2")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0nr53cjifqwnz3icxsj01yd3aw1vfsfxga4zz5zi8aqr175mvq27"))
(modules '((guix build utils)))
(snippet
#~(begin
(substitute* "pcsx2/Pcsx2Config.cpp"
(("Path::Canonicalize\\(Path::GetDirectory\\(program_path\\)\\);")
"Path::Canonicalize(
((std::string)Path::GetDirectory(program_path)).append(\"/../share/\"));"))
(delete-file-recursively "3rdparty/d3d12memalloc")
(delete-file-recursively "3rdparty/winpixeventruntime")
(delete-file-recursively "3rdparty/winwil")))))
(build-system cmake-build-system)
(arguments
(list
#:parallel-build? #t
#:configure-flags
#~(list "-DCMAKE_C_COMPILER=clang"
"-DCMAKE_CXX_COMPILER=clang++"
"-DCMAKE_PREFIX_PATH=\"$PWD/deps\""
"-GNinja")
#:imported-modules `((guix build copy-build-system)
,@%cmake-build-system-modules)
#:phases
#~(modify-phases %standard-phases
(replace 'build
(lambda _
(invoke "ninja" "-j" (number->string (parallel-job-count)))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests? (invoke "ninja" "unittests"))))
(replace 'install
(lambda* args
(apply
(assoc-ref (@ (guix build copy-build-system) %standard-phases)
'install)
#:install-plan
'(("bin/pcsx2-qt" "bin/")
("bin/resources" "share/")
("bin/translations" "share/")
("../source/.github/workflows/scripts/linux/pcsx2-qt.desktop"
"share/applications/"))
args)))
(add-after 'install 'install-patches
(lambda* (#:key inputs #:allow-other-keys)
(install-file (search-input-file %build-inputs "/patches.zip")
(string-append #$output "/share/resources")))))))
(inputs (list (module-ref
(resolve-interface '(gnu packages debug)) 'libbacktrace)
`(,zstd-1.5.7 "lib")
curl
dbus
eudev
ffmpeg
freetype
kddockwidgets
libaio
libjpeg-turbo
libpcap
libpng-for-pcsx2
libwebp
libxrandr
lz4
pcsx2-patches
plutovg
plutosvg
qtbase
qtdeclarative
qtsvg
qttools
qtwayland
sdl3
shaderc
vulkan-headers
wayland
libxi))
(native-inputs (list clang-17 extra-cmake-modules ninja pkg-config))
(home-page "https://pcsx2.net")
(synopsis "PlayStation 2 (PS2) emulator")
(description
"PCSX2 is a free and open-source PlayStation 2 (PS2)
emulator. Its purpose is to emulate the PS2's hardware, using a combination
of MIPS CPU interpreters, recompilers and a virtual machine which manages
hardware states and PS2 system memory. This allows you to play PS2 games on
your PC, with many additional features and benefits.")
(license license:gpl3+)))
(define-public gens-gs
(package
(name "gens-gs")