blob: 2fd353231e00cc78da139a0c740bd3c43db201f7 (
plain) (
blame)
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
Unicode true
!ifdef _DEBUG
SetCompress off
FileBufSize 64
SetDatablockOptimize off
!else
SetDatablockOptimize on
!ifdef lzma
SetCompressor /SOLID lzma
SetCompressorDictSize 16
FileBufSize 64
!else
SetCompressor /SOLID bzip2 ; actually doesnt seem to help :(
!endif
!endif
ReserveFile /plugin "LangDLL.dll"
ReserveFile /plugin "nsDialogs.dll"
ReserveFile /plugin "System.dll"
; temp hack 2022 (hard-coded to 32-bit release build - might need e.g. a Winamp_x64_Release version later)
!ifndef FILES_PATH
!define FILES_PATH ..\..\..\Build\Winamp_x86_Release
; change to this when copied to Winamp-Desktop\Src\Build\Winamp_x86_Release\installer\winamp
; !define FILES_PATH ..\..\..\Winamp_x86_Release
!endif
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${WINAMP}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "LangId"
!define MUI_LANGDLL_WINDOWTITLE $(LANGUAGE_DLL_TITLE)
!define MUI_LANGDLL_INFO $(LANGUAGE_DLL_INFO)
!addincludedir "..\shared\scripts"
!include "MUI2.nsh"
!include "WordFunc.nsh"
!include "WinMessages.nsh"
!include "LogicLib.nsh"
!include ".\parameters.nsh"
!include ".\branding.nsh"
!include "verInfo.nsh"
!include "WinVer.nsh"
Var SETTINGSDIR
Var INSTINI
Var WINAMPINI
Var WINAMPM3U
Var M3UBASEDIR
Var PREVINSTINI
Var RESTARTAGENT
Var FIRSTINSTALL
Var needplaystart
Var IDX_INSTTYPE_STANDARD
Var IDX_INSTTYPE_PREVIOUS
Var IDX_INSTTYPE_FULL
Var /GLOBAL VERSION_REGISTRY
Var /GLOBAL VERSION_MINIMUM
!include ".\utils\wafuncs.nsh"
!ifndef _DEBUG
; BrandingText "Winamp ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MINOR_SECOND} ${InstallType} -- $(BuiltOn) ${__DATE__} $(at) ${__TIME__}"
BrandingText "Winamp ${VERSION_MAJOR}.${VERSION_MINOR} ${InstallType} -- $(BuiltOn) ${__DATE__} $(at) ${__TIME__}"
!else
BrandingText "Winamp Debug -- internal use only"
!endif
RequestExecutionLevel admin
Caption $(IDS_CAPTION)
Name "${WINAMP}"
InstallDir "$PROGRAMFILES\${WINAMPFOLDER}"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${WINAMP}" "UninstallString"
XPStyle on
!define OVERWRITEMODE on
!ifdef _DEBUG
ShowInstDetails show
AutoCloseWindow false
!else
ShowInstDetails nevershow
AutoCloseWindow true
!endif
SetDateSave on
!define SECTIONIN_FULL "SectionIn 1"
!ifdef FULL
!define SECTIONIN_STD "SectionIn 1 2"
!define SECTIONIN_LITE "SectionIn 1 2 3"
!else
!define SECTIONIN_STD "SectionIn 1"
!define SECTIONIN_LITE "SectionIn 1"
!endif
!ifndef INSTALL_NAME
!define INSTALL_NAME "winamp${VERSION_MAJOR}${VERSION_MINOR}${VERSION_MINOR_SECOND}"
!endif
!ifdef _DEBUG
OutFile "wasetup_dbg${LANG_FILESPEC}.exe"
!else
!ifdef LITE
OutFile "$%INSTALL_NAME%_lite${LANG_FILESPEC}.exe"
!else ifdef full
OutFile "$%INSTALL_NAME%_full${LANG_FILESPEC}.exe"
!else
OutFile 'winamp_unknown${LANG_FILESPEC}.exe'
!endif
!endif
!include ".\ui.nsh"
!include ".\sectionsHelper.nsh"
!include ".\wasections.nsh"
!include ".\uninstall\uninstall.nsh"
!include ".\languages.nsh"
Section -LastSection IDX_SECTION_LAST ; keep last section after languages
SectionEnd
!include ".\uiEvents.nsh"
!include ".\descriptionTable.nsh"
Function .onInit
!ifdef WINAMP64
ReadEnvStr $0 PROGRAMW6432
StrCpy $INSTDIR "$0\${WINAMPFOLDER}"
!endif
InitPluginsDir
System::Call "User32::SetProcessDPIAware()"
StrCpy $PREVINSTINI ""
StrCpy $INSTINI "$PLUGINSDIR\install.ini"
!ifdef LANGID
WriteRegStr "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" ${LANGID}
!endif ; LANGID
!insertmacro MUI_LANGDLL_DISPLAY
; check Windows version
; this will need testing...
${If} ${AtMostWin7}
${If} ${IsWin7}
${AndIf} ${AtLeastServicePack} 1
${Else}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(IDS_MSG_WINDOWS_TOO_OLD)" /SD IDOK
Quit
${EndIf}
${EndIf}
; VC142 runtime required for all installations - pt.1: external
/* ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version"
${If} $0 == "v14.29.30139.00"
${OrIf} $0 == "v14.30.30423.00"
${OrIf} $0 == "v14.30.30528.00"
${OrIf} $0 == "v14.30.30704.00"
${OrIf} $0 == "v14.30.*"
${OrIf} $0 == "v14.31.30818.00"
${OrIf} $0 == "v14.31.30919.00"
${OrIf} $0 == "v14.31.31005.00"
${OrIf} $0 == "v14.31.31103.00"
${OrIf} $0 == "v14.31.*"
${OrIf} $0 == "v14.32.31302.00"
${OrIf} $0 == "v14.32.31326.00"
${OrIf} $0 == "v14.32.31332.00"
${OrIf} $0 == "v14.32.*"
${OrIf} $0 == "v14.33.31424.00"
${OrIf} $0 == "v14.33.*"
${OrIf} $0 == "v14.34.*"
Goto continue
*/
; Get Visual Studio Version
DetailPrint "Getting Visual Studio Version string from registry..."
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version"
DetailPrint "Visual Studio Version String: $0"
DetailPrint "Done!"
DetailPrint ""
; Replace v in Version String
DetailPrint "Replacing v substring in version string..."
${WordReplace} "$0" "v" "" "+" $0
DetailPrint "Visual Studio Version: $0"
DetailPrint "Done!"
DetailPrint ""
; Compare Versions
DetailPrint "Comparing Visual Studio Registry and Minimal Versions..."
; ${VersionCompare} "[Version1]" "[Version2]" $var
; "[Version1]" ; REGISTRY VERSION
; "[Version2]" ; MINIMUM VERSION
; $var ; Result:
; $var=0 Versions are equal
; $var=1 Version1 is newer
; $var=2 Version2 is newer
; Visual Studio Registry Version
StrCpy $VERSION_REGISTRY $0
DetailPrint " Registry Version: $VERSION_REGISTRY"
; Visual Studio Minimal Version
StrCpy $VERSION_MINIMUM "14.29.30139.00" ; MINIMUM VERSION!!!
; ===========================================================
; --- DEBUG ---
;StrCpy $VERSION_MINIMUM "14.29.30139.00" ; REGISTRY > MINIMUM
;StrCpy $VERSION_MINIMUM "14.32.31332.00" ; REGISTRY = MINIMUM
;StrCpy $VERSION_MINIMUM "14.33.31424.00" ; REGISTRY < MINIMUM -> INSTALLATION REQUIRED!
; --- DEBUG ---
; ===========================================================
DetailPrint " Minimum Version: $VERSION_MINIMUM"
${VersionCompare} "$VERSION_REGISTRY" "$VERSION_MINIMUM" $R0
DetailPrint "Version Compare Result: $R0"
${If} $R0 == 0
${OrIf} $R0 == 1
; Visual C++ Redistributable for Visual Studio 2015 Installation NOT Required!
${If} $R0 == 0
DetailPrint "VERSIONS ARE EQUAL ($VERSION_REGISTRY = $VERSION_MINIMUM)"
DetailPrint "Visual C++ Redistributable for Visual Studio 2015 Installation NOT Required!"
${Else}
DetailPrint "REGISTRY VERSION ($VERSION_REGISTRY) > MINIMUM VERSION ($VERSION_MINIMUM)"
DetailPrint "Visual C++ Redistributable for Visual Studio 2015 Installation NOT Required!"
${EndIf}
${Else}
; Visual C++ Redistributable for Visual Studio 2015 Installation Required!
DetailPrint "REGISTRY VERSION ($VERSION_REGISTRY) < MINIMUM VERSION ($VERSION_MINIMUM)"
DetailPrint "Visual C++ Redistributable for Visual Studio 2015 Installation Required!"
; Code for Download and Install vc_redist.x86.exe...
MessageBox MB_YESNO|MB_ICONQUESTION "$(IDS_MSG_VC_REDIST_LINK_TO_MSDOWNLOAD)$\r$\n$\r$\n$(IDS_VC_REDIST_MSDOWNLOAD_URL)$\r$\n$\r$\n$(IDS_VC_DOWNLOAD)$\r$\n$(IDS_VC_DOWNLOAD_OR_ABORT)" /SD IDYES IDYES download IDNO abortInstaller
download:
SetOutPath "$TEMP"
NSISdl::download "https://aka.ms/vs/16/release/vc_redist.x86.exe" "$TEMP\vc_redist.x86.exe"
ExecWait "$TEMP\vc_redist.x86.exe"
Delete "$TEMP\vc_redist.x86.exe"
Goto continue
abortInstaller:
Quit
continue:
${EndIf}
${FrenchRadio_OnInit}
${If} ${AtLeastWin7}
${ExpressMode_Initialize}
${EndIf}
FunctionEnd
Function .onInstSuccess
Delete $PREVINSTINI
Call SaveSelection
DeleteINISec "$INSTINI" "Bundle"
CopyFiles /SILENT "$INSTINI" "$INSTDIR\install.ini"
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
StrCpy $winamp.uninstall.checkFolder "false"
FunctionEnd
${InitializeGetSectionName}
Function GetLastInstTypeIndex
Push $R0
Push $R1
StrCpy $R0 0
loop:
InstTypeGetText $R0 $R1
StrCmp $R1 '' +3
IntOp $R0 $R0 + 1
goto loop
Pop $R1
IntOp $R0 $R0 - 1
Exch $R0
FunctionEnd
Function ReadSections
Push $R0
Push $R1
Push $R2
Push $R3
Push $R4
Push $R5
Push $R6
Push $R7
Push $R8
StrCpy $R1 ${IDX_SECTION_LAST}
Call GetLastInstTypeIndex
Pop $R5
StrCpy $R0 1
IntOp $R6 $R0 << $R5
IntOp $R6 $R6 ~
StrCpy $R0 0
ReadINIStr $R8 "$INSTINI" "installer" "sectionsVer"
loop:
!ifdef IDX_SEC_ML
StrCmp $R0 ${IDX_SEC_ML} skipRead
!endif
!ifdef IDX_SEC_ML_PMP
StrCmp $R0 ${IDX_SEC_ML_PMP} skipRead
!endif
${If} $R8 >= 2
${GetSectionName} $R0 $R2
${Else}
SectionGetText $R0 $R2
${EndIf}
StrCmp $R2 "-" skipRead
StrCmp $R2 "" skipRead
SectionGetFlags $R0 $R3
IntOp $R3 $R3 & 0x00000017
IntCmp $R3 1 gotoRead gotoRead
IntOp $R7 $R3 & 0x00000002 ; check if it is section
IntCmp $R7 0 +2
StrCpy $R7 $R0 ;remember section index (we can use it later to make it bold)
goto skipRead ; skip sections, section end and readonly
gotoRead:
ReadINIStr $R4 "$INSTINI" "sections" $R2
; MessageBox MB_OK "$R2 - $R4"
StrCmp $R4 "" 0 normalRead ;new feature or not?
IntOp $R4 0x00000000 | 0x0000009 ; new feature make it selected and bold
SectionGetFlags $R7 $0
IntOp $0 $0 | 0x0000008
SectionSetFlags $R7 $0
normalRead:
IntOp $R3 $R3 & 0xfffffffe
IntOp $R3 $R3 | $R4
SectionSetFlags $R0 $R3
SectionGetInstTypes $R0 $R3
IntOp $R3 $R3 & $R6
IntOp $R4 $R4 << $R5
IntOp $R3 $R3 | $R4
SectionSetInstTypes $R0 $R3
skipRead:
IntOp $R0 $R0 + 1
IntCmp $R0 $R1 "" loop
Pop $R8
Pop $R7
Pop $R6
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
Function SaveSelection
Push $R0
Push $R1
Push $R2
Push $R3
StrCpy $R1 ${IDX_SECTION_LAST}
StrCpy $R0 0
WriteINIStr "$INSTINI" "installer" "sectionsVer" "2"
DeleteINISec "$INSTINI" "sections"
loop:
!ifdef FULL
StrCmp $R0 ${IDX_SEC_ML} 0 ignore_1
StrCmp $R0 ${IDX_SEC_ML_PMP} 0 ignore_1
!endif ; FULL
${GetSectionName} $R0 $R2
SectionGetFlags $R0 $R3
IntOp $R3 $R3 & 0x0001
goto force_write
!ifdef FULL
ignore_1:
!endif ; FULL
${GetSectionName} $R0 $R2
StrCmp $R2 "-" skipWrite
StrCmp $R2 "" skipWrite
SectionGetFlags $R0 $R3
IntOp $R3 $R3 & 0x00000017
IntCmp $R3 1 0 0 skipWrite ; skip sections, section end and readonly
force_write:
WriteINIStr "$INSTINI" "sections" $R2 $R3
skipWrite:
IntOp $R0 $R0 + 1
IntCmp $R0 $R1 "" loop
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
!ifdef FULL
Function UpdateAutoSelectSection
Exch $1 ; section id
Exch
Exch $0 ; group id
Exch
Push $2
Push $3
Push $4
Push $5
StrCpy $2 "1" ; - nesting counter
StrCpy $3 "0" ; - sel counter
IntOp $0 $0 + 1
${Do}
SectionGetFlags $0 $4
IntOp $5 $4 & 0x0002 ; test if group start
${If} $5 <> 0
IntOp $2 $2 + 1
${EndIf}
IntOp $5 $4 & 0x0004 ; test if group end
${If} $5 <> 0
IntOp $2 $2 - 1
${If} $2 == 0
${ExitDo}
${EndIf}
${Else}
IntOp $5 $4 & 0x0041 ; test if selected or partial selected
${If} $5 <> 0
${AndIf} $0 <> $1
StrCpy $3 "1"
${ExitDo}
${EndIf}
${EndIf}
IntOp $0 $0 + 1
${Loop}
SectionGetFlags $1 $4
IntOp $4 $4 & 0xFFEF
${If} $3 <> 0
IntOp $4 $4 | 0x0011
${EndIf}
SectionSetFlags $1 $4
Pop $5
Pop $4
Pop $3
Exch $2
Exch
Exch $1
Exch 2
Exch $0
FunctionEnd
!macro UpdateAutoSelectSection __groupId __sectionId
Push ${__groupId}
Push ${__sectionId}
Call UpdateAutoSelectSection
!macroend
!define UpdateAutoSelectSection "!insertmacro 'UpdateAutoSelectSection'"
!endif
Function .onSelChange
!ifdef FULL
${UpdateAutoSelectSection} ${IDX_GRP_WALIB_PORTABLE} ${IDX_SEC_ML_PMP}
${UpdateAutoSelectSection} ${IDX_GRP_WALIB} ${IDX_SEC_ML}
!endif
FunctionEnd
|