From 5f1a1aad641f7a7a2604248200b56118bee25d0e Mon Sep 17 00:00:00 2001 From: Melody Renata Date: Sun, 1 Sep 2024 21:24:18 -0400 Subject: [PATCH] star-citizen 1.6.10 -> 2.03 * Bump star-citizen to 2.0.3 * change winetricks version to winetricks-git * Add options `enableGameScope` `gameScopeArgs` --- pkgs/default.nix | 1 + pkgs/star-citizen/default.nix | 62 ++++++++++++++++----------- pkgs/star-citizen/powershell-stub.nix | 28 ------------ 3 files changed, 37 insertions(+), 54 deletions(-) delete mode 100644 pkgs/star-citizen/powershell-stub.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index f344d18..00fce00 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -87,6 +87,7 @@ star-citizen = pkgs.callPackage ./star-citizen { wine = config.packages.wine-ge; + winetricks = config.packages.winetricks-git; inherit (config.packages) umu; }; star-citizen-umu = config.packages.star-citizen.override {useUmu = true;}; diff --git a/pkgs/star-citizen/default.nix b/pkgs/star-citizen/default.nix index 5ccd9f6..3aed4f4 100644 --- a/pkgs/star-citizen/default.nix +++ b/pkgs/star-citizen/default.nix @@ -4,6 +4,7 @@ symlinkJoin, writeShellScriptBin, gamemode, + gamescope, winetricks, wine, dxvk, @@ -13,12 +14,14 @@ wineFlags ? "", pname ? "star-citizen", location ? "$HOME/Games/star-citizen", - tricks ? [], + tricks ? ["powershell"], useUmu ? false, protonPath ? "${proton-ge-bin.steamcompattool}/", steamRuntime ? "${steamPackages.steam-runtime}/", protonVerbs ? ["waitforexitandrun"], - wineDllOverrides ? ["powershell.exe=n"], + wineDllOverrides ? [], + gameScopeEnable ? false, + gameScopeArgs ? [], preCommands ? "", postCommands ? "", enableGlCache ? true, @@ -26,15 +29,15 @@ pkgs, }: let inherit (lib.strings) concatStringsSep optionalString; - version = "1.6.10"; + # Latest version can be found: https://install.robertsspaceindustries.com/star-citizen/latest.yml + version = "2.0.3"; src = pkgs.fetchurl { - url = "https://install.robertsspaceindustries.com/star-citizen/RSI-Setup-${version}.exe"; - name = "RSI-Setup-${version}.exe"; - hash = "sha256-axttJvw3MFmhLC4e+aqtf4qx0Z0x4vz78LElyGkMAbs="; + url = "https://install.robertsspaceindustries.com/rel/2/RSI%20Launcher-Setup-${version}.exe"; + name = "RSI Launcher-Setup-${version}.exe"; + hash = "sha256-tnhbAuS49Hg550nR0gmetdoetI884RfATipNyzyOFOE="; }; # Powershell stub for star-citizen - powershell-stub = pkgs.callPackage ./powershell-stub.nix {}; # concat winetricks args tricksFmt = @@ -42,38 +45,47 @@ then concatStringsSep " " tricks else "-V"; + gameScope = lib.strings.optionalString gameScopeEnable "${gamescope}/bin/gamescope ${concatStringsSep " " gameScopeArgs} --"; + script = writeShellScriptBin pname '' + export WINETRICKS_LATEST_VERSION_CHECK=disabled export WINEARCH="win64" export WINEPREFIX="${location}" - ${optionalString + ${ + optionalString #this option doesn't work on umu, an umu TOML config file will be needed instead - (!useUmu) '' + (!useUmu) + '' export WINEFSYNC=1 export WINEESYNC=1 export WINEDLLOVERRIDES="${lib.strings.concatStringsSep "," wineDllOverrides}" - ''} + # Anti-cheat + export EOS_USE_ANTICHEATCLIENTNULL=1 + # Nvidia tweaks + export WINE_HIDE_NVIDIA_GPU=1 + # AMD + export dual_color_blend_by_location="true" + + '' + } # ID for umu, not used for now export GAMEID="umu-starcitizen" export STORE="none" - # Anti-cheat - export EOS_USE_ANTICHEATCLIENTNULL=1 - # Nvidia tweaks - export WINE_HIDE_NVIDIA_GPU=1 + export __GL_SHADER_DISK_CACHE=${ if enableGlCache then "1" else "0" } export __GL_SHADER_DISK_CACHE_SIZE=${toString glCacheSize} - export WINE_HIDE_NVIDIA_GPU=1 - # AMD - export dual_color_blend_by_location="true" - PATH=${lib.makeBinPath ( - if useUmu - then [umu] - else [wine winetricks] - )}:$PATH + PATH=${ + lib.makeBinPath ( + if useUmu + then [umu] + else [wine winetricks] + ) + }:$PATH USER="$(whoami)" RSI_LAUNCHER="$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" ${ @@ -108,16 +120,14 @@ fi cd $WINEPREFIX - ${powershell-stub}/bin/install.sh - ${preCommands} ${ if useUmu then '' - ${gamemode}/bin/gamemoderun umu-run "$RSI_LAUNCHER" "$@" + ${gameScope} ${gamemode}/bin/gamemoderun umu-run "$RSI_LAUNCHER" "$@" '' else '' - ${gamemode}/bin/gamemoderun wine ${wineFlags} "$RSI_LAUNCHER" "$@" + ${gameScope} ${gamemode}/bin/gamemoderun wine ${wineFlags} "$RSI_LAUNCHER" "$@" wineserver -w '' } diff --git a/pkgs/star-citizen/powershell-stub.nix b/pkgs/star-citizen/powershell-stub.nix deleted file mode 100644 index 6e4b41d..0000000 --- a/pkgs/star-citizen/powershell-stub.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - stdenvNoCC, - bash, - fetchurl, - ... -}: let - version = "0.1"; -in - stdenvNoCC.mkDerivation { - name = "powerstub"; - inherit version; - - src = fetchurl { - url = "https://github.com/ngh246/powerstub/releases/download/v${version}/powerstub-v${version}.tar.gz"; - hash = "sha256-l7SgYXoqIhL/GmbFgf8GfQJUMaaJ2QK5Qo8pYf2ydac="; - }; - - installPhase = '' - mkdir -p $out/bin $out/lib - substitute install.sh $out/bin/install.sh \ - --subst-var-by bash ${bash} - substituteInPlace $out/bin/install.sh \ - --replace-fail 'CURDIR=$(pwd)' CURDIR=$out/lib - chmod a+x $out/bin/install.sh - cp -rv x86 $out/lib/ - cp -rv x86_64 $out/lib/ - ''; - }