OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
main @ 141 LINES
 
[ HISTORY ]  [ UP ]
 

{
  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}/p
roject-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";
      };
    };

    analytics = {
      enable = mkEnableOption "Enable anaylytics";
    };

    startFullscreen = mkEnableOption "Start emulated game fullscreen";

    gamesDir = mkOption {
      type = str;
      default = "./Games";
      description = ''
        Location of the directory that stores all game isos, this is where you sho
uld store
        your brawl iso. Defaults to "./Brawl" (The . is relative to the User dolph
in 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";
          };
          Analytics = {
            Enabled = cfg.analytics.enable;
            PermissionAsked = true;
          };
          Display = {
            Fullscreen = cfg.startFullscreen;
          };
        };
      };
      # Copy dolphin GameSettings configuration from faster-project-plus config
      # This includes various Gecko Code files to make for a better Netplay experi
ence
      "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;
      # };
    };
  };
}

{
  lib,
  self',
  config,
  ...
}: let
  inherit (lib) mkOption mkEnableOption mkIf
;
  inherit (lib.types) package str path attrs
Of 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}/pr
oject-plus";
      description = ''
        Location of the Dolphin User directo
ry, this is the path that the wrapped packag
e
        will use for User configuration. def
aults to "\$\{config.xdg.configHome}/project
-plus"
      '';
    };

    launcherSource = mkOption {
      type = path;
      default = "${self'.packages.fpp-launch
er}/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 disp
layed to other players";
      };
      disableMusic = mkOption {
        type = bool;
        default = true;
        description = "Whether to disable mu
sic during netplay";
      };
      buffer = mkOption {
        type = int;
        default = 4;
        description = "Default netplay buffe
r";
      };
    };

    analytics = {
      enable = mkEnableOption "Enable anayly
tics";
    };

    startFullscreen = mkEnableOption "Start 
emulated game fullscreen";

    gamesDir = mkOption {
      type = str;
      default = "./Games";
      description = ''
        Location of the directory that store
s all game isos, this is where you should st
ore
        your brawl iso. Defaults to "./Brawl
" (The . is relative to the User dolphin dir
ectory)
      '';
    };

    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 proje
ct-plus works OOTB.
          General = {
            IsoPaths = 2;
            IsoPath0 = "${cfg.userDir}/Games
";
            IsoPath1 = "${cfg.userDir}/Launc
her";
            WiiSDCardPath = "${cfg.userDir}/
Wii/sd.raw";
          };
          Core = {
            DefaultISO = "${cfg.userDir}/Gam
es/brawl.iso";
          };
          Netplay = {
            SelectedHostGame = "Project+ Net
play Launcher.dol";
            BufferSize = cfg.netplay.buffer;
            Nickname = cfg.netplay.nickname;
            MusicOff = cfg.netplay.disableMu
sic;
            ListenPort = "0x0a42";
            HostPort = "0x0a42";
            ConnectPort = "0x0a42";
            HostCode = 00000000;
            TraversalChoice = "traversal";
          };
          Analytics = {
            Enabled = cfg.analytics.enable;
            PermissionAsked = true;
          };
          Display = {
            Fullscreen = cfg.startFullscreen
;
          };
        };
      };
      # Copy dolphin GameSettings configurat
ion from faster-project-plus config
      # This includes various Gecko Code fil
es to make for a better Netplay experience
      "project-plus/GameSettings" = {
        source = "${cfg.userSource}/GameSett
ings";
        recursive = true;
      };
      "project-plus/Launcher" = {
        source = "${cfg.launcherSource}";
        recursive = true;
      };
      # Cant get this to work, does the sd c
ard need to be writable for dolphin to use i
t?
      # for now sd card will need to be manu
ally placed in the SD directory
      # "project-plus/Wii/sd.raw" = {
      #   source = cfg.sdCardSource;
      # };
    };
  };
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET