commit
78237f36ac
@ -0,0 +1,175 @@ |
||||
{ stdenv, lib, pkgs, fetchurl, nix, pkgsCross, |
||||
installDir ? "$HOME/.local/starcitizen", |
||||
launcherCache ? "$HOME/.local/share", |
||||
prefixBaseDir ? "$HOME/.winenix", |
||||
binName ? "starcitizen", |
||||
launcherArgs ? [ "--use-gl=osmesa" ], |
||||
winePackage ? pkgs.wineWowPackages.unstable, |
||||
wineGlobalEnv ? [ "DXVK_STATE_CACHE=0" ], |
||||
winePatches ? [ ./patches/joyaxis.patch ], |
||||
virtualDesktop ? null, |
||||
registryFiles ? [ ] |
||||
}: |
||||
|
||||
#check wether string is two positive integers separated by x |
||||
assert virtualDesktop == null || |
||||
(lib.strings.toInt(lib.strings.concatStrings(lib.strings.splitString "x" virtualDesktop))) > 0; |
||||
#check whether paths are not terminated with a / |
||||
assert !(builtins.any (lib.strings.hasSuffix "/") [ installDir launcherCache prefixBaseDir ]); |
||||
|
||||
let |
||||
winePkg = winePackage.overrideAttrs (attrs: { |
||||
patches = attrs.patches ++ winePatches; |
||||
}); |
||||
|
||||
dxvk = (with import ~/repositories/nixpkgs/default.nix {}; pkgsCross.mingwW64.callPackage ./dxvk.nix { }); |
||||
fonts = pkgs.callPackage ./fonts.nix {}; |
||||
wine64 = "${winePkg}/bin/wine64"; |
||||
wineMulti = "${winePkg}/bin/wine"; |
||||
regEdit = "${wine64} regedit"; |
||||
reg = "${wine64} reg"; |
||||
rsiInstaller = fetchurl { |
||||
url = "https://install.robertsspaceindustries.com/star-citizen/RSI-Setup-1.4.11.exe"; |
||||
sha256 = "1afc4b36dd1e22d75df8da2ecb925833f9b10327c991be20e138503cde627022"; |
||||
}; |
||||
win10Reg = pkgs.writeTextFile { |
||||
name = "win10.reg"; |
||||
text = ./win10.reg; |
||||
}; |
||||
script = pkgs.writeShellScriptBin binName '' |
||||
#sane bash |
||||
set -eo pipefail |
||||
|
||||
function installPrefix () { |
||||
if [ ! -d "$WINEPREFIX" ]; then |
||||
${winePkg}/bin/wineboot -i |
||||
#set win 10 |
||||
${regEdit} ${win10Reg} |
||||
|
||||
#install dxvk |
||||
for library in ${dxvk}/bin/*.dll ; do |
||||
cp $library "$WINEPREFIX/drive_c/windows/system32" |
||||
local libraryFile=$(basename $library) |
||||
${reg} add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v ''${libraryFile/\.dll/} /d native /f |
||||
done |
||||
|
||||
#install fonts |
||||
cp ${fonts}/share/fonts/*.TTF "$WINEPREFIX/drive_c/windows/Fonts" |
||||
${regEdit} ${fonts}/share/regs/fonts.reg |
||||
|
||||
|
||||
#symlink persistent game and launcher binaries into prefix. |
||||
gameBinariesPers="${installDir}/Roberts Space Industries" |
||||
gameBinariesLinkDest="$WINEPREFIX/drive_c/Program Files/" |
||||
|
||||
mkdir -p "$gameBinariesPers" "$gameBinariesLinkDest" |
||||
ln -s "$gameBinariesPers" "$gameBinariesLinkDest" |
||||
|
||||
#symlink launcher cache |
||||
launcherCachePers="${launcherCache}/rsilauncher" |
||||
mkdir -p "$launcherCachePers" "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/" |
||||
ln -s "$launcherCachePers" "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/" |
||||
|
||||
#apply custom user registry files |
||||
${lib.concatMapStrings (x: "${regEdit} " + x + "\n") registryFiles} |
||||
|
||||
fi |
||||
} |
||||
|
||||
function installLauncher () { |
||||
installPrefix |
||||
|
||||
#install the launcher |
||||
echo "Install with default parameters, launcherArgs won't be used when you launch the launcher from the setup" |
||||
${winePkg}/bin/wine ${rsiInstaller} |
||||
} |
||||
|
||||
function runGame () { |
||||
installPrefix |
||||
|
||||
#install the launcher conditionally here and not in the launcher to allow force reinstalls. |
||||
if [ ! -f "${installDir}/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" ]; then |
||||
installLauncher |
||||
fi |
||||
|
||||
${wineMulti} \ |
||||
${if virtualDesktop != null then "explorer /desktop=${binName},${virtualDesktop}" else ""} \ |
||||
"$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" \ |
||||
${lib.concatStringsSep " " launcherArgs} |
||||
} |
||||
|
||||
function printPrefix () { |
||||
echo "$WINEPREFIX" |
||||
} |
||||
|
||||
function clean () { |
||||
find "${prefixBaseDir}" -maxdepth 1 -type d -name ????????????????????????????????-"${binName}" -and -not -wholename "$WINEPREFIX" -delete |
||||
} |
||||
|
||||
function removePrefix () { |
||||
#Good thing the GPL contains a no warranty clause |
||||
rm -rf "$WINEPREFIX" |
||||
} |
||||
|
||||
function help () { |
||||
echo "Gid gud!" |
||||
} |
||||
|
||||
function wine () { |
||||
installPrefix |
||||
${winePkg}/bin/"$@" |
||||
} |
||||
|
||||
|
||||
#base setup |
||||
if [ ! -d "${installDir}" ]; then |
||||
mkdir -p "${installDir}/Roberts Space Industries" |
||||
fi |
||||
|
||||
#create base dir for nix installs |
||||
if [ ! -d ${prefixBaseDir} ]; then |
||||
mkdir -p "${prefixBaseDir}" |
||||
fi |
||||
|
||||
#core idea: Generate UUID from storage path of this script, ensure |
||||
#new prefix for any changes. Needs fast prefix installs and state outside. |
||||
uuid=$(basename $(${pkgs.nix}/bin/nix path-info "$BASH_SOURCE")) |
||||
export WINEPREFIX="${prefixBaseDir}/$uuid" |
||||
|
||||
#export all global env vars |
||||
${lib.concatMapStrings (x: "export " + x + "\n") wineGlobalEnv } |
||||
|
||||
#parse input |
||||
case "$@" in |
||||
--install-prefix) |
||||
installPrefix |
||||
;; |
||||
--install-launcher) |
||||
installLauncher |
||||
;; |
||||
--clean) |
||||
clean |
||||
;; |
||||
--removePrefix) |
||||
cleanPrefix |
||||
;; |
||||
--run-game|"") |
||||
runGame |
||||
;; |
||||
--print-prefix) |
||||
printPrefix |
||||
;; |
||||
--help) |
||||
help |
||||
;; |
||||
--wine*) |
||||
shift |
||||
wine "$@" |
||||
;; |
||||
*) |
||||
help |
||||
exit 1 |
||||
esac |
||||
''; |
||||
|
||||
in script |
@ -0,0 +1,34 @@ |
||||
{ stdenv, lib, fetchFromGitHub, glslang, buildPackages, writeScriptBin, pkgs, pkgsCross }: |
||||
|
||||
let |
||||
fix = writeScriptBin "x86_64-w64-mingw32-windres" '' |
||||
#!${stdenv.shell} |
||||
exec ${pkgsCross.mingwW64.buildPackages.binutils.bintools}/bin/x86_64-w64-mingw32-windres --preprocessor=x86_64-w64-mingw32-gcc --preprocessor-arg=-E --preprocessor-arg=-xc --preprocessor-arg=-DRC_INVOKED $@ |
||||
''; |
||||
|
||||
in stdenv.mkDerivation rec { |
||||
pname = "dxvk"; |
||||
version = "1.9"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "doitsujin"; |
||||
repo = "dxvk"; |
||||
rev = "v${version}"; |
||||
sha256 = "01db23ncbrrq0cqnp25fg5plp88v5i5ri0i38m0wida8mw3mmjsa"; |
||||
}; |
||||
|
||||
CFLAGS="-fstack-protector"; |
||||
CPPFLAGS="-fstack-protector"; |
||||
mesonFlags = [ "--cross-file build-win64.txt" "--buildtype release" ]; |
||||
depsBuildBuild = [ |
||||
fix |
||||
buildPackages.gcc |
||||
buildPackages.meson |
||||
buildPackages.ninja |
||||
glslang |
||||
]; |
||||
depsBuildTarget = [ |
||||
pkgs.windows.pthreads |
||||
]; |
||||
} |
||||
|
@ -0,0 +1,39 @@ |
||||
{ stdenv, lib, fetchurl, cabextract, pkgs }: |
||||
|
||||
let |
||||
regeditfile = pkgs.writeTextFile { |
||||
name = "fonts.reg"; |
||||
text = |
||||
'' |
||||
REGEDIT4 |
||||
|
||||
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts] |
||||
"Arial Bold"="Arialbd.TTF" |
||||
"Arial Bold Italic"="Arialbi.TTF" |
||||
"Arial Italic"="Ariali.TTF" |
||||
"Arial"="Arial.TTF" |
||||
"Arial Black"="AriBlk.TTF" |
||||
''; |
||||
}; |
||||
in stdenv.mkDerivation rec { |
||||
name = "ariblk-font"; |
||||
src = fetchurl { |
||||
url = "https://mirrors.kernel.org/gentoo/distfiles/arial32.exe"; |
||||
sha256 = "85297a4d146e9c87ac6f74822734bdee5f4b2a722d7eaa584b7f2cbf76f478f6"; |
||||
}; |
||||
srcblk = fetchurl { |
||||
url = "https://mirrors.kernel.org/gentoo/distfiles/arialb32.exe"; |
||||
sha256 = "a425f0ffb6a1a5ede5b979ed6177f4f4f4fdef6ae7c302a7b7720ef332fec0a8"; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ cabextract ]; |
||||
unpackPhase = '' |
||||
cabextract ${src} |
||||
cabextract ${srcblk} |
||||
''; |
||||
installPhase = '' |
||||
mkdir -p $out/share/fonts $out/share/regs |
||||
cp *.TTF $out/share/fonts |
||||
cp ${regeditfile} $out/share/regs/fonts.reg |
||||
''; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,90 @@ |
||||
diff --git a/dlls/joy.cpl/joy.h b/dlls/joy.cpl/joy.h
|
||||
index ec7af4f787..672e8995e1 100644
|
||||
--- a/dlls/joy.cpl/joy.h
|
||||
+++ b/dlls/joy.cpl/joy.h
|
||||
@@ -47,8 +47,8 @@ struct Joystick {
|
||||
struct Effect *effects;
|
||||
};
|
||||
|
||||
-#define TEST_MAX_BUTTONS 32
|
||||
-#define TEST_MAX_AXES 4
|
||||
+#define TEST_MAX_BUTTONS 64
|
||||
+#define TEST_MAX_AXES 8
|
||||
|
||||
struct Graphics {
|
||||
HWND hwnd;
|
||||
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
|
||||
index 4ad9cf848c..35dba75978 100644
|
||||
--- a/dlls/joy.cpl/main.c
|
||||
+++ b/dlls/joy.cpl/main.c
|
||||
@@ -414,6 +414,16 @@ static DWORD WINAPI input_thread(void *param)
|
||||
axes_pos[1][1] = state.lRy;
|
||||
axes_pos[2][0] = state.lZ;
|
||||
axes_pos[2][1] = state.lRz;
|
||||
+ axes_pos[3][0] = 0;
|
||||
+ axes_pos[3][1] = 0;
|
||||
+ axes_pos[4][0] = 0;
|
||||
+ axes_pos[4][1] = 0;
|
||||
+ axes_pos[5][0] = 0;
|
||||
+ axes_pos[5][1] = 0;
|
||||
+ axes_pos[6][0] = 0;
|
||||
+ axes_pos[6][1] = 0;
|
||||
+ axes_pos[7][0] = 0;
|
||||
+ axes_pos[7][1] = 0;
|
||||
|
||||
/* Set pov values */
|
||||
for (j = 0; j < ARRAY_SIZE(pov_val); j++)
|
||||
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
|
||||
index 0560e4bb12..13d3377b03 100644
|
||||
--- a/dlls/winebus.sys/bus_sdl.c
|
||||
+++ b/dlls/winebus.sys/bus_sdl.c
|
||||
@@ -402,10 +402,10 @@ static BOOL build_report_descriptor(struct platform_private *ext)
|
||||
report_size = 0;
|
||||
|
||||
axis_count = pSDL_JoystickNumAxes(ext->sdl_joystick);
|
||||
- if (axis_count > 6)
|
||||
+ if (axis_count > 16)
|
||||
{
|
||||
- FIXME("Clamping joystick to 6 axis\n");
|
||||
- axis_count = 6;
|
||||
+ FIXME("Clamping joystick to 16 axis\n");
|
||||
+ axis_count = 16;
|
||||
}
|
||||
|
||||
ext->axis_start = report_size;
|
||||
@@ -421,9 +421,9 @@ static BOOL build_report_descriptor(struct platform_private *ext)
|
||||
ext->ball_start = report_size;
|
||||
if (ball_count)
|
||||
{
|
||||
- if ((ball_count*2) + axis_count > 9)
|
||||
+ if ((ball_count*2) + axis_count > 19)
|
||||
{
|
||||
- FIXME("Capping ball + axis at 9\n");
|
||||
+ FIXME("Capping ball + axis at 19\n");
|
||||
ball_count = (9-axis_count)/2;
|
||||
}
|
||||
descript_size += sizeof(REPORT_AXIS_HEADER);
|
||||
diff --git a/dlls/winejoystick.drv/joystick_linux.c b/dlls/winejoystick.drv/joystick_linux.c
|
||||
index 8d1a7b1a25..e579d99aa7 100644
|
||||
--- a/dlls/winejoystick.drv/joystick_linux.c
|
||||
+++ b/dlls/winejoystick.drv/joystick_linux.c
|
||||
@@ -260,9 +260,9 @@ LRESULT driver_joyGetDevCaps(DWORD_PTR dwDevID, LPJOYCAPSW lpCaps, DWORD dwSize)
|
||||
lpCaps->wUmax = 0xFFFF;
|
||||
lpCaps->wVmin = 0;
|
||||
lpCaps->wVmax = 0xFFFF;
|
||||
- lpCaps->wMaxAxes = 6; /* same as MS Joystick Driver */
|
||||
+ lpCaps->wMaxAxes = 16; /* same as MS Joystick Driver */
|
||||
lpCaps->wNumAxes = 0; /* nr of axes in use */
|
||||
- lpCaps->wMaxButtons = 32; /* same as MS Joystick Driver */
|
||||
+ lpCaps->wMaxButtons = 64; /* same as MS Joystick Driver */
|
||||
lpCaps->szRegKey[0] = 0;
|
||||
lpCaps->szOEMVxD[0] = 0;
|
||||
lpCaps->wCaps = 0;
|
||||
@@ -326,6 +326,7 @@ LRESULT driver_joyGetPosEx(DWORD_PTR dwDevID, LPJOYINFOEX lpInfo)
|
||||
switch (jstck->axesMap[ev.number]) {
|
||||
case 0: /* X */
|
||||
case 8: /* Wheel */
|
||||
+ case 40: /* Mouse-like */
|
||||
jstck->x = ev.value;
|
||||
break;
|
||||
case 1: /* Y */
|
@ -0,0 +1,18 @@ |
||||
REGEDIT4 |
||||
|
||||
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ProductOptions] |
||||
"ProductType"="WinNT" |
||||
|
||||
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion] |
||||
"CSDVersion"="" |
||||
"CurrentBuildNumber"="10241" |
||||
"CurrentVersion"="10.0" |
||||
"ProductName"="Microsoft Windows 10" |
||||
"CurrentBuild"="17763" |
||||
"CurrentBuildNumber"="17763" |
||||
"CurrentMajorVersionNumber"=dword:0000000a |
||||
"CurrentMinorVersionNumber"=dword:00000000 |
||||
|
||||
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows] |
||||
"CSDVersion"="dword:00000000" |
||||
|
Loading…
Reference in new issue