From 196896244b470fc8d5afcf534f817f7885f5e6a2 Mon Sep 17 00:00:00 2001 From: Holger Frydrych Date: Fri, 22 Dec 2023 18:17:03 +0100 Subject: [PATCH] Update installer to automatically detect Steam, GOG install directories; add uninstaller --- Installer/crysis.nsi | 48 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/Installer/crysis.nsi b/Installer/crysis.nsi index 50580a5..7816843 100644 --- a/Installer/crysis.nsi +++ b/Installer/crysis.nsi @@ -1,7 +1,9 @@ !include "MUI2.nsh" -!define VERSION '0.3.0' +!define VERSION '0.3.1' Name "Crysis VR Mod" +; should not need admin privileges as the install folder should be user writable, anyway +RequestExecutionLevel user OutFile ".\crysis-vrmod-${VERSION}.exe" @@ -13,7 +15,7 @@ OutFile ".\crysis-vrmod-${VERSION}.exe" !define MUI_WELCOMEPAGE_TITLE 'Crysis VR Mod v${VERSION}' !define MUI_WELCOMEPAGE_TEXT 'This will install the Crysis VR Mod on your computer. \ Please be aware that this is an early development version, and bugs are to be expected. \ -It is a seated-only experience for now without any motion controller support. \ +It is a seated-only experience for now with limited motion controller support. \ Also, it is Crysis - expect performance to not be great :)' !define MUI_DIRECTORYPAGE_TEXT 'Please enter the location of your Crysis installation.' @@ -24,9 +26,14 @@ Also, it is Crysis - expect performance to not be great :)' !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + !insertmacro MUI_LANGUAGE "English" Section "" @@ -43,8 +50,43 @@ Section "" Delete $INSTDIR\Bin64\d3d10.dll Delete $INSTDIR\Bin64\dxgi.dll Delete $INSTDIR\LaunchVRMod.bat + + WriteUninstaller "$INSTDIR\Uninstall_CrysisVR.exe" +SectionEnd + +Section "Start menu shortcut" + CreateShortcut "$SMPrograms\$(^Name).lnk" "$InstDir\Bin64\CrysisVR.exe" +SectionEnd + +Section /o "Desktop shortcut" + CreateShortcut "$Desktop\$(^Name).lnk" "$InstDir\Bin64\CrysisVR.exe" +SectionEnd + +Section "Uninstall" + SetOutPath $INSTDIR + RMDir /r "$INSTDIR\Mods\VRMod" + Delete "$INSTDIR\Bin64\CrysisVR.exe" + Delete "$SMPrograms\$(^Name).lnk" + Delete "$Desktop\$(^Name).lnk" + Delete "Uninstall_CrysisVR.exe" SectionEnd Function .onInit - StrCpy $INSTDIR "C:\Program Files (x86)\Steam\steamapps\common\Crysis" + ; try to look up install directory for the GOG.com version of Crysis + SetRegView 32 + ReadRegStr $R0 HKLM "Software\GOG.com\Games\1809223221" "path" + IfErrors lbl_checksteam 0 + StrCpy $INSTDIR $R0 + Return + + lbl_checksteam: + ; try to look up install directory for the Steam version of Crysis + SetRegView 64 + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 17300" "InstallLocation" + IfErrors lbl_fallback 0 + StrCpy $INSTDIR $R0 + Return + + lbl_fallback: + StrCpy $INSTDIR "$PROGRAMFILES32\Steam\steamapps\common\Crysis" FunctionEnd