; nullsoft install script for installing sphere games ; requires a fairly new version of nullsoft installer ;----------------------------- ;!define StandAlone !define GameTitle "Flik's Input Demo" !define GameDirectory "input_demo" !define GameAuthor "Flik" ;----------------------------- Name "${GameTitle}" OutFile "${GameDirectory}.exe" Var DirectoryText Var SphereRootDirectory Var SphereStartupDirectory Var SphereGameDirectory ;----------------------------- Function .onInit !ifdef StandAlone StrCpy $DirectoryText "Please select the path where you want to install$\r${GameTitle}" StrCpy $INSTDIR "$PROGRAMFILES\${GameDirectory}" !else StrCpy $DirectoryText "Please select your Sphere path below$\r(You will be able to proceed when Sphere is detected):" StrCpy $INSTDIR "$PROGRAMFILES\sphere" !endif FunctionEnd ;----------------------------- DirText "$DirectoryText" DirShow show ; Icon icon.ico ; UninstallIcon icon.ico ;----------------------------- VIAddVersionKey ProductName "${GameDirectory}" VIAddVersionKey FileVersion "1.0" VIAddVersionKey FileDescription "Installer for ${GameTitle}" VIAddVersionKey LegalCopyright "-" VIProductVersion "1.0.0.0" ;----------------------------- Page components Page directory Page instfiles ;----------------------------- Function UpdateDirectoryInfo !ifdef StandAlone StrCpy $SphereRootDirectory "$INSTDIR" StrCpy $SphereStartupDirectory "$SphereRootDirectory\startup" StrCpy $SphereGameDirectory "$SphereRootDirectory\startup" !else StrCpy $SphereRootDirectory "$INSTDIR" StrCpy $SphereStartupDirectory "$SphereRootDirectory\startup" StrCpy $SphereGameDirectory "$SphereRootDirectory\games\${GameDirectory}" !endif FunctionEnd ;----------------------------- Function ValidateDirectoryInfo !ifndef StandAlone IfFileExists "$SphereRootDirectory\engine.exe" SphereDoesExist MessageBox MB_OK "Can not find sphere $\r$\"$SphereRootDirectory\engine.exe$\"" Quit SphereDoesExist: !endif IfFileExists "$SphereGameDirectory\game.sgm" 0 GameDoesNotExist MessageBox MB_YESNO|MB_ICONQUESTION "Game already exists $\r$\"$SphereGameDirectory\game.sgm$\" \ $\rOverwrite game data?" IDYES GameDoesNotExist Quit GameDoesNotExist: FunctionEnd ;----------------------------- Section "Game Files (Required)" SectionIn RO Call UpdateDirectoryInfo Call ValidateDirectoryInfo MessageBox MB_OK "${DText}" !ifdef StandAlone SetOutPath "$SphereRootDirectory" File "..\..\engine.exe" "..\..\config.exe" File "..\..\audiere.dll" "..\..\corona.dll" "..\..\js32.dll" "..\..\libmng.dll" "..\..\zlib.dll" File /r "..\..\system" !endif SetOutPath "$SphereGameDirectory" File /nonfatal /r * animations images maps fonts other save spritesets scripts windowstyles SectionEnd ;----------------------------- Section "Start Menu Shortcuts" !define SphereStartMenuDirectory "Sphere" Call UpdateDirectoryInfo !ifdef StandAlone SetOutPath "$SphereRootDirectory" CreateDirectory "$SMPROGRAMS\${GameDirectory}" CreateShortCut "$SMPROGRAMS\${GameDirectory}\${GameDirectory}.lnk" "$SphereRootDirectory\engine.exe" "icon.ico" CreateShortCut "$SMPROGRAMS\${GameDirectory}\config.lnk" "$SphereRootDirectory\config.exe" !else SetOutPath "$SphereRootDirectory" CreateDirectory "$SMPROGRAMS\${SphereStartMenuDirectory}\games\input_demo" CreateShortCut "$SMPROGRAMS\${SphereStartMenuDirectory}\games\${GameDirectory}\${GameDirectory}.lnk" "$SphereRootDirectory\engine.exe" `-game "${GameDirectory}"` "$SphereGameDirectory\icon.ico" !endif SectionEnd ;-----------------------------