From f59c08deb52fa3ec36c4eb57ccd1b4b8d78d10ec Mon Sep 17 00:00:00 2001 From: ooks-io Date: Sat, 11 Jan 2025 20:18:38 +1100 Subject: [PATCH] project-plus: home-manager module init --- modules/home/workstation/gaming/default.nix | 1 + modules/home/workstation/gaming/emulation.nix | 9 ++ .../gaming/project-plus/default.nix | 5 + .../gaming/project-plus/options.nix | 129 ++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 modules/home/workstation/gaming/project-plus/default.nix create mode 100644 modules/home/workstation/gaming/project-plus/options.nix diff --git a/modules/home/workstation/gaming/default.nix b/modules/home/workstation/gaming/default.nix index 20f918e..4412448 100644 --- a/modules/home/workstation/gaming/default.nix +++ b/modules/home/workstation/gaming/default.nix @@ -11,6 +11,7 @@ in { ./wine.nix ./bottles.nix ./emulation.nix + ./project-plus ]; config = mkIf (elem "gaming" profiles) { ooknet.binds = { diff --git a/modules/home/workstation/gaming/emulation.nix b/modules/home/workstation/gaming/emulation.nix index c569f10..a9cb88e 100644 --- a/modules/home/workstation/gaming/emulation.nix +++ b/modules/home/workstation/gaming/emulation.nix @@ -2,6 +2,7 @@ lib, osConfig, pkgs, + self', ... }: let inherit (lib) mkIf elem; @@ -14,6 +15,14 @@ in { (pkgs) ryujinx ; + inherit + (self'.packages) + wii-u-gc-adapter + ; + }; + ooknet.gaming.project-plus = { + enable = true; + netplay.nickname = "ooks"; }; }; } diff --git a/modules/home/workstation/gaming/project-plus/default.nix b/modules/home/workstation/gaming/project-plus/default.nix new file mode 100644 index 0000000..86e0060 --- /dev/null +++ b/modules/home/workstation/gaming/project-plus/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./options.nix + ]; +} diff --git a/modules/home/workstation/gaming/project-plus/options.nix b/modules/home/workstation/gaming/project-plus/options.nix new file mode 100644 index 0000000..7a27230 --- /dev/null +++ b/modules/home/workstation/gaming/project-plus/options.nix @@ -0,0 +1,129 @@ +{ + lib, + self', + config, + ... +}: let + inherit (lib) mkOption mkEnableOption mkIf; + inherit (lib.types) package str path attrsOf anything bool int; + cfg = config.ooknet.gaming.project-plus; +in { + options.ooknet.gaming.project-plus = { + enable = mkEnableOption "Enable Project Plus"; + package = mkOption { + type = package; + default = self'.packages.project-plus.override { + inherit (cfg) userDir; + }; + }; + userDir = mkOption { + type = str; + default = "${config.xdg.configHome}/project-plus"; + description = '' + Location of the Dolphin User directory, this is the path that the wrapped package + will use for User configuration. defaults to "\$\{config.xdg.configHome}/project-plus" + ''; + }; + + launcherSource = mkOption { + type = path; + default = "${self'.packages.fpp-launcher}/Launcher"; + description = '' + Location of the faster-project-plus launcher files. + ''; + }; + sdCardSource = mkOption { + type = path; + default = "${self'.packages.fpp-sd}/sd.raw"; + description = '' + Location of the faster-project-plus sd card + ''; + }; + userSource = mkOption { + type = path; + default = "${self'.packages.fpp-config}/Binaries/User"; + }; + + netplay = { + nickname = mkOption { + type = str; + default = "Player"; + description = "Netplay nickname displayed to other players"; + }; + disableMusic = mkOption { + type = bool; + default = true; + description = "Whether to disable music during netplay"; + }; + buffer = mkOption { + type = int; + default = 4; + description = "Default netplay buffer"; + }; + }; + + gamesDir = mkOption { + type = str; + default = "./Games"; + description = '' + Location of the directory that stores all game isos, this is where you should store + your brawl iso. Defaults to "./Brawl" (The . is relative to the User dolphin directory) + ''; + }; + + extraSettings = mkOption { + type = attrsOf anything; + default = {}; + description = '' + Additional settings for Dolphin.ini + ''; + }; + }; + config = mkIf cfg.enable { + home.packages = [cfg.package]; + xdg.configFile = { + "project-plus/Config/Dolphin.ini" = { + text = lib.generators.toINI {} { + # default settings to ensure project-plus works OOTB. + General = { + IsoPaths = 2; + IsoPath0 = "${cfg.userDir}/Games"; + IsoPath1 = "${cfg.userDir}/Launcher"; + WiiSDCardPath = "${cfg.userDir}/Wii/sd.raw"; + }; + Core = { + DefaultISO = "${cfg.userDir}/Games/brawl.iso"; + }; + Netplay = + { + SelectedHostGame = "Project+ Netplay Launcher.dol"; + BufferSize = cfg.netplay.buffer; + Nickname = cfg.netplay.nickname; + MusicOff = cfg.netplay.disableMusic; + ListenPort = "0x0a42"; + HostPort = "0x0a42"; + ConnectPort = "0x0a42"; + HostCode = 00000000; + TraversalChoice = "traversal"; + } + // cfg.extraSettings; + }; + }; + # Copy dolphin GameSettings configuration from faster-project-plus config + # This includes various Gecko Code files to make for a better Netplay experience + "project-plus/GameSettings" = { + source = "${cfg.userSource}/GameSettings"; + recursive = true; + }; + "project-plus/Launcher" = { + source = "${cfg.launcherSource}"; + recursive = true; + }; + # Cant get this to work, does the sd card need to be writable for dolphin to use it? + # for now sd card will need to be manually placed in the SD directory + # "project-plus/Wii/sd.raw" = { + # source = cfg.sdCardSource; + # }; + }; + }; +}