;Product Info Name "Final-Power" ;Define your own software name here !define PRODUCT "Final-Power" ;Define your own software name here !define VERSION "Alpha 1" ;Define your own software version here CRCCheck On ; Script create for version 2.0rc1/final (from 12.jan.04) with GUI NSIS (c) by Dirk Paehl. Thank you for use my program !include "MUI.nsh" !define HAVE_UPX !ifdef HAVE_UPX ;!packhdr tmp.dat "upx -9 tmp.dat" !packhdr temp.exe "upx\upx --best temp.exe" !endif SetCompressor lzma ;-------------------------------- ;Configuration OutFile "setup.exe" BRANDINGTEXT "Final-Power:The Ultimate Warrior Alpha 1" ;Folder selection page InstallDir "$INSTDIR\" ;Remember install folder InstallDirRegKey "HKCU" "Software\Valve\Steam" "ModInstallPath" !define MUI_ICON "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer1.ico" !define MUI_UNICON "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer1.ico" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\header.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer.bmp" !define MUI_HEADERIMAGE_UNBITMAP "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\header.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer.bmp" !define SND_NAME "installer.mp3" ;-------------------------------- Var STARTMENU_FOLDER Var MUI_TEMP Var hmci ReserveFile "${SND_NAME}" ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_COMPONENTS !insertmacro MUI_UNPAGE_DIRECTORY !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH !define MUI_ABORTWARNING !define MUI_CUSTOMFUNCTION_GUIINIT ".GUIInit" !define MUI_CUSTOMFUNCTION_UNGUIINIT "un.onGUIInit" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Final-Power" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Final-Power" ;-------------------------------- ;Language !insertmacro MUI_LANGUAGE "English" ;-------------------------------- Section "Final-Power Mod Files" section_1 SetOutPath "$INSTDIR\" FILE /r "C:\Programme\valve\Steam\SteamApps\cctnt@gmx.at\half-life\fp\*.*" SetOutPath "$R5" FILE "C:\Programme\valve\Steam\SteamApps\cctnt@gmx.at\half-life\cgGL.dll" FILE "C:\Programme\valve\Steam\SteamApps\cctnt@gmx.at\half-life\cg.dll" CreateShortCut "$DESKTOP\Final-Power.lnk" "$R4$1" "-applaunch 70 -console -game fp" "$INSTDIR\fp.ico" CreateShortCut "$QUICKLAUNCH\Final-Power.lnk" "$R4$1" "-applaunch 70 -console -game fp" "$INSTDIR\fp.ico" CreateDirectory "$INSTDIR\" SectionEnd Section "Start Menu" section_2 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ;Create shortcuts CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstaller.lnk" "$INSTDIR\Uninst.exe" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Final-Power.lnk" "$R4$1" "-applaunch 70 -console -game fp" "$INSTDIR\fp.ico" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FP-MP3 Playlist Editor.lnk" "$INSTDIR\music\MP3_Playlist-Editor.exe" "$INSTDIR\fp.ico" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Section "Uninstaller" Uninstaller CreateShortCut "$INSTDIR\fp\Uninstall.lnk" "$INSTDIR\uninst.exe" "" "$INSTDIR\uninst.exe" 0 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" "DisplayName" "${PRODUCT} ${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" "URLInfoAbout" "http://www.final-power.com" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" "Publisher" "Final-Power:The Ultimate Warrior" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" "UninstallString" "$INSTDIR\Uninst.exe" WriteRegStr HKCU "Software\${PRODUCT}" "" $INSTDIR WriteUninstaller "$INSTDIR\Uninst.exe" SectionEnd LangString DESC_section_1 ${LANG_ENGLISH} "Installs Final-Power Mod Files" LangString DESC_section_2 ${LANG_ENGLISH} "Adds entrys to the Startmenu" LangString DESC_Uninstaller ${LANG_ENGLISH} "Installs Final-Power Uninstaller" ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${section_1} $(DESC_section_1) !insertmacro MUI_DESCRIPTION_TEXT ${section_2} $(DESC_section_2) !insertmacro MUI_DESCRIPTION_TEXT ${Uninstaller} $(DESC_Uninstaller) !insertmacro MUI_FUNCTION_DESCRIPTION_END Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer.." FunctionEnd Function un.onInit InitPluginsDir SetOutPath $PLUGINSDIR File "/oname=$PLUGINSDIR\spltmp.bmp" "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer splash.bmp" Splash::Show "2000" "$PLUGINSDIR\spltmp" Delete "$PLUGINSDIR\spltmp.bmp" File "${SND_NAME}" System::Call 'msvfw32.dll::MCIWndCreate(i 0, i 0,i 0x0070, t "$PLUGINSDIR\${SND_NAME}") i .r0' ; you can use "STR:play" or "STR:play repeat", but I saw "repeat" problems with midi files SendMessage $0 0x0465 0 "STR:play" ; if you want mci window to be hidden System::Call 'user32.dll::ShowWindow(i r0, i 0)' ; saves MCI window handle for WM_CLOSE in SecDummy StrCpy $hmci $0 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 Abort FunctionEnd Section "Uninstall" Uninstall InitPluginsDir SetOutPath $PLUGINSDIR File "/oname=$PLUGINSDIR\spltmp.bmp" "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer splash.bmp" Splash::Show "2000" "$PLUGINSDIR\spltmp" Delete "$PLUGINSDIR\spltmp.bmp" Delete "$INSTDIR\fp\*.*" Delete "$INSTDIR\fp\aurora\*.*" Delete "$INSTDIR\fp\cgprograms\*.*" Delete "$INSTDIR\fp\cl_dlls\*.*" Delete "$INSTDIR\fp\classes\*.*" Delete "$INSTDIR\fp\dlls\*.*" Delete "$INSTDIR\fp\gfx\env\*.*" Delete "$INSTDIR\fp\gfx\FX\*.*" Delete "$INSTDIR\fp\gfx\FX\part\*.*" Delete "$INSTDIR\fp\gfx\hires_tex\*.*" Delete "$INSTDIR\fp\gfx\menu\*.*" Delete "$INSTDIR\fp\gfx\shell\*.*" Delete "$INSTDIR\fp\gfx\vgui\*.*" Delete "$INSTDIR\fp\gfx\*.*" Delete "$INSTDIR\fp\lib\*.*" Delete "$INSTDIR\fp\events\*.*" Delete "$INSTDIR\fp\manual\*.*" Delete "$INSTDIR\fp\maps\*.*" Delete "$INSTDIR\fp\maps\graphs\*.*" Delete "$INSTDIR\fp\media\*.*" Delete "$INSTDIR\fp\models\*.*" Delete "$INSTDIR\fp\models\player\*.*" Delete "$INSTDIR\fp\models\player\brolly\*.*" Delete "$INSTDIR\fp\models\player\buu\*.*" Delete "$INSTDIR\fp\models\player\gohan\*.*" Delete "$INSTDIR\fp\models\player\goku\*.*" Delete "$INSTDIR\fp\models\player\goten\*.*" Delete "$INSTDIR\fp\models\player\ssjgoku\*.*" Delete "$INSTDIR\fp\models\player\ssjvegeta\*.*" Delete "$INSTDIR\fp\models\player\vegeta\*.*" Delete "$INSTDIR\fp\music\.*" Delete "$INSTDIR\fp\overviews\*.*" Delete "$INSTDIR\fp\resource\*.*" Delete "$INSTDIR\fp\resource\background\*.*" Delete "$INSTDIR\fp\SAVE\*.*" Delete "$INSTDIR\fp\sound\*.*" Delete "$INSTDIR\fp\sound\brolly\*.*" Delete "$INSTDIR\fp\sound\buu\*.*" Delete "$INSTDIR\fp\sound\gohan\*.*" Delete "$INSTDIR\fp\sound\goku\*.*" Delete "$INSTDIR\fp\sound\goten\*.*" Delete "$INSTDIR\fp\sound\maps\*.*" Delete "$INSTDIR\fp\sound\player\*.*" Delete "$INSTDIR\fp\sound\UI\*.*" Delete "$INSTDIR\fp\sound\vegeta\*.*" Delete "$INSTDIR\fp\sound\weapons\*.*" Delete "$INSTDIR\fp\sprites\*.*" RmDir "$INSTDIR\fp\aurora" RmDir "$INSTDIR\fp\cgprograms" RmDir "$INSTDIR\fp\cl_dlls" RmDir "$INSTDIR\fp\classes" RmDir "$INSTDIR\fp\dlls" RmDir "$INSTDIR\fp\gfx\env" RmDir "$INSTDIR\fp\gfx\FX\part" RmDir "$INSTDIR\fp\gfx\FX" RmDir "$INSTDIR\fp\gfx\hires_tex" RmDir "$INSTDIR\fp\gfx\menu" RmDir "$INSTDIR\fp\gfx\shell" RmDir "$INSTDIR\fp\gfx\vgui" RmDir "$INSTDIR\fp\gfx" RmDir "$INSTDIR\fp\lib" RmDir "$INSTDIR\fp\events" RmDir "$INSTDIR\fp\maps\graphs" RmDir "$INSTDIR\fp\maps" RmDir "$INSTDIR\fp\media" RmDir "$INSTDIR\fp\models\player\brolly" RmDir "$INSTDIR\fp\models\player\buu" RmDir "$INSTDIR\fp\models\player\gohan" RmDir "$INSTDIR\fp\models\player\goku" RmDir "$INSTDIR\fp\models\player\goten" RmDir "$INSTDIR\fp\models\player\ssjgoku" RmDir "$INSTDIR\fp\models\player\ssjvegeta" RmDir "$INSTDIR\fp\models\player\vegeta" RmDir "$INSTDIR\fp\models\player" RmDir "$INSTDIR\fp\models" RmDir "$INSTDIR\fp\music" RmDir "$INSTDIR\fp\overviews" RmDir "$INSTDIR\fp\resource\background" RmDir "$INSTDIR\fp\resource" RmDir "$INSTDIR\fp\SAVE" RmDir "$INSTDIR\fp\sound\brolly" RmDir "$INSTDIR\fp\sound\buu" RmDir "$INSTDIR\fp\sound\gohan" RmDir "$INSTDIR\fp\sound\goku" RmDir "$INSTDIR\fp\sound\goten" RmDir "$INSTDIR\fp\sound\maps" RmDir "$INSTDIR\fp\sound\player" RmDir "$INSTDIR\fp\sound\UI" RmDir "$INSTDIR\fp\sound\vegeta" RmDir "$INSTDIR\fp\sound\weapons" RmDir "$INSTDIR\fp\sound" RmDir "$INSTDIR\fp\sprites" RmDir "$INSTDIR\fp" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Final-Power" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Final-Power" !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" startMenuDeleteLoop: ClearErrors RMDir $MUI_TEMP GetFullPathName $MUI_TEMP "$MUI_TEMP\.." IfErrors startMenuDeleteLoopDone StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: SectionEnd Function .onInit InitPluginsDir SetOutPath $PLUGINSDIR File "/oname=$PLUGINSDIR\spltmp.bmp" "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer splash.bmp" Splash::Show "2000" "$PLUGINSDIR\spltmp" Delete "$PLUGINSDIR\spltmp.bmp" File "${SND_NAME}" System::Call 'msvfw32.dll::MCIWndCreate(i 0, i 0,i 0x0070, t "$PLUGINSDIR\${SND_NAME}") i .r0' ; you can use "STR:play" or "STR:play repeat", but I saw "repeat" problems with midi files SendMessage $0 0x0465 0 "STR:play" ; if you want mci window to be hidden System::Call 'user32.dll::ShowWindow(i r0, i 0)' ; saves MCI window handle for WM_CLOSE in SecDummy StrCpy $hmci $0 ReadRegStr $R4 HKLM "Software\Valve\Steam" "InstallPath" ReadRegStr $R5 HKCU "Software\Valve\Steam" "ModInstallPath" ; -------------------------- ; this bit sets out mod path ; -------------------------- StrCpy $0 "\half-life\fp" StrCpy $1 "\steam.exe" ; -------------------------------- ; this bit gets our installer path ; -------------------------------- ReadRegStr $R0 HKCU "Software\Valve\Steam" "ModInstallPath" StrCmp $R0 "" NotPresent Present NotPresent: Goto Done Present: StrLen $R3 $R0 loop: IntOp $R1 $R1 - 1 IntCmp $R1 -$R3 exit exit StrCpy $R2 $R0 1 $R1 StrCmp $R2 "\" exit Goto loop exit: StrCpy $R0 $R0 $R1 StrCpy $INSTDIR "$R0$0" Done: FunctionEnd !macro GetReturnValue !macroend Function .GUIInit # the plugins dir is automatically deleted when the installer exits InitPluginsDir # lets extract some bitmaps... File "/oname=$PLUGINSDIR\spltmp.bmp" "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer splash.bmp" !ifdef DEBUG # turn return values on if in debug mode BgImage::SetReturn /NOUNLOAD on !endif # set the initial background for images to be drawn on # we will use a gradient from drak green to dark red BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\spltmp.bmp 0 0 !insertmacro GetReturnValue # create the font for the following text CreateFont $R0 "Comic Sans MS" 50 700 # add a blue shadow for the text # show our creation to the world! BgImage::Redraw /NOUNLOAD # Refresh doesn't return any value FunctionEnd Function .onGUIEnd # Destroy must not have /NOUNLOAD so NSIS will be able to unload # and delete BgImage before it exits BgImage::Destroy # Destroy doesn't return any value SendMessage $hmci ${WM_CLOSE} 0 0 FunctionEnd Function un.onGUIInit # the plugins dir is automatically deleted when the installer exits InitPluginsDir # lets extract some bitmaps... File "/oname=$PLUGINSDIR\spltmp.bmp" "C:\Dokumente und Einstellungen\Christoph\Desktop\installerstuff\installer splash.bmp" !ifdef DEBUG # turn return values on if in debug mode BgImage::SetReturn /NOUNLOAD on !endif # set the initial background for images to be drawn on # we will use a gradient from drak green to dark red BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\spltmp.bmp 0 0 !insertmacro GetReturnValue # create the font for the following text CreateFont $R0 "Comic Sans MS" 50 700 # add a blue shadow for the text # show our creation to the world! BgImage::Redraw /NOUNLOAD # Refresh doesn't return any value FunctionEnd Function un.onGUIEnd # Destroy must not have /NOUNLOAD so NSIS will be able to unload # and delete BgImage before it exits BgImage::Destroy # Destroy doesn't return any value SendMessage $hmci ${WM_CLOSE} 0 0 FunctionEnd