maint(iw7_Installer.nsi) better file/error handling, silent argument, launch options
This commit is contained in:
parent
c415b43eee
commit
aeb5784113
@ -1,11 +1,20 @@
|
||||
SetCompressor /SOLID lzma
|
||||
SetCompressorDictSize 64
|
||||
; /SOLID: Improves compression ratio by treating files as a single stream
|
||||
; SetCompressorDictSize: Controls compression memory and efficiency
|
||||
; - Larger values (32-64) improve compression but use more memory
|
||||
; - Smaller values (16-32) use less memory but compress less effectively
|
||||
|
||||
!include "MUI2.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "nsDialogs.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
!include "x64.nsh"
|
||||
|
||||
; Constants
|
||||
!define PRODUCT_NAME "IW7-Mod"
|
||||
!define PRODUCT_DESCRIPTION "Call of Duty Infinite Warfare Client"
|
||||
!define COPYRIGHT "Installer created by Ahrimdon (FOSS)"
|
||||
!define PRODUCT_DESCRIPTION "Call of Duty: Infinite Warfare - Client"
|
||||
!define COPYRIGHT "Copyright © 2024 AlterWare"
|
||||
!define PRODUCT_VERSION "1.0.0.0"
|
||||
!define SETUP_VERSION "1.0.0.0"
|
||||
|
||||
@ -61,12 +70,70 @@ ShowUninstDetails show
|
||||
; Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
; Conditional Debug Details
|
||||
!ifdef DEBUG
|
||||
ShowInstDetails always
|
||||
!endif
|
||||
|
||||
Function .onInit
|
||||
; X64 Filesystem Redirection
|
||||
${If} ${RunningX64}
|
||||
${DisableX64FSRedirection}
|
||||
${EndIf}
|
||||
; Check for Silent Install arguments
|
||||
${GetParameters} $R0
|
||||
${GetOptions} $R0 "/s" $0
|
||||
IfErrors +3
|
||||
SetSilent silent
|
||||
Goto done
|
||||
|
||||
${GetOptions} $R0 "-s" $0
|
||||
IfErrors +3
|
||||
SetSilent silent
|
||||
Goto done
|
||||
|
||||
; GUI install
|
||||
MessageBox MB_OKCANCEL|MB_ICONINFORMATION "Place the installer in your Call of Duty Infinite Warfare game folder. Click OK to continue or Cancel to exit." IDOK done
|
||||
Abort
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
; Check and Cleanup Old Files
|
||||
Section "Cleanup Old Files"
|
||||
; Check if each file exists before deleting
|
||||
${If} ${FileExists} "$INSTDIR\iw7-mod.exe"
|
||||
Delete "$INSTDIR\iw7-mod.exe"
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\runner.exe"
|
||||
Delete "$INSTDIR\runner.exe"
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\tlsdll.dll"
|
||||
Delete "$INSTDIR\tlsdll.dll"
|
||||
${EndIf}
|
||||
|
||||
; Directory cleanup
|
||||
${If} ${FileExists} "$INSTDIR\iw7-mod\custom_scripts"
|
||||
RMDir /r "$INSTDIR\iw7-mod\custom_scripts"
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\iw7-mod\sounddata"
|
||||
RMDir /r "$INSTDIR\iw7-mod\sounddata"
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\iw7-mod\ui_scripts"
|
||||
RMDir /r "$INSTDIR\iw7-mod\ui_scripts"
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\iw7-mod\zone"
|
||||
RMDir /r "$INSTDIR\iw7-mod\zone"
|
||||
${EndIf}
|
||||
|
||||
; IfFileExists "$INSTDIR\*.*" 0 +2
|
||||
; RMDir /r "$INSTDIR\*.*"
|
||||
SectionEnd
|
||||
|
||||
; Sections
|
||||
Section "Main Application" SecMain
|
||||
SetOutPath $INSTDIR
|
||||
@ -98,15 +165,35 @@ Function finishpageaction
|
||||
CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\iw7-mod.exe" "" "$INSTDIR\iw7-mod.exe"
|
||||
FunctionEnd
|
||||
|
||||
; Uninstaller Sections
|
||||
; Display informational message after silent installation is complete
|
||||
Function .onInstSuccess
|
||||
${If} ${Silent}
|
||||
MessageBox MB_ICONINFORMATION|MB_OKCANCEL "Install complete! Launch IW7-Mod?" IDOK launchGame
|
||||
Return
|
||||
|
||||
launchGame:
|
||||
Exec "$INSTDIR\iw7-mod.exe"
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; Uninstaller
|
||||
Section "Uninstall"
|
||||
; ; Check for Silent Uninstall arguments
|
||||
; ${GetParameters} $R0
|
||||
; ${GetOptions} $R0 "/s" $0
|
||||
; IfErrors +3
|
||||
; SetSilent silent
|
||||
|
||||
; ${GetOptions} $R0 "-s" $0
|
||||
; IfErrors +3
|
||||
; SetSilent silent
|
||||
|
||||
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
|
||||
Delete $INSTDIR\iw7-mod.exe
|
||||
Delete $INSTDIR\runner.exe
|
||||
Delete $INSTDIR\tlsdll.dll
|
||||
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
|
||||
Delete $INSTDIR\main\server_mp.cfg
|
||||
Delete $INSTDIR\main\server_zm.cfg
|
||||
|
||||
Delete "$INSTDIR\!launch_iw7_mod.bat"
|
||||
Delete "$INSTDIR\!start_mp_server.bat"
|
||||
Delete "$INSTDIR\!start_zm_server.bat"
|
||||
@ -114,9 +201,5 @@ Section "Uninstall"
|
||||
RMDir /r $INSTDIR\iw7-mod
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
RMDir $INSTDIR
|
||||
; RMDir $INSTDIR
|
||||
SectionEnd
|
||||
|
||||
; Create the desktop shortcut based on the checkbox state
|
||||
; Function .onInstSuccess
|
||||
; FunctionEnd
|
2012
installer/tools/Include/FileFunc.nsh
Normal file
2012
installer/tools/Include/FileFunc.nsh
Normal file
File diff suppressed because it is too large
Load Diff
120
installer/tools/Include/x64.nsh
Normal file
120
installer/tools/Include/x64.nsh
Normal file
@ -0,0 +1,120 @@
|
||||
; ---------------------
|
||||
; x64.nsh
|
||||
; ---------------------
|
||||
;
|
||||
; A few simple macros to handle installations on x64 machines.
|
||||
;
|
||||
; RunningX64 checks if the installer is running on a 64-bit OS.
|
||||
; IsWow64 checks if the installer is a 32-bit application running on a 64-bit OS.
|
||||
;
|
||||
; ${If} ${RunningX64}
|
||||
; MessageBox MB_OK "Running on 64-bit Windows"
|
||||
; ${EndIf}
|
||||
;
|
||||
; IsNative* checks the OS native CPU architecture.
|
||||
;
|
||||
; ${If} ${IsNativeAMD64}
|
||||
; ; Install AMD64 64-bit driver/library
|
||||
; ${ElseIf} ${IsNativeARM64}
|
||||
; ; Install ARM64 64-bit driver/library
|
||||
; ${ElseIf} ${IsNativeIA32}
|
||||
; ; Install i386 32-bit driver/library
|
||||
; ${Else}
|
||||
; Abort "Unsupported CPU architecture!"
|
||||
; ${EndIf}
|
||||
;
|
||||
; ${If} ${IsNativeAMD64}
|
||||
; File "amd64\myapp.exe"
|
||||
; ${ElseIf} ${IsNativeIA32}
|
||||
; ${OrIf} ${IsWow64}
|
||||
; File "x86\myapp.exe"
|
||||
; ${Else}
|
||||
; Abort "Unsupported CPU architecture!"
|
||||
; ${EndIf}
|
||||
;
|
||||
; DisableX64FSRedirection disables file system redirection.
|
||||
; EnableX64FSRedirection enables file system redirection.
|
||||
;
|
||||
; SetOutPath $SYSDIR
|
||||
; ${DisableX64FSRedirection}
|
||||
; File something.bin # extracts to C:\Windows\System32
|
||||
; ${EnableX64FSRedirection}
|
||||
; File something.bin # extracts to C:\Windows\SysWOW64
|
||||
;
|
||||
|
||||
!ifndef ___X64__NSH___
|
||||
!define ___X64__NSH___
|
||||
|
||||
!include LogicLib.nsh
|
||||
|
||||
|
||||
!define IsWow64 `"" IsWow64 ""`
|
||||
!macro _IsWow64 _a _b _t _f
|
||||
!insertmacro _LOGICLIB_TEMP
|
||||
System::Call kernel32::GetCurrentProcess()p.s
|
||||
System::Call kernel32::IsWow64Process2(ps,*i0s,*i) ; [Win10.1511+] 0 if not WOW64
|
||||
Push |
|
||||
System::Call kernel32::IsWow64Process(p-1,*i0s) ; [WinXP+] FALSE for a 32-bit application on ARM64!
|
||||
System::Int64Op
|
||||
Pop $_LOGICLIB_TEMP
|
||||
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
|
||||
!macroend
|
||||
|
||||
|
||||
!define RunningX64 `"" RunningX64 ""`
|
||||
!macro _RunningX64 _a _b _t _f
|
||||
!if ${NSIS_PTR_SIZE} > 4
|
||||
!insertmacro LogicLib_JumpToBranch `${_t}` `${_f}`
|
||||
!else
|
||||
!insertmacro _IsWow64 `${_a}` `${_b}` `${_t}` `${_f}`
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
|
||||
!define GetNativeMachineArchitecture "!insertmacro GetNativeMachineArchitecture "
|
||||
!macro GetNativeMachineArchitecture outvar
|
||||
!define GetNativeMachineArchitecture_lbl lbl_GNMA_${__COUNTER__}
|
||||
System::Call kernel32::GetCurrentProcess()p.s
|
||||
System::Call kernel32::IsWow64Process2(ps,*i,*i0s)
|
||||
Pop ${outvar}
|
||||
IntCmp ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_done ${GetNativeMachineArchitecture_lbl}_done
|
||||
!if "${NSIS_PTR_SIZE}" <= 4
|
||||
!if "${NSIS_CHAR_SIZE}" <= 1
|
||||
System::Call 'USER32::CharNextW(w"")p.s'
|
||||
Pop ${outvar}
|
||||
IntPtrCmpU ${outvar} 0 "" ${GetNativeMachineArchitecture_lbl}_oldnt ${GetNativeMachineArchitecture_lbl}_oldnt
|
||||
StrCpy ${outvar} 332 ; Always IMAGE_FILE_MACHINE_I386 on Win9x
|
||||
Goto ${GetNativeMachineArchitecture_lbl}_done
|
||||
${GetNativeMachineArchitecture_lbl}_oldnt:
|
||||
!endif
|
||||
!endif
|
||||
System::Call '*0x7FFE002E(&i2.s)'
|
||||
Pop ${outvar}
|
||||
${GetNativeMachineArchitecture_lbl}_done:
|
||||
!undef GetNativeMachineArchitecture_lbl
|
||||
!macroend
|
||||
|
||||
!macro _IsNativeMachineArchitecture _ignore _arc _t _f
|
||||
!insertmacro _LOGICLIB_TEMP
|
||||
${GetNativeMachineArchitecture} $_LOGICLIB_TEMP
|
||||
!insertmacro _= $_LOGICLIB_TEMP ${_arc} `${_t}` `${_f}`
|
||||
!macroend
|
||||
|
||||
!define IsNativeMachineArchitecture `"" IsNativeMachineArchitecture `
|
||||
!define IsNativeIA32 '${IsNativeMachineArchitecture} 332' ; Intel x86
|
||||
!define IsNativeAMD64 '${IsNativeMachineArchitecture} 34404' ; x86-64/x64
|
||||
!define IsNativeARM64 '${IsNativeMachineArchitecture} 43620'
|
||||
|
||||
|
||||
!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
|
||||
!macro DisableX64FSRedirection
|
||||
System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
|
||||
!macroend
|
||||
|
||||
!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
|
||||
!macro EnableX64FSRedirection
|
||||
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
|
||||
!macroend
|
||||
|
||||
|
||||
!endif # !___X64__NSH___
|
BIN
installer/tools/Stubs/lzma_solid-x86-unicode
Normal file
BIN
installer/tools/Stubs/lzma_solid-x86-unicode
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user