; bg2-1.2b.nsi ; ; This script will compile the installer for BG2, provided all the materials are available. ;-------------------------------- !include "MUI2.nsh" Name "Battle Grounds 2 - 1.5a" OutFile "bg2-1.5a-installer.exe" SetCompressor /FINAL /SOLID lzma SetDatablockOptimize on SetCompressorDictSize 32 XPStyle off VIProductVersion "1.5.0.0" ;VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application" VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Battle Grounds 1.5a released September 25th, 2009." ;VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company" ;VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company" ;VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Fake company" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Battle Grounds 2 Installer" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.5a" ;-------------------------------- ;Variables Var StartMenuFolder ;Var SteamEXE ;-------------------------------- ;Interface Configuration !define MUI_WELCOMEPAGE_TITLE "Welcome to the Battle Grounds 2 Setup" !define MUI_WELCOMEPAGE_TEXT "This will install Battle Grounds 2 1.5a onto your machine. Please keep in mind you will also need Source SDK Base - Orangebox installed for it to work properly." !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "header.bmp" ; optional !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH !define MUI_ABORTWARNING !define MUI_ICON "bg2_icon.ico" !define MUI_FINISHPAGE_TEXT "Battle Grounds 2 is now installed. Please remember to restart STEAM so the game will show up in the games list; and that you will need Source SDK - Orangebox to play BG2 1.5a" !define MUI_HEADER_TRANSPARENT_TEXT !define MUI_PAGE_HEADER_TEXT "" !define MUI_PAGE_HEADER_SUBTEXT "" !define MUI_LICENSEPAGE_TEXT_TOP "Read Me:" !define MUI_LICENSEPAGE_TEXT_BOTTOM " " !define MUI_LICENSEPAGE_BUTTON "Next >" ;!define MUI_DIRECTORYPAGE_HEADER_TITLE "lawl" ;!define MUI_DIRECTORYPAGE_HEADER_SUBTITLE "lawl" !define MUI_WELCOMEFINISHPAGE_BITMAP "side1.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH ;!define MUI_FINISHPAGE_RUN $STEAMEXE ;!define MUI_FINISHPAGE_RUN_PARAMETERS '$\ '-gameidlaunch 15454500952001741018 -game $INSTDIR\bg2'' !define MUI_UNICON "bg2_uninstall.ico" !define MUI_UNCONFIRMPAGE_TEXT_TOP "Battle Grounds 2 will be uninstalled from the following folder. Click Uninstall to begin the uninstallation. Please keep in mind that this will remove ALL files, including demos and configs. You must manually back those up yourself, if you'd like to keep them." !define MUI_UNPAGE_HEADERIMAGE_BITMAP "header.bmp" ; optional !define MUI_UNPAGE_HEADERIMAGE_BITMAP_NOSTRETCH ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "C:\Program Files\Steam\steamapps\sourcemods\bg2\readme.txt" !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- !insertmacro MUI_LANGUAGE "English" ; The default installation directory ;Get installation folder from registry if available ;InstallDirRegKey HKCU "Software\BattleGrounds2" "" Function GetSteamAccountName ReadRegStr $R0 HKCU "Software\Valve\Steam" "SourceModInstallPath" StrCmp $R0 "" noSteam Goto +2 noSteam: StrCpy $R0 "$PROGRAMFILES\Steam\SteamApps\SourceMods" Push '$R0\bg2' FunctionEnd ;-------------------------------- ; The stuff to install Section "" ; Set output path to the installation directory. SetOutPath $INSTDIR ;Store installation folder ;WriteRegStr HKCU "Software\BattleGrounds2" "" $INSTDIR ; Put file there File /r "C:\Program Files\Steam\SteamApps\SourceMods\bg2-nextrelease" ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Create shortcuts CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall BG2.lnk" "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Function .onInit Call GetSteamAccountName Pop $INSTDIR ;Call GetSteamEXE ;Pop $STEAMEXE # the plugins dir is automatically deleted when the installer exits #InitPluginsDir #File /oname=$PLUGINSDIR\splash.bmp "header.bmp" #advsplash::show 2000 600 400 -1 $PLUGINSDIR\splash #Pop $0 ; $0 has '1' if the user closed the splash screen early, # ; '0' if everything closed normally, and '-1' if some error occurred. #Delete $PLUGINSDIR\splash.bmp FunctionEnd ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" RMDir /r "$INSTDIR" !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall BG2.lnk" RMDir "$SMPROGRAMS\$StartMenuFolder" ;DeleteRegKey /ifempty HKCU "Software\BattleGrounds2" SectionEnd