Skip to content

Commit

Permalink
Update installer to automatically detect Steam, GOG install directori…
Browse files Browse the repository at this point in the history
…es; add uninstaller
  • Loading branch information
fholger committed Dec 22, 2023
1 parent 09a4127 commit 1968962
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions Installer/crysis.nsi
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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.'
Expand All @@ -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 ""
Expand All @@ -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

0 comments on commit 1968962

Please sign in to comment.