ccdevnet / openc2e

openc2e

This URL has Read+Write access

openc2e / windows / gamefinder.nsi
100755 304 lines (275 sloc) 9.976 kb
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
; Openc2e Game Finder Script
; by Eric Goodwin (ElasticMuffin)
; 4/29/06
; Last Update: 10/24/06 (add C2)
 
 
Name "openc2e Game Finder Script"
OutFile "gamefinder.exe"
ShowInstDetails show
 
SetCompressor lzma
 
Icon "gamefind.ico"
 
!include LogicLib.nsh
 
Var dir
Var plainc3
Var plainc3exist
Var plainds
Var edynn
Var exodc3
Var exodc3exist
Var exodds
Var ca
Var cp
Var cv
Var plainc2
Var plainc1
Var tayc2
Var tayc1
 
;RegKey checker
!macro IfKeyExists ROOT MAIN_KEY KEY
push $R0
push $R1
 
!define Index 'Line${__LINE__}'
 
StrCpy $R1 "0"
 
"${Index}-Loop:"
; Check for Key
EnumRegKey $R0 ${ROOT} "${MAIN_KEY}" "$R1"
StrCmp $R0 "" "${Index}-False"
  IntOp $R1 $R1 + 1
  StrCmp $R0 "${KEY}" "${Index}-True" "${Index}-Loop"
 
"${Index}-True:"
;Return 1 if found
push "1"
goto "${Index}-End"
 
"${Index}-False:"
;Return 0 if not found
push "0"
goto "${Index}-End"
 
"${Index}-End:"
!undef Index
exch 2
pop $R0
pop $R1
!macroend
 
Section
 
  ReadRegStr $dir HKLM "Software\openc2e" ""
 
DetailPrint "Checking for Creatures games installed on your computer..."
DetailPrint ""
 
  ; Vanilla C3
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures 3"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 3 (original)."
ReadRegStr $plainc3 HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures 3" "Main Directory"
StrCpy $R1 "$plainc3" 1 -1
StrCpy $plainc3exist "1"
StrCmp "$R1" "\" trim1
Goto make1
trim1:
StrCpy $plainc3 "$plainc3" -1
make1:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 3.lnk" "$dir\openc2e.exe" '-d "$plainc3" --autokill'
${Else}
DetailPrint "Could not find Creatures 3 (original)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 3.lnk"
${EndIf}
 
; Vanilla DS
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Docking Station"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Docking Station (original)."
ReadRegStr $plainds HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Docking Station" "Main Directory"
StrCpy $R1 "$plainds" 1 -1
StrCmp "$R1" "\" trim2
Goto make2
trim2:
StrCpy $plainds "$plainds" -1
make2:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Docking Station.lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$plainds" --autokill'
${If} $plainc3exist == "1"
DetailPrint "Creating Docked shortcut for C3/DS (original)."
CreateShortCut "$SMPROGRAMS\openc2e\Games\C3 + DS (Docked).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$plainc3" -d "$plainds" --autokill'
${Else}
Delete "$SMPROGRAMS\openc2e\Games\C3 + DS (Docked).lnk"
${EndIf}
${Else}
DetailPrint "Could not find Docking Station (original)."
Delete "$SMPROGRAMS\openc2e\Docking Station.lnk"
${EndIf}
 
; Edynn
  !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Edynn"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Edynn."
ReadRegStr $edynn HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Edynn" "Main Directory"
StrCpy $R1 "$edynn" 1 -1
StrCmp "$R1" "\" trim3
Goto make3
trim3:
StrCpy $edynn "$edynn" -1
make3:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Edynn.lnk" "$dir\openc2e.exe" '--gamename "Edynn" -d "$edynn" --autokill'
${Else}
DetailPrint "Could not find Edynn."
Delete "$SMPROGRAMS\openc2e\Games\Edynn.lnk"
${EndIf}
 
;Exodus C3
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 3"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 3 (Exodus)."
ReadRegStr $exodc3 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 3" "Main Directory"
StrCpy $R1 "$exodc3" 1 -1
StrCpy $exodc3exist "1"
StrCmp "$R1" "\" trim4
Goto make4
trim4:
StrCpy $exodc3 "$exodc3" -1
make4:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 3 (Exodus).lnk" "$dir\openc2e.exe" '-d "$exodc3" --autokill'
${Else}
DetailPrint "Could not find Creatures 3 (Exodus)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 3 (Exodus).lnk"
${EndIf}
 
;Exodus DS
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Docking Station"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Docking Station (Exodus)."
ReadRegStr $exodds HKEY_LOCAL_MACHINE "Software\Gameware Development\Docking Station" "Main Directory"
StrCpy $R1 "$exodds" 1 -1
StrCmp "$R1" "\" trim5
Goto make5
trim5:
StrCpy $exodds "$exodds" -1
make5:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Docking Station (Exodus).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$exodds" --autokill'
${If} $exodc3exist == "1"
DetailPrint "Creating Docked shortcut for C3/DS (Exodus)."
CreateShortCut "$SMPROGRAMS\openc2e\Games\C3 + DS Exodus (Docked).lnk" "$dir\openc2e.exe" '--gamename "Docking Station" -d "$exodc3" -d "$exodds" --autokill'
${Else}
Delete "$SMPROGRAMS\openc2e\Games\C3 + DS Exodus (Docked).lnk"
${EndIf}
${Else}
DetailPrint "Could not find Docking Station (Exodus)."
Delete "$SMPROGRAMS\openc2e\Games\Docking Station (Exodus).lnk"
${EndIf}
 
;Creatures Adventures
  !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures Adventures"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures Adventures."
ReadRegStr $ca HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures Adventures" "Main Directory"
StrCpy $R1 "$ca" 1 -1
StrCmp "$R1" "\" trim6
Goto make6
trim6:
StrCpy $ca "$ca" -1
make6:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Adventures.lnk" "$dir\openc2e.exe" '--gamename "Creatures Adventures" -d "$ca" -g cv'
${Else}
DetailPrint "Could not find Creatures Adventures."
Delete "$SMPROGRAMS\openc2e\Games\Creatures Adventures.lnk"
${EndIf}
 
;Creatures Playground
  !insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\CyberLife Technology" "Creatures Playground"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures Playground."
ReadRegStr $cp HKEY_LOCAL_MACHINE "Software\CyberLife Technology\Creatures Playground" "Main Directory"
StrCpy $R1 "$cp" 1 -1
StrCmp "$R1" "\" trim7
Goto make7
trim7:
StrCpy $cp "$cp" -1
make7:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Playground.lnk" "$dir\openc2e.exe" '--gamename "Creatures Playground" -d "$cp" -g cv'
${Else}
DetailPrint "Could not find Creatures Playground."
Delete "$SMPROGRAMS\openc2e\Games\Creatures Playground.lnk"
${EndIf}
 
;Creatures Village
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures Village"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures Village."
ReadRegStr $cv HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures Village" "Main Directory"
StrCpy $R1 "$cv" 1 -1
StrCmp "$R1" "\" trim8
Goto make8
trim8:
StrCpy $cv "$cv" -1
make8:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures Village.lnk" "$dir\openc2e.exe" '-d "$cv" -g cv'
${Else}
DetailPrint "Could not find Creatures Village."
Delete "$SMPROGRAMS\openc2e\Games\Creatures Village.lnk"
${EndIf}
 
;Original C2
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Cyberlife Technology" "Creatures 2"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 2 (original)."
ReadRegStr $plainc2 HKEY_LOCAL_MACHINE "Software\Cyberlife Technology\Creatures 2\1.0" "Main Directory"
StrCpy $R1 "$plainc2" 1 -1
StrCmp "$R1" "\" trim9
Goto make9
trim9:
StrCpy $plainc2 "$plainc2" -1
make9:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 2.lnk" "$dir\openc2e.exe" '-d "$plainc2" -g c2 --autokill'
${Else}
DetailPrint "Could not find Creatures 2 (original)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 2.lnk"
${EndIf}
 
;Original C1
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Millennium Interactive" "Creatures"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 1 (original)."
ReadRegStr $plainc1 HKEY_LOCAL_MACHINE "Software\Millennium Interactive\Creatures\1.0" "Main Directory"
StrCpy $R1 "$plainc1" 1 -1
StrCmp "$R1" "\" trim10
Goto make10
trim10:
StrCpy $plainc1 "$plainc1" -1
make10:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 1.lnk" "$dir\openc2e.exe" '-d "$plainc1" -g c1 --autokill'
${Else}
DetailPrint "Could not find Creatures 1 (original)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 1.lnk"
${EndIf}
 
;TAY C2
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 2"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 2 (The Albian Years)."
ReadRegStr $tayc2 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 2\1.0" "Main Directory"
StrCpy $R1 "$tayc2" 1 -1
StrCmp "$R1" "\" trim11
Goto make11
trim11:
StrCpy $tayc2 "$tayc2" -1
make11:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 2 (TAY).lnk" "$dir\openc2e.exe" '-d "$tayc2" -g c2 --autokill'
${Else}
DetailPrint "Could not find Creatures 2 (The Albian Years)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 2 (TAY).lnk"
${EndIf}
 
;TAY C1
!insertmacro IfKeyExists "HKEY_LOCAL_MACHINE" "Software\Gameware Development" "Creatures 1"
Pop $R0
${If} $R0 = 1
DetailPrint "Found Creatures 1 (The Albian Years)."
ReadRegStr $tayc1 HKEY_LOCAL_MACHINE "Software\Gameware Development\Creatures 1\1.0" "Main Directory"
StrCpy $R1 "$tayc1" 1 -1
StrCmp "$R1" "\" trim12
Goto make12
trim12:
StrCpy $tayc1 "$tayc1" -1
make12:
CreateShortCut "$SMPROGRAMS\openc2e\Games\Creatures 1 (TAY).lnk" "$dir\openc2e.exe" '-d "$tayc1" -g c1 --autokill'
${Else}
DetailPrint "Could not find Creatures 1 (The Albian Years)."
Delete "$SMPROGRAMS\openc2e\Games\Creatures 1 (TAY).lnk"
${EndIf}
SectionEnd
 
BrandingText "openc2e Gamefinder"