make Agent::finishInit public
[openc2e.git] / gamefinder.nsi
blob921679180c308752d51cbe5352fe0d6c1cf2dda7
1 ; Openc2e Game Finder Script
2 ; by Eric Goodwin (ElasticMuffin)
3 ; 4/29/06
4 ; Last Update: 10/24/06 (add C2)
7 Name "openc2e Game Finder Script"
8 OutFile "gamefinder.exe"
9 ShowInstDetails show
11 SetCompressor lzma
13 Icon "gamefind.ico"
15 !include LogicLib.nsh
17 Var dir
18 Var plainc3
19 Var plainc3exist
20 Var plainds
21 Var edynn
22 Var exodc3
23 Var exodc3exist
24 Var exodds
25 Var ca
26 Var cp
27 Var cv
28 Var plainc2
29 Var plainc1
30 Var tayc2
31 Var tayc1
33 ;RegKey checker
34 !macro IfKeyExists ROOT MAIN_KEY KEY
35 push $R0
36 push $R1
38 !define Index 'Line${__LINE__}'
40 StrCpy $R1 "0"
42 "${Index}-Loop:"
43 ; Check for Key
44 EnumRegKey $R0 ${ROOT} "${MAIN_KEY}" "$R1"
45 StrCmp $R0 "" "${Index}-False"
46 IntOp $R1 $R1 + 1
47 StrCmp $R0 "${KEY}" "${Index}-True" "${Index}-Loop"
49 "${Index}-True:"
50 ;Return 1 if found
51 push "1"
52 goto "${Index}-End"
54 "${Index}-False:"
55 ;Return 0 if not found
56 push "0"
57 goto "${Index}-End"
59 "${Index}-End:"
60 !undef Index
61 exch 2
62 pop $R0
63 pop $R1
64 !macroend
66 Section
68 ReadRegStr $dir HKLM "Software\openc2e" ""
70 DetailPrint "Checking for Creatures games installed on your computer..."
71 DetailPrint ""
73 ; Vanilla C3
74 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures 3"
75 Pop $R0
76 ${If} $R0 = 1
77 DetailPrint "Found Creatures 3 (original)."
78 ReadRegStr $plainc3 HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures 3" "Main Directory"
79 StrCpy $R1 "$plainc3" 1 -1
80 StrCpy $plainc3exist "1"
81 StrCmp "$R1" "\" trim1
82 Goto make1
83 trim1:
84 StrCpy $plainc3 "$plainc3" -1
85 make1:
86 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 3.lnk" "$dir\openc2e.exe" '-d "$plainc3" --autokill'
87 ${Else}
88 DetailPrint "Could not find Creatures 3 (original)."
89 Delete "$SMPROGRAMS\openc2e\Games\Creatures 3.lnk"
90 ${EndIf}
92 ; Vanilla DS
93 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Docking Station"
94 Pop $R0
95 ${If} $R0 = 1
96 DetailPrint "Found Docking Station (original)."
97 ReadRegStr $plainds HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Docking Station" "Main Directory"
98 StrCpy $R1 "$plainds" 1 -1
99 StrCmp "$R1" "\" trim2
100 Goto make2
101 trim2:
102 StrCpy $plainds "$plainds" -1
103 make2:
104 CreateShortCut "$SMPROGRAMS\openc2e\Games\Docking Station.lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$plainds" --autokill'
105 ${If} $plainc3exist == "1"
106 DetailPrint "Creating Docked shortcut for C3/DS (original)."
107 CreateShortCut "$SMPROGRAMS\openc2e\Games\C3 + DS (Docked).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$plainc3" -d "$plainds" --autokill'
108 ${Else}
109 Delete "$SMPROGRAMS\openc2e\Games\C3 + DS (Docked).lnk"
110 ${EndIf}
111 ${Else}
112 DetailPrint "Could not find Docking Station (original)."
113 Delete "$SMPROGRAMS\openc2e\Docking Station.lnk"
114 ${EndIf}
116 ; Edynn
117 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Edynn"
118 Pop $R0
119 ${If} $R0 = 1
120 DetailPrint "Found Edynn."
121 ReadRegStr $edynn HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Edynn" "Main Directory"
122 StrCpy $R1 "$edynn" 1 -1
123 StrCmp "$R1" "\" trim3
124 Goto make3
125 trim3:
126 StrCpy $edynn "$edynn" -1
127 make3:
128 CreateShortCut "$SMPROGRAMS\openc2e\Games\Edynn.lnk" "$dir\openc2e.exe" '--gamename "Edynn" -d "$edynn" --autokill'
129 ${Else}
130 DetailPrint "Could not find Edynn."
131 Delete "$SMPROGRAMS\openc2e\Games\Edynn.lnk"
132 ${EndIf}
134 ;Exodus C3
135 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 3"
136 Pop $R0
137 ${If} $R0 = 1
138 DetailPrint "Found Creatures 3 (Exodus)."
139 ReadRegStr $exodc3 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 3" "Main Directory"
140 StrCpy $R1 "$exodc3" 1 -1
141 StrCpy $exodc3exist "1"
142 StrCmp "$R1" "\" trim4
143 Goto make4
144 trim4:
145 StrCpy $exodc3 "$exodc3" -1
146 make4:
147 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 3 (Exodus).lnk" "$dir\openc2e.exe" '-d "$exodc3" --autokill'
148 ${Else}
149 DetailPrint "Could not find Creatures 3 (Exodus)."
150 Delete "$SMPROGRAMS\openc2e\Games\Creatures 3 (Exodus).lnk"
151 ${EndIf}
153 ;Exodus DS
154 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Docking Station"
155 Pop $R0
156 ${If} $R0 = 1
157 DetailPrint "Found Docking Station (Exodus)."
158 ReadRegStr $exodds HKEY_LOCAL_MACHINE "Software\Gameware Development\Docking Station" "Main Directory"
159 StrCpy $R1 "$exodds" 1 -1
160 StrCmp "$R1" "\" trim5
161 Goto make5
162 trim5:
163 StrCpy $exodds "$exodds" -1
164 make5:
165 CreateShortCut "$SMPROGRAMS\openc2e\Games\Docking Station (Exodus).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$exodds" --autokill'
166 ${If} $exodc3exist == "1"
167 DetailPrint "Creating Docked shortcut for C3/DS (Exodus)."
168 CreateShortCut "$SMPROGRAMS\openc2e\Games\C3 + DS Exodus (Docked).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$exodc3" -d "$exodds" --autokill'
169 ${Else}
170 Delete "$SMPROGRAMS\openc2e\Games\C3 + DS Exodus (Docked).lnk"
171 ${EndIf}
172 ${Else}
173 DetailPrint "Could not find Docking Station (Exodus)."
174 Delete "$SMPROGRAMS\openc2e\Games\Docking Station (Exodus).lnk"
175 ${EndIf}
177 ;Creatures Adventures
178 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures Adventures"
179 Pop $R0
180 ${If} $R0 = 1
181 DetailPrint "Found Creatures Adventures."
182 ReadRegStr $ca HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures Adventures" "Main Directory"
183 StrCpy $R1 "$ca" 1 -1
184 StrCmp "$R1" "\" trim6
185 Goto make6
186 trim6:
187 StrCpy $ca "$ca" -1
188 make6:
189 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Adventures.lnk" "$dir\openc2e.exe" '--gamename "Creatures Adventures" -d "$ca" -g cv'
190 ${Else}
191 DetailPrint "Could not find Creatures Adventures."
192 Delete "$SMPROGRAMS\openc2e\Games\Creatures Adventures.lnk"
193 ${EndIf}
195 ;Creatures Playground
196 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures Playground"
197 Pop $R0
198 ${If} $R0 = 1
199 DetailPrint "Found Creatures Playground."
200 ReadRegStr $cp HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures Playground" "Main Directory"
201 StrCpy $R1 "$cp" 1 -1
202 StrCmp "$R1" "\" trim7
203 Goto make7
204 trim7:
205 StrCpy $cp "$cp" -1
206 make7:
207 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Playground.lnk" "$dir\openc2e.exe" '--gamename "Creatures Playground" -d "$cp" -g cv'
208 ${Else}
209 DetailPrint "Could not find Creatures Playground."
210 Delete "$SMPROGRAMS\openc2e\Games\Creatures Playground.lnk"
211 ${EndIf}
213 ;Creatures Village
214 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures Village"
215 Pop $R0
216 ${If} $R0 = 1
217 DetailPrint "Found Creatures Village."
218 ReadRegStr $cv HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures Village" "Main Directory"
219 StrCpy $R1 "$cv" 1 -1
220 StrCmp "$R1" "\" trim8
221 Goto make8
222 trim8:
223 StrCpy $cv "$cv" -1
224 make8:
225 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Village.lnk" "$dir\openc2e.exe" '-d "$cv" -g cv'
226 ${Else}
227 DetailPrint "Could not find Creatures Village."
228 Delete "$SMPROGRAMS\openc2e\Games\Creatures Village.lnk"
229 ${EndIf}
231 ;Original C2
232 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Cyberlife Technology" "Creatures 2"
233 Pop $R0
234 ${If} $R0 = 1
235 DetailPrint "Found Creatures 2 (original)."
236 ReadRegStr $plainc2 HKEY_LOCAL_MACHINE "Software\Cyberlife Technology\Creatures 2\1.0" "Main Directory"
237 StrCpy $R1 "$plainc2" 1 -1
238 StrCmp "$R1" "\" trim9
239 Goto make9
240 trim9:
241 StrCpy $plainc2 "$plainc2" -1
242 make9:
243 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 2.lnk" "$dir\openc2e.exe" '-d "$plainc2" -g c2 --autokill'
244 ${Else}
245 DetailPrint "Could not find Creatures 2 (original)."
246 Delete "$SMPROGRAMS\openc2e\Games\Creatures 2.lnk"
247 ${EndIf}
249 ;Original C1
250 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Millennium Interactive" "Creatures"
251 Pop $R0
252 ${If} $R0 = 1
253 DetailPrint "Found Creatures 1 (original)."
254 ReadRegStr $plainc1 HKEY_LOCAL_MACHINE "Software\Millennium Interactive\Creatures\1.0" "Main Directory"
255 StrCpy $R1 "$plainc1" 1 -1
256 StrCmp "$R1" "\" trim10
257 Goto make10
258 trim10:
259 StrCpy $plainc1 "$plainc1" -1
260 make10:
261 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 1.lnk" "$dir\openc2e.exe" '-d "$plainc1" -g c1 --autokill'
262 ${Else}
263 DetailPrint "Could not find Creatures 1 (original)."
264 Delete "$SMPROGRAMS\openc2e\Games\Creatures 1.lnk"
265 ${EndIf}
267 ;TAY C2
268 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 2"
269 Pop $R0
270 ${If} $R0 = 1
271 DetailPrint "Found Creatures 2 (The Albian Years)."
272 ReadRegStr $tayc2 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 2\1.0" "Main Directory"
273 StrCpy $R1 "$tayc2" 1 -1
274 StrCmp "$R1" "\" trim11
275 Goto make11
276 trim11:
277 StrCpy $tayc2 "$tayc2" -1
278 make11:
279 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 2 (TAY).lnk" "$dir\openc2e.exe" '-d "$tayc2" -g c2 --autokill'
280 ${Else}
281 DetailPrint "Could not find Creatures 2 (The Albian Years)."
282 Delete "$SMPROGRAMS\openc2e\Games\Creatures 2 (TAY).lnk"
283 ${EndIf}
285 ;TAY C1
286 !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 1"
287 Pop $R0
288 ${If} $R0 = 1
289 DetailPrint "Found Creatures 1 (The Albian Years)."
290 ReadRegStr $tayc1 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 1\1.0" "Main Directory"
291 StrCpy $R1 "$tayc1" 1 -1
292 StrCmp "$R1" "\" trim12
293 Goto make12
294 trim12:
295 StrCpy $tayc1 "$tayc1" -1
296 make12:
297 CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 1 (TAY).lnk" "$dir\openc2e.exe" '-d "$tayc1" -g c1 --autokill'
298 ${Else}
299 DetailPrint "Could not find Creatures 1 (The Albian Years)."
300 Delete "$SMPROGRAMS\openc2e\Games\Creatures 1 (TAY).lnk"
301 ${EndIf}
302 SectionEnd
304 BrandingText "openc2e Gamefinder"