From 83389cb5cf781c2c0c9684d3038d262b50a30499 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 29 Mar 2025 20:45:36 -0400 Subject: [PATCH] Add ares for snes and nintendo 64. --- nix/steam_deck/configuration/home.nix | 1 + .../configuration/hosts/deck/default.nix | 1 + .../configuration/roles/ares/default.nix | 95 ++++ .../roles/ares/files/settings.bml | 418 ++++++++++++++++++ 4 files changed, 515 insertions(+) create mode 100644 nix/steam_deck/configuration/roles/ares/default.nix create mode 100644 nix/steam_deck/configuration/roles/ares/files/settings.bml diff --git a/nix/steam_deck/configuration/home.nix b/nix/steam_deck/configuration/home.nix index fc6454f..6ca17df 100644 --- a/nix/steam_deck/configuration/home.nix +++ b/nix/steam_deck/configuration/home.nix @@ -8,6 +8,7 @@ { imports = [ ./roles/2ship2harkinian + ./roles/ares ./roles/global_options ./roles/graphics ./roles/pcsx2 diff --git a/nix/steam_deck/configuration/hosts/deck/default.nix b/nix/steam_deck/configuration/hosts/deck/default.nix index bd204ba..b6dd04c 100644 --- a/nix/steam_deck/configuration/hosts/deck/default.nix +++ b/nix/steam_deck/configuration/hosts/deck/default.nix @@ -9,6 +9,7 @@ imports = [ ]; config = { + me.ares.enable = true; me.graphical = true; me.optimizations.enable = true; me.pcsx2.enable = true; diff --git a/nix/steam_deck/configuration/roles/ares/default.nix b/nix/steam_deck/configuration/roles/ares/default.nix new file mode 100644 index 0000000..0225687 --- /dev/null +++ b/nix/steam_deck/configuration/roles/ares/default.nix @@ -0,0 +1,95 @@ +# MANUAL: mkdir -p ~/.persist/.local/share/ares/saves ~/.persist/.local/share/ares/screenshots +{ + config, + lib, + pkgs, + ... +}: + +let + steam_ares = pkgs.writeScriptBin "steam_ares" '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib" + exec ${pkgs.ares}/bin/ares "''${@}" + ''; +in +{ + imports = [ ]; + + options.me = { + ares.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install ares."; + }; + }; + + config = lib.mkIf config.me.ares.enable ( + lib.mkMerge [ + (lib.mkIf config.me.graphical { + nixGL.vulkan.enable = true; + + home.packages = with pkgs; [ + ares + steam_ares + ]; + + home.persistence."/home/deck/.persist" = { + directories = [ + { + directory = ".local/share/ares/saves"; + method = "symlink"; + } + { + directory = ".local/share/ares/screenshots"; + method = "symlink"; + } + ]; + }; + + home.file.".local/share/ares/settings.bml" = { + source = ./files/settings.bml; + }; + + nixpkgs.overlays = [ + ( + final: prev: + let + optimizeWithFlags = + pkg: flags: + pkg.overrideAttrs (old: { + env.NIX_CFLAGS_COMPILE = + (old.env.NIX_CFLAGS_COMPILE or "") + (lib.strings.concatStringsSep " " flags); + }); + original_package = + if config.me.optimizations.enable then + (optimizeWithFlags prev.ares [ + "-march=znver2" + "-mtune=znver2" + ]) + else + prev.ares; + in + { + ares = pkgs.buildEnv { + name = prev.ares.name; + paths = [ + (config.lib.nixGL.wrap original_package) + ]; + extraOutputsToInstall = [ + "man" + "doc" + "info" + ]; + # We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them. + postBuild = '' + chmod 0555 $out/share/applications/ares.desktop + ''; + }; + } + ) + ]; + }) + ] + ); +} diff --git a/nix/steam_deck/configuration/roles/ares/files/settings.bml b/nix/steam_deck/configuration/roles/ares/files/settings.bml new file mode 100644 index 0000000..25bd90f --- /dev/null +++ b/nix/steam_deck/configuration/roles/ares/files/settings.bml @@ -0,0 +1,418 @@ +Video + Driver: OpenGL 3.2 + Monitor: Primary + Format: ARGB24 + Exclusive: false + Blocking: false + PresentSRGB: false + ThreadedRenderer: true + NativeFullScreen: false + Flush: false + Shader: bilinear.slangp + Multiplier: 1 + Output: Scale + AspectCorrection: true + AdaptiveSizing: true + AutoCentering: false + Luminance: 1.0 + Saturation: 1.0 + Gamma: 1.0 + ColorBleed: false + ColorEmulation: true + DeepBlackBoost: false + InterframeBlending: true + Overscan: false + PixelAccuracy: false + Quality: SD + Supersampling: false + DisableVideoInterfaceProcessing: false + WeaveDeinterlacing: true +Audio + Driver: PulseAudio Simple + Device: Default + Frequency: 48000 + Latency: 0 + Exclusive: false + Blocking: false + Dynamic: false + Mute: false + Volume: 1.0 + Balance: 0.0 +Input + Driver: SDL + Defocus: Pause +Boot + Fast: false + Debugger: false + Prefer: NTSC-U +General + ShowStatusBar: true + Rewind: false + RunAhead: false + AutoSaveMemory: true + HomebrewMode: false + ForceInterpreter: false +Rewind + Length: 100 + Frequency: 10 +Paths + Home + Firmware + Saves: /home/deck/.local/share/ares/saves/ + Screenshots: /home/deck/.local/share/ares/screenshots/ + Debugging: /home/deck/.local/share/ares/debug/ + ArcadeRoms + SuperFamicom + GameBoy + BSMemory + SufamiTurbo +DebugServer + Port: 9123 + Enabled: false + UseIPv4: false +Nintendo64 + ExpansionPak: true + Visible: true + Path: /home/deck/.persist/manual/games/nintendo_64/roms/ +MegaDrive + TMSS: false + Visible: false + Path +Recent + Game-1 + Game-2 + Game-3 + Game-4 + Game-5 + Game-6 + Game-7 + Game-8 + Game-9 +VirtualPad1 + Pad.Up: 0x28de1205/1/1/Lo;; + Pad.Down: 0x28de1205/1/1/Hi;; + Pad.Left: 0x28de1205/1/0/Lo;; + Pad.Right: 0x28de1205/1/0/Hi;; + Select: ;; + Start: 0x28de1205/3/7;; + A..South: 0x28de1205/3/0;; + B..East: ;; + X..West: 0x28de1205/3/1;; + Y..North: ;; + L-Bumper: 0x28de1205/3/4;; + R-Bumper: 0x28de1205/3/5;; + L-Trigger: ;; + R-Trigger: 0x28de1205/0/2/Hi;; + L-Stick..Click: ;; + R-Stick..Click: ;; + L-Up: 0x28de1205/0/1/Lo;; + L-Down: 0x28de1205/0/1/Hi;; + L-Left: 0x28de1205/0/0/Lo;; + L-Right: 0x28de1205/0/0/Hi;; + R-Up: 0x28de1205/0/4/Lo;; + R-Down: 0x28de1205/0/4/Hi;; + R-Left: 0x28de1205/0/3/Lo;; + R-Right: 0x28de1205/0/3/Hi;; + Rumble: 0x28de1205/3/6;; +VirtualMouse1 + X: ;; + Y: ;; + Left: ;; + Middle: ;; + Right: ;; + Extra: ;; +VirtualPad2 + Pad.Up: ;; + Pad.Down: ;; + Pad.Left: ;; + Pad.Right: ;; + Select: ;; + Start: ;; + A..South: ;; + B..East: ;; + X..West: ;; + Y..North: ;; + L-Bumper: ;; + R-Bumper: ;; + L-Trigger: ;; + R-Trigger: ;; + L-Stick..Click: ;; + R-Stick..Click: ;; + L-Up: ;; + L-Down: ;; + L-Left: ;; + L-Right: ;; + R-Up: ;; + R-Down: ;; + R-Left: ;; + R-Right: ;; + Rumble: ;; +VirtualMouse2 + X: ;; + Y: ;; + Left: ;; + Middle: ;; + Right: ;; + Extra: ;; +VirtualPad3 + Pad.Up: ;; + Pad.Down: ;; + Pad.Left: ;; + Pad.Right: ;; + Select: ;; + Start: ;; + A..South: ;; + B..East: ;; + X..West: ;; + Y..North: ;; + L-Bumper: ;; + R-Bumper: ;; + L-Trigger: ;; + R-Trigger: ;; + L-Stick..Click: ;; + R-Stick..Click: ;; + L-Up: ;; + L-Down: ;; + L-Left: ;; + L-Right: ;; + R-Up: ;; + R-Down: ;; + R-Left: ;; + R-Right: ;; + Rumble: ;; +VirtualMouse3 + X: ;; + Y: ;; + Left: ;; + Middle: ;; + Right: ;; + Extra: ;; +VirtualPad4 + Pad.Up: ;; + Pad.Down: ;; + Pad.Left: ;; + Pad.Right: ;; + Select: ;; + Start: ;; + A..South: ;; + B..East: ;; + X..West: ;; + Y..North: ;; + L-Bumper: ;; + R-Bumper: ;; + L-Trigger: ;; + R-Trigger: ;; + L-Stick..Click: ;; + R-Stick..Click: ;; + L-Up: ;; + L-Down: ;; + L-Left: ;; + L-Right: ;; + R-Up: ;; + R-Down: ;; + R-Left: ;; + R-Right: ;; + Rumble: ;; +VirtualMouse4 + X: ;; + Y: ;; + Left: ;; + Middle: ;; + Right: ;; + Extra: ;; +VirtualPad5 + Pad.Up: ;; + Pad.Down: ;; + Pad.Left: ;; + Pad.Right: ;; + Select: ;; + Start: ;; + A..South: ;; + B..East: ;; + X..West: ;; + Y..North: ;; + L-Bumper: ;; + R-Bumper: ;; + L-Trigger: ;; + R-Trigger: ;; + L-Stick..Click: ;; + R-Stick..Click: ;; + L-Up: ;; + L-Down: ;; + L-Left: ;; + L-Right: ;; + R-Up: ;; + R-Down: ;; + R-Left: ;; + R-Right: ;; + Rumble: ;; +VirtualMouse5 + X: ;; + Y: ;; + Left: ;; + Middle: ;; + Right: ;; + Extra: ;; +Hotkey + ToggleFullscreen: ;; + ToggleMouseCapture: ;; + ToggleKeyboardCapture: ;; + FastForward: ;; + ToggleFastForward: ;; + Rewind: ;; + FrameAdvance: ;; + CaptureScreenshot: ;; + SaveState: ;; + LoadState: ;; + DecrementStateSlot: ;; + IncrementStateSlot: ;; + PauseEmulation: ;; + ResetSystem: ;; + ReloadCurrentGame: ;; + QuitEmulator: ;; + MuteAudio: ;; + IncreaseAudio: ;; + DecreaseAudio: ;; +Arcade + Visible: false + Path +Atari2600 + Visible: false + Path +WonderSwan + Visible: false + Path +WonderSwanColor + Visible: false + Path +PocketChallengeV2 + Visible: false + Path +ColecoVision + Visible: false + Path + Firmware + BIOS.World +MyVision + Visible: false + Path +MSX + Visible: false + Path + Firmware + BIOS.Japan +MSX2 + Visible: false + Path + Firmware + MAIN.Japan + SUB.Japan +PCEngine + Visible: false + Path +PCEngineCD + Visible: false + Path + Firmware + System-Card-1.0.Japan + Arcade-Card.Japan + System-Card-3.0.US + Games-Express.Japan +SuperGrafx + Visible: false + Path +SuperGrafxCD + Visible: false + Path + Firmware + Arcade-Card.Japan +Famicom + Visible: false + Path +FamicomDiskSystem + Visible: false + Path + Firmware + BIOS.Japan +SuperFamicom + Visible: true + Path +Nintendo64DD + Visible: false + Path + Firmware + BIOS.Japan + BIOS.US + BIOS.DEV +GameBoy + Visible: true + Path +GameBoyColor + Visible: true + Path +GameBoyAdvance + Visible: true + Path + Firmware + BIOS.World +SG-1000 + Visible: false + Path +MasterSystem + Visible: false + Path + Firmware + BIOS.US + BIOS.Japan + BIOS.Europe +GameGear + Visible: false + Path + Firmware + BIOS.World +Mega32X + Visible: false + Path +MegaCD + Visible: false + Path + Firmware + BIOS.US + BIOS.Japan + BIOS.Europe +MegaCD32X + Visible: false + Path +NeoGeoAES + Visible: false + Path + Firmware + BIOS.World +NeoGeoMVS + Visible: false + Path + Firmware + BIOS.World +NeoGeoPocket + Visible: false + Path + Firmware + BIOS.World +NeoGeoPocketColor + Visible: false + Path + Firmware + BIOS.World +PlayStation + Visible: true + Path + Firmware + BIOS.US + BIOS.Japan + BIOS.Europe +ZXSpectrum + Visible: false + Path +ZXSpectrum128 + Visible: false + Path