forked from GehnShard/Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstaller.nsi
196 lines (169 loc) · 5.75 KB
/
Installer.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
; Installer for Gehn Shard.
; Makes use of the Modern UI for NSIS.
;;;;;;;;;;;;
; Includes ;
;;;;;;;;;;;;
!include MUI2.nsh
!include WinVer.nsh
;;;;;;;;;;;;;;;;;;;;;;
; Installer Settings ;
;;;;;;;;;;;;;;;;;;;;;;
BrandingText "Gehn Shard"
CRCCheck on
InstallDir "$PROGRAMFILES\Gehn Shard"
OutFile "gehn_shard.exe"
RequestExecutionLevel admin
;;;;;;;;;;;;;;;;;;;;
; Meta Information ;
;;;;;;;;;;;;;;;;;;;;
Name "Gehn Shard"
VIAddVersionKey "CompanyName" "Guild of Writers"
VIAddVersionKey "FileDescription" "Gehn Shard"
VIAddVersionKey "FileVersion" "20"
VIAddVersionKey "LegalCopyright" "Guild of Writers"
VIAddVersionKey "ProductName" "Gehn Shard"
VIProductVersion "20.0.0.0"
;;;;;;;;;;;;;;;;;;;;;
; MUI Configuration ;
;;;;;;;;;;;;;;;;;;;;;
!define MUI_ABORTWARNING
!define MUI_ICON "Resources\Icon.ico"
!define MUI_FINISHPAGE_RUN "$INSTDIR\UruLauncher.exe"
; Custom Images :D
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Resources\Header.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "Resources\WelcomeFinish.bmp"
;;;;;;;;;;;;;
; Variables ;
;;;;;;;;;;;;;
Var InstallToUru
Var InstDirUru
Var LaunchRepair
;;;;;;;;;;;;;
; Functions ;
;;;;;;;;;;;;;
; Inform the user if their OS is unsupported.
Function .onInit
${IfNot} ${AtLeastWinVista}
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Windows Vista or above is required to run Gehn Shard.$\r$\n\
You may install the client but will be unable to run it on this OS.$\r$\n$\r$\n\
Do you still wish to install?" \
/SD IDYES IDNO do_quit
${EndIf}
Goto done
do_quit:
Quit
done:
FunctionEnd
; Tries to find the Uru Live directory in the registry.
Function FindUruDir
StrCmp $InstallToUru "true" skip_this_step
ReadRegStr $InstDirUru HKLM "Software\MOUL" "Install_Dir"
Goto done
skip_this_step:
Abort
done:
FunctionEnd
; Checks if the installation directory is an existing Uru Live directory.
; The check for the PhysX DLL is required to ensure it is a valid Uru Live
; installation, and not just an Uru installation.
Function CheckIfDirIsUru
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 $InstallToUru "true"
done:
FunctionEnd
;;;;;;;;;
; Pages ;
;;;;;;;;;
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfDirIsUru
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;;;;;;;;;;;;;
; Languages ;
;;;;;;;;;;;;;
!insertmacro MUI_LANGUAGE "English"
;;;;;;;;;;;;
; Sections ;
;;;;;;;;;;;;
Section "Files"
SetOutPath $INSTDIR
File "Files\UruLauncher.exe"
File "Files\repair.ini"
File "Files\server.ini"
File "Files\vcredist_x86.exe"
ExecWait "$INSTDIR\vcredist_x86.exe /q /norestart"
WriteRegStr HKCU "Software\Gehn Shard" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"
CreateDirectory "$SMPROGRAMS\Gehn Shard"
CreateShortCut "$SMPROGRAMS\Gehn Shard\Gehn Shard.lnk" "$INSTDIR\UruLauncher.exe"
CreateShortCut "$SMPROGRAMS\Gehn Shard\Gehn Shard - Repair.lnk" "$INSTDIR\UruLauncher.exe" \
"/ServerIni=repair.ini /Repair"
CreateShortCut "$SMPROGRAMS\Gehn Shard\Gehn User Profile.lnk" "$LOCALAPPDATA\Uru - Gehn Shard"
CreateShortCut "$SMPROGRAMS\Gehn Shard\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
SectionEnd
Section "FigureOutDataSource"
StrCmp $InstallToUru "true" done
Call FindUruDir
; Check to see if we have a MOULa install. If we do, we'll want to
; copy the files. If not, automatically launch a patch-only repair.
; This will download just the files from Cyan's MOULa, then quit.
FindFirst $0 $1 "$InstDirUru\UruLauncher.exe"
StrCmp $1 "" bad_uru_dir
FindClose $0
Goto done
bad_uru_dir:
StrCpy $LaunchRepair "true"
done:
SectionEnd
Section "dat"
StrCmp $InstallToUru "true" skip_this_step
StrCmp $LaunchRepair "true" skip_this_step
CreateDirectory "$INSTDIR\dat"
CopyFiles /Silent /FilesOnly "$InstDirUru\dat\*" "$INSTDIR\dat"
skip_this_step:
SectionEnd
Section "sfx"
StrCmp $InstallToUru "true" skip_this_step
StrCmp $LaunchRepair "true" skip_this_step
CreateDirectory "$INSTDIR\sfx"
CopyFiles /Silent /FilesOnly "$InstDirUru\sfx\*.ogg" "$INSTDIR\sfx"
skip_this_step:
SectionEnd
; Give everyone permissions to write to the shard folder.
; This is needed because the patcher likes to touch itself.
Section "SetPermissions"
ExecWait 'cacls "$INSTDIR" /t /e /g "Authenticated Users":c'
SectionEnd
; This fires up the patcher if there is no MOULa install.
Section "Repair"
StrCmp $LaunchRepair "true" repair
Goto done
repair:
ExecWait "$INSTDIR\UruLauncher.exe /ServerIni=repair.ini /Repair /PatchOnly"
done:
SectionEnd
Section "Uninstall"
RMDir /r "$SMPROGRAMS\Gehn Shard"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Gehn Shard"
SectionEnd