Skip to content

Instantly share code, notes, and snippets.

@branan
Created February 24, 2012 04:55
Show Gist options
  • Save branan/1897875 to your computer and use it in GitHub Desktop.
Save branan/1897875 to your computer and use it in GitHub Desktop.
# basic NSIS bookkeeping. Nothing special
OutFile gehn_shard.exe
RequestExecutionLevel admin
Name "Gehn Shard"
Var CYAN_URULIVE_DIR
Var INSTALL_TO_URU
Function .onInit
StrCpy $INSTDIR "$PROGRAMFILES\Gehn Shard"
FunctionEnd
Function findUruDir
StrCmp $INSTALL_TO_URU "true" skip_this_step
ReadRegStr $CYAN_URULIVE_DIR HKLM "Software\MOUL" "Install_Dir"
Goto done
skip_this_step:
Abort
done:
FunctionEnd
Function verifyUruDir
# UruExplorer only indicates Uru, not Uru Live.
# So we also check for a PhysX DLL
FindFirst $0 $1 $CYAN_URULIVE_DIR\UruExplorer.exe
StrCmp $1 "" bad_uru_dir
FindClose $0
FindFirst $0 $1 $CYAN_URULIVE_DIR\NxExtensions.dll
StrCmp $1 "" bad_uru_dir
FindClose $0
Goto done
bad_uru_dir:
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"The folder you selected does not appear to be a valid Uru Live \
installation. Are you sure you want to use this directory?" \
IDYES done
Abort
done:
FunctionEnd
Function checkIfDirIsUru
# UruExplorer only indicates Uru, not Uru Live.
# So we also check for a PhysX DLL
FindFirst $0 $1 $INSTDIR\UruExplorer.exe
StrCmp $1 "" done
FindClose $0
FindFirst $0 $1 $INSTDIR\NxExtensions.dll
StrCmp $1 "" done
FindClose $0
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Your install folder appears to be a previous Uru Live installation. \
This will work, but you will be unable to use this installation to access \
Cyan's MOULagain shard anymore. Are you sure you want to continue?" \
IDYES set_have_urudir
Abort
set_have_urudir:
StrCpy $INSTALL_TO_URU "true"
done:
FunctionEnd
PageEx license
LicenseData LICENSE.txt
PageExEnd
PageEx directory
PageCallbacks "" "" checkIfDirIsUru
PageExEnd
PageEx directory
Caption ": Myst Online Folder"
DirText "Setup needs to copy some files from your Uru Live installation. If \
you want to copy from a different Uru Live installation, click browse \
and select another folder." "Uru Live Directory" "" ""
DirVar $CYAN_URULIVE_DIR
PageCallbacks findUruDir "" verifyUruDir
PageExEnd
Page instfiles
Section "UruFiles"
SetOutPath $INSTDIR
File "UruLauncher.exe"
# These are all H'uru-Plasma specific requirements
# They may not be needed for all shards
File "server.ini"
File "oalinst.exe"
File "vcredist_x86.exe"
File "dxwebsetup.exe"
ExecWait "vcredist_x86.exe /q"
ExecWait "oalinst.exe /s"
ExecWait "dxwebsetup.exe /q"
createShortCut "$SMPROGRAMS\Gehn Shard.lnk" "$INSTDIR\UruLauncher.exe"
# These are the registry keys for registering the uninstaller for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GehnShard" \
"DisplayName" "Gehn Shard"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GehnShard" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
writeUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section "dat"
StrCmp $INSTALL_TO_URU "true" skip_this_step
CreateDirectory $INSTDIR\dat
CopyFiles $CYAN_URULIVE_DIR\dat\* $INSTDIR\dat
skip_this_step:
SectionEnd
Section "sfx"
StrCmp $INSTALL_TO_URU "true" skip_this_step
CreateDirectory $INSTDIR\sfx
# make sure we don't copy the cache
CopyFiles $CYAN_URULIVE_DIR\sfx\*.ogg $INSTDIR\sfx
skip_this_step:
SectionEnd
# If you have a build that supports bink, you probably want to
# copy avi just like dat or sfx. Here's a good place to put that.
Section "Uninstall"
Delete "$SMPROGRAMS\Gehn Shard.lnk"
RMDir /r $INSTDIR
Delete $INSTDIR\uninstall.exe
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GehnShard"
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment