-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMPUI_Setup.nsi
1240 lines (1035 loc) · 43.3 KB
/
MPUI_Setup.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
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; ///////////////////////////////////////////////////////////////////////////////
; // MPlayer for Windows - Install Script
; // Copyright (C) 2004-2024 LoRd_MuldeR <[email protected]>
; //
; // This program is free software; you can redistribute it and/or modify
; // it under the terms of the GNU General Public License as published by
; // the Free Software Foundation; either version 2 of the License, or
; // (at your option) any later version.
; //
; // This program is distributed in the hope that it will be useful,
; // but WITHOUT ANY WARRANTY; without even the implied warranty of
; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; // GNU General Public License for more details.
; //
; // You should have received a copy of the GNU General Public License along
; // with this program; if not, write to the Free Software Foundation, Inc.,
; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; //
; // http://www.gnu.org/licenses/gpl-2.0.txt
; ///////////////////////////////////////////////////////////////////////////////
;--------------------------------------------------------------------------------
; BASIC DEFINES
;--------------------------------------------------------------------------------
!ifndef NSIS_UNICODE
!error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
!endif
!ifndef MPLAYER_BUILDNO
!error "MPLAYER_BUILDNO is not defined !!!"
!endif
!ifndef MPLAYER_REVISION
!error "MPLAYER_REVISION is not defined !!!"
!endif
!ifndef MPLAYER_DATE
!error "MPLAYER_DATE is not defined !!!"
!endif
!ifndef SMPLAYER_VERSION
!error "SMPLAYER_VERSION is not defined !!!"
!endif
!ifndef MPUI_VERSION
!error "MPUI_VERSION is not defined !!!"
!endif
!ifndef CODECS_DATE
!error "CODECS_DATE is not defined !!!"
!endif
!ifndef MPLAYER_OUTFILE
!error "MPLAYER_OUTFILE is not defined !!!"
!endif
!ifndef UPX_PATH
!error "UPX_PATH is not defined !!!"
!endif
; UUID
!define MPlayerRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{97D341C8-B0D1-4E4A-A49A-C30B52F168E9}"
; Web-Site
!define MPlayerWebSite "http://mplayerhq.hu/"
;--------------------------------------------------------------------------------
; INSTALLER ATTRIBUTES
;--------------------------------------------------------------------------------
RequestExecutionLevel admin
ShowInstDetails show
ShowUninstDetails show
Name "$(MPLAYER_LANG_MPLAYER_WIN32) ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
Caption "$(MPLAYER_LANG_MPLAYER_WIN32) ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
BrandingText "MPlayer-Win32 (Build #${MPLAYER_BUILDNO})"
InstallDir "$PROGRAMFILES\MPlayer for Windows"
InstallDirRegKey HKLM "${MPlayerRegPath}" "InstallLocation"
OutFile "${MPLAYER_OUTFILE}"
;--------------------------------------------------------------------------------
; COMPRESSOR
;--------------------------------------------------------------------------------
SetCompressor /SOLID /FINAL LZMA
SetCompressorDictSize 112
!tempfile PACKHDRTEMP
!packhdr "${PACKHDRTEMP}" '"Utils\MT.exe" -manifest "Resources\Setup.manifest" -outputresource:"${PACKHDRTEMP};1"'
!packhdr "$%TEMP%\exehead.tmp" '"${UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
;--------------------------------------------------------------------------------
; RESERVE FILES
;--------------------------------------------------------------------------------
ReserveFile "${NSISDIR}\Plugins\Aero.dll"
ReserveFile "${NSISDIR}\Plugins\Banner.dll"
ReserveFile "${NSISDIR}\Plugins\CPUFeatures.dll"
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
ReserveFile "Dialogs\Page_CPU.ini"
ReserveFile "Resources\Splash.gif"
;--------------------------------------------------------------------------------
; INCLUDES
;--------------------------------------------------------------------------------
!include `MUI2.nsh`
!include `InstallOptions.nsh`
!include `WinVer.nsh`
!include `x64.nsh`
!include `StrFunc.nsh`
!include `StdUtils.nsh`
!include `CPUFeatures.nsh`
!include `MPUI_Common.nsh`
; Enable functions
${StrRep}
;--------------------------------------------------------------------------------
; GLOBAL VARIABLES
;--------------------------------------------------------------------------------
Var StartMenuFolder
Var DetectedCPUType
Var DetectedCPUCores
Var SelectedCPUType
Var SelectedTweaks
Var NotUpdateInstall
;--------------------------------------------------------------------------------
; VERSION INFO
;--------------------------------------------------------------------------------
!searchreplace PRODUCT_VERSION_DATE "${MPLAYER_DATE}" "-" "."
VIProductVersion "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
VIAddVersionKey "Author" "LoRd_MuldeR <[email protected]>"
VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
VIAddVersionKey "CompanyName" "Free Software Foundation"
VIAddVersionKey "FileDescription" "MPlayer for Windows (Build #${MPLAYER_BUILDNO})"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
VIAddVersionKey "LegalCopyright" "Copyright 2000-2018 The MPlayer Project"
VIAddVersionKey "LegalTrademarks" "GNU"
VIAddVersionKey "OriginalFilename" "MPUI-Setup.exe"
VIAddVersionKey "ProductName" "MPlayer for Windows"
VIAddVersionKey "ProductVersion" "Build #${MPLAYER_BUILDNO} (${MPLAYER_DATE})"
VIAddVersionKey "Website" "${MPlayerWebSite}"
;--------------------------------------------------------------------------------
; MUI2 INTERFACE SETTINGS
;--------------------------------------------------------------------------------
!define MUI_ABORTWARNING
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${MPlayerRegPath}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "${MPlayerRegPath}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "MPlayer for Windows"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
!define MUI_FINISHPAGE_LINK ${MPlayerWebSite}
!define MUI_FINISHPAGE_LINK_LOCATION ${MPlayerWebSite}
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "Artwork\wizard.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "Artwork\wizard-un.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Artwork\header.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "Artwork\header-un.bmp"
!define MUI_LANGDLL_ALLLANGUAGES
!define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
!define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
!define MUI_LANGDLL_ALWAYSSHOW
!define MUI_COMPONENTSPAGE_SMALLDESC
;--------------------------------------------------------------------------------
; MUI2 PAGE SETUP
;--------------------------------------------------------------------------------
; Installer
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "Docs\License.txt"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
Page Custom SelectCPUPage_Show SelectCPUPage_Validate
Page Custom SetTweaksPage_Show
Page Custom LockedListPage_Show
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Un-Installer
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
UninstPage Custom un.LockedListPage_Show
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------------------------------------------------------
; LANGUAGE
;--------------------------------------------------------------------------------
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
; Translation files
!include "Language\MPUI_EN.nsh"
!include "Language\MPUI_DE.nsh"
;--------------------------------------------------------------------------------
; INSTALL TYPES
;--------------------------------------------------------------------------------
InstType "$(MPLAYER_LANG_INSTTYPE_COMPLETE)"
InstType "$(MPLAYER_LANG_INSTTYPE_MINIMAL)"
;--------------------------------------------------------------------------------
; INITIALIZATION
;--------------------------------------------------------------------------------
Function .onInit
StrCpy $SelectedCPUType 0
StrCpy $DetectedCPUType 0
StrCpy $DetectedCPUCores 0
StrCpy $SelectedTweaks 1
StrCpy $NotUpdateInstall 1
InitPluginsDir
; --------
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
Pop $0
${If} $0 <> 0
MessageBox MB_ICONSTOP|MB_TOPMOST "Oups, the installer is already running!"
Quit
${EndIf}
; --------
# Running on Windows NT family?
${IfNot} ${IsNT}
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
ExecShell "open" "http://windows.microsoft.com/"
Quit
${EndIf}
# Running on Windows XP or later?
${If} ${AtMostWin2000}
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, but your operating system is *not* supported anymore.$\nInstallation will be aborted!$\n$\nThe minimum required platform is Windows XP."
ExecShell "open" "http://windows.microsoft.com/"
Quit
${EndIf}
; --------
UserInfo::GetAccountType
Pop $0
${If} $0 != "Admin"
MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
; --------
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_CPU.ini" "Page_CPU.ini"
!insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_Tweaks.ini" "Page_Tweaks.ini"
!ifdef PRE_RELEASE
${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL|MB_DEFBUTTON2 "Note: This is an early pre-release version for test only!" IDCANCEL ${||} Quit ${|}
!endif
; --------
${IfNot} ${Silent}
File "/oname=$PLUGINSDIR\Splash.gif" "Resources\Splash.gif"
newadvsplash::show 3000 1000 500 -1 /NOCANCEL "$PLUGINSDIR\Splash.gif"
Delete /REBOOTOK "$PLUGINSDIR\Splash.gif"
${EndIf}
FunctionEnd
Function un.onInit
InitPluginsDir
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
Pop $0
${If} $0 <> 0
MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
Quit
${EndIf}
; --------
UserInfo::GetAccountType
Pop $0
${If} $0 != "Admin"
MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to un-install this software."
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
; --------
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
;--------------------------------------------------------------------------------
; GUI INITIALIZATION
;--------------------------------------------------------------------------------
Function MyGuiInit
StrCpy $0 $HWNDPARENT
System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
Aero::Apply
FunctionEnd
Function un.MyGuiInit
StrCpy $0 $HWNDPARENT
System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
Aero::Apply
FunctionEnd
;--------------------------------------------------------------------------------
; INSTALL SECTIONS
;--------------------------------------------------------------------------------
Section "-Check Current Version"
${StdUtils.TestParameter} $0 "Update"
${IfNot} "$0" == "true"
${AndIf} ${FileExists} "$INSTDIR\MPlayer.exe"
${AndIf} ${FileExists} "$INSTDIR\version.tag"
ReadINIStr $0 "$INSTDIR\version.tag" "mplayer_version" "build_no"
${If} $0 > ${MPLAYER_BUILDNO}
MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "$(MPLAYER_LANG_CAN_NOT_UPDATE)"
Quit
${EndIf}
${EndIf}
SectionEnd
Section "-Clean Up"
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CLEAN)"
SetShellVarContext all
SetOutPath "$INSTDIR"
; Uninstall old version (aka "Setup v1")
ClearErrors
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}" "InstallLocation"
${IfNot} ${Errors}
MessageBox MB_ICONINFORMATION|MB_OK "$(MPLAYER_LANG_UNINSTALL_OLDVER)"
File "/oname=$PLUGINSDIR\Uninstall-V1.exe" "Resources\Uninstall-V1.exe"
HideWindow
ExecWait '"$PLUGINSDIR\Uninstall-V1.exe" _?=$0'
Delete /REBOOTOK "$PLUGINSDIR\Uninstall-V1.exe"
BringToFront
${EndIf}
; Clean registry
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
; Make sure MPlayer isn't running
${Do}
ClearErrors
Delete "$INSTDIR\MPlayer.exe"
Delete "$INSTDIR\SMPlayer.exe"
Delete "$INSTDIR\MPUI.exe"
${If} ${Errors}
${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_STILL_RUNNING)" IDCANCEL ${||} Abort ${|}
${Else}
${Break}
${EndIf}
${Loop}
; Clean the install folder
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.ini"
Delete "$INSTDIR\*.txt"
Delete "$INSTDIR\*.html"
Delete "$INSTDIR\*.htm"
Delete "$INSTDIR\*.ass"
Delete "$INSTDIR\*.m3u8"
Delete "$INSTDIR\*.tag"
RMDir /r "$INSTDIR\bearer"
RMDir /r "$INSTDIR\codecs"
RMDir /r "$INSTDIR\fonts"
RMDir /r "$INSTDIR\iconengines"
RMDir /r "$INSTDIR\imageformats"
RMDir /r "$INSTDIR\legal_stuff"
RMDir /r "$INSTDIR\locale"
RMDir /r "$INSTDIR\mplayer"
RMDir /r "$INSTDIR\platforms"
RMDir /r "$INSTDIR\shortcuts"
RMDir /r "$INSTDIR\styles"
RMDir /r "$INSTDIR\themes"
RMDir /r "$INSTDIR\translations"
; Now deal with Virtual Store
${GetVirtualStorePath} $0 "$INSTDIR"
${If} ${FileExists} "$0\*.*"
RMDir /r "$0"
${EndIf}
SectionEnd
Section "!MPlayer r${MPLAYER_REVISION}" SECID_MPLAYER
SectionIn 1 2 RO
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPLAYER)"
SetOutPath "$INSTDIR"
; Detect
${If} ${Silent}
Call DetectCPUType
StrCpy $SelectedCPUType $DetectedCPUType
${EndIf}
; MPlayer.exe
${Select} $SelectedCPUType
${Case} "2"
DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): x64 (x86-64)"
File "Builds\MPlayer-x86_64\MPlayer.exe"
${Case} "3"
DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): core2"
File "Builds\MPlayer-core2\MPlayer.exe"
${Case} "4"
DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): corei7"
File "Builds\MPlayer-corei7\MPlayer.exe"
${Case} "5"
DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): k8-sse3"
File "Builds\MPlayer-k8-sse3\MPlayer.exe"
${Case} "6"
DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): generic"
File "Builds\MPlayer-generic\MPlayer.exe"
${CaseElse}
MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OK "Internal error: Invalid CPU type selection detected!"
Abort
${EndSelect}
; Utilities
File ".Compile\Updater.exe"
File "Resources\AppRegGUI.exe"
; Other MPlayer-related files
File "Builds\MPlayer-generic\*.dll"
${ExtractSubDir} "Builds\MPlayer-generic" "mplayer"
${ExtractSubDir} "Builds\MPlayer-generic" "fonts"
; Documents
SetOutPath "$INSTDIR"
File "GPL.txt"
File "/oname=Manual.html" "Builds\MPlayer-generic\MPlayer.man.html"
File "Docs\Readme.html"
SetOutPath "$INSTDIR\legal_stuff"
File "Docs\legal_stuff\*.txt"
; Write version tag
${Do}
ClearErrors
Delete "$INSTDIR\version.tag"
${If} ${Errors}
${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_TAG_WRITE)" IDCANCEL ${||} Abort ${|}
${Else}
${Break}
${EndIf}
${Loop}
WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "build_no" "${MPLAYER_BUILDNO}"
WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "pkg_date" "${MPLAYER_DATE}"
SetFileAttributes "$INSTDIR\version.tag" FILE_ATTRIBUTE_READONLY
; Set file access rights
${MakePathPublic} "$INSTDIR"
${MakeFilePublic} "$INSTDIR\mplayer\config"
${MakeFilePublic} "$INSTDIR\fonts\fonts.conf"
SectionEnd
Section "!MPUI $(MPLAYER_LANG_FRONT_END) v${MPUI_VERSION}" SECID_MPUI
SectionIn 1 2
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPUI)"
; Extract files
SetOutPath "$INSTDIR"
File "MPUI\MPUI.exe"
; Extract locales
SetOutPath "$INSTDIR\locale"
File "MPUI\locale\*.txt"
; Set file access rights
${MakeFilePublic} "$INSTDIR\MPUI.ini"
; Setup initial config
ClearErrors
WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo direct3d -lavdopts threads=$DetectedCPUCores"
WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Locale" "$(MPLAYER_LANG_MPUI_DEFAULT_LANGUAGE)"
${If} ${Errors}
${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
${EndIf}
SectionEnd
Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
SectionIn 1
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_SMPLAYER)"
; SMPlayer program files
SetOutPath "$INSTDIR"
File "SMPlayer\smplayer.exe"
File "SMPlayer\yt-dlp_x86.exe"
File "SMPlayer\*.dll"
; Additional SMPlayer files
${ExtractSubDir} "SMPlayer" "bearer"
${ExtractSubDir} "SMPlayer" "iconengines"
${ExtractSubDir} "SMPlayer" "imageformats"
${ExtractSubDir} "SMPlayer" "platforms"
${ExtractSubDir} "SMPlayer" "shortcuts"
${ExtractSubDir} "SMPlayer" "styles"
${ExtractSubDir} "SMPlayer" "themes"
${ExtractSubDir} "SMPlayer" "translations"
; Set file access rights
${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
${MakeFilePublic} "$INSTDIR\SMPlayer_files.ini"
${MakeFilePublic} "$INSTDIR\player_info.ini"
${MakeFilePublic} "$INSTDIR\playlist.ini"
${MakeFilePublic} "$INSTDIR\favorites.m3u8"
${MakeFilePublic} "$INSTDIR\radio.m3u8"
${MakeFilePublic} "$INSTDIR\tv.m3u8"
${MakeFilePublic} "$INSTDIR\styles.ass"
${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
; Setup initial config
${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
${StrRep} $1 "$INSTDIR\yt-dlp_x86.exe" "\" "/"
ClearErrors
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync" "true"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync_factor" "30"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "config_version" "5"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "file_settings_method" "normal"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "osd" "1"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_audio_equalizer" "false"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_scaletempo" "0"
WriteINIStr "$INSTDIR\SMPlayer.ini" "advanced" "mplayer_additional_options" ""
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Numix-remix"
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "qt_style" "WindowsVista"
WriteINIStr "$INSTDIR\SMPlayer.ini" "mplayer_info" "is_mplayer2" "false"
WriteINIStr "$INSTDIR\SMPlayer.ini" "mplayer_info" "mplayer_detected_version" "${MPLAYER_REVISION}"
WriteINIStr "$INSTDIR\SMPlayer.ini" "mplayer_info" "mplayer_user_supplied_version" "-1"
WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "frame_drop" "true"
WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "priority" "1"
WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_for_new_version" "false"
WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_if_upgraded" "false"
WriteINIStr "$INSTDIR\SMPlayer.ini" "streaming" "streaming\youtube\ytdl_bin" "$1"
WriteINIStr "$INSTDIR\SMPlayer.ini" "update_checker" "enabled" "false"
${If} ${Errors}
${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
${EndIf}
SectionEnd
Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
SectionIn 1
${If} $SelectedCPUType > 2
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
SetOutPath "$INSTDIR\codecs"
File "Codecs\*.0"
File "Codecs\*.acm"
File "Codecs\*.ax"
File "Codecs\*.dll"
File "Codecs\*.qtx"
File "Codecs\*.so"
File "Codecs\*.vwp"
File "Codecs\*.xa"
${EndIf}
SectionEnd
Section "-Write Uninstaller"
${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "-Create Shortcuts"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
SetShellVarContext current
Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
SetShellVarContext all
Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
${If} ${FileExists} "$INSTDIR\MPUI.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
${EndIf}
${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
${EndIf}
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
${If} ${AtLeastWinVista}
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_APPREG).lnk" "$INSTDIR\AppRegGUI.exe"
${EndIf}
${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://muldersoft.com/"
${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ShellVerb.PinToTaskbar}
DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
${EndIf}
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "-ApplyTweaks"
${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
IntOp $0 $SelectedTweaks & 1
${If} $0 <> 0
${AndIf} ${FileExists} "$INSTDIR\SMPlayer.ini"
DetailPrint "SMPlayer: Enable tweak 'gui=SkinGUI'"
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "qt_style" "Fusion"
WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Modern"
${EndIf}
IntOp $0 $SelectedTweaks & 2
${If} $0 <> 0
${AndIf} ${FileExists} "$INSTDIR\MPUI.ini"
DetailPrint "MPUI: Enable tweak '-vo gl'"
WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl -lavdopts threads=$DetectedCPUCores"
${EndIf}
${If} $0 <> 0
${AndIf} ${FileExists} "$INSTDIR\SMPlayer.ini"
DetailPrint "SMPlayer: Enable tweak '-vo gl'"
WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl"
${EndIf}
IntOp $0 $SelectedTweaks & 4
${If} $0 <> 0
${AndIf} ${FileExists} "$INSTDIR\MPUI.ini"
DetailPrint "MPUI: Enable tweak '-af volnorm=2'"
ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
${EndIf}
${If} $0 <> 0
${AndIf} ${FileExists} "$INSTDIR\SMPlayer.ini"
DetailPrint "SMPlayer: Enable tweak 'initial_volnorm=true'"
WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
${EndIf}
SectionEnd
Section "$(MPLAYER_LANG_COMPRESS_FILES)"
SectionIn 1 2
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
File "/oname=$PLUGINSDIR\UPX.exe" "${UPX_PATH}\UPX.exe"
${PackAll} "$INSTDIR" "*.exe"
${PackAll} "$INSTDIR" "*.dll"
${PackAll} "$INSTDIR\codecs" "*.acm"
${PackAll} "$INSTDIR\codecs" "*.ax"
${PackAll} "$INSTDIR\codecs" "*.dll"
${PackAll} "$INSTDIR\codecs" "*.qtx"
Delete "$PLUGINSDIR\UPX.exe"
SectionEnd
Section "-Update Font Cache"
${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
SetShellVarContext current
Delete "$APPDATA\fontconfig\cache\*.*"
Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
SetShellVarContext all
Delete "$APPDATA\fontconfig\cache\*.*"
Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
Delete "Resources\Sample.avi"
SectionEnd
Section "-Update Registry"
${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
; Clean up
DeleteRegKey HKLM "${MPlayerRegPath}"
DeleteRegKey HKCU "${MPlayerRegPath}"
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
; Uninstaller
WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
WriteRegStr HKLM "${MPlayerRegPath}" "DisplayIcon" "$INSTDIR\MPlayer.exe,0"
WriteRegStr HKLM "${MPlayerRegPath}" "DisplayVersion" "${MPLAYER_DATE}"
WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://muldersoft.com/"
WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://muldersoft.com/"
WriteRegStr HKLM "${MPlayerRegPath}" "Publisher" "The MPlayer Team"
WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
; Shell
DeleteRegKey HKCR "MPlayerForWindowsV2.File"
DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
${If} ${FileExists} "$INSTDIR\MPUI.exe"
WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\MPUI.exe" "%1"'
WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\MPUI.exe,0"
${EndIf}
${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\SMPlayer.exe" "%1"'
WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\SMPlayer.exe,1"
${EndIf}
; Register App
DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2" "${MPlayerRegPath}\Capabilities"
; Capabilities
WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
; File Associations
${RegisterFileExtCapability} "256"
${RegisterFileExtCapability} "3GP"
${RegisterFileExtCapability} "AAC"
${RegisterFileExtCapability} "ASF"
${RegisterFileExtCapability} "AVI"
${RegisterFileExtCapability} "BIN"
${RegisterFileExtCapability} "DAT"
${RegisterFileExtCapability} "DIVX"
${RegisterFileExtCapability} "EVO"
${RegisterFileExtCapability} "FLV"
${RegisterFileExtCapability} "M2V"
${RegisterFileExtCapability} "M2TS"
${RegisterFileExtCapability} "M4A"
${RegisterFileExtCapability} "MKA"
${RegisterFileExtCapability} "MKV"
${RegisterFileExtCapability} "MOV"
${RegisterFileExtCapability} "MP2"
${RegisterFileExtCapability} "MP3"
${RegisterFileExtCapability} "MP4"
${RegisterFileExtCapability} "MPEG"
${RegisterFileExtCapability} "MPG"
${RegisterFileExtCapability} "MPV"
${RegisterFileExtCapability} "NSV"
${RegisterFileExtCapability} "OGG"
${RegisterFileExtCapability} "OGM"
${RegisterFileExtCapability} "RM"
${RegisterFileExtCapability} "RMVB"
${RegisterFileExtCapability} "TS"
${RegisterFileExtCapability} "VOB"
${RegisterFileExtCapability} "WAV"
${RegisterFileExtCapability} "WEBM"
${RegisterFileExtCapability} "WMV"
; Reset auto update interval
DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
SectionEnd
Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
SectionIn 1 2
DetailPrint "$(MPLAYER_LANG_SCHEDULE_UPDATE)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
SectionEnd
Section "-Protect Files"
SetFileAttributes "$INSTDIR\AppRegGUI.exe" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\mplayer.exe" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\smplayer.exe" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\libeay32.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\libstdc++-6.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\libwinpthread-1.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Core.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Gui.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Network.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Script.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Widgets.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\Qt5Xml.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\ssleay32.dll" FILE_ATTRIBUTE_READONLY
SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
SectionEnd
Section "-Finished"
${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
SectionEnd
;--------------------------------------------------------------------------------
; UN-INSTALL SECTIONS
;--------------------------------------------------------------------------------
Section "Uninstall"
SetOutPath "$TEMP"
${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
; Validate uninstall path
${IfThen} "$INSTDIR" == "" ${|} Abort ${|}
StrCpy $0 "$INSTDIR" "" -2
${IfThen} $0 == ":\" ${|} Abort ${|}
; Startmenu
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
${IfNot} "$StartMenuFolder" == ""
SetShellVarContext current
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
${EndIf}
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
RMDir "$SMPROGRAMS\$StartMenuFolder"
${EndIf}
SetShellVarContext all
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
${EndIf}
${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
RMDir "$SMPROGRAMS\$StartMenuFolder"
${EndIf}
${EndIf}
; Desktop icons
Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
; Files
RMDir /r "$INSTDIR"
; Virtual Store
${GetVirtualStorePath} $0 "$INSTDIR"
${If} ${FileExists} "$0\*.*"
RMDir /r "$0"
${EndIf}
; Registry Keys
DeleteRegKey HKLM "${MPlayerRegPath}"
DeleteRegKey HKCU "${MPlayerRegPath}"
DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
; Auto Update
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
; Shell
DeleteRegKey HKCR "MPlayerForWindowsV2.File"
DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
SectionEnd
;--------------------------------------------------------------------------------
; SECTION SELECTION CHANGED
;--------------------------------------------------------------------------------
Function .onSelChange
${IfNot} ${SectionIsSelected} ${SECID_MPUI}
${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
SectionGetFlags ${SECID_MPUI} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${SECID_MPUI} $0
${EndIf}
${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
StrCpy $0 "nope"
${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
${If} "$0" == "ok"
SectionGetFlags ${SECID_AUTOUPDATE} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${SECID_AUTOUPDATE} $0
${EndIf}
${EndIf}
FunctionEnd
;--------------------------------------------------------------------------------
; LOCKED-LIST PLUGIN
;--------------------------------------------------------------------------------
!macro LockedListPage_Function
!insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
InitPluginsDir
File /oname=$PLUGINSDIR\LockedList64.dll `${NSISDIR}\Plugins\LockedList64.dll`
LockedList::AddModule "\MPlayer.exe"
LockedList::AddModule "\SMPlayer.exe"
LockedList::AddModule "\MPUI.exe"
LockedList::AddModule "${NSISDIR}\Qt5Core.dll"
LockedList::Dialog /autonext /ignore "$(MPLAYER_LANG_IGNORE)" /heading "$(MPLAYER_LANG_LOCKEDLIST_HEADING)" /noprograms "$(MPLAYER_LANG_LOCKEDLIST_NOPROG)" /searching "$(MPLAYER_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(MPLAYER_LANG_LOCKEDLIST_COLHDR1)" "$(MPLAYER_LANG_LOCKEDLIST_COLHDR2)"
Pop $R0
!macroend
Function LockedListPage_Show
!insertmacro LockedListPage_Function
FunctionEnd
Function un.LockedListPage_Show
!insertmacro LockedListPage_Function
FunctionEnd
;--------------------------------------------------------------------------------
; CUSTOME PAGE: CPU SELECTOR
;--------------------------------------------------------------------------------
Function SelectCPUPage_Show
; Detect CPU type, if not detected yet
${If} $DetectedCPUType < 2
${OrIf} $DetectedCPUType > 6
Call DetectCPUType
!insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
!insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <-- recommended"
${EndIf}
; Make sure the current selection is valid
${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
${IfThen} $SelectedCPUType > 6 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}