channel

My GNU Guix channel
Log | Files | Refs | README

commit 344ca71a04f620f73a1b29512955f7dad048f3a1
parent f7b882a397a5c92b5e302bb2405479c1c4740621
Author: Luke Willis <lukejw@loquat.dev>
Date:   Thu, 23 Oct 2025 18:09:11 -0400

Improve the Minecraft experience

Diffstat:
Mloquat/packages/games.scm | 118++++++++++++++++++++++++++++++++++---------------------------------------------
1 file changed, 50 insertions(+), 68 deletions(-)

diff --git a/loquat/packages/games.scm b/loquat/packages/games.scm @@ -2,6 +2,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix git-download) + #:use-module (gnu packages audio) #:use-module (gnu packages compression) #:use-module (gnu packages elf) #:use-module (gnu packages gl) @@ -14,13 +15,54 @@ #:use-module (gnu packages pulseaudio) #:use-module (gnu packages qt) #:use-module (gnu packages sdl) + #:use-module (gnu packages speech) #:use-module (gnu packages sqlite) #:use-module (gnu packages video) #:use-module (guix build-system cmake) #:use-module (guix build-system qt) #:use-module (guix gexp)) -;; For playing Minecraft. Setup to run on wayland by default. +;; Controller patches for GLFW 3.4 +;; Pulled from https://github.com/mdqinc/SDL_GameControllerDB + +;; Mappings for the 8BitDo Ultimate 2C controller. +(define 8bitdo-ultimate-2c-patch + (plain-file "8bitdo-ultimate-2c-glfw-3.4.patch" "\ +--- a/src/mappings.h 2025-10-23 11:33:49.165631631 -0400 ++++ b/src/mappings.h 2025-10-23 11:35:10.850409920 -0400 +@@ -996,6 +996,9 @@ + \"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,\", + \"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,\", + \"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,\", ++\"03000000c82d00000a31000014010000,8BitDo Ultimate 2C,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\", ++\"03000000c82d00001d30000011010000,8BitDo Ultimate 2C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,\", ++\"05000000c82d00001b30000001000000,8BitDo Ultimate 2C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,\" + #endif // GLFW_BUILD_LINUX_JOYSTICK + };")) + +;; Custom build of GLFW with more controllers included. +;; This is important for forks like BTA! which implement controller support +;; using the provided GLFW version. + +(define-public glfw-mc + (package + (inherit glfw-3.4) + (name "glfw-mc") + (version "3.4") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/glfw/glfw" + "/releases/download/" version + "/glfw-" version ".zip")) + (sha256 + (base32 + "1sd396kkn53myp61kxrd18h7b1q4ix173hhxhvl0iz8j4x5h1v5m")) + (patches (list 8bitdo-ultimate-2c-patch)))) + (synopsis "A patched version of GLFW 3.4 that works better with Minecraft +out of the box. Intended to replace the bundled version."))) + +;; For playing Minecraft. Setup to run on Wayland by default. +;; TODO: Support X11 out of the box. (define-public prismlauncher (package (name "prismlauncher") @@ -40,12 +82,14 @@ (arguments `(#:phases (modify-phases %standard-phases - ;; Patch default settings + ;; Patch default settings to use native libraries (add-after 'unpack 'change-default-settings (lambda* (#:key inputs #:allow-other-keys) (substitute* "launcher/Application.cpp" (("\"UseNativeGLFW\", false") - "\"UseNativeGLFW\", true")))) + "\"UseNativeGLFW\", true") + (("\"UseNativeOpenAL\", false") + "\"UseNativeOpenAL\", true")))) ;; Add required environment variables (add-after 'install 'patch-paths (lambda* (#:key inputs outputs #:allow-other-keys) @@ -82,74 +126,12 @@ ("jdk17" ,openjdk17 "jdk") ("jdk21" ,openjdk21 "jdk") ;; Runtime deps for MC itself - ("glfw" ,glfw-3.4) + ("glfw" ,glfw-mc) ("mesa" ,mesa) + ("flite" ,flite) ;; For narrator + ("openal" ,openal) ("pulseaudio" ,pulseaudio))) (home-page "https://prismlauncher.org/") (synopsis #f) (description #f) (license #f))) - -;; I don't know if this is really necessary, but the upstream mgba package doesn't seem to -;; work on wayland when using mgba-qt. -(define-public mgba-qt-wayland - (package - (name "mgba-qt-wayland") - (version "0.10.5") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/mgba-emu/mgba") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1scyvcp8l5z1sy1hcr0wgdf8zrirg07fzqjdmhkjnyhxmb9sibb5")) - (modules '((guix build utils))) - (snippet - ;; Make sure we don't use the bundled software. - '(begin - (for-each - (lambda (subdir) - (let ((lib-subdir (string-append "src/third-party/" subdir))) - (delete-file-recursively lib-subdir))) - '("libpng" "lzma" "sqlite3" "zlib")))))) - (build-system qt-build-system) - (arguments - `(#:tests? #f ;no "test" target - #:configure-flags - (list "-DENABLE_SCRIPTING=OFF" - "-DM_CORE_GB=OFF" - "-DUSE_DISCORD_RPC=OFF" - "-DBUILD_SDL=OFF" - "-DBUILD_LTO=OFF" ;FIXME: <https://github.com/mgba-emu/mgba/issues/3115> - "-DUSE_LZMA=OFF" ;do not use bundled LZMA - "-DUSE_LIBZIP=OFF"))) ;use "zlib" instead - (native-inputs (list pkg-config qttools-5)) - (inputs - (list libedit - libelf - libepoxy - libpng - mesa - minizip - ncurses - qtbase-5 - qtmultimedia-5 - qtwayland-5 - sdl2 - sqlite - zlib)) - (home-page "https://mgba.io") - (synopsis "Game Boy Advance emulator") - (description - "mGBA is an emulator for running Game Boy Advance games. It aims to be -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)))) - -prismlauncher