;City of Lost Dreams Mod Installer !define VER_MAJOR 1 !define VER_MINOR 3 !define VER_FILE "13" !define VER_DISPLAY "1.3" ;-------------------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;General ;Name and file Name "City of Lost Dreams Mod 1.3" OutFile "CoLD.Mod.1.3.Full.exe" ;Default installation folder InstallDir "$PROGRAMFILES\Mafia" ;Get installation folder from registry if available InstallDirRegKey HKLM "Software\City of Lost Dreams Mod" "" ;Remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" !define MUI_LANGDLL_REGISTRY_KEY "Software\City of Lost Dreams Mod" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" BrandingText "NSIS 2.05 * CoLD Mod Team" SetCompressor "lzma" XPStyle on ;-------------------------------- ;Variables Var MUI_TEMP Var STARTMENU_FOLDER ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Interface Configuration !define MUI_WELCOMEFINISHPAGE_BITMAP "E:\CoLD\cold_install.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "E:\CoLD\cold_uninstall.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "E:\CoLD\cold.bmp" !define MUI_HEADERIMAGE_UNBITMAP "E:\CoLD\cold_un.bmp" !define MUI_ICON "E:\CoLD\cold.ico" !define MUI_UNICON "E:\CoLD\cold_un.ico" !define MUI_BGCOLOR EEEEEE !define MUI_PAGE_WELCOME_BITMAP "E:\CoLD\cold.ico" !define MUI_UNCONFIRMPAGE_TEXT_TOP "$(MyUnconfirmTextTop)" !define MUI_WELCOMEPAGE_TEXT "$(MyWelcomeText)" !define MUI_LICENSEPAGE_RADIOBUTTONS !define MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT "I have read and I accept the terms in the License Agreement" !define MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE "I do not accept the terms in the License Agreement" !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\CoLD Mod Manual\manual.html" !define MUI_FINISHPAGE_SHOWREADME_TEXT "$(MyReadmeText)" !define MUI_FINISHPAGE_LINK "$(MyFinishPageLink)" !define MUI_FINISHPAGE_LINK_LOCATION "http://cold.lostheaven.co.uk" !define MUI_WELCOMEPAGE_TITLE "$(MyWelcomePageTitle)" ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE $(LicenseRTF) Page custom PageReinstall PageLeaveReinstall !insertmacro MUI_PAGE_DIRECTORY ;-------------------------------- ;Start Menu Folder !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\City of Lost Dreams Mod" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER ;-------------------------------- !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Reserve Files ;These files should be inserted before other files in the data block ReserveFile "cold.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Portuguese" LangString MyWelcomeText ${LANG_ENGLISH} "This wizard will guide you through the installation of the City of Lost Dreams Mod.\r\n\r\nIt is strongly recommended that you uninstall all other Mafia game modifications before starting Setup. This will ensure that the City of Lost Dreams Mod works without problems.\r\n\r\nClick Next to continue." LangString MyWelcomeText ${LANG_FRENCH} "Ce guide va vous guider tout au long de l’installation du City of Lost Dreams Mod.\r\n\r\nIl est fortement recommandé de désinstaller toutes les autres modifications que vous avez apporté a Mafia avant de lancer le setup. Cela va assurer que le City of Lost Dreams Mod marchera sans aucun problčmes.\r\n\r\nCliquer sur Suivant pour continuer." LangString MyWelcomeText ${LANG_GERMAN} "Diese Anleitung wird sie durch die Installaion der City of Lost Dreams Mod führen.\r\n\r\nEs wird empfohlen alle Spieländerungen vor der Installation zu löschen. Dies stellt sicher das City of Lost Dreams einwandfrei funktioniert.\r\n\r\nKlicken sie Weiter um fortzufahren." LangString MyWelcomeText ${LANG_CZECH} "Tento průvodce vás provede celou instalací modu City of Lost Dreams.\r\n\r\nJe silně doporučeno odinstalovat všechny ostatní modifikace hry Mafia před spuštěním instalace. Tím zajistíte, že mod City of Lost Dreams bude pracovat bez problémů.\r\n\r\nKlikněte na Dalši pro pokračování." LangString MyWelcomeText ${LANG_ITALIAN} "Questo wizard ti guiderŕ attraverso l'installazione del the City of Lost Dreams Mod.\r\n\r\nE' fortemente raccomandato che tu disinstalli tutte le altre modifiche di Mafia prima di iniziare il Setup. Questo assicurerŕ che il the City of Lost Dreams Mod. lavori senza problemi.\r\n\r\nClicca Avanti per continuare" LangString MyWelcomeText ${LANG_PORTUGUESE} "O Instalador vai guiar vocę durante a instalaçăo do City of Lost Dreams Mod.\r\n\r\nÉ altamente recomendado que vocę desinstale qualquer modificaçăo do Mafia previamente instalada antes de iniciar o Setup. Isto garante que o City of Lost Dreams Mod funcione sem problemas.\r\n\r\nClique em Seguinte para continuar." LangString MyReadmeText ${LANG_ENGLISH} "Read the manual" LangString MyReadmeText ${LANG_FRENCH} "Lire le manuel " LangString MyReadmeText ${LANG_GERMAN} "Lesen sie die Handbuch" LangString MyReadmeText ${LANG_CZECH} "Přečtěte si manuál" LangString MyReadmeText ${LANG_ITALIAN} "Leggi il manuale" LangString MyReadmeText ${LANG_PORTUGUESE} "Leia o Manual" LangString MyUnconfirmTextTop ${LANG_ENGLISH} "Note: The uninstaller will uninstall the City of Lost Dreams Mod including any other Mafia mods previously installed. Make a backup of other installed mods in case you still need them." LangString MyUnconfirmTextTop ${LANG_FRENCH} "Note: L’uninstaller va désinstaller le City of Lost Dreams Mod ainsi que d’autres mods qui ont été installé avant. Faites une backup des autres mods que vous avez installé si vous avez encore besoin d’eux." LangString MyUnconfirmTextTop ${LANG_GERMAN} "Achtung: Der uninstaller wird die City of Lost Dreams Mod deinstallieren inklusive aller anderen Mods die installert wurden. Erstellen sie eine Sicherungskopie aller installierter Mods falls Sie sie noch benötigen." LangString MyUnconfirmTextTop ${LANG_CZECH} "Poznámka: Uninstaller odinstaluje nejen mod City of Lost Dreams, ale také všechny ostatní mody do hry Mafia, které jste nainstalovali. Vytvořte si zálohu všech ostatních nainstalovaných modů, jestliže je stále chcete." LangString MyUnconfirmTextTop ${LANG_ITALIAN} "Nota: L'uninstaller disinstallerŕ the City of Lost Dreams Mod incluso ogni altro mod precedentemente installato. Fare una copia di Backup degli altri mod installati nel caso in cui ti servissero." LangString MyUnconfirmTextTop ${LANG_PORTUGUESE} "Nota: O desinstalador do City of Lost Dreams Mod vai desinstalar o MOD e qualquer outro MOD antes instalado no Mafia. Faça um backup dos outros MOD caso sejam importantes." LangString MyWelcomePageTitle ${LANG_ENGLISH} "Welcome to the City of Lost Dreams Mod Setup" LangString MyWelcomePageTitle ${LANG_FRENCH} "Bienvenue ŕ l'installation du City of Lost Dreams Mod!" LangString MyWelcomePageTitle ${LANG_GERMAN} "Willkommen zum die City of Lost Dreams Mod Setup" LangString MyWelcomePageTitle ${LANG_CZECH} "Vítejte v instalaci modu City of Lost Dreams" LangString MyWelcomePageTitle ${LANG_ITALIAN} "Benvenuti al setup di the City of Lost Dreams Mod" LangString MyWelcomePageTitle ${LANG_PORTUGUESE} "Bem-vindo a instalaçăo do City of Lost Dreams Mod" LangString MyFinishPageLink ${LANG_ENGLISH} "Visit the City of Lost Dreams Mod Website" LangString MyFinishPageLink ${LANG_FRENCH} "Visiter le site du City of Lost Dreams Mod" LangString MyFinishPageLink ${LANG_GERMAN} "Besuchen sie doch die City of Lost Dreams Mod Website" LangString MyFinishPageLink ${LANG_CZECH} "Navštivtě internetové stránky modu City of Lost Dreams" LangString MyFinishPageLink ${LANG_ITALIAN} "Visita il sito di City of Lost Dreams Mod" LangString MyFinishPageLink ${LANG_PORTUGUESE} "Visite o site do City of Lost Dreams Mod" LicenseLangString LicenseRTF ${LANG_ENGLISH} "E:\CoLD\eula_en.rtf" LicenseLangString LicenseRTF ${LANG_FRENCH} "E:\CoLD\eula_en.rtf" LicenseLangString LicenseRTF ${LANG_GERMAN} "E:\CoLD\eula_en.rtf" LicenseLangString LicenseRTF ${LANG_CZECH} "E:\CoLD\eula_en.rtf" LicenseLangString LicenseRTF ${LANG_ITALIAN} "E:\CoLD\eula_en.rtf" LicenseLangString LicenseRTF ${LANG_PORTUGUESE} "E:\CoLD\eula_en.rtf" !insertmacro MUI_RESERVEFILE_LANGDLL ;-------------------------------- ;Installer Sections Section "Dummy Section" SecDummy SetOutPath "$INSTDIR" WriteRegStr HKLM "Software\City of Lost Dreams Mod" "" $INSTDIR WriteRegDword HKLM "Software\City of Lost Dreams Mod" "VersionMajor" "${VER_MAJOR}" WriteRegDword HKLM "Software\City of Lost Dreams Mod" "VersionMinor" "${VER_MINOR}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" "DisplayVersion" "${VER_DISPLAY}" WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" "UninstallString" '"$INSTDIR\CoLD Mod Uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" "VersionMajor" "${VER_MAJOR}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" "VersionMinor" "${VER_MINOR}" ;ADD YOUR OWN FILES HERE... File /r "E:\CoLD\1.0\rw_data.dll" File /r "E:\CoLD\1.0\maps" File /r "E:\CoLD\1.0\MISSIONS" File /r "E:\CoLD\1.0\models" File /r "E:\CoLD\1.0\SOUNDS" File /r "E:\CoLD\1.0\tables" File /r "E:\CoLD\1.0\cold.ico" File /r "E:\CoLD\1.0\CoLD Mod Website.url" File /r "E:\CoLD\1.0\CoLD Mod Manual" ;Store installation folder WriteRegStr HKLM "Software\City of Lost Dreams Mod" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\CoLD Mod Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Create shortcuts CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" CreateShortCut "$DESKTOP\CoLD Mod.lnk" "$INSTDIR\game.exe" icon.file "$INSTDIR\cold.ico" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\CoLD Mod.lnk" "$INSTDIR\game.exe" icon.file "$INSTDIR\cold.ico" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\CoLD Mod Uninstall.lnk" "$INSTDIR\CoLD Mod Uninstall.exe" icon.file "$INSTDIR\CoLD Mod Uninstall.exe" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\CoLD Mod Website.lnk" "$INSTDIR\CoLD Mod Website.url" icon.file "$INSTDIR\cold.ico" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\CoLD Mod Manual.lnk" "$INSTDIR\CoLD Mod Manual\manual.html" icon.file "$INSTDIR\cold.ico" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd ;-------------------------------- Function .onInit SetOutPath $TEMP File /oname=spltmp.bmp "E:\CoLD\logo.bmp" splash::show 2500 $TEMP\spltmp Pop $0 ; $0 has '1' if the user closed the splash screen early, ; '0' if everything closed normal, and '-1' if some error occured. Delete $TEMP\spltmp.bmp !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd Function PageReinstall ReadRegStr $R0 HKLM "Software\City of Lost Dreams Mod" "" StrCmp $R0 "" 0 +2 Abort ;Detect version ReadRegDWORD $R0 HKLM "Software\City of Lost Dreams Mod" "VersionMajor" IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version minor_check: ReadRegDWORD $R0 HKLM "Software\City of Lost Dreams Mod" "VersionMinor" IntCmp $R0 ${VER_MINOR} same_version new_version older_version new_version: !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 1" "Text" "An older version of City of Lost Dreams Mod is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue." !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 2" "Text" "Uninstall before installing" !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 3" "Text" "Do not uninstall" !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install City of Lost Dreams Mod." StrCpy $R0 "1" Goto reinst_start older_version: !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 1" "Text" "A newer version of City of Lost Dreams Mod is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue." !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 2" "Text" "Uninstall before installing" !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 3" "Text" "Do not uninstall" !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install City of Lost Dreams Mod." StrCpy $R0 "1" Goto reinst_start same_version: !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 1" "Text" "City of Lost Dreams Mod ${VER_DISPLAY} is already installed. Select the operation you want to perform and click Next to continue." !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 2" "Text" "Reinstall City of Lost Dreams Mod ${VER_DISPLAY}" !insertmacro MUI_INSTALLOPTIONS_WRITE "cold.ini" "Field 3" "Text" "Uninstall City of Lost Dreams Mod ${VER_DISPLAY}" !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform." StrCpy $R0 "2" reinst_start: !insertmacro MUI_INSTALLOPTIONS_DISPLAY "cold.ini" FunctionEnd Function PageLeaveReinstall !insertmacro MUI_INSTALLOPTIONS_READ $R1 "cold.ini" "Field 2" "State" StrCmp $R0 "1" 0 +2 StrCmp $R1 "1" reinst_uninstall reinst_done StrCmp $R0 "2" 0 +3 StrCmp $R1 "1" reinst_done reinst_uninstall reinst_uninstall: ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" "UninstallString" ;Run uninstaller HideWindow ClearErrors ExecWait '$R1 _?=$INSTDIR' IfErrors no_remove_uninstaller IfFileExists "$INSTDIR\CoLD Mod Uninstall.exe" no_remove_uninstaller Delete $R1 RMDir $INSTDIR no_remove_uninstaller: StrCmp $R0 "2" 0 +2 Quit BringToFront reinst_done: FunctionEnd ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\CoLD Mod Uninstall.exe" Delete "$INSTDIR\CoLD Mod Website.url" Delete "$INSTDIR\cold.ico" Delete "$DESKTOP\CoLD Mod.lnk" RMDir /r "$INSTDIR\MISSIONS" RMDir /r "$INSTDIR\models" RMDir /r "$INSTDIR\maps" RMDir /r "$INSTDIR\SOUNDS" RMDir /r "$INSTDIR\tables" RMDir /r "$INSTDIR\CoLD Mod Manual" !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP Delete "$SMPROGRAMS\$MUI_TEMP\CoLD Mod Website.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\CoLD Mod Uninstall.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\CoLD Mod.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\CoLD Mod Manual.lnk" ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" startMenuDeleteLoop: RMDir $MUI_TEMP GetFullPathName $MUI_TEMP "$MUI_TEMP\.." IfErrors startMenuDeleteLoopDone StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: DeleteRegKey /ifempty HKLM "Software\City of Lost Dreams Mod" DeleteRegKey /ifempty HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\City of Lost Dreams Mod" SectionEnd ;-------------------------------- ;Uninstaller Functions Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd