~ubuntu-branches/debian/squeeze/assaultcube-data/squeeze

« back to all changes in this revision

Viewing changes to source/vcpp/buildEnv/ac.nsi

  • Committer: Bazaar Package Importer
  • Author(s): Gonéri Le Bouder, Ansgar Burchardt, Gonéri Le Bouder
  • Date: 2010-04-02 23:37:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402233755-kf74fxwlu634o6vg
Tags: 1.0.4+repack1-1
[ Ansgar Burchardt ]
* debian/control: fix typo in short description

[ Gonéri Le Bouder ]
* Upgrade to 1.0.4
* bump standards-version to 3.8.4
* Add Depends: ${misc:Depends} just to avoid a lintian warning
* Add a debian/source/format file for the same reason

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
!include MUI.nsh
 
2
!include Sections.nsh
 
3
 
 
4
## TOOLS
 
5
 
 
6
# Open Browser Window
 
7
 
 
8
# Uses $0
 
9
Function openLinkNewWindow
 
10
  Push $3 
 
11
  Push $2
 
12
  Push $1
 
13
  Push $0
 
14
  ReadRegStr $0 HKCR "http\shell\open\command" ""
 
15
# Get browser path
 
16
    DetailPrint $0
 
17
  StrCpy $2 '"'
 
18
  StrCpy $1 $0 1
 
19
  StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
 
20
    StrCpy $2 ' '
 
21
  StrCpy $3 1
 
22
  loop:
 
23
    StrCpy $1 $0 1 $3
 
24
    DetailPrint $1
 
25
    StrCmp $1 $2 found
 
26
    StrCmp $1 "" found
 
27
    IntOp $3 $3 + 1
 
28
    Goto loop
 
29
 
 
30
  found:
 
31
    StrCpy $1 $0 $3
 
32
    StrCmp $2 " " +2
 
33
      StrCpy $1 '$1"'
 
34
 
 
35
  Pop $0
 
36
  Exec '$1 $0'
 
37
  Pop $1
 
38
  Pop $2
 
39
  Pop $3
 
40
FunctionEnd
 
41
 
 
42
# Uses $0
 
43
Function un.openLinkNewWindow
 
44
  Push $3 
 
45
  Push $2
 
46
  Push $1
 
47
  Push $0
 
48
  ReadRegStr $0 HKCR "http\shell\open\command" ""
 
49
# Get browser path
 
50
    DetailPrint $0
 
51
  StrCpy $2 '"'
 
52
  StrCpy $1 $0 1
 
53
  StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
 
54
    StrCpy $2 ' '
 
55
  StrCpy $3 1
 
56
  loop:
 
57
    StrCpy $1 $0 1 $3
 
58
    DetailPrint $1
 
59
    StrCmp $1 $2 found
 
60
    StrCmp $1 "" found
 
61
    IntOp $3 $3 + 1
 
62
    Goto loop
 
63
 
 
64
  found:
 
65
    StrCpy $1 $0 $3
 
66
    StrCmp $2 " " +2
 
67
      StrCpy $1 '$1"'
 
68
 
 
69
  Pop $0
 
70
  Exec '$1 $0'
 
71
  Pop $1
 
72
  Pop $2
 
73
  Pop $3
 
74
FunctionEnd
 
75
 
 
76
 
 
77
Function SplitFirstStrPart
 
78
  Exch $R0
 
79
  Exch
 
80
  Exch $R1
 
81
  Push $R2
 
82
  Push $R3
 
83
  StrCpy $R3 $R1
 
84
  StrLen $R1 $R0
 
85
  IntOp $R1 $R1 + 1
 
86
  loop:
 
87
    IntOp $R1 $R1 - 1
 
88
    StrCpy $R2 $R0 1 -$R1
 
89
    StrCmp $R1 0 exit0
 
90
    StrCmp $R2 $R3 exit1 loop
 
91
  exit0:
 
92
  StrCpy $R1 ""
 
93
  Goto exit2
 
94
  exit1:
 
95
    IntOp $R1 $R1 - 1
 
96
    StrCmp $R1 0 0 +3
 
97
     StrCpy $R2 ""
 
98
     Goto +2
 
99
    StrCpy $R2 $R0 "" -$R1
 
100
    IntOp $R1 $R1 + 1
 
101
    StrCpy $R0 $R0 -$R1
 
102
    StrCpy $R1 $R2
 
103
  exit2:
 
104
  Pop $R3
 
105
  Pop $R2
 
106
  Exch $R1 ;rest
 
107
  Exch
 
108
  Exch $R0 ;first
 
109
FunctionEnd
 
110
 
 
111
 
 
112
; CONFIGURATION
 
113
 
 
114
; general
 
115
 
 
116
SetCompressor /SOLID lzma
 
117
 
 
118
!define CURPATH "R:\projects\ActionCube\ac\source\vcpp\buildEnv" ; CHANGE ME
 
119
!define AC_VERSION "v1.0"
 
120
!define AC_FULLVERSION "v1.0.1"
 
121
!define AC_FULLVERSIONINT "1.0.1"
 
122
!define AC_SHORTNAME "AssaultCube"
 
123
!define AC_FULLNAME "AssaultCube v1.0"
 
124
!define AC_FULLNAMESAVE "AssaultCube_v1.0"
 
125
 
 
126
Name "AssaultCube"
 
127
VAR StartMenuFolder
 
128
OutFile "AssaultCube_${AC_VERSION}.exe"
 
129
InstallDir "$PROGRAMFILES\${AC_FULLNAMESAVE}"
 
130
InstallDirRegKey HKLM "Software\${AC_FULLNAMESAVE}" ""
 
131
RequestExecutionLevel admin  ; require admin in vista
 
132
 
 
133
; Interface Configuration
 
134
 
 
135
!define MUI_HEADERIMAGE
 
136
!define MUI_HEADERIMAGE_BITMAP "${CURPATH}\header.bmp" ; optional
 
137
 
 
138
; icon
 
139
 
 
140
XPStyle on
 
141
Icon "${CURPATH}\icon.ico"
 
142
UninstallIcon "${CURPATH}\icon.ico"
 
143
!define MUI_ICON "${CURPATH}\icon.ico"
 
144
!define MUI_UNICON "${CURPATH}\icon.ico"
 
145
 
 
146
; Pages
 
147
 
 
148
Page custom WelcomePage
 
149
!insertmacro MUI_PAGE_LICENSE "${CURPATH}\License.txt"
 
150
Page custom InstallationTypePage
 
151
!insertmacro MUI_PAGE_COMPONENTS
 
152
!insertmacro MUI_PAGE_DIRECTORY
 
153
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
 
154
!insertmacro MUI_PAGE_INSTFILES
 
155
Page custom FinishPage
 
156
 
 
157
!insertmacro MUI_UNPAGE_CONFIRM
 
158
!insertmacro MUI_UNPAGE_INSTFILES
 
159
 
 
160
!insertmacro MUI_LANGUAGE "English"
 
161
 
 
162
 
 
163
; Custom Welcome Page
 
164
 
 
165
!define WS_CHILD            0x40000000
 
166
!define WS_VISIBLE          0x10000000
 
167
!define WS_DISABLED         0x08000000
 
168
!define WS_CLIPSIBLINGS     0x04000000
 
169
!define WS_MAXIMIZE         0x01000000
 
170
!define WS_VSCROLL          0x00200000
 
171
!define WS_HSCROLL          0x00100000
 
172
!define WS_GROUP            0x00020000
 
173
!define WS_TABSTOP          0x00010000
 
174
 
 
175
!define ES_LEFT             0x00000000
 
176
!define ES_CENTER           0x00000001
 
177
!define ES_RIGHT            0x00000002
 
178
!define ES_MULTILINE        0x00000004
 
179
!define ES_UPPERCASE        0x00000008
 
180
!define ES_LOWERCASE        0x00000010
 
181
!define ES_PASSWORD         0x00000020
 
182
!define ES_AUTOVSCROLL      0x00000040
 
183
!define ES_AUTOHSCROLL      0x00000080
 
184
!define ES_NOHIDESEL        0x00000100
 
185
!define ES_OEMCONVERT       0x00000400
 
186
!define ES_READONLY         0x00000800
 
187
!define ES_WANTRETURN       0x00001000
 
188
!define ES_NUMBER           0x00002000
 
189
 
 
190
!define SS_LEFT             0x00000000
 
191
!define SS_CENTER           0x00000001
 
192
!define SS_RIGHT            0x00000002
 
193
!define SS_ICON             0x00000003
 
194
!define SS_BLACKRECT        0x00000004
 
195
!define SS_GRAYRECT         0x00000005
 
196
!define SS_WHITERECT        0x00000006
 
197
!define SS_BLACKFRAME       0x00000007
 
198
!define SS_GRAYFRAME        0x00000008
 
199
!define SS_WHITEFRAME       0x00000009
 
200
!define SS_USERITEM         0x0000000A
 
201
!define SS_SIMPLE           0x0000000B
 
202
!define SS_LEFTNOWORDWRAP   0x0000000C
 
203
!define SS_OWNERDRAW        0x0000000D
 
204
!define SS_BITMAP           0x0000000E
 
205
!define SS_ENHMETAFILE      0x0000000F
 
206
!define SS_ETCHEDHORZ       0x00000010
 
207
!define SS_ETCHEDVERT       0x00000011
 
208
!define SS_ETCHEDFRAME      0x00000012
 
209
!define SS_TYPEMASK         0x0000001F
 
210
!define SS_REALSIZECONTROL  0x00000040
 
211
!define SS_NOPREFIX         0x00000080
 
212
!define SS_NOTIFY           0x00000100
 
213
!define SS_CENTERIMAGE      0x00000200
 
214
!define SS_RIGHTJUST        0x00000400
 
215
!define SS_REALSIZEIMAGE    0x00000800
 
216
!define SS_SUNKEN           0x00001000
 
217
!define SS_EDITCONTROL      0x00002000
 
218
!define SS_ENDELLIPSIS      0x00004000
 
219
!define SS_PATHELLIPSIS     0x00008000
 
220
!define SS_WORDELLIPSIS     0x0000C000
 
221
!define SS_ELLIPSISMASK     0x0000C000
 
222
 
 
223
!define BS_PUSHBUTTON       0x00000000
 
224
!define BS_DEFPUSHBUTTON    0x00000001
 
225
!define BS_CHECKBOX         0x00000002
 
226
!define BS_AUTOCHECKBOX     0x00000003
 
227
!define BS_RADIOBUTTON      0x00000004
 
228
!define BS_3STATE           0x00000005
 
229
!define BS_AUTO3STATE       0x00000006
 
230
!define BS_GROUPBOX         0x00000007
 
231
!define BS_USERBUTTON       0x00000008
 
232
!define BS_AUTORADIOBUTTON  0x00000009
 
233
!define BS_PUSHBOX          0x0000000A
 
234
!define BS_OWNERDRAW        0x0000000B
 
235
!define BS_TYPEMASK         0x0000000F
 
236
!define BS_LEFTTEXT         0x00000020
 
237
!define BS_TEXT             0x00000000
 
238
!define BS_ICON             0x00000040
 
239
!define BS_BITMAP           0x00000080
 
240
!define BS_LEFT             0x00000100
 
241
!define BS_RIGHT            0x00000200
 
242
!define BS_CENTER           0x00000300
 
243
!define BS_TOP              0x00000400
 
244
!define BS_BOTTOM           0x00000800
 
245
!define BS_VCENTER          0x00000C00
 
246
!define BS_PUSHLIKE         0x00001000
 
247
!define BS_MULTILINE        0x00002000
 
248
!define BS_NOTIFY           0x00004000
 
249
!define BS_FLAT             0x00008000
 
250
!define BS_RIGHTBUTTON      ${BS_LEFTTEXT}
 
251
 
 
252
!define LR_DEFAULTCOLOR     0x0000
 
253
!define LR_MONOCHROME       0x0001
 
254
!define LR_COLOR            0x0002
 
255
!define LR_COPYRETURNORG    0x0004
 
256
!define LR_COPYDELETEORG    0x0008
 
257
!define LR_LOADFROMFILE     0x0010
 
258
!define LR_LOADTRANSPARENT  0x0020
 
259
!define LR_DEFAULTSIZE      0x0040
 
260
!define LR_VGACOLOR         0x0080
 
261
!define LR_LOADMAP3DCOLORS  0x1000
 
262
!define LR_CREATEDIBSECTION 0x2000
 
263
!define LR_COPYFROMRESOURCE 0x4000
 
264
!define LR_SHARED           0x8000
 
265
 
 
266
!define IMAGE_BITMAP        0
 
267
!define IMAGE_ICON          1
 
268
!define IMAGE_CURSOR        2
 
269
!define IMAGE_ENHMETAFILE   3
 
270
 
 
271
Var DIALOG
 
272
Var HEADLINE
 
273
Var TEXT
 
274
Var HWND
 
275
Var IMAGECTL
 
276
Var IMAGE
 
277
 
 
278
Function .onInit
 
279
 
 
280
        InitPluginsDir
 
281
        File /oname=$TEMP\welcome.bmp "${CURPATH}\welcome.bmp"
 
282
        
 
283
        !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "InstallTypes.ini" "InstallTypes.ini"
 
284
 
 
285
FunctionEnd
 
286
 
 
287
Function .onInstSuccess
 
288
 
 
289
    StrCpy $0 "http://assault.cubers.net/releasenotes/v1.0/"
 
290
    Call openLinkNewWindow
 
291
 
 
292
FunctionEnd
 
293
 
 
294
Function un.onUninstSuccess
 
295
 
 
296
    StrCpy $0 "http://assault.cubers.net/uninstallnotes/v1.0/"
 
297
    Call un.openLinkNewWindow  
 
298
 
 
299
FunctionEnd
 
300
 
 
301
Function HideControls
 
302
 
 
303
    LockWindow on
 
304
    GetDlgItem $0 $HWNDPARENT 1028
 
305
    ShowWindow $0 ${SW_HIDE}
 
306
 
 
307
    GetDlgItem $0 $HWNDPARENT 1256
 
308
    ShowWindow $0 ${SW_HIDE}
 
309
 
 
310
    GetDlgItem $0 $HWNDPARENT 1035
 
311
    ShowWindow $0 ${SW_HIDE}
 
312
 
 
313
    GetDlgItem $0 $HWNDPARENT 1037
 
314
    ShowWindow $0 ${SW_HIDE}
 
315
 
 
316
    GetDlgItem $0 $HWNDPARENT 1038
 
317
    ShowWindow $0 ${SW_HIDE}
 
318
 
 
319
    GetDlgItem $0 $HWNDPARENT 1039
 
320
    ShowWindow $0 ${SW_HIDE}
 
321
 
 
322
    GetDlgItem $0 $HWNDPARENT 1045
 
323
    ShowWindow $0 ${SW_NORMAL}
 
324
    LockWindow off
 
325
 
 
326
FunctionEnd
 
327
 
 
328
Function ShowControls
 
329
 
 
330
    LockWindow on
 
331
    GetDlgItem $0 $HWNDPARENT 1028
 
332
    ShowWindow $0 ${SW_NORMAL}
 
333
 
 
334
    GetDlgItem $0 $HWNDPARENT 1256
 
335
    ShowWindow $0 ${SW_NORMAL}
 
336
 
 
337
    GetDlgItem $0 $HWNDPARENT 1035
 
338
    ShowWindow $0 ${SW_NORMAL}
 
339
 
 
340
    GetDlgItem $0 $HWNDPARENT 1037
 
341
    ShowWindow $0 ${SW_NORMAL}
 
342
 
 
343
    GetDlgItem $0 $HWNDPARENT 1038
 
344
    ShowWindow $0 ${SW_NORMAL}
 
345
 
 
346
    GetDlgItem $0 $HWNDPARENT 1039
 
347
    ShowWindow $0 ${SW_NORMAL}
 
348
 
 
349
    GetDlgItem $0 $HWNDPARENT 1045
 
350
    ShowWindow $0 ${SW_HIDE}
 
351
    LockWindow off
 
352
 
 
353
FunctionEnd
 
354
 
 
355
Function WelcomePage
 
356
 
 
357
        nsDialogs::Create /NOUNLOAD 1044
 
358
        Pop $DIALOG
 
359
 
 
360
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u ""
 
361
        Pop $IMAGECTL
 
362
 
 
363
        StrCpy $0 $TEMP\welcome.bmp
 
364
        System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
 
365
        Pop $IMAGE
 
366
        
 
367
        SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
 
368
 
 
369
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Welcome to the AssaultCube Setup Wizard"
 
370
        Pop $HEADLINE
 
371
 
 
372
        SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
 
373
 
 
374
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "This wizard will guide you through the installation of AssaultCube.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\r$\n$\r$\nClick next to continue."
 
375
        Pop $TEXT
 
376
 
 
377
        SetCtlColors $DIALOG "" 0xffffff
 
378
        SetCtlColors $HEADLINE "" 0xffffff
 
379
        SetCtlColors $TEXT "" 0xffffff
 
380
 
 
381
        Call HideControls
 
382
 
 
383
        nsDialogs::Show
 
384
 
 
385
        Call ShowControls
 
386
 
 
387
        System::Call gdi32::DeleteObject(i$IMAGE)
 
388
        
 
389
        # MessageBox MB_OK "This is a TEST BUILD, do NOT redistribute this file! This is NOT a final release!"
 
390
 
 
391
FunctionEnd
 
392
 
 
393
Function FinishPage
 
394
 
 
395
        nsDialogs::Create /NOUNLOAD 1044
 
396
        Pop $DIALOG
 
397
 
 
398
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u ""
 
399
        Pop $IMAGECTL
 
400
 
 
401
        StrCpy $0 $TEMP\welcome.bmp
 
402
        System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
 
403
        Pop $IMAGE
 
404
        
 
405
        SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
 
406
 
 
407
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Completing the AssaultCube Setup Wizard"
 
408
        Pop $HEADLINE
 
409
 
 
410
        SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
 
411
 
 
412
        nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "AssaultCube has been installed on your computer.$\r$\n$\r$\nClick Finish to close this wizard."
 
413
        Pop $TEXT
 
414
 
 
415
        SetCtlColors $DIALOG "" 0xffffff
 
416
        SetCtlColors $HEADLINE "" 0xffffff
 
417
        SetCtlColors $TEXT "" 0xffffff
 
418
 
 
419
        Call HideControls
 
420
 
 
421
        nsDialogs::Show
 
422
 
 
423
        Call ShowControls
 
424
 
 
425
        System::Call gdi32::DeleteObject(i$IMAGE)
 
426
 
 
427
FunctionEnd
 
428
 
 
429
Function DisableMultiuserOption
 
430
 
 
431
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 2" "Flags" "DISABLED"   
 
432
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 4" "Flags" "DISABLED"
 
433
        
 
434
        ; fix currently selected option
 
435
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 2" "State" "0"  
 
436
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 1" "State" "1"
 
437
        
 
438
FunctionEnd
 
439
 
 
440
 
 
441
Function InstallationTypePage
 
442
 
 
443
    ; check if "my documents" folder is present, might disable 2nd option
 
444
    
 
445
    ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal"
 
446
    StrCmp $0 "" nohome hashome
 
447
    nohome:
 
448
    
 
449
        Call DisableMultiuserOption ; not present, disable option
 
450
        goto homecheckdone
 
451
            
 
452
    hashome: 
 
453
    homecheckdone:
 
454
    
 
455
    
 
456
    ; check installed windows version, might change default option
 
457
    
 
458
    GetVersion::WindowsVersion
 
459
    Pop $R0
 
460
    Push "." ; divider char
 
461
    Push $R0 ; input string
 
462
    Call SplitFirstStrPart
 
463
    Pop $R0 ; major version
 
464
    Pop $R1 ; minor version
 
465
 
 
466
    StrCmp $R0 "6" 0 winvercheckdone ; vista
 
467
   
 
468
        ; suggest multiuser option on vista and later
 
469
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 2" "State" "1"  
 
470
        !insertmacro MUI_INSTALLOPTIONS_WRITE "InstallTypes.ini" "Field 1" "State" "0"
 
471
    
 
472
    winvercheckdone:
 
473
    
 
474
    
 
475
    ; set up GUI
 
476
    
 
477
        !insertmacro MUI_HEADER_TEXT "Installation Type" "Select the installation type" 
 
478
        !insertmacro MUI_INSTALLOPTIONS_DISPLAY "InstallTypes.ini"
 
479
    
 
480
        Pop $HWND
 
481
 
 
482
        GetDlgItem $1 $HWNDPARENT 1
 
483
        EnableWindow $1 0
 
484
 
 
485
        !insertmacro MUI_INSTALLOPTIONS_SHOW
 
486
        Pop $0
 
487
 
 
488
FunctionEnd
 
489
 
 
490
 
 
491
Function ConfigureWithoutAppdata
 
492
 
 
493
    ; remove shortcuts to user data directory
 
494
 
 
495
    ; Delete "$SMPROGRAMS\AssaultCube\AssaultCube User Data.lnk"
 
496
    ; Delete "$INSTDIR\User Data.lnk"
 
497
    
 
498
    ; configure ac without home dir
 
499
    
 
500
    FileOpen $9 "$INSTDIR\AssaultCube.bat" w
 
501
    FileWrite $9 "bin_win32\ac_client.exe --init %1 %2 %3 %4 %5$\r$\n"
 
502
    FileWrite $9 "pause$\r$\n"
 
503
    FileClose $9
 
504
 
 
505
FunctionEnd
 
506
 
 
507
; Installer Sections
 
508
 
 
509
Section "AssaultCube v1.0" AC
 
510
 
 
511
    SectionIn RO
 
512
 
 
513
    SetOutPath "$INSTDIR"
 
514
 
 
515
    File /r ac\*.*
 
516
 
 
517
    WriteRegStr HKLM "Software\${AC_FULLNAMESAVE}" "" $INSTDIR
 
518
 
 
519
    ; Create uninstaller
 
520
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "DisplayName" "${AC_FULLNAME}"
 
521
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "UninstallString" '"$INSTDIR\uninstall.exe"'
 
522
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "DisplayIcon" '"$INSTDIR\icon.ico"'
 
523
 
 
524
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "HelpLink" "http://assault.cubers.net/help.html"
 
525
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "URLInfoAbout" "http://assault.cubers.net"
 
526
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "URLUpdateInfo" "http://assault.cubers.net/download.html"
 
527
 
 
528
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "DisplayVersion" "v1.0"
 
529
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "VersionMajor" 1
 
530
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "VersionMinor" 0
 
531
 
 
532
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "NoModify" 1
 
533
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}" "NoRepair" 1
 
534
 
 
535
    WriteUninstaller "$INSTDIR\Uninstall.exe"
 
536
    
 
537
 
 
538
    ; create shortcuts
 
539
    
 
540
    ; CreateShortCut "$INSTDIR\User Data.lnk" "%appdata%\${AC_FULLNAMESAVE}" "" "" 0
 
541
      
 
542
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
 
543
       
 
544
        SetShellVarContext all
 
545
 
 
546
        CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
 
547
        CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${AC_SHORTNAME}.lnk" "$INSTDIR\AssaultCube.bat" "" "$INSTDIR\icon.ico" 0 SW_SHOWMINIMIZED
 
548
        CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\icon.ico" 0
 
549
        CreateShortCut "$SMPROGRAMS\$StartMenuFolder\README.lnk" "$INSTDIR\README.html" "" "" 0
 
550
        ; CreateShortCut "$SMPROGRAMS\AssaultCube\AssaultCube User Data.lnk" "%appdata%\${AC_FULLNAMESAVE}" "" "" 0  
 
551
 
 
552
    !insertmacro MUI_STARTMENU_WRITE_END
 
553
    
 
554
 
 
555
    ; set up ac dir config
 
556
    
 
557
        !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallTypes.ini" "Field 1" "State"
 
558
        !insertmacro MUI_INSTALLOPTIONS_READ $R1 "InstallTypes.ini" "Field 2" "State"
 
559
        
 
560
        StrCmp $R0 "1" 0 appdatadone
 
561
            Call ConfigureWithoutAppdata
 
562
        appdatadone:
 
563
        
 
564
 
 
565
SectionEnd
 
566
 
 
567
Section "OpenAL 1.1 redistributable" OAL
 
568
 
 
569
    SectionIn RO
 
570
    ExecWait '"$INSTDIR\bin_win32\oalinst.exe" -s'
 
571
 
 
572
SectionEnd
 
573
 
 
574
Section "Desktop Shortcuts" DESKSHORTCUTS
 
575
 
 
576
    SetShellVarContext all
 
577
 
 
578
    CreateShortCut "$DESKTOP\${AC_SHORTNAME}.lnk" "$INSTDIR\AssaultCube.bat" "" "$INSTDIR\icon.ico" 0 SW_SHOWMINIMIZED
 
579
 
 
580
SectionEnd
 
581
 
 
582
Section "-Debug Helper Library"
 
583
 
 
584
    GetVersion::WindowsVersion
 
585
    Pop $R0
 
586
    Push "." ; divider char
 
587
    Push $R0 ; input string
 
588
    Call SplitFirstStrPart
 
589
    Pop $R0 ; major version
 
590
    Pop $R1 ; minor version
 
591
 
 
592
    StrCmp $R0 "4" 0 winvercheckdone ; win98
 
593
   
 
594
        ; make app-specific debug helper library available on win98
 
595
        Rename "$INSTDIR\bin_win32\DbgHelp_RemoveThisPartIfOnWin98.DLL" "$INSTDIR\bin_win32\DbgHelp.DLL"
 
596
    
 
597
    winvercheckdone:
 
598
 
 
599
SectionEnd
 
600
 
 
601
Section "Uninstall"
 
602
  
 
603
    SetShellVarContext all
 
604
 
 
605
    ; delete reg keys
 
606
 
 
607
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AC_FULLNAMESAVE}"
 
608
    DeleteRegKey HKLM "SOFTWARE\${AC_FULLNAMESAVE}"
 
609
    DeleteRegKey /ifempty HKLM "SOFTWARE\${AC_FULLNAMESAVE}"
 
610
 
 
611
    ; delete directory
 
612
 
 
613
    RMDir /r "$INSTDIR"
 
614
 
 
615
    ; delete shortcuts
 
616
 
 
617
    Delete "$DESKTOP\AssaultCube.lnk"
 
618
    
 
619
    !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder 
 
620
    
 
621
    Delete "$SMPROGRAMS\$StartMenuFolder\${AC_SHORTNAME}.lnk"
 
622
    Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
 
623
    Delete "$SMPROGRAMS\$StartMenuFolder\README.lnk"
 
624
    Delete "$SMPROGRAMS\$StartMenuFolder\Firefox Support Forums.lnk"
 
625
    Delete "$SMPROGRAMS\$StartMenuFolder\AssaultCube User Data.lnk"
 
626
    RmDir  "$SMPROGRAMS\$StartMenuFolder"
 
627
    
 
628
SectionEnd
 
629
 
 
630
 
 
631
; set descriptions
 
632
 
 
633
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
634
 
 
635
    !insertmacro MUI_DESCRIPTION_TEXT ${AC} "Installs the required AssaultCube core files"
 
636
    !insertmacro MUI_DESCRIPTION_TEXT ${OAL} "Installs a sound library for 3D audio"
 
637
    !insertmacro MUI_DESCRIPTION_TEXT ${DESKSHORTCUTS} "Creates shortcuts on your Desktop"
 
638
 
 
639
!insertmacro MUI_FUNCTION_DESCRIPTION_END