Updated installer script for newer SMPlayer/Qt version. Some of the dependencies...
[mplayer-setup-win32.git] / MPUI_Setup.nsi
bloba235c695c6c6f03a05bdca17a7dc9685988a3c4e
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2014 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-2014 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 RMDir /r "$INSTDIR\codecs"
411 RMDir /r "$INSTDIR\imageformats"
412 RMDir /r "$INSTDIR\mplayer"
414 ; Now deal with Virtual Store
415 ${GetVirtualStorePath} $0 "$INSTDIR"
416 Delete "$0\*.exe"
417 Delete "$0\*.dll"
418 Delete "$0\*.ini"
419 Delete "$0\*.txt"
420 Delete "$0\*.html"
421 Delete "$0\*.htm"
422 Delete "$0\*.ass"
423 Delete "$0\*.m3u8"
424 Delete "$0\*.tag"
425 Delete "$0\mplayer\config"
426 Delete "$0\mplayer\*.conf"
427 SectionEnd
429 Section "!MPlayer r${MPLAYER_REVISION}" SECID_MPLAYER
430 SectionIn 1 2 RO
431 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPLAYER)"
432 SetOutPath "$INSTDIR"
434 ; Detect
435 ${If} ${Silent}
436 Call DetectCPUType
437 StrCpy $SelectedCPUType $DetectedCPUType
438 ${EndIf}
440 ; MPlayer.exe
441 ${Select} $SelectedCPUType
442 ${Case} "2"
443 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): core2"
444 File "Builds\MPlayer-core2\MPlayer.exe"
445 ${Case} "3"
446 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): corei7"
447 File "Builds\MPlayer-corei7\MPlayer.exe"
448 ${Case} "4"
449 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): k8-sse3"
450 File "Builds\MPlayer-k8-sse3\MPlayer.exe"
451 ${Case} "5"
452 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): generic"
453 File "Builds\MPlayer-generic\MPlayer.exe"
454 ${CaseElse}
455 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OK "Internal error: Invalid CPU type selection detected!"
456 Abort
457 ${EndSelect}
459 ; Utilities
460 File ".Compile\Updater.exe"
461 File "Resources\AppRegGUI.exe"
463 ; Other MPlayer-related files
464 File "Builds\MPlayer-generic\dsnative.dll"
465 SetOutPath "$INSTDIR\mplayer"
466 File "Builds\MPlayer-generic\mplayer\config"
467 File "Builds\MPlayer-generic\mplayer\subfont.ttf"
468 SetOutPath "$INSTDIR\fonts"
469 File "Builds\MPlayer-generic\fonts\fonts.conf"
470 SetOutPath "$INSTDIR\fonts\conf.d"
471 File "Builds\MPlayer-generic\fonts\conf.d\*.conf"
473 ; Documents
474 SetOutPath "$INSTDIR"
475 File "GPL.txt"
476 File "/oname=Manual.html" "Builds\MPlayer-generic\MPlayer.man.html"
477 File "Docs\Readme.html"
478 SetOutPath "$INSTDIR\legal_stuff"
479 File "Docs\legal_stuff\*.txt"
481 ; Write version tag
482 ${Do}
483 ClearErrors
484 Delete "$INSTDIR\version.tag"
485 ${If} ${Errors}
486 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_TAG_WRITE)" IDCANCEL ${||} Abort ${|}
487 ${Else}
488 ${Break}
489 ${EndIf}
490 ${Loop}
491 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "build_no" "${MPLAYER_BUILDNO}"
492 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "pkg_date" "${MPLAYER_DATE}"
493 SetFileAttributes "$INSTDIR\version.tag" FILE_ATTRIBUTE_READONLY
495 ; Set file access rights
496 ${MakeFilePublic} "$INSTDIR\mplayer\config"
497 ${MakeFilePublic} "$INSTDIR\fonts\fonts.conf"
498 SectionEnd
500 Section "!MPUI $(MPLAYER_LANG_FRONT_END) v${MPUI_VERSION}" SECID_MPUI
501 SectionIn 1 2
502 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPUI)"
504 ; Extract files
505 SetOutPath "$INSTDIR"
506 File "MPUI\MPUI.exe"
508 ; Extract locales
509 SetOutPath "$INSTDIR\locale"
510 File "MPUI\locale\*.txt"
512 ; Set file access rights
513 ${MakeFilePublic} "$INSTDIR\MPUI.ini"
515 ; Setup initial config
516 ClearErrors
517 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo direct3d -lavdopts threads=$DetectedCPUCores"
518 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Locale" "$(MPLAYER_LANG_MPUI_DEFAULT_LANGUAGE)"
519 ${If} ${Errors}
520 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
521 ${EndIf}
522 SectionEnd
524 Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
525 SectionIn 1
526 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_SMPLAYER)"
528 ; SMPlayer files
529 SetOutPath "$INSTDIR"
530 File "SMPlayer\SMPlayer.exe"
531 File "SMPlayer\libgcc_s_dw2-1.dll"
532 File "SMPlayer\libstdc++-6.dll"
533 File "SMPlayer\libwinpthread-1.dll"
534 File "SMPlayer\QtCore4.dll"
535 File "SMPlayer\QtGui4.dll"
536 File "SMPlayer\QtNetwork4.dll"
537 File "SMPlayer\QtScript4.dll"
538 File "SMPlayer\QtXml4.dll"
539 File "SMPlayer\zlib1.dll"
541 ; Additional SMPlayer files
542 SetOutPath "$INSTDIR\translations"
543 File "SMPlayer\translations\*.qm"
544 SetOutPath "$INSTDIR\imageformats"
545 File "SMPlayer\imageformats\*.dll"
546 SetOutPath "$INSTDIR\shortcuts"
547 File "SMPlayer\shortcuts\*.keys"
548 SetOutPath "$INSTDIR\themes"
549 File /r "SMPlayer\themes\*.css"
550 File /r "SMPlayer\themes\*.png"
552 ; Set file access rights
553 ${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
554 ${MakeFilePublic} "$INSTDIR\SMPlayer_files.ini"
555 ${MakeFilePublic} "$INSTDIR\favorites.m3u8"
556 ${MakeFilePublic} "$INSTDIR\radio.m3u8"
557 ${MakeFilePublic} "$INSTDIR\tv.m3u8"
558 ${MakeFilePublic} "$INSTDIR\styles.ass"
559 ${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
561 ; Setup initial config
562 ${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
563 ClearErrors
564 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "config_version" "4"
565 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
566 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
567 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync" "true"
568 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync_factor" "30"
569 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_audio_equalizer" "false"
570 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_scaletempo" "0"
571 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "osd" "1"
572 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "file_settings_method" "normal"
573 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
574 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "priority" "1"
575 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "frame_drop" "true"
576 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
577 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Oxygen-Refit"
578 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
579 WriteINIStr "$INSTDIR\SMPlayer.ini" "advanced" "mplayer_additional_options" ""
580 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_for_new_version" "false"
581 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_if_upgraded" "false"
582 WriteINIStr "$INSTDIR\SMPlayer.ini" "update_checker" "enabled" "false"
584 ${If} ${Errors}
585 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
586 ${EndIf}
587 SectionEnd
589 Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
590 SectionIn 1
591 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
593 SetOutPath "$INSTDIR\codecs"
595 File "Codecs\*.0"
596 File "Codecs\*.acm"
597 File "Codecs\*.ax"
598 File "Codecs\*.dll"
599 File "Codecs\*.qtx"
600 File "Codecs\*.so"
601 File "Codecs\*.vwp"
602 File "Codecs\*.xa"
603 SectionEnd
605 Section "-Write Uninstaller"
606 ${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
607 WriteUninstaller "$INSTDIR\Uninstall.exe"
608 SectionEnd
610 Section "-Create Shortcuts"
611 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
612 ${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
613 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
615 SetShellVarContext current
616 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
617 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
618 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
620 SetShellVarContext all
621 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
622 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
623 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
625 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
626 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
627 CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
628 ${EndIf}
629 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
630 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
631 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
632 ${EndIf}
634 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
635 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
636 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
638 ${If} ${AtLeastWinVista}
639 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_APPREG).lnk" "$INSTDIR\AppRegGUI.exe"
640 ${EndIf}
642 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://muldersoft.com/"
643 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
644 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
646 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
647 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
648 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
649 ${EndIf}
650 !insertmacro MUI_STARTMENU_WRITE_END
651 SectionEnd
653 Section "-ApplyTweaks"
654 ${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
655 DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
657 IntOp $0 $SelectedTweaks & 1
658 ${If} $0 != 0
659 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
660 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
661 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Gonzo"
662 ${EndIf}
663 ${EndIf}
665 IntOp $0 $SelectedTweaks & 2
666 ${If} $0 != 0
667 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
668 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl:yuv=3 -lavdopts threads=$DetectedCPUCores"
669 ${EndIf}
670 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
671 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl:yuv=3"
672 ${EndIf}
673 ${EndIf}
675 IntOp $0 $SelectedTweaks & 4
676 ${If} $0 != 0
677 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
678 ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
679 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
680 ${EndIf}
681 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
682 WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
683 ${EndIf}
684 ${EndIf}
685 SectionEnd
687 Section "$(MPLAYER_LANG_COMPRESS_FILES)"
688 SectionIn 1 2
689 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
691 File "/oname=$PLUGINSDIR\UPX.exe" "Utils\UPX.exe"
693 ${PackAll} "$INSTDIR" "*.exe"
694 ${PackAll} "$INSTDIR" "*.dll"
695 ${PackAll} "$INSTDIR\codecs" "*.acm"
696 ${PackAll} "$INSTDIR\codecs" "*.ax"
697 ${PackAll} "$INSTDIR\codecs" "*.dll"
698 ${PackAll} "$INSTDIR\codecs" "*.qtx"
700 Delete "$PLUGINSDIR\UPX.exe"
701 SectionEnd
703 Section "-Update Font Cache"
704 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
706 SetShellVarContext current
707 Delete "$APPDATA\fontconfig\cache\*.*"
708 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
710 SetShellVarContext all
711 Delete "$APPDATA\fontconfig\cache\*.*"
712 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
714 File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
715 DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
716 NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
717 Delete "Resources\Sample.avi"
718 SectionEnd
720 Section "-Update Registry"
721 ${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
722 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
724 ; Clean up
725 DeleteRegKey HKLM "${MPlayerRegPath}"
726 DeleteRegKey HKCU "${MPlayerRegPath}"
727 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
728 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
730 ; Uninstaller
731 WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
732 WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
733 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
734 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayIcon" "$INSTDIR\MPlayer.exe,0"
735 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayVersion" "${MPLAYER_DATE}"
736 WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://muldersoft.com/"
737 WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://muldersoft.com/"
738 WriteRegStr HKLM "${MPlayerRegPath}" "Publisher" "The MPlayer Team"
739 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
740 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
742 ; Shell
743 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
744 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
745 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
746 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
747 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\MPUI.exe" "%1"'
748 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\MPUI.exe,0"
749 ${EndIf}
750 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
751 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\SMPlayer.exe" "%1"'
752 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\SMPlayer.exe,1"
753 ${EndIf}
755 ; Register App
756 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
757 WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2" "${MPlayerRegPath}\Capabilities"
759 ; Capabilities
760 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
761 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
762 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
764 ; File Associations
765 ${RegisterFileExtCapability} "256"
766 ${RegisterFileExtCapability} "3GP"
767 ${RegisterFileExtCapability} "AAC"
768 ${RegisterFileExtCapability} "ASF"
769 ${RegisterFileExtCapability} "AVI"
770 ${RegisterFileExtCapability} "BIN"
771 ${RegisterFileExtCapability} "DAT"
772 ${RegisterFileExtCapability} "DIVX"
773 ${RegisterFileExtCapability} "EVO"
774 ${RegisterFileExtCapability} "FLV"
775 ${RegisterFileExtCapability} "M2V"
776 ${RegisterFileExtCapability} "M2TS"
777 ${RegisterFileExtCapability} "M4A"
778 ${RegisterFileExtCapability} "MKA"
779 ${RegisterFileExtCapability} "MKV"
780 ${RegisterFileExtCapability} "MOV"
781 ${RegisterFileExtCapability} "MP2"
782 ${RegisterFileExtCapability} "MP3"
783 ${RegisterFileExtCapability} "MP4"
784 ${RegisterFileExtCapability} "MPEG"
785 ${RegisterFileExtCapability} "MPG"
786 ${RegisterFileExtCapability} "MPV"
787 ${RegisterFileExtCapability} "NSV"
788 ${RegisterFileExtCapability} "OGG"
789 ${RegisterFileExtCapability} "OGM"
790 ${RegisterFileExtCapability} "RM"
791 ${RegisterFileExtCapability} "RMVB"
792 ${RegisterFileExtCapability} "TS"
793 ${RegisterFileExtCapability} "VOB"
794 ${RegisterFileExtCapability} "WAV"
795 ${RegisterFileExtCapability} "WEBM"
796 ${RegisterFileExtCapability} "WMV"
798 ; Reset auto update interval
799 DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
800 DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
801 SectionEnd
803 Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
804 SectionIn 1 2
805 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
806 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
807 SectionEnd
809 Section "-Protect Files"
810 SetFileAttributes "$INSTDIR\MPlayer.exe" FILE_ATTRIBUTE_READONLY
811 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
812 SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
813 SetFileAttributes "$INSTDIR\SMPlayer.exe" FILE_ATTRIBUTE_READONLY
814 SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
815 SetFileAttributes "$INSTDIR\QtCore4.dll" FILE_ATTRIBUTE_READONLY
816 SetFileAttributes "$INSTDIR\QtGui4.dll" FILE_ATTRIBUTE_READONLY
817 SetFileAttributes "$INSTDIR\QtNetwork4.dll" FILE_ATTRIBUTE_READONLY
818 SetFileAttributes "$INSTDIR\QtXml4.dll" FILE_ATTRIBUTE_READONLY
819 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
820 SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
821 SetFileAttributes "$INSTDIR\mingwm10.dll" FILE_ATTRIBUTE_READONLY
822 SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
823 SectionEnd
825 Section "-Finished"
826 ${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
827 SectionEnd
830 ;--------------------------------------------------------------------------------
831 ; UN-INSTALL SECTIONS
832 ;--------------------------------------------------------------------------------
834 Section "Uninstall"
835 SetOutPath "$INSTDIR"
836 ${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
838 ; Startmenu
839 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
840 ${IfNot} "$StartMenuFolder" == ""
841 SetShellVarContext current
842 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
843 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
844 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
845 ${EndIf}
846 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
847 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
848 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
849 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
850 RMDir "$SMPROGRAMS\$StartMenuFolder"
851 ${EndIf}
852 SetShellVarContext all
853 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
854 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
855 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
856 ${EndIf}
857 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
858 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
859 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
860 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
861 RMDir "$SMPROGRAMS\$StartMenuFolder"
862 ${EndIf}
863 ${EndIf}
865 ; Desktop icons
866 Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
867 Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
869 ; Files
870 Delete /REBOOTOK "$INSTDIR\*.exe"
871 Delete /REBOOTOK "$INSTDIR\*.dll"
872 Delete /REBOOTOK "$INSTDIR\*.ini"
873 Delete /REBOOTOK "$INSTDIR\*.txt"
874 Delete /REBOOTOK "$INSTDIR\*.html"
875 Delete /REBOOTOK "$INSTDIR\*.htm"
876 Delete /REBOOTOK "$INSTDIR\*.ass"
877 Delete /REBOOTOK "$INSTDIR\*.m3u8"
878 Delete /REBOOTOK "$INSTDIR\*.tag"
879 RMDir /r "$INSTDIR\codecs"
880 RMDir /r "$INSTDIR\fonts"
881 RMDir /r "$INSTDIR\imageformats"
882 RMDir /r "$INSTDIR\legal_stuff"
883 RMDir /r "$INSTDIR\locale"
884 RMDir /r "$INSTDIR\mplayer"
885 RMDir /r "$INSTDIR\shortcuts"
886 RMDir /r "$INSTDIR\themes"
887 RMDir /r "$INSTDIR\translations"
888 RMDir "$INSTDIR"
890 ; Virtual Store
891 ${GetVirtualStorePath} $0 "$INSTDIR"
892 ${If} ${FileExists} "$0\*.*"
893 RMDir /r "$0"
894 ${EndIf}
896 ; Registry Keys
897 DeleteRegKey HKLM "${MPlayerRegPath}"
898 DeleteRegKey HKCU "${MPlayerRegPath}"
899 DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
900 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
902 ; Auto Update
903 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
904 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
906 ; Shell
907 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
908 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
909 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
911 ${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
912 SectionEnd
915 ;--------------------------------------------------------------------------------
916 ; SECTION SELECTION CHANGED
917 ;--------------------------------------------------------------------------------
919 Function .onSelChange
920 ${IfNot} ${SectionIsSelected} ${SECID_MPUI}
921 ${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
922 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
923 SectionGetFlags ${SECID_MPUI} $0
924 IntOp $0 $0 | ${SF_SELECTED}
925 SectionSetFlags ${SECID_MPUI} $0
926 ${EndIf}
928 ${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
929 StrCpy $0 "nope"
930 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
931 ${If} "$0" == "ok"
932 SectionGetFlags ${SECID_AUTOUPDATE} $0
933 IntOp $0 $0 | ${SF_SELECTED}
934 SectionSetFlags ${SECID_AUTOUPDATE} $0
935 ${EndIf}
936 ${EndIf}
937 FunctionEnd
940 ;--------------------------------------------------------------------------------
941 ; LOCKED-LIST PLUGIN
942 ;--------------------------------------------------------------------------------
944 !macro LockedListPage_Function
945 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
946 LockedList::AddModule "\MPlayer.exe"
947 LockedList::AddModule "\SMPlayer.exe"
948 LockedList::AddModule "\MPUI.exe"
949 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)"
950 Pop $R0
951 !macroend
953 Function LockedListPage_Show
954 !insertmacro LockedListPage_Function
955 FunctionEnd
957 Function un.LockedListPage_Show
958 !insertmacro LockedListPage_Function
959 FunctionEnd
962 ;--------------------------------------------------------------------------------
963 ; CUSTOME PAGE: CPU SELECTOR
964 ;--------------------------------------------------------------------------------
966 Function SelectCPUPage_Show
967 ; Detect CPU type, if not detected yet
968 ${If} $DetectedCPUType < 2
969 ${OrIf} $DetectedCPUType > 5
970 Call DetectCPUType
971 !insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
972 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <---"
973 ${EndIf}
975 ; Make sure the current selection is valid
976 ${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
977 ${IfThen} $SelectedCPUType > 5 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
979 ; Translate
980 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 1" "Text" "$(MPLAYER_LANG_SELECT_CPU_TYPE)"
981 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 6" "Text" "$(MPLAYER_LANG_SELECT_CPU_HINT)"
983 ; Apply current selection to dialog
984 ${For} $0 2 5
985 ${If} $0 == $SelectedCPUType
986 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "1"
987 ${Else}
988 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "0"
989 ${EndIf}
990 ${Next}
992 ; Display dialog
993 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_SELECT_CPU_HEAD)" "$(MPLAYER_LANG_SELECT_CPU_TEXT)"
994 !insertmacro INSTALLOPTIONS_DISPLAY "Page_CPU.ini"
996 ; Read new selection from dialog
997 StrCpy $SelectedCPUType 0
998 ${For} $0 2 5
999 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
1000 ${IfThen} $1 == 1 ${|} StrCpy $SelectedCPUType $0 ${|}
1001 ${Next}
1002 FunctionEnd
1004 Function SelectCPUPage_Validate
1005 ; Read new selection from dialog
1006 StrCpy $2 0
1007 ${For} $0 2 5
1008 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
1009 ${IfThen} $1 == 1 ${|} StrCpy $2 $0 ${|}
1010 ${Next}
1012 ; Validate selection
1013 ${If} $2 < 2
1014 ${OrIf} $2 > 5
1015 MessageBox MB_ICONSTOP "Oups, invalid selection detected!"
1016 Abort
1017 ${EndIf}
1018 FunctionEnd
1020 Function DetectCPUType
1021 StrCpy $DetectedCPUType 5 ;generic
1022 StrCpy $DetectedCPUCores 2
1024 ${IfNot} ${Silent}
1025 Banner::show /NOUNLOAD "$(MPLAYER_LANG_DETECTING)"
1026 ${EndIf}
1028 ${CPUFeatures.GetCount} $0
1029 ${IfNot} $0 == "error"
1030 StrCpy $DetectedCPUCores $0
1031 ${EndIf}
1033 ; Debug Code
1034 !ifdef CPU_DETECT_DEBUG
1035 ${CPUFeatures.GetVendor} $0
1036 ${CPUFeatures.CheckFeature} "MMX1" $1
1037 ${CPUFeatures.CheckFeature} "3DNOW" $2
1038 ${CPUFeatures.CheckFeature} "SSE3" $3
1039 ${CPUFeatures.CheckFeature} "SSSE3" $4
1040 ${CPUFeatures.CheckFeature} "SSE4.2" $5
1041 ${CPUFeatures.CheckFeature} "AVX1" $6
1042 ${CPUFeatures.CheckFeature} "FMA4" $7
1043 StrCpy $9 `Vendor = $0`
1044 StrCpy $9 `$9$\n"MMX1" = $1`
1045 StrCpy $9 `$9$\n"3DNOW" = $2`
1046 StrCpy $9 `$9$\n"SSE3" = $3`
1047 StrCpy $9 `$9$\n"SSSE3" = $4`
1048 StrCpy $9 `$9$\n"SSE4.2" = $5`
1049 StrCpy $9 `$9$\n"AVX1" = $6`
1050 StrCpy $9 `$9$\n"FMA4" = $7`
1051 MessageBox MB_TOPMOST `$9`
1052 !endif
1054 ; Make sure we have at least MMX
1055 ${IfNot} ${CPUSupports} "MMX1"
1056 Banner::destroy
1057 Return
1058 ${EndIf}
1060 ; Select the "best" model for Intel's
1061 ${If} ${CPUIsIntel}
1062 ; Core2 (SSE3 + SSSE3)
1063 ${If} ${CPUSupportsAll} "SSE3,SSSE3"
1064 StrCpy $DetectedCPUType 2 ;
1065 ${EndIf}
1066 ; Nehalem (SSE3 + SSSE3 + SSE4.2)
1067 ${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2"
1068 StrCpy $DetectedCPUType 3
1069 ${EndIf}
1070 ${EndIf}
1072 ; Select the "best" model for AMD's
1073 ${If} ${CPUIsAMD}
1074 ; K8+SSE3 (3DNow! + SSE3)
1075 ${If} ${CPUSupportsAll} "3DNOW,SSE3"
1076 StrCpy $DetectedCPUType 4
1077 ${EndIf}
1078 ; Bulldozer (SSE3 + SSSE3 + SSE4.2 + AVX + FMA4)
1079 ;${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2,AVX1,FMA4"
1080 ; StrCpy $DetectedCPUType 5 #5 is now generic, as 'bdver1' build got dropped
1081 ;${EndIf}
1082 ${EndIf}
1084 Banner::destroy
1085 FunctionEnd
1088 ;--------------------------------------------------------------------------------
1089 ; CUSTOME PAGE: TWEAKS
1090 ;--------------------------------------------------------------------------------
1092 Function SetTweaksPage_Show
1093 ; Apply current selection to dialog
1094 StrCpy $0 1
1095 ${For} $1 2 4
1096 IntOp $2 $0 & $SelectedTweaks
1097 ${If} $2 != 0
1098 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "1"
1099 ${Else}
1100 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "0"
1101 ${EndIf}
1102 IntOp $0 $0 << 1
1103 ${Next}
1105 ; Translate
1106 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 1" "Text" "$(MPLAYER_LANG_TWEAKS_HINT)"
1107 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 2" "Text" "$(MPLAYER_LANG_TWEAKS_SKINNEDUI)"
1108 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 3" "Text" "$(MPLAYER_LANG_TWEAKS_OPENGL)"
1109 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 4" "Text" "$(MPLAYER_LANG_TWEAKS_VOLNORM)"
1111 ; Display dialog
1112 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_TWEAKS_HEAD)" "$(MPLAYER_LANG_TWEAKS_TEXT)"
1113 !insertmacro INSTALLOPTIONS_DISPLAY "Page_Tweaks.ini"
1115 ; Read new selection from dialog
1116 StrCpy $0 1
1117 ${For} $1 2 4
1118 !insertmacro INSTALLOPTIONS_READ $2 "Page_Tweaks.ini" "Field $1" "State"
1119 ${IfThen} $2 == 1 ${|} IntOp $SelectedTweaks $SelectedTweaks | $0 ${|}
1120 IntOp $0 $0 << 1
1121 ${Next}
1122 FunctionEnd
1125 ;--------------------------------------------------------------------------------
1126 ; CHECK FOR UPDATE MODE
1127 ;--------------------------------------------------------------------------------
1129 !macro EnablePathEditable flag show_msg
1130 ${IfNot} $NotUpdateInstall == ${flag}
1131 !if ${show_msg} == 1
1132 MessageBox MB_OK|MB_ICONINFORMATION "$(MPLAYER_LANG_FORCE_UPDATE)" /SD IDOK
1133 !endif
1134 StrCpy $NotUpdateInstall ${flag}
1135 ${EndIf}
1136 FindWindow $1 "#32770" "" $HWNDPARENT
1137 GetDlgItem $2 $1 1019
1138 EnableWindow $2 ${flag}
1139 GetDlgItem $2 $1 1001
1140 EnableWindow $2 ${flag}
1141 !macroend
1143 Function CheckForUpdate
1144 ${StdUtils.GetParameter} $0 "Update" "?"
1145 ${IfNot} "$0" == "?"
1146 !insertmacro EnablePathEditable 0 0
1147 Return
1148 ${EndIf}
1150 ${If} ${FileExists} "$INSTDIR\MPlayer.exe"
1151 !insertmacro EnablePathEditable 0 1
1152 Return
1153 ${EndIf}
1155 !insertmacro EnablePathEditable 1 0
1156 FunctionEnd
1159 ;--------------------------------------------------------------------------------
1160 ; FINISHED
1161 ;--------------------------------------------------------------------------------
1163 Function RunAppFunction
1164 !insertmacro DisableNextButton $R0
1165 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
1166 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\SMPlayer.exe" "open" "http://lounge-office.rautemusik.fm/"
1167 ${Else}
1168 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\MPUI.exe" "open" "http://lounge-office.rautemusik.fm/"
1169 ${EndIf}
1170 FunctionEnd
1172 Function ShowReadmeFunction
1173 !insertmacro DisableNextButton $R0
1174 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\Readme.html" "open" ""
1175 FunctionEnd
1177 Function .onInstSuccess
1178 ${StdUtils.ExecShellAsUser} $R0 "$SMPROGRAMS\$StartMenuFolder" "explore" ""
1179 FunctionEnd
1182 ### EOF ###