Updated wrapper code for the StdUtils plug-in version, ported from LameXP.
[mplayer-setup-win32.git] / MPUI_Setup.nsi
blob280915a4f6c1c0fe7d1f1bb16f46cadb4a3ddc95
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------------------------------------------------------
24 ; BASIC DEFINES
25 ;--------------------------------------------------------------------------------
27 !ifndef NSIS_UNICODE
28 !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
29 !endif
31 !ifndef MPLAYER_BUILDNO
32 !error "MPLAYER_BUILDNO is not defined !!!"
33 !endif
35 !ifndef MPLAYER_REVISION
36 !error "MPLAYER_REVISION is not defined !!!"
37 !endif
39 !ifndef MPLAYER_DATE
40 !error "MPLAYER_DATE is not defined !!!"
41 !endif
43 !ifndef SMPLAYER_VERSION
44 !error "SMPLAYER_VERSION is not defined !!!"
45 !endif
47 !ifndef MPUI_VERSION
48 !error "MPUI_VERSION is not defined !!!"
49 !endif
51 !ifndef CODECS_DATE
52 !error "CODECS_DATE is not defined !!!"
53 !endif
55 !ifndef MPLAYER_OUTFILE
56 !error "MPLAYER_OUTFILE is not defined !!!"
57 !endif
59 !ifndef UPX_PATH
60 !error "UPX_PATH is not defined !!!"
61 !endif
63 ; UUID
64 !define MPlayerRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{97D341C8-B0D1-4E4A-A49A-C30B52F168E9}"
66 ; Web-Site
67 !define MPlayerWebSite "http://mplayerhq.hu/"
70 ;--------------------------------------------------------------------------------
71 ; INSTALLER ATTRIBUTES
72 ;--------------------------------------------------------------------------------
74 RequestExecutionLevel admin
75 ShowInstDetails show
76 ShowUninstDetails show
78 Name "$(MPLAYER_LANG_MPLAYER_WIN32) ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
79 Caption "$(MPLAYER_LANG_MPLAYER_WIN32) ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
80 BrandingText "MPlayer-Win32 (Build #${MPLAYER_BUILDNO})"
81 InstallDir "$PROGRAMFILES\MPlayer for Windows"
82 InstallDirRegKey HKLM "${MPlayerRegPath}" "InstallLocation"
83 OutFile "${MPLAYER_OUTFILE}"
86 ;--------------------------------------------------------------------------------
87 ; COMPRESSOR
88 ;--------------------------------------------------------------------------------
90 SetCompressor /SOLID /FINAL LZMA
91 SetCompressorDictSize 112
93 !packhdr "$%TEMP%\exehead.tmp" '"${UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
96 ;--------------------------------------------------------------------------------
97 ; RESERVE FILES
98 ;--------------------------------------------------------------------------------
100 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
101 ReserveFile "${NSISDIR}\Plugins\Banner.dll"
102 ReserveFile "${NSISDIR}\Plugins\CPUFeatures.dll"
103 ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
104 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
105 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
106 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
107 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
108 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
109 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
110 ReserveFile "${NSISDIR}\Plugins\System.dll"
111 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
112 ReserveFile "Dialogs\Page_CPU.ini"
113 ReserveFile "Resources\Splash.gif"
116 ;--------------------------------------------------------------------------------
117 ; INCLUDES
118 ;--------------------------------------------------------------------------------
120 !include `MUI2.nsh`
121 !include `InstallOptions.nsh`
122 !include `WinVer.nsh`
123 !include `x64.nsh`
124 !include `StrFunc.nsh`
125 !include `StdUtils.nsh`
126 !include `CPUFeatures.nsh`
127 !include `MPUI_Common.nsh`
129 ; Enable functions
130 ${StrRep}
133 ;--------------------------------------------------------------------------------
134 ; GLOBAL VARIABLES
135 ;--------------------------------------------------------------------------------
137 Var StartMenuFolder
138 Var DetectedCPUType
139 Var DetectedCPUCores
140 Var SelectedCPUType
141 Var SelectedTweaks
142 Var NotUpdateInstall
145 ;--------------------------------------------------------------------------------
146 ; VERSION INFO
147 ;--------------------------------------------------------------------------------
149 !searchreplace PRODUCT_VERSION_DATE "${MPLAYER_DATE}" "-" "."
150 VIProductVersion "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
152 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
153 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."
154 VIAddVersionKey "CompanyName" "Free Software Foundation"
155 VIAddVersionKey "FileDescription" "MPlayer for Windows (Build #${MPLAYER_BUILDNO})"
156 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
157 VIAddVersionKey "LegalCopyright" "Copyright 2000-2013 The MPlayer Project"
158 VIAddVersionKey "LegalTrademarks" "GNU"
159 VIAddVersionKey "OriginalFilename" "MPUI-Setup.exe"
160 VIAddVersionKey "ProductName" "MPlayer for Windows"
161 VIAddVersionKey "ProductVersion" "Build #${MPLAYER_BUILDNO} (${MPLAYER_DATE})"
162 VIAddVersionKey "Website" "${MPlayerWebSite}"
165 ;--------------------------------------------------------------------------------
166 ; MUI2 INTERFACE SETTINGS
167 ;--------------------------------------------------------------------------------
169 !define MUI_ABORTWARNING
170 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
171 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MPlayerRegPath}"
172 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
173 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
174 !define MUI_LANGDLL_REGISTRY_KEY "${MPlayerRegPath}"
175 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
176 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "MPlayer for Windows"
177 !define MUI_FINISHPAGE_NOAUTOCLOSE
178 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
179 !define MUI_FINISHPAGE_RUN
180 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
181 !define MUI_FINISHPAGE_SHOWREADME
182 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
183 !define MUI_FINISHPAGE_LINK ${MPlayerWebSite}
184 !define MUI_FINISHPAGE_LINK_LOCATION ${MPlayerWebSite}
185 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
186 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
187 !define MUI_WELCOMEFINISHPAGE_BITMAP "Artwork\wizard.bmp"
188 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "Artwork\wizard-un.bmp"
189 !define MUI_HEADERIMAGE
190 !define MUI_HEADERIMAGE_BITMAP "Artwork\header.bmp"
191 !define MUI_HEADERIMAGE_UNBITMAP "Artwork\header-un.bmp"
192 !define MUI_LANGDLL_ALLLANGUAGES
193 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
194 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
195 !define MUI_LANGDLL_ALWAYSSHOW
196 !define MUI_COMPONENTSPAGE_SMALLDESC
199 ;--------------------------------------------------------------------------------
200 ; MUI2 PAGE SETUP
201 ;--------------------------------------------------------------------------------
203 ; Installer
204 !define MUI_WELCOMEPAGE_TITLE_3LINES
205 !define MUI_FINISHPAGE_TITLE_3LINES
206 !insertmacro MUI_PAGE_WELCOME
207 !insertmacro MUI_PAGE_LICENSE "Docs\License.txt"
208 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
209 !insertmacro MUI_PAGE_DIRECTORY
210 !insertmacro MUI_PAGE_COMPONENTS
211 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
212 Page Custom SelectCPUPage_Show SelectCPUPage_Validate
213 Page Custom SetTweaksPage_Show
214 Page Custom LockedListPage_Show
215 !insertmacro MUI_PAGE_INSTFILES
216 !insertmacro MUI_PAGE_FINISH
218 ; Un-Installer
219 !define MUI_WELCOMEPAGE_TITLE_3LINES
220 !define MUI_FINISHPAGE_TITLE_3LINES
221 !insertmacro MUI_UNPAGE_WELCOME
222 !insertmacro MUI_UNPAGE_CONFIRM
223 UninstPage Custom un.LockedListPage_Show
224 !insertmacro MUI_UNPAGE_INSTFILES
225 !insertmacro MUI_UNPAGE_FINISH
228 ;--------------------------------------------------------------------------------
229 ; LANGUAGE
230 ;--------------------------------------------------------------------------------
232 !insertmacro MUI_LANGUAGE "English"
233 !insertmacro MUI_LANGUAGE "German"
235 ; Translation files
236 !include "Language\MPUI_EN.nsh"
237 !include "Language\MPUI_DE.nsh"
240 ;--------------------------------------------------------------------------------
241 ; INSTALL TYPES
242 ;--------------------------------------------------------------------------------
244 InstType "$(MPLAYER_LANG_INSTTYPE_COMPLETE)"
245 InstType "$(MPLAYER_LANG_INSTTYPE_MINIMAL)"
248 ;--------------------------------------------------------------------------------
249 ; INITIALIZATION
250 ;--------------------------------------------------------------------------------
252 Function .onInit
253 StrCpy $SelectedCPUType 0
254 StrCpy $DetectedCPUType 0
255 StrCpy $DetectedCPUCores 0
256 StrCpy $SelectedTweaks 1
257 StrCpy $NotUpdateInstall 1
259 InitPluginsDir
261 ; --------
263 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
264 Pop $0
265 ${If} $0 <> 0
266 MessageBox MB_ICONSTOP|MB_TOPMOST "Oups, the installer is already running!"
267 Quit
268 ${EndIf}
270 ; --------
272 # Running on Windows NT family?
273 ${IfNot} ${IsNT}
274 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
275 ExecShell "open" "http://windows.microsoft.com/"
276 Quit
277 ${EndIf}
279 # Running on Windows XP or later?
280 ${If} ${AtMostWin2000}
281 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."
282 ExecShell "open" "http://windows.microsoft.com/"
283 Quit
284 ${EndIf}
286 ; --------
288 UserInfo::GetAccountType
289 Pop $0
290 ${If} $0 != "Admin"
291 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
292 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
293 Quit
294 ${EndIf}
296 ; --------
298 !insertmacro MUI_LANGDLL_DISPLAY
300 !insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_CPU.ini" "Page_CPU.ini"
301 !insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_Tweaks.ini" "Page_Tweaks.ini"
303 !ifdef PRE_RELEASE
304 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL|MB_DEFBUTTON2 "Note: This is an early pre-release version for test only!" IDCANCEL ${||} Quit ${|}
305 !endif
307 ; --------
309 ${IfNot} ${Silent}
310 File "/oname=$PLUGINSDIR\Splash.gif" "Resources\Splash.gif"
311 newadvsplash::show 3000 1000 500 -1 /NOCANCEL "$PLUGINSDIR\Splash.gif"
312 Delete /REBOOTOK "$PLUGINSDIR\Splash.gif"
313 ${EndIf}
314 FunctionEnd
316 Function un.onInit
317 InitPluginsDir
319 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
320 Pop $0
321 ${If} $0 <> 0
322 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
323 Quit
324 ${EndIf}
326 ; --------
328 UserInfo::GetAccountType
329 Pop $0
330 ${If} $0 != "Admin"
331 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to un-install this software."
332 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
333 Quit
334 ${EndIf}
336 ; --------
338 !insertmacro MUI_LANGDLL_DISPLAY
339 FunctionEnd
342 ;--------------------------------------------------------------------------------
343 ; GUI INITIALIZATION
344 ;--------------------------------------------------------------------------------
346 Function MyGuiInit
347 StrCpy $0 $HWNDPARENT
348 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
349 Aero::Apply
350 FunctionEnd
352 Function un.MyGuiInit
353 StrCpy $0 $HWNDPARENT
354 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
355 Aero::Apply
356 FunctionEnd
359 ;--------------------------------------------------------------------------------
360 ; INSTALL SECTIONS
361 ;--------------------------------------------------------------------------------
363 Section "-Clean Up"
364 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CLEAN)"
366 SetShellVarContext all
367 SetOutPath "$INSTDIR"
369 ; Uninstall old version (aka "Setup v1")
370 ClearErrors
371 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}" "InstallLocation"
372 ${IfNot} ${Errors}
373 MessageBox MB_ICONINFORMATION|MB_OK "$(MPLAYER_LANG_UNINSTALL_OLDVER)"
374 File "/oname=$PLUGINSDIR\Uninstall-V1.exe" "Resources\Uninstall-V1.exe"
375 HideWindow
376 ExecWait '"$PLUGINSDIR\Uninstall-V1.exe" _?=$0'
377 Delete /REBOOTOK "$PLUGINSDIR\Uninstall-V1.exe"
378 BringToFront
379 ${EndIf}
381 ; Clean registry
382 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
383 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
384 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
385 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
387 ; Make sure MPlayer isn't running
388 ${Do}
389 ClearErrors
390 Delete "$INSTDIR\MPlayer.exe"
391 Delete "$INSTDIR\SMPlayer.exe"
392 Delete "$INSTDIR\MPUI.exe"
393 ${If} ${Errors}
394 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_STILL_RUNNING)" IDCANCEL ${||} Abort ${|}
395 ${Else}
396 ${Break}
397 ${EndIf}
398 ${Loop}
400 ; Clean the install folder
401 Delete "$INSTDIR\*.exe"
402 Delete "$INSTDIR\*.dll"
403 Delete "$INSTDIR\*.ini"
404 Delete "$INSTDIR\*.txt"
405 Delete "$INSTDIR\*.html"
406 Delete "$INSTDIR\*.htm"
407 Delete "$INSTDIR\*.ass"
408 Delete "$INSTDIR\*.m3u8"
409 Delete "$INSTDIR\*.tag"
410 Delete "$INSTDIR\mplayer\config"
411 Delete "$INSTDIR\mplayer\*.conf"
413 ; Now deal with Virtual Store
414 ${GetVirtualStorePath} $0 "$INSTDIR"
415 Delete "$0\*.exe"
416 Delete "$0\*.dll"
417 Delete "$0\*.ini"
418 Delete "$0\*.txt"
419 Delete "$0\*.html"
420 Delete "$0\*.htm"
421 Delete "$0\*.ass"
422 Delete "$0\*.m3u8"
423 Delete "$0\*.tag"
424 Delete "$0\mplayer\config"
425 Delete "$0\mplayer\*.conf"
426 SectionEnd
428 Section "!MPlayer r${MPLAYER_REVISION}" SECID_MPLAYER
429 SectionIn 1 2 RO
430 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPLAYER)"
431 SetOutPath "$INSTDIR"
433 ; Detect
434 ${If} ${Silent}
435 Call DetectCPUType
436 StrCpy $SelectedCPUType $DetectedCPUType
437 ${EndIf}
439 ; MPlayer.exe
440 ${Select} $SelectedCPUType
441 ${Case} "2"
442 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): core2"
443 File "Builds\MPlayer-core2\MPlayer.exe"
444 ${Case} "3"
445 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): corei7"
446 File "Builds\MPlayer-corei7\MPlayer.exe"
447 ${Case} "4"
448 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): k8-sse3"
449 File "Builds\MPlayer-k8-sse3\MPlayer.exe"
450 ${Case} "5"
451 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): generic"
452 File "Builds\MPlayer-generic\MPlayer.exe"
453 ${CaseElse}
454 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OK "Internal error: Invalid CPU type selection detected!"
455 Abort
456 ${EndSelect}
458 ; Utilities
459 File ".Compile\Updater.exe"
460 File "Resources\AppRegGUI.exe"
462 ; Other MPlayer-related files
463 File "Builds\MPlayer-generic\dsnative.dll"
464 SetOutPath "$INSTDIR\mplayer"
465 File "Builds\MPlayer-generic\mplayer\config"
466 File "Builds\MPlayer-generic\mplayer\subfont.ttf"
467 SetOutPath "$INSTDIR\fonts"
468 File "Builds\MPlayer-generic\fonts\fonts.conf"
469 SetOutPath "$INSTDIR\fonts\conf.d"
470 File "Builds\MPlayer-generic\fonts\conf.d\*.conf"
472 ; Documents
473 SetOutPath "$INSTDIR"
474 File "GPL.txt"
475 File "/oname=Manual.html" "Builds\MPlayer-generic\MPlayer.man.html"
476 File "Docs\Readme.html"
477 SetOutPath "$INSTDIR\legal_stuff"
478 File "Docs\legal_stuff\*.txt"
480 ; Write version tag
481 ${Do}
482 ClearErrors
483 Delete "$INSTDIR\version.tag"
484 ${If} ${Errors}
485 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_TAG_WRITE)" IDCANCEL ${||} Abort ${|}
486 ${Else}
487 ${Break}
488 ${EndIf}
489 ${Loop}
490 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "build_no" "${MPLAYER_BUILDNO}"
491 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "pkg_date" "${MPLAYER_DATE}"
492 SetFileAttributes "$INSTDIR\version.tag" FILE_ATTRIBUTE_READONLY
494 ; Set file access rights
495 ${MakeFilePublic} "$INSTDIR\mplayer\config"
496 ${MakeFilePublic} "$INSTDIR\fonts\fonts.conf"
497 SectionEnd
499 Section "!MPUI $(MPLAYER_LANG_FRONT_END) v${MPUI_VERSION}" SECID_MPUI
500 SectionIn 1 2
501 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPUI)"
503 ; Extract files
504 SetOutPath "$INSTDIR"
505 File "MPUI\MPUI.exe"
507 ; Extract locales
508 SetOutPath "$INSTDIR\locale"
509 File "MPUI\locale\*.txt"
511 ; Set file access rights
512 ${MakeFilePublic} "$INSTDIR\MPUI.ini"
514 ; Setup initial config
515 ClearErrors
516 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo direct3d -lavdopts threads=$DetectedCPUCores"
517 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Locale" "$(MPLAYER_LANG_MPUI_DEFAULT_LANGUAGE)"
518 ${If} ${Errors}
519 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
520 ${EndIf}
521 SectionEnd
523 Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
524 SectionIn 1
525 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_SMPLAYER)"
527 ; SMPlayer files
528 SetOutPath "$INSTDIR"
529 File "SMPlayer\SMPlayer.exe"
530 File "SMPlayer\libgcc_s_dw2-1.dll"
531 File "SMPlayer\mingwm10.dll"
532 File "SMPlayer\QtCore4.dll"
533 File "SMPlayer\QtGui4.dll"
534 File "SMPlayer\QtNetwork4.dll"
535 File "SMPlayer\QtScript4.dll"
536 File "SMPlayer\QtXml4.dll"
537 File "SMPlayer\zlib1.dll"
539 ; Additional SMPlayer files
540 SetOutPath "$INSTDIR\translations"
541 File "SMPlayer\translations\*.qm"
542 SetOutPath "$INSTDIR\imageformats"
543 File "SMPlayer\imageformats\*.dll"
544 SetOutPath "$INSTDIR\shortcuts"
545 File "SMPlayer\shortcuts\*.keys"
546 SetOutPath "$INSTDIR\themes"
547 File /r "SMPlayer\themes\*.css"
548 File /r "SMPlayer\themes\*.png"
550 ; Set file access rights
551 ${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
552 ${MakeFilePublic} "$INSTDIR\SMPlayer_files.ini"
553 ${MakeFilePublic} "$INSTDIR\favorites.m3u8"
554 ${MakeFilePublic} "$INSTDIR\radio.m3u8"
555 ${MakeFilePublic} "$INSTDIR\tv.m3u8"
556 ${MakeFilePublic} "$INSTDIR\styles.ass"
557 ${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
559 ; Setup initial config
560 ${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
561 ClearErrors
562 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "config_version" "4"
563 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
564 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
565 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync" "true"
566 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync_factor" "30"
567 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_audio_equalizer" "false"
568 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_scaletempo" "0"
569 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "osd" "1"
570 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "file_settings_method" "normal"
571 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
572 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "priority" "1"
573 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "frame_drop" "true"
574 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
575 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Oxygen-Refit"
576 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
577 WriteINIStr "$INSTDIR\SMPlayer.ini" "advanced" "mplayer_additional_options" ""
578 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_for_new_version" "false"
579 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_if_upgraded" "false"
580 WriteINIStr "$INSTDIR\SMPlayer.ini" "update_checker" "enabled" "false"
582 ${If} ${Errors}
583 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
584 ${EndIf}
585 SectionEnd
587 Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
588 SectionIn 1
589 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
591 SetOutPath "$INSTDIR\codecs"
593 File "Codecs\*.0"
594 File "Codecs\*.acm"
595 File "Codecs\*.ax"
596 File "Codecs\*.dll"
597 File "Codecs\*.qtx"
598 File "Codecs\*.so"
599 File "Codecs\*.vwp"
600 File "Codecs\*.xa"
601 SectionEnd
603 Section "-Write Uninstaller"
604 ${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
605 WriteUninstaller "$INSTDIR\Uninstall.exe"
606 SectionEnd
608 Section "-Create Shortcuts"
609 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
610 ${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
611 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
613 SetShellVarContext current
614 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
615 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
616 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
618 SetShellVarContext all
619 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
620 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
621 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
623 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
624 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
625 CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
626 ${EndIf}
627 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
628 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
629 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
630 ${EndIf}
632 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
633 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
634 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
636 ${If} ${AtLeastWinVista}
637 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_APPREG).lnk" "$INSTDIR\AppRegGUI.exe"
638 ${EndIf}
640 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://muldersoft.com/"
641 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
642 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
644 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
645 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
646 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
647 ${EndIf}
648 !insertmacro MUI_STARTMENU_WRITE_END
649 SectionEnd
651 Section "-ApplyTweaks"
652 ${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
653 DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
655 IntOp $0 $SelectedTweaks & 1
656 ${If} $0 != 0
657 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
658 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
659 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Gonzo"
660 ${EndIf}
661 ${EndIf}
663 IntOp $0 $SelectedTweaks & 2
664 ${If} $0 != 0
665 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
666 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl:yuv=3 -lavdopts threads=$DetectedCPUCores"
667 ${EndIf}
668 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
669 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl:yuv=3"
670 ${EndIf}
671 ${EndIf}
673 IntOp $0 $SelectedTweaks & 4
674 ${If} $0 != 0
675 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
676 ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
677 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
678 ${EndIf}
679 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
680 WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
681 ${EndIf}
682 ${EndIf}
683 SectionEnd
685 Section "$(MPLAYER_LANG_COMPRESS_FILES)"
686 SectionIn 1 2
687 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
689 File "/oname=$PLUGINSDIR\UPX.exe" "Utils\UPX.exe"
691 ${PackAll} "$INSTDIR" "*.exe"
692 ${PackAll} "$INSTDIR" "*.dll"
693 ${PackAll} "$INSTDIR\codecs" "*.acm"
694 ${PackAll} "$INSTDIR\codecs" "*.ax"
695 ${PackAll} "$INSTDIR\codecs" "*.dll"
696 ${PackAll} "$INSTDIR\codecs" "*.qtx"
698 Delete "$PLUGINSDIR\UPX.exe"
699 SectionEnd
701 Section "-Update Font Cache"
702 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
704 SetShellVarContext current
705 Delete "$APPDATA\fontconfig\cache\*.*"
706 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
708 SetShellVarContext all
709 Delete "$APPDATA\fontconfig\cache\*.*"
710 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
712 File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
713 DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
714 NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
715 Delete "Resources\Sample.avi"
716 SectionEnd
718 Section "-Update Registry"
719 ${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
720 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
722 ; Clean up
723 DeleteRegKey HKLM "${MPlayerRegPath}"
724 DeleteRegKey HKCU "${MPlayerRegPath}"
725 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
726 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
728 ; Uninstaller
729 WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
730 WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
731 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
732 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayIcon" "$INSTDIR\MPlayer.exe,0"
733 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayVersion" "${MPLAYER_DATE}"
734 WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://muldersoft.com/"
735 WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://muldersoft.com/"
736 WriteRegStr HKLM "${MPlayerRegPath}" "Publisher" "The MPlayer Team"
737 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
738 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
740 ; Shell
741 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
742 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
743 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
744 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
745 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\MPUI.exe" "%1"'
746 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\MPUI.exe,0"
747 ${EndIf}
748 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
749 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\SMPlayer.exe" "%1"'
750 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\SMPlayer.exe,1"
751 ${EndIf}
753 ; Register App
754 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
755 WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2" "${MPlayerRegPath}\Capabilities"
757 ; Capabilities
758 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
759 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
760 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
762 ; File Associations
763 ${RegisterFileExtCapability} "256"
764 ${RegisterFileExtCapability} "3GP"
765 ${RegisterFileExtCapability} "AAC"
766 ${RegisterFileExtCapability} "ASF"
767 ${RegisterFileExtCapability} "AVI"
768 ${RegisterFileExtCapability} "BIN"
769 ${RegisterFileExtCapability} "DAT"
770 ${RegisterFileExtCapability} "DIVX"
771 ${RegisterFileExtCapability} "EVO"
772 ${RegisterFileExtCapability} "FLV"
773 ${RegisterFileExtCapability} "M2V"
774 ${RegisterFileExtCapability} "M2TS"
775 ${RegisterFileExtCapability} "M4A"
776 ${RegisterFileExtCapability} "MKA"
777 ${RegisterFileExtCapability} "MKV"
778 ${RegisterFileExtCapability} "MOV"
779 ${RegisterFileExtCapability} "MP2"
780 ${RegisterFileExtCapability} "MP3"
781 ${RegisterFileExtCapability} "MP4"
782 ${RegisterFileExtCapability} "MPEG"
783 ${RegisterFileExtCapability} "MPG"
784 ${RegisterFileExtCapability} "MPV"
785 ${RegisterFileExtCapability} "NSV"
786 ${RegisterFileExtCapability} "OGG"
787 ${RegisterFileExtCapability} "OGM"
788 ${RegisterFileExtCapability} "RM"
789 ${RegisterFileExtCapability} "RMVB"
790 ${RegisterFileExtCapability} "TS"
791 ${RegisterFileExtCapability} "VOB"
792 ${RegisterFileExtCapability} "WAV"
793 ${RegisterFileExtCapability} "WEBM"
794 ${RegisterFileExtCapability} "WMV"
796 ; Reset auto update interval
797 DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
798 DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
799 SectionEnd
801 Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
802 SectionIn 1 2
803 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
804 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
805 SectionEnd
807 Section "-Protect Files"
808 SetFileAttributes "$INSTDIR\MPlayer.exe" FILE_ATTRIBUTE_READONLY
809 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
810 SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
811 SetFileAttributes "$INSTDIR\SMPlayer.exe" FILE_ATTRIBUTE_READONLY
812 SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
813 SetFileAttributes "$INSTDIR\QtCore4.dll" FILE_ATTRIBUTE_READONLY
814 SetFileAttributes "$INSTDIR\QtGui4.dll" FILE_ATTRIBUTE_READONLY
815 SetFileAttributes "$INSTDIR\QtNetwork4.dll" FILE_ATTRIBUTE_READONLY
816 SetFileAttributes "$INSTDIR\QtXml4.dll" FILE_ATTRIBUTE_READONLY
817 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
818 SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
819 SetFileAttributes "$INSTDIR\mingwm10.dll" FILE_ATTRIBUTE_READONLY
820 SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
821 SectionEnd
823 Section "-Finished"
824 ${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
825 SectionEnd
828 ;--------------------------------------------------------------------------------
829 ; UN-INSTALL SECTIONS
830 ;--------------------------------------------------------------------------------
832 Section "Uninstall"
833 SetOutPath "$INSTDIR"
834 ${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
836 ; Startmenu
837 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
838 ${IfNot} "$StartMenuFolder" == ""
839 SetShellVarContext current
840 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
841 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
842 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
843 ${EndIf}
844 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
845 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
846 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
847 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
848 RMDir "$SMPROGRAMS\$StartMenuFolder"
849 ${EndIf}
850 SetShellVarContext all
851 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
852 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
853 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
854 ${EndIf}
855 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
856 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
857 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
858 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
859 RMDir "$SMPROGRAMS\$StartMenuFolder"
860 ${EndIf}
861 ${EndIf}
863 ; Desktop icons
864 Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
865 Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
867 ; Files
868 Delete /REBOOTOK "$INSTDIR\*.exe"
869 Delete /REBOOTOK "$INSTDIR\*.dll"
870 Delete /REBOOTOK "$INSTDIR\*.ini"
871 Delete /REBOOTOK "$INSTDIR\*.txt"
872 Delete /REBOOTOK "$INSTDIR\*.html"
873 Delete /REBOOTOK "$INSTDIR\*.htm"
874 Delete /REBOOTOK "$INSTDIR\*.ass"
875 Delete /REBOOTOK "$INSTDIR\*.m3u8"
876 Delete /REBOOTOK "$INSTDIR\*.tag"
877 RMDir /r "$INSTDIR\codecs"
878 RMDir /r "$INSTDIR\fonts"
879 RMDir /r "$INSTDIR\imageformats"
880 RMDir /r "$INSTDIR\legal_stuff"
881 RMDir /r "$INSTDIR\locale"
882 RMDir /r "$INSTDIR\mplayer"
883 RMDir /r "$INSTDIR\shortcuts"
884 RMDir /r "$INSTDIR\themes"
885 RMDir /r "$INSTDIR\translations"
886 RMDir "$INSTDIR"
888 ; Virtual Store
889 ${GetVirtualStorePath} $0 "$INSTDIR"
890 ${If} ${FileExists} "$0\*.*"
891 RMDir /r "$0"
892 ${EndIf}
894 ; Registry Keys
895 DeleteRegKey HKLM "${MPlayerRegPath}"
896 DeleteRegKey HKCU "${MPlayerRegPath}"
897 DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
898 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
900 ; Auto Update
901 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
902 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
904 ; Shell
905 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
906 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
907 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
909 ${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
910 SectionEnd
913 ;--------------------------------------------------------------------------------
914 ; SECTION SELECTION CHANGED
915 ;--------------------------------------------------------------------------------
917 Function .onSelChange
918 ${IfNot} ${SectionIsSelected} ${SECID_MPUI}
919 ${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
920 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
921 SectionGetFlags ${SECID_MPUI} $0
922 IntOp $0 $0 | ${SF_SELECTED}
923 SectionSetFlags ${SECID_MPUI} $0
924 ${EndIf}
926 ${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
927 StrCpy $0 "nope"
928 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
929 ${If} "$0" == "ok"
930 SectionGetFlags ${SECID_AUTOUPDATE} $0
931 IntOp $0 $0 | ${SF_SELECTED}
932 SectionSetFlags ${SECID_AUTOUPDATE} $0
933 ${EndIf}
934 ${EndIf}
935 FunctionEnd
938 ;--------------------------------------------------------------------------------
939 ; LOCKED-LIST PLUGIN
940 ;--------------------------------------------------------------------------------
942 !macro LockedListPage_Function
943 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
944 LockedList::AddModule "\MPlayer.exe"
945 LockedList::AddModule "\SMPlayer.exe"
946 LockedList::AddModule "\MPUI.exe"
947 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)"
948 Pop $R0
949 !macroend
951 Function LockedListPage_Show
952 !insertmacro LockedListPage_Function
953 FunctionEnd
955 Function un.LockedListPage_Show
956 !insertmacro LockedListPage_Function
957 FunctionEnd
960 ;--------------------------------------------------------------------------------
961 ; CUSTOME PAGE: CPU SELECTOR
962 ;--------------------------------------------------------------------------------
964 Function SelectCPUPage_Show
965 ; Detect CPU type, if not detected yet
966 ${If} $DetectedCPUType < 2
967 ${OrIf} $DetectedCPUType > 5
968 Call DetectCPUType
969 !insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
970 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <---"
971 ${EndIf}
973 ; Make sure the current selection is valid
974 ${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
975 ${IfThen} $SelectedCPUType > 5 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
977 ; Translate
978 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 1" "Text" "$(MPLAYER_LANG_SELECT_CPU_TYPE)"
979 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 6" "Text" "$(MPLAYER_LANG_SELECT_CPU_HINT)"
981 ; Apply current selection to dialog
982 ${For} $0 2 5
983 ${If} $0 == $SelectedCPUType
984 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "1"
985 ${Else}
986 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "0"
987 ${EndIf}
988 ${Next}
990 ; Display dialog
991 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_SELECT_CPU_HEAD)" "$(MPLAYER_LANG_SELECT_CPU_TEXT)"
992 !insertmacro INSTALLOPTIONS_DISPLAY "Page_CPU.ini"
994 ; Read new selection from dialog
995 StrCpy $SelectedCPUType 0
996 ${For} $0 2 5
997 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
998 ${IfThen} $1 == 1 ${|} StrCpy $SelectedCPUType $0 ${|}
999 ${Next}
1000 FunctionEnd
1002 Function SelectCPUPage_Validate
1003 ; Read new selection from dialog
1004 StrCpy $2 0
1005 ${For} $0 2 5
1006 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
1007 ${IfThen} $1 == 1 ${|} StrCpy $2 $0 ${|}
1008 ${Next}
1010 ; Validate selection
1011 ${If} $2 < 2
1012 ${OrIf} $2 > 5
1013 MessageBox MB_ICONSTOP "Oups, invalid selection detected!"
1014 Abort
1015 ${EndIf}
1016 FunctionEnd
1018 Function DetectCPUType
1019 StrCpy $DetectedCPUType 5 ;generic
1020 StrCpy $DetectedCPUCores 2
1022 ${IfNot} ${Silent}
1023 Banner::show /NOUNLOAD "$(MPLAYER_LANG_DETECTING)"
1024 ${EndIf}
1026 ${CPUFeatures.GetCount} $0
1027 ${IfNot} $0 == "error"
1028 StrCpy $DetectedCPUCores $0
1029 ${EndIf}
1031 ; Debug Code
1032 !ifdef CPU_DETECT_DEBUG
1033 ${CPUFeatures.GetVendor} $0
1034 ${CPUFeatures.CheckFeature} "MMX1" $1
1035 ${CPUFeatures.CheckFeature} "3DNOW" $2
1036 ${CPUFeatures.CheckFeature} "SSE3" $3
1037 ${CPUFeatures.CheckFeature} "SSSE3" $4
1038 ${CPUFeatures.CheckFeature} "SSE4.2" $5
1039 ${CPUFeatures.CheckFeature} "AVX1" $6
1040 ${CPUFeatures.CheckFeature} "FMA4" $7
1041 StrCpy $9 `Vendor = $0`
1042 StrCpy $9 `$9$\n"MMX1" = $1`
1043 StrCpy $9 `$9$\n"3DNOW" = $2`
1044 StrCpy $9 `$9$\n"SSE3" = $3`
1045 StrCpy $9 `$9$\n"SSSE3" = $4`
1046 StrCpy $9 `$9$\n"SSE4.2" = $5`
1047 StrCpy $9 `$9$\n"AVX1" = $6`
1048 StrCpy $9 `$9$\n"FMA4" = $7`
1049 MessageBox MB_TOPMOST `$9`
1050 !endif
1052 ; Make sure we have at least MMX
1053 ${IfNot} ${CPUSupports} "MMX1"
1054 Banner::destroy
1055 Return
1056 ${EndIf}
1058 ; Select the "best" model for Intel's
1059 ${If} ${CPUIsIntel}
1060 ; Core2 (SSE3 + SSSE3)
1061 ${If} ${CPUSupportsAll} "SSE3,SSSE3"
1062 StrCpy $DetectedCPUType 2 ;
1063 ${EndIf}
1064 ; Nehalem (SSE3 + SSSE3 + SSE4.2)
1065 ${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2"
1066 StrCpy $DetectedCPUType 3
1067 ${EndIf}
1068 ${EndIf}
1070 ; Select the "best" model for AMD's
1071 ${If} ${CPUIsAMD}
1072 ; K8+SSE3 (3DNow! + SSE3)
1073 ${If} ${CPUSupportsAll} "3DNOW,SSE3"
1074 StrCpy $DetectedCPUType 4
1075 ${EndIf}
1076 ; Bulldozer (SSE3 + SSSE3 + SSE4.2 + AVX + FMA4)
1077 ;${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2,AVX1,FMA4"
1078 ; StrCpy $DetectedCPUType 5 #5 is now generic, as 'bdver1' build got dropped
1079 ;${EndIf}
1080 ${EndIf}
1082 Banner::destroy
1083 FunctionEnd
1086 ;--------------------------------------------------------------------------------
1087 ; CUSTOME PAGE: TWEAKS
1088 ;--------------------------------------------------------------------------------
1090 Function SetTweaksPage_Show
1091 ; Apply current selection to dialog
1092 StrCpy $0 1
1093 ${For} $1 2 4
1094 IntOp $2 $0 & $SelectedTweaks
1095 ${If} $2 != 0
1096 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "1"
1097 ${Else}
1098 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "0"
1099 ${EndIf}
1100 IntOp $0 $0 << 1
1101 ${Next}
1103 ; Translate
1104 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 1" "Text" "$(MPLAYER_LANG_TWEAKS_HINT)"
1105 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 2" "Text" "$(MPLAYER_LANG_TWEAKS_SKINNEDUI)"
1106 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 3" "Text" "$(MPLAYER_LANG_TWEAKS_OPENGL)"
1107 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 4" "Text" "$(MPLAYER_LANG_TWEAKS_VOLNORM)"
1109 ; Display dialog
1110 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_TWEAKS_HEAD)" "$(MPLAYER_LANG_TWEAKS_TEXT)"
1111 !insertmacro INSTALLOPTIONS_DISPLAY "Page_Tweaks.ini"
1113 ; Read new selection from dialog
1114 StrCpy $0 1
1115 ${For} $1 2 4
1116 !insertmacro INSTALLOPTIONS_READ $2 "Page_Tweaks.ini" "Field $1" "State"
1117 ${IfThen} $2 == 1 ${|} IntOp $SelectedTweaks $SelectedTweaks | $0 ${|}
1118 IntOp $0 $0 << 1
1119 ${Next}
1120 FunctionEnd
1123 ;--------------------------------------------------------------------------------
1124 ; CHECK FOR UPDATE MODE
1125 ;--------------------------------------------------------------------------------
1127 !macro EnablePathEditable flag show_msg
1128 ${IfNot} $NotUpdateInstall == ${flag}
1129 !if ${show_msg} == 1
1130 MessageBox MB_OK|MB_ICONINFORMATION "$(MPLAYER_LANG_FORCE_UPDATE)" /SD IDOK
1131 !endif
1132 StrCpy $NotUpdateInstall ${flag}
1133 ${EndIf}
1134 FindWindow $1 "#32770" "" $HWNDPARENT
1135 GetDlgItem $2 $1 1019
1136 EnableWindow $2 ${flag}
1137 GetDlgItem $2 $1 1001
1138 EnableWindow $2 ${flag}
1139 !macroend
1141 Function CheckForUpdate
1142 ${StdUtils.GetParameter} $0 "Update" "?"
1143 ${IfNot} "$0" == "?"
1144 !insertmacro EnablePathEditable 0 0
1145 Return
1146 ${EndIf}
1148 ${If} ${FileExists} "$INSTDIR\MPlayer.exe"
1149 !insertmacro EnablePathEditable 0 1
1150 Return
1151 ${EndIf}
1153 !insertmacro EnablePathEditable 1 0
1154 FunctionEnd
1157 ;--------------------------------------------------------------------------------
1158 ; FINISHED
1159 ;--------------------------------------------------------------------------------
1161 Function RunAppFunction
1162 !insertmacro DisableNextButton $R0
1163 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
1164 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\SMPlayer.exe" "open" "http://lounge-office.rautemusik.fm/"
1165 ${Else}
1166 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\MPUI.exe" "open" "http://lounge-office.rautemusik.fm/"
1167 ${EndIf}
1168 FunctionEnd
1170 Function ShowReadmeFunction
1171 !insertmacro DisableNextButton $R0
1172 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\Readme.html" "open" ""
1173 FunctionEnd
1175 Function .onInstSuccess
1176 ${StdUtils.ExecShellAsUser} $R0 "$SMPROGRAMS\$StartMenuFolder" "explore" ""
1177 FunctionEnd
1180 ### EOF ###