2022-05-14 19:51:23 -04:00
!include " FileFunc.nsh "
2022-05-20 17:09:42 -04:00
!include " LogicLib.nsh "
2022-05-14 19:51:23 -04:00
!include " MUI2.nsh "
2022-05-16 19:28:04 -04:00
Unicode true
2022-10-24 11:23:02 +02:00
Name " @Launcher_DisplayName@ "
2022-05-30 12:56:29 -04:00
InstallDir " $LOCALAPPDATA \Programs\@Launcher_CommonName@ "
InstallDirRegKey HKCU " Software\@Launcher_CommonName@ " " InstallDir "
2022-05-16 15:29:37 -04:00
RequestExecutionLevel user
2022-05-30 12:56:29 -04:00
OutFile " ../@Launcher_CommonName@-Setup.exe "
2022-05-29 17:37:45 -04:00
!define MUI_ICON " ../@Launcher_Branding_ICO@ "
2022-05-14 19:51:23 -04:00
;--------------------------------
; Pages
!insertmacro MUI_PAGE_WELCOME
!define MUI_COMPONENTSPAGE_NODESC
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
2022-05-29 17:37:45 -04:00
!define MUI_FINISHPAGE_RUN " $InstDir \@Launcher_APP_BINARY_NAME@.exe "
2022-05-14 19:51:23 -04:00
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
2022-05-16 15:29:37 -04:00
;--------------------------------
; Languages
2022-05-14 19:51:23 -04:00
!insertmacro MUI_LANGUAGE " English "
2022-05-16 19:28:04 -04:00
!insertmacro MUI_LANGUAGE " French "
!insertmacro MUI_LANGUAGE " German "
!insertmacro MUI_LANGUAGE " Spanish "
!insertmacro MUI_LANGUAGE " SpanishInternational "
!insertmacro MUI_LANGUAGE " SimpChinese "
!insertmacro MUI_LANGUAGE " TradChinese "
!insertmacro MUI_LANGUAGE " Japanese "
!insertmacro MUI_LANGUAGE " Korean "
!insertmacro MUI_LANGUAGE " Italian "
!insertmacro MUI_LANGUAGE " Dutch "
!insertmacro MUI_LANGUAGE " Danish "
!insertmacro MUI_LANGUAGE " Swedish "
!insertmacro MUI_LANGUAGE " Norwegian "
!insertmacro MUI_LANGUAGE " NorwegianNynorsk "
!insertmacro MUI_LANGUAGE " Finnish "
!insertmacro MUI_LANGUAGE " Greek "
!insertmacro MUI_LANGUAGE " Russian "
!insertmacro MUI_LANGUAGE " Portuguese "
!insertmacro MUI_LANGUAGE " PortugueseBR "
!insertmacro MUI_LANGUAGE " Polish "
!insertmacro MUI_LANGUAGE " Ukrainian "
!insertmacro MUI_LANGUAGE " Czech "
!insertmacro MUI_LANGUAGE " Slovak "
!insertmacro MUI_LANGUAGE " Croatian "
!insertmacro MUI_LANGUAGE " Bulgarian "
!insertmacro MUI_LANGUAGE " Hungarian "
!insertmacro MUI_LANGUAGE " Thai "
!insertmacro MUI_LANGUAGE " Romanian "
!insertmacro MUI_LANGUAGE " Latvian "
!insertmacro MUI_LANGUAGE " Macedonian "
!insertmacro MUI_LANGUAGE " Estonian "
!insertmacro MUI_LANGUAGE " Turkish "
!insertmacro MUI_LANGUAGE " Lithuanian "
!insertmacro MUI_LANGUAGE " Slovenian "
!insertmacro MUI_LANGUAGE " Serbian "
!insertmacro MUI_LANGUAGE " SerbianLatin "
!insertmacro MUI_LANGUAGE " Arabic "
!insertmacro MUI_LANGUAGE " Farsi "
!insertmacro MUI_LANGUAGE " Hebrew "
!insertmacro MUI_LANGUAGE " Indonesian "
!insertmacro MUI_LANGUAGE " Mongolian "
!insertmacro MUI_LANGUAGE " Luxembourgish "
!insertmacro MUI_LANGUAGE " Albanian "
!insertmacro MUI_LANGUAGE " Breton "
!insertmacro MUI_LANGUAGE " Belarusian "
!insertmacro MUI_LANGUAGE " Icelandic "
!insertmacro MUI_LANGUAGE " Malay "
!insertmacro MUI_LANGUAGE " Bosnian "
!insertmacro MUI_LANGUAGE " Kurdish "
!insertmacro MUI_LANGUAGE " Irish "
!insertmacro MUI_LANGUAGE " Uzbek "
!insertmacro MUI_LANGUAGE " Galician "
!insertmacro MUI_LANGUAGE " Afrikaans "
!insertmacro MUI_LANGUAGE " Catalan "
!insertmacro MUI_LANGUAGE " Esperanto "
!insertmacro MUI_LANGUAGE " Asturian "
!insertmacro MUI_LANGUAGE " Basque "
!insertmacro MUI_LANGUAGE " Pashto "
!insertmacro MUI_LANGUAGE " ScotsGaelic "
!insertmacro MUI_LANGUAGE " Georgian "
!insertmacro MUI_LANGUAGE " Vietnamese "
!insertmacro MUI_LANGUAGE " Welsh "
!insertmacro MUI_LANGUAGE " Armenian "
!insertmacro MUI_LANGUAGE " Corsican "
!insertmacro MUI_LANGUAGE " Tatar "
!insertmacro MUI_LANGUAGE " Hindi "
2022-05-14 19:51:23 -04:00
;--------------------------------
2022-06-12 14:51:24 +02:00
; Version info
2022-07-23 14:20:52 +02:00
VIProductVersion " @Launcher_VERSION_NAME4@ "
VIFileVersion " @Launcher_VERSION_NAME4@ "
2022-10-19 12:17:06 +02:00
VIAddVersionKey /LANG = ${LANG_ENGLISH} " ProductName " " @Launcher_DisplayName@ "
VIAddVersionKey /LANG = ${LANG_ENGLISH} " FileDescription " " @Launcher_DisplayName@ Installer "
2022-06-12 14:21:56 -04:00
VIAddVersionKey /LANG = ${LANG_ENGLISH} " LegalCopyright " " @Launcher_Copyright@ "
2022-07-23 14:20:52 +02:00
VIAddVersionKey /LANG = ${LANG_ENGLISH} " FileVersion " " @Launcher_VERSION_NAME4@ "
VIAddVersionKey /LANG = ${LANG_ENGLISH} " ProductVersion " " @Launcher_VERSION_NAME4@ "
2022-06-12 14:51:24 +02:00
2022-10-23 06:49:46 -07:00
;--------------------------------
; Shell Associate Macros
!macro APP_SETUP DESCRIPTION ICON APP_ID APP_NAME APP_EXE COMMANDTEXT COMMAND ; VERB APP_COMPANY
; setup APP_ID
WriteRegStr ShCtx " Software\Classes\${APP_ID} " " " ` ${DESCRIPTION} `
WriteRegStr ShCtx " Software\Classes\${APP_ID}\DefaultIcon " " " ` ${ICON} `
; default open verb
WriteRegStr ShCtx " Software\Classes\${APP_ID}\shell " " " " open "
WriteRegStr ShCtx " Software\Classes\${APP_ID}\shell\open " " " ` ${COMMANDTEXT} `
WriteRegStr ShCtx " Software\Classes\${APP_ID}\shell\open\command " " " ` ${COMMAND} `
; if you want the app to use it's own implementation of a verb
;WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\${VERB}" "" "${DESCRIPTION}"
;WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\${VERB}\command" "" `${COMMAND}`
WriteRegStr ShCtx " Software\Classes\Applications\${APP_EXE}\shell\open\command " " " ` ${COMMAND} `
WriteRegStr ShCtx " Software\Classes\Applications\${APP_EXE} " " FriendlyAppName " ` ${APP_NAME} ` ; [Optional]
;WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}" "ApplicationCompany" `${APP_COMPANY}` ; [Optional]
;WriteRegNone ShCtx "Software\Classes\Applications\${APP_EXE}\SupportedTypes" ".${EXT}" ; [Optional] Only allow "Open With" with specific extension(s) on WinXP+
# Register "Default Programs" [Optional]
!ifdef REGISTER_DEFAULTPROGRAMS
WriteRegStr ShCtx " Software\Classes\Applications\${APP_EXE}\Capabilities " " ApplicationDescription " ` ${DESCRIPTION} `
WriteRegStr ShCtx " Software\RegisteredApplications " ` ${APP_NAME} ` " Software\Classes\Applications\${APP_EXE}\Capabilities "
!endif
!macroend
2022-10-23 08:44:15 -07:00
!macro APP_ASSOCIATE EXT APP_ID APP_EXE OVERWIRTE
2022-10-23 06:49:46 -07:00
; Backup the previously associated file class
2022-10-23 08:44:15 -07:00
${If} ${OVERWIRTE} == true
2022-10-23 06:49:46 -07:00
ReadRegStr $R0 ShCtx " Software\Classes\${EXT} " " "
WriteRegStr ShCtx " Software\Classes\${EXT} " " ${APP_ID}_backup " " $R0 "
WriteRegStr ShCtx " Software\Classes\${EXT} " " " " ${APP_ID} "
2022-10-23 08:44:15 -07:00
${EndIf}
2022-10-23 06:49:46 -07:00
WriteRegNone ShCtx " Software\Classes\${EXT}\OpenWithList " " ${APP_EXE} " ; Win2000+
WriteRegNone ShCtx " Software\Classes\${EXT}\OpenWithProgids " " ${APP_ID} " ; WinXP+
# Register "Default Programs" [Optional]
!ifdef REGISTER_DEFAULTPROGRAMS
WriteRegStr ShCtx " Software\Classes\Applications\${APP_EXE}\Capabilities\FileAssociations " " ${EXT} " " ${APP_ID} "
!endif
!macroend
!macro APP_UNASSOCIATE EXT APP_ID
# Unregister file type
ClearErrors
; restore backup
2022-10-23 08:44:15 -07:00
ReadRegStr $R1 ShCtx " Software\Classes\${EXT} " " "
${If} $R1 == " ${APP_ID} "
ReadRegStr $R0 ShCtx " Software\Classes\${EXT} " ` ${APP_ID}_backup `
WriteRegStr ShCtx " Software\Classes\${EXT} " " " " $R0 "
${Else}
ReadRegStr $R0 ShCtx " Software\Classes\${EXT} " " "
${EndIf}
2022-10-23 06:49:46 -07:00
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${APP_ID} "
${IfNot} ${Errors}
${AndIf} $R0 == " ${APP_ID} "
DeleteRegValue ShCtx " Software\Classes\${EXT} " " "
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${EXT} "
${EndIf}
DeleteRegValue ShCtx " Software\Classes\${EXT}\OpenWithList " " ${APP_EXE} "
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${EXT}\OpenWithList "
DeleteRegValue ShCtx " Software\Classes\${EXT}\OpenWithProgids " " ${APP_ID} "
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${EXT}\OpenWithProgids "
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${EXT} "
# Attempt to clean up junk left behind by the Windows shell
DeleteRegValue HKCU " Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " " ${APP_ID}_${EXT} "
DeleteRegValue HKCU " Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " " Applications\${APP_EXE}_${EXT} "
DeleteRegValue HKCU " Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}\OpenWithProgids " " ${APP_ID} "
DeleteRegKey /IfEmpty HKCU " Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}\OpenWithProgids "
DeleteRegKey /IfEmpty HKCU " Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}\OpenWithList "
DeleteRegKey /IfEmpty HKCU " Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT} "
;DeleteRegKey HKCU "Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.${EXT}"
;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.${EXT}"
!macroend
!macro APP_TEARDOWN APP_ID APP_NAME APP_EXE
# Unregister file type
ClearErrors
DeleteRegKey /IfEmpty ShCtx " Software\Classes\${APP_ID}\shell "
${IfNot} ${Errors}
DeleteRegKey ShCtx " Software\Classes\${APP_ID}\DefaultIcon "
${EndIf}
# Unregister "Open With"
DeleteRegKey ShCtx " Software\Classes\Applications\${APP_EXE} "
# Unregister "Default Programs"
!ifdef REGISTER_DEFAULTPROGRAMS
DeleteRegValue ShCtx " Software\RegisteredApplications " ` ${APP_NAME} `
DeleteRegKey ShCtx " Software\Classes\Applications\${APP_EXE}\Capabilities "
DeleteRegKey /IfEmpty ShCtx " Software\Classes\Applications\${APP_EXE} "
!endif
DeleteRegKey ShCtx ` Software\Classes\${APP_ID} `
DeleteRegKey ShCtx " Software\Classes\Applications\${APP_EXE} "
# Attempt to clean up junk left behind by the Windows shell
DeleteRegValue HKCU " Software\Microsoft\Windows\CurrentVersion\Search\JumplistData " " $INSTDIR \${APP_EXE} "
DeleteRegValue HKCU " Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache " " $INSTDIR \${APP_EXE}.FriendlyAppName "
DeleteRegValue HKCU " Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache " " $INSTDIR \${APP_EXE}.ApplicationCompany "
DeleteRegValue HKCU " Software\Microsoft\Windows\ShellNoRoam\MUICache " " $INSTDIR \${APP_EXE} " ; WinXP
DeleteRegValue HKCU " Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store " " $INSTDIR \${APP_EXE} "
!macroend
; !defines for use with SHChangeNotify
!ifdef SHCNE_ASSOCCHANGED
!undef SHCNE_ASSOCCHANGED
!endif
!define SHCNE_ASSOCCHANGED 0x08000000
!ifdef SHCNF_FLUSH
!undef SHCNF_FLUSH
!endif
!define SHCNF_FLUSH 0x1000
# ensure this is called at the end of any section that changes shell keys
!macro NotifyShell_AssocChanged
; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
; can update the shell.
System :: Call " shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0) "
!macroend
2022-06-12 14:51:24 +02:00
;--------------------------------
2022-05-14 19:51:23 -04:00
; The stuff to install
2022-10-24 11:23:02 +02:00
Section " @Launcher_DisplayName@ "
2022-05-14 19:51:23 -04:00
SectionIn RO
2022-05-29 17:37:45 -04:00
nsExec :: Exec /TIMEOUT = 2000 'TaskKill /IM @Launcher_APP_BINARY_NAME@.exe /F'
2022-05-14 19:51:23 -04:00
SetOutPath $INSTDIR
2022-05-29 17:37:45 -04:00
File " @Launcher_APP_BINARY_NAME@.exe "
2022-05-14 19:51:23 -04:00
File " qt.conf "
File * .dll
File /r " iconengines "
File /r " imageformats "
File /r " jars "
File /r " platforms "
File /r " styles "
2022-05-17 21:56:35 +02:00
File /nonfatal /r " tls "
2022-05-14 19:51:23 -04:00
; Write the installation path into the registry
2022-05-30 12:56:29 -04:00
WriteRegStr HKCU Software\ @ Launcher_CommonName@ " InstallDir " " $INSTDIR "
2022-05-14 19:51:23 -04:00
; Write the uninstall keys for Windows
2022-05-20 17:09:42 -04:00
${GetParameters} $R0
${GetOptions} $R0 " /NoUninstaller " $R1
${If} ${Errors}
2022-05-30 12:56:29 -04:00
!define UNINST_KEY " Software\Microsoft\Windows\CurrentVersion\Uninstall\@Launcher_CommonName@ "
2022-10-19 12:17:06 +02:00
WriteRegStr HKCU " ${UNINST_KEY} " " DisplayName " " @Launcher_DisplayName@ "
2022-05-29 17:37:45 -04:00
WriteRegStr HKCU " ${UNINST_KEY} " " DisplayIcon " " $INSTDIR \@Launcher_APP_BINARY_NAME@.exe "
2022-05-20 17:09:42 -04:00
WriteRegStr HKCU " ${UNINST_KEY} " " UninstallString " '"$INSTDIR\uninstall.exe"'
WriteRegStr HKCU " ${UNINST_KEY} " " QuietUninstallString " '"$INSTDIR\uninstall.exe" /S'
WriteRegStr HKCU " ${UNINST_KEY} " " InstallLocation " " $INSTDIR "
2022-10-19 12:17:06 +02:00
WriteRegStr HKCU " ${UNINST_KEY} " " Publisher " " @Launcher_DisplayName@ Contributors "
2022-07-23 14:20:52 +02:00
WriteRegStr HKCU " ${UNINST_KEY} " " Version " " @Launcher_VERSION_NAME4@ "
WriteRegStr HKCU " ${UNINST_KEY} " " DisplayVersion " " @Launcher_VERSION_NAME@ "
2022-06-12 14:21:56 -04:00
WriteRegStr HKCU " ${UNINST_KEY} " " VersionMajor " " @Launcher_VERSION_MAJOR@ "
WriteRegStr HKCU " ${UNINST_KEY} " " VersionMinor " " @Launcher_VERSION_MINOR@ "
2022-05-20 17:09:42 -04:00
${GetSize} " $INSTDIR " " /S=0K " $0 $1 $2
IntFmt $0 " 0x%08X " $0
WriteRegDWORD HKCU " ${UNINST_KEY} " " EstimatedSize " " $0 "
WriteRegDWORD HKCU " ${UNINST_KEY} " " NoModify " 1
WriteRegDWORD HKCU " ${UNINST_KEY} " " NoRepair " 1
WriteUninstaller " $INSTDIR \uninstall.exe "
${EndIf}
2022-05-14 19:51:23 -04:00
SectionEnd
2022-05-23 14:15:49 -04:00
Section " Start Menu Shortcut " SM_SHORTCUTS
2022-05-14 19:51:23 -04:00
2022-10-19 12:17:06 +02:00
CreateShortcut " $SMPROGRAMS \@Launcher_DisplayName@.lnk " " $INSTDIR \@Launcher_APP_BINARY_NAME@.exe " " " " $INSTDIR \@Launcher_APP_BINARY_NAME@.exe " 0
2022-05-14 19:51:23 -04:00
SectionEnd
2022-06-15 00:46:34 -04:00
Section /o " Desktop Shortcut " DESKTOP_SHORTCUTS
2022-05-23 14:15:49 -04:00
2022-10-19 12:17:06 +02:00
CreateShortcut " $DESKTOP \@Launcher_DisplayName@.lnk " " $INSTDIR \@Launcher_APP_BINARY_NAME@.exe " " " " $INSTDIR \@Launcher_APP_BINARY_NAME@.exe " 0
2022-05-23 14:15:49 -04:00
SectionEnd
2022-10-23 06:49:46 -07:00
!define APP_ID " @Launcher_CommonName@.App "
!define APP_EXE " @Launcher_APP_BINARY_NAME@.exe "
!define APP_ICON " $INSTDIR \${APP_EXE},0 "
!define APP_DESCRIPTION " @Launcher_DisplayName@ "
!define APP_NAME " @Launcher_DisplayName@ "
2022-11-11 05:46:41 -07:00
!define APP_CMD_TEXT " Minecraft Modpack "
2022-10-23 06:49:46 -07:00
2022-10-23 08:44:15 -07:00
!define REGISTER_DEFAULTPROGRAMS ; value doesn't matter
2022-10-23 06:49:46 -07:00
Section - ShellAssoc
2022-10-23 08:44:15 -07:00
!insertmacro APP_SETUP ` ${APP_DESCRIPTION} ` ` ${APP_ICON} ` ` ${APP_ID} ` ` ${APP_CMD_TEXT} ` ` ${APP_EXE} ` ` ${APP_CMD_TEXT} ` '$INSTDIR\${APP_EXE} -I "%1"'
2022-10-23 06:49:46 -07:00
2022-10-23 08:44:15 -07:00
!insertmacro APP_ASSOCIATE " .zip " ` ${APP_ID} ` ` ${APP_EXE} ` false
!insertmacro APP_ASSOCIATE " .mrpack " ` ${APP_ID} ` ` ${APP_EXE} ` true
2022-10-23 06:49:46 -07:00
!insertmacro NotifyShell_AssocChanged
SectionEnd
2022-05-14 19:51:23 -04:00
;--------------------------------
; Uninstaller
Section " Uninstall "
2022-05-29 17:37:45 -04:00
nsExec :: Exec /TIMEOUT = 2000 'TaskKill /IM @Launcher_APP_BINARY_NAME@.exe /F'
2022-05-14 19:51:23 -04:00
2022-05-30 12:56:29 -04:00
DeleteRegKey HKCU " Software\Microsoft\Windows\CurrentVersion\Uninstall\@Launcher_CommonName@ "
DeleteRegKey HKCU SOFTWARE\ @ Launcher_CommonName@
2022-05-14 19:51:23 -04:00
2022-05-29 17:37:45 -04:00
Delete $INSTDIR \ @ Launcher_APP_BINARY_NAME@ .exe
2022-05-14 19:51:23 -04:00
Delete $INSTDIR \ qt.conf
2022-05-17 21:56:35 +02:00
Delete $INSTDIR \ * .dll
Delete $INSTDIR \ uninstall.exe
2022-05-14 19:51:23 -04:00
RMDir /r $INSTDIR \ iconengines
RMDir /r $INSTDIR \ imageformats
RMDir /r $INSTDIR \ jars
RMDir /r $INSTDIR \ platforms
RMDir /r $INSTDIR \ styles
2022-05-17 21:56:35 +02:00
RMDir /r $INSTDIR \ tls
2022-05-14 19:51:23 -04:00
2022-10-19 12:17:06 +02:00
Delete " $SMPROGRAMS \@Launcher_DisplayName@.lnk "
Delete " $DESKTOP \@Launcher_DisplayName@.lnk "
2022-05-14 19:51:23 -04:00
RMDir " $INSTDIR "
SectionEnd
2022-05-20 17:22:30 -04:00
2022-10-23 06:49:46 -07:00
Section - un.ShellAssoc
!insertmacro APP_TEARDOWN ` ${APP_ID} ` ` ${APP_NAME} ` ` ${APP_EXE} `
!insertmacro APP_UNASSOCIATE " .zip " ` ${APP_ID} `
!insertmacro APP_UNASSOCIATE " .mrpack " ` ${APP_ID} `
!insertmacro NotifyShell_AssocChanged
SectionEnd
2022-05-20 17:22:30 -04:00
;--------------------------------
; Extra command line parameters
Function .onInit
${GetParameters} $R0
${GetOptions} $R0 " /NoShortcuts " $R1
${IfNot} ${Errors}
2022-06-15 00:41:52 -04:00
${OrIf} ${FileExists} " $InstDir \@Launcher_APP_BINARY_NAME@.exe "
2022-05-23 14:15:49 -04:00
!insertmacro UnselectSection ${SM_SHORTCUTS}
!insertmacro UnselectSection ${DESKTOP_SHORTCUTS}
2022-05-20 17:22:30 -04:00
${EndIf}
FunctionEnd