Ported the Auto-Update tool to the "new" update architecture.
[mplayer-setup-win32.git] / MPUI_Setup.nsi
blob869fbe1382c131ab435db77cfc0ff89a3f400481
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2015 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 !tempfile PACKHDRTEMP
94 !packhdr "${PACKHDRTEMP}" '"Utils\MT.exe" -manifest "Resources\Setup.manifest" -outputresource:"${PACKHDRTEMP};1"'
96 #!packhdr "$%TEMP%\exehead.tmp" '"${UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
99 ;--------------------------------------------------------------------------------
100 ; RESERVE FILES
101 ;--------------------------------------------------------------------------------
103 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
104 ReserveFile "${NSISDIR}\Plugins\Banner.dll"
105 ReserveFile "${NSISDIR}\Plugins\CPUFeatures.dll"
106 ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
107 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
108 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
109 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
110 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
111 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
112 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
113 ReserveFile "${NSISDIR}\Plugins\System.dll"
114 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
115 ReserveFile "Dialogs\Page_CPU.ini"
116 ReserveFile "Resources\Splash.gif"
119 ;--------------------------------------------------------------------------------
120 ; INCLUDES
121 ;--------------------------------------------------------------------------------
123 !include `MUI2.nsh`
124 !include `InstallOptions.nsh`
125 !include `WinVer.nsh`
126 !include `x64.nsh`
127 !include `StrFunc.nsh`
128 !include `StdUtils.nsh`
129 !include `CPUFeatures.nsh`
130 !include `MPUI_Common.nsh`
132 ; Enable functions
133 ${StrRep}
136 ;--------------------------------------------------------------------------------
137 ; GLOBAL VARIABLES
138 ;--------------------------------------------------------------------------------
140 Var StartMenuFolder
141 Var DetectedCPUType
142 Var DetectedCPUCores
143 Var SelectedCPUType
144 Var SelectedTweaks
145 Var NotUpdateInstall
148 ;--------------------------------------------------------------------------------
149 ; VERSION INFO
150 ;--------------------------------------------------------------------------------
152 !searchreplace PRODUCT_VERSION_DATE "${MPLAYER_DATE}" "-" "."
153 VIProductVersion "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
155 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
156 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."
157 VIAddVersionKey "CompanyName" "Free Software Foundation"
158 VIAddVersionKey "FileDescription" "MPlayer for Windows (Build #${MPLAYER_BUILDNO})"
159 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
160 VIAddVersionKey "LegalCopyright" "Copyright 2000-2015 The MPlayer Project"
161 VIAddVersionKey "LegalTrademarks" "GNU"
162 VIAddVersionKey "OriginalFilename" "MPUI-Setup.exe"
163 VIAddVersionKey "ProductName" "MPlayer for Windows"
164 VIAddVersionKey "ProductVersion" "Build #${MPLAYER_BUILDNO} (${MPLAYER_DATE})"
165 VIAddVersionKey "Website" "${MPlayerWebSite}"
168 ;--------------------------------------------------------------------------------
169 ; MUI2 INTERFACE SETTINGS
170 ;--------------------------------------------------------------------------------
172 !define MUI_ABORTWARNING
173 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
174 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MPlayerRegPath}"
175 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
176 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
177 !define MUI_LANGDLL_REGISTRY_KEY "${MPlayerRegPath}"
178 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
179 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "MPlayer for Windows"
180 !define MUI_FINISHPAGE_NOAUTOCLOSE
181 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
182 !define MUI_FINISHPAGE_RUN
183 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
184 !define MUI_FINISHPAGE_SHOWREADME
185 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
186 !define MUI_FINISHPAGE_LINK ${MPlayerWebSite}
187 !define MUI_FINISHPAGE_LINK_LOCATION ${MPlayerWebSite}
188 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
189 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
190 !define MUI_WELCOMEFINISHPAGE_BITMAP "Artwork\wizard.bmp"
191 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "Artwork\wizard-un.bmp"
192 !define MUI_HEADERIMAGE
193 !define MUI_HEADERIMAGE_BITMAP "Artwork\header.bmp"
194 !define MUI_HEADERIMAGE_UNBITMAP "Artwork\header-un.bmp"
195 !define MUI_LANGDLL_ALLLANGUAGES
196 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
197 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
198 !define MUI_LANGDLL_ALWAYSSHOW
199 !define MUI_COMPONENTSPAGE_SMALLDESC
202 ;--------------------------------------------------------------------------------
203 ; MUI2 PAGE SETUP
204 ;--------------------------------------------------------------------------------
206 ; Installer
207 !define MUI_WELCOMEPAGE_TITLE_3LINES
208 !define MUI_FINISHPAGE_TITLE_3LINES
209 !insertmacro MUI_PAGE_WELCOME
210 !insertmacro MUI_PAGE_LICENSE "Docs\License.txt"
211 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
212 !insertmacro MUI_PAGE_DIRECTORY
213 !insertmacro MUI_PAGE_COMPONENTS
214 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
215 Page Custom SelectCPUPage_Show SelectCPUPage_Validate
216 Page Custom SetTweaksPage_Show
217 Page Custom LockedListPage_Show
218 !insertmacro MUI_PAGE_INSTFILES
219 !insertmacro MUI_PAGE_FINISH
221 ; Un-Installer
222 !define MUI_WELCOMEPAGE_TITLE_3LINES
223 !define MUI_FINISHPAGE_TITLE_3LINES
224 !insertmacro MUI_UNPAGE_WELCOME
225 !insertmacro MUI_UNPAGE_CONFIRM
226 UninstPage Custom un.LockedListPage_Show
227 !insertmacro MUI_UNPAGE_INSTFILES
228 !insertmacro MUI_UNPAGE_FINISH
231 ;--------------------------------------------------------------------------------
232 ; LANGUAGE
233 ;--------------------------------------------------------------------------------
235 !insertmacro MUI_LANGUAGE "English"
236 !insertmacro MUI_LANGUAGE "German"
238 ; Translation files
239 !include "Language\MPUI_EN.nsh"
240 !include "Language\MPUI_DE.nsh"
243 ;--------------------------------------------------------------------------------
244 ; INSTALL TYPES
245 ;--------------------------------------------------------------------------------
247 InstType "$(MPLAYER_LANG_INSTTYPE_COMPLETE)"
248 InstType "$(MPLAYER_LANG_INSTTYPE_MINIMAL)"
251 ;--------------------------------------------------------------------------------
252 ; INITIALIZATION
253 ;--------------------------------------------------------------------------------
255 Function .onInit
256 StrCpy $SelectedCPUType 0
257 StrCpy $DetectedCPUType 0
258 StrCpy $DetectedCPUCores 0
259 StrCpy $SelectedTweaks 1
260 StrCpy $NotUpdateInstall 1
262 InitPluginsDir
264 ; --------
266 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
267 Pop $0
268 ${If} $0 <> 0
269 MessageBox MB_ICONSTOP|MB_TOPMOST "Oups, the installer is already running!"
270 Quit
271 ${EndIf}
273 ; --------
275 # Running on Windows NT family?
276 ${IfNot} ${IsNT}
277 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
278 ExecShell "open" "http://windows.microsoft.com/"
279 Quit
280 ${EndIf}
282 # Running on Windows XP or later?
283 ${If} ${AtMostWin2000}
284 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."
285 ExecShell "open" "http://windows.microsoft.com/"
286 Quit
287 ${EndIf}
289 ; --------
291 UserInfo::GetAccountType
292 Pop $0
293 ${If} $0 != "Admin"
294 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
295 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
296 Quit
297 ${EndIf}
299 ; --------
301 !insertmacro MUI_LANGDLL_DISPLAY
303 !insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_CPU.ini" "Page_CPU.ini"
304 !insertmacro INSTALLOPTIONS_EXTRACT_AS "Dialogs\Page_Tweaks.ini" "Page_Tweaks.ini"
306 !ifdef PRE_RELEASE
307 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL|MB_DEFBUTTON2 "Note: This is an early pre-release version for test only!" IDCANCEL ${||} Quit ${|}
308 !endif
310 ; --------
312 ${IfNot} ${Silent}
313 File "/oname=$PLUGINSDIR\Splash.gif" "Resources\Splash.gif"
314 newadvsplash::show 3000 1000 500 -1 /NOCANCEL "$PLUGINSDIR\Splash.gif"
315 Delete /REBOOTOK "$PLUGINSDIR\Splash.gif"
316 ${EndIf}
317 FunctionEnd
319 Function un.onInit
320 InitPluginsDir
322 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{B800490C-C100-4B12-9F09-1A54DF063049}") i .r1 ?e'
323 Pop $0
324 ${If} $0 <> 0
325 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
326 Quit
327 ${EndIf}
329 ; --------
331 UserInfo::GetAccountType
332 Pop $0
333 ${If} $0 != "Admin"
334 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to un-install this software."
335 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
336 Quit
337 ${EndIf}
339 ; --------
341 !insertmacro MUI_LANGDLL_DISPLAY
342 FunctionEnd
345 ;--------------------------------------------------------------------------------
346 ; GUI INITIALIZATION
347 ;--------------------------------------------------------------------------------
349 Function MyGuiInit
350 StrCpy $0 $HWNDPARENT
351 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
352 Aero::Apply
353 FunctionEnd
355 Function un.MyGuiInit
356 StrCpy $0 $HWNDPARENT
357 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
358 Aero::Apply
359 FunctionEnd
362 ;--------------------------------------------------------------------------------
363 ; INSTALL SECTIONS
364 ;--------------------------------------------------------------------------------
366 Section "-Clean Up"
367 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CLEAN)"
369 SetShellVarContext all
370 SetOutPath "$INSTDIR"
372 ; Uninstall old version (aka "Setup v1")
373 ClearErrors
374 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}" "InstallLocation"
375 ${IfNot} ${Errors}
376 MessageBox MB_ICONINFORMATION|MB_OK "$(MPLAYER_LANG_UNINSTALL_OLDVER)"
377 File "/oname=$PLUGINSDIR\Uninstall-V1.exe" "Resources\Uninstall-V1.exe"
378 HideWindow
379 ExecWait '"$PLUGINSDIR\Uninstall-V1.exe" _?=$0'
380 Delete /REBOOTOK "$PLUGINSDIR\Uninstall-V1.exe"
381 BringToFront
382 ${EndIf}
384 ; Clean registry
385 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
386 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DB9E4EAB-2717-499F-8D56-4CC8A644AB60}"
387 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
388 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_UpdateReminder"
390 ; Make sure MPlayer isn't running
391 ${Do}
392 ClearErrors
393 Delete "$INSTDIR\MPlayer.exe"
394 Delete "$INSTDIR\SMPlayer.exe"
395 Delete "$INSTDIR\MPUI.exe"
396 ${If} ${Errors}
397 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_STILL_RUNNING)" IDCANCEL ${||} Abort ${|}
398 ${Else}
399 ${Break}
400 ${EndIf}
401 ${Loop}
403 ; Clean the install folder
404 Delete "$INSTDIR\*.exe"
405 Delete "$INSTDIR\*.dll"
406 Delete "$INSTDIR\*.ini"
407 Delete "$INSTDIR\*.txt"
408 Delete "$INSTDIR\*.html"
409 Delete "$INSTDIR\*.htm"
410 Delete "$INSTDIR\*.ass"
411 Delete "$INSTDIR\*.m3u8"
412 Delete "$INSTDIR\*.tag"
413 RMDir /r "$INSTDIR\codecs"
414 RMDir /r "$INSTDIR\fonts"
415 RMDir /r "$INSTDIR\imageformats"
416 RMDir /r "$INSTDIR\legal_stuff"
417 RMDir /r "$INSTDIR\locale"
418 RMDir /r "$INSTDIR\mplayer"
419 RMDir /r "$INSTDIR\shortcuts"
420 RMDir /r "$INSTDIR\themes"
421 RMDir /r "$INSTDIR\translations"
423 ; Now deal with Virtual Store
424 ${GetVirtualStorePath} $0 "$INSTDIR"
425 Delete "$0\*.exe"
426 Delete "$0\*.dll"
427 Delete "$0\*.ini"
428 Delete "$0\*.txt"
429 Delete "$0\*.html"
430 Delete "$0\*.htm"
431 Delete "$0\*.ass"
432 Delete "$0\*.m3u8"
433 Delete "$0\*.tag"
434 Delete "$0\mplayer\config"
435 Delete "$0\mplayer\*.conf"
436 SectionEnd
438 Section "!MPlayer r${MPLAYER_REVISION}" SECID_MPLAYER
439 SectionIn 1 2 RO
440 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPLAYER)"
441 SetOutPath "$INSTDIR"
443 ; Detect
444 ${If} ${Silent}
445 Call DetectCPUType
446 StrCpy $SelectedCPUType $DetectedCPUType
447 ${EndIf}
449 ; MPlayer.exe
450 ${Select} $SelectedCPUType
451 ${Case} "2"
452 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): core2"
453 File "Builds\MPlayer-core2\MPlayer.exe"
454 ${Case} "3"
455 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): corei7"
456 File "Builds\MPlayer-corei7\MPlayer.exe"
457 ${Case} "4"
458 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): k8-sse3"
459 File "Builds\MPlayer-k8-sse3\MPlayer.exe"
460 ${Case} "5"
461 DetailPrint "$(MPLAYER_LANG_SELECTED_TYPE): generic"
462 File "Builds\MPlayer-generic\MPlayer.exe"
463 ${CaseElse}
464 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OK "Internal error: Invalid CPU type selection detected!"
465 Abort
466 ${EndSelect}
468 ; Utilities
469 File ".Compile\Updater.exe"
470 File "Resources\AppRegGUI.exe"
472 ; Other MPlayer-related files
473 File "Builds\MPlayer-generic\dsnative.dll"
474 SetOutPath "$INSTDIR\mplayer"
475 File "Builds\MPlayer-generic\mplayer\config"
476 File "Builds\MPlayer-generic\mplayer\subfont.ttf"
477 SetOutPath "$INSTDIR\fonts"
478 File "Builds\MPlayer-generic\fonts\fonts.conf"
479 SetOutPath "$INSTDIR\fonts\conf.d"
480 File "Builds\MPlayer-generic\fonts\conf.d\*.conf"
482 ; Documents
483 SetOutPath "$INSTDIR"
484 File "GPL.txt"
485 File "/oname=Manual.html" "Builds\MPlayer-generic\MPlayer.man.html"
486 File "Docs\Readme.html"
487 SetOutPath "$INSTDIR\legal_stuff"
488 File "Docs\legal_stuff\*.txt"
490 ; Write version tag
491 ${Do}
492 ClearErrors
493 Delete "$INSTDIR\version.tag"
494 ${If} ${Errors}
495 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_TAG_WRITE)" IDCANCEL ${||} Abort ${|}
496 ${Else}
497 ${Break}
498 ${EndIf}
499 ${Loop}
500 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "build_no" "${MPLAYER_BUILDNO}"
501 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "pkg_date" "${MPLAYER_DATE}"
502 SetFileAttributes "$INSTDIR\version.tag" FILE_ATTRIBUTE_READONLY
504 ; Set file access rights
505 ${MakeFilePublic} "$INSTDIR\mplayer\config"
506 ${MakeFilePublic} "$INSTDIR\fonts\fonts.conf"
507 SectionEnd
509 Section "!MPUI $(MPLAYER_LANG_FRONT_END) v${MPUI_VERSION}" SECID_MPUI
510 SectionIn 1 2
511 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPUI)"
513 ; Extract files
514 SetOutPath "$INSTDIR"
515 File "MPUI\MPUI.exe"
517 ; Extract locales
518 SetOutPath "$INSTDIR\locale"
519 File "MPUI\locale\*.txt"
521 ; Set file access rights
522 ${MakeFilePublic} "$INSTDIR\MPUI.ini"
524 ; Setup initial config
525 ClearErrors
526 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo direct3d -lavdopts threads=$DetectedCPUCores"
527 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Locale" "$(MPLAYER_LANG_MPUI_DEFAULT_LANGUAGE)"
528 ${If} ${Errors}
529 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
530 ${EndIf}
531 SectionEnd
533 Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
534 SectionIn 1
535 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_SMPLAYER)"
537 ; SMPlayer files
538 SetOutPath "$INSTDIR"
539 File "SMPlayer\SMPlayer.exe"
540 File "SMPlayer\libgcc_s_dw2-1.dll"
541 File "SMPlayer\libstdc++-6.dll"
542 File "SMPlayer\libwinpthread-1.dll"
543 File "SMPlayer\QtCore4.dll"
544 File "SMPlayer\QtGui4.dll"
545 File "SMPlayer\QtNetwork4.dll"
546 File "SMPlayer\QtScript4.dll"
547 File "SMPlayer\QtXml4.dll"
548 File "SMPlayer\zlib1.dll"
550 ; Additional SMPlayer files
551 SetOutPath "$INSTDIR\translations"
552 File "SMPlayer\translations\*.qm"
553 SetOutPath "$INSTDIR\imageformats"
554 File "SMPlayer\imageformats\*.dll"
555 SetOutPath "$INSTDIR\shortcuts"
556 File "SMPlayer\shortcuts\*.keys"
557 SetOutPath "$INSTDIR\themes"
558 File /r "SMPlayer\themes\*.txt"
559 File /r "SMPlayer\themes\*.rcc"
560 File /r "SMPlayer\themes\*.css"
562 ; Set file access rights
563 ${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
564 ${MakeFilePublic} "$INSTDIR\SMPlayer_files.ini"
565 ${MakeFilePublic} "$INSTDIR\favorites.m3u8"
566 ${MakeFilePublic} "$INSTDIR\radio.m3u8"
567 ${MakeFilePublic} "$INSTDIR\tv.m3u8"
568 ${MakeFilePublic} "$INSTDIR\styles.ass"
569 ${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
571 ; Setup initial config
572 ${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
573 ClearErrors
574 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "config_version" "4"
575 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
576 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
577 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync" "true"
578 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "autosync_factor" "30"
579 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_audio_equalizer" "false"
580 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "use_scaletempo" "0"
581 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "osd" "1"
582 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "file_settings_method" "normal"
583 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
584 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "priority" "1"
585 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "frame_drop" "true"
586 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
587 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Numix-remix"
588 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
589 WriteINIStr "$INSTDIR\SMPlayer.ini" "advanced" "mplayer_additional_options" ""
590 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_for_new_version" "false"
591 WriteINIStr "$INSTDIR\SMPlayer.ini" "smplayer" "check_if_upgraded" "false"
592 WriteINIStr "$INSTDIR\SMPlayer.ini" "update_checker" "enabled" "false"
594 ${If} ${Errors}
595 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
596 ${EndIf}
597 SectionEnd
599 Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
600 SectionIn 1
601 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
603 SetOutPath "$INSTDIR\codecs"
605 File "Codecs\*.0"
606 File "Codecs\*.acm"
607 File "Codecs\*.ax"
608 File "Codecs\*.dll"
609 File "Codecs\*.qtx"
610 File "Codecs\*.so"
611 File "Codecs\*.vwp"
612 File "Codecs\*.xa"
613 SectionEnd
615 Section "-Write Uninstaller"
616 ${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
617 WriteUninstaller "$INSTDIR\Uninstall.exe"
618 SectionEnd
620 Section "-Create Shortcuts"
621 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
622 ${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
623 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
625 SetShellVarContext current
626 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
627 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
628 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
630 SetShellVarContext all
631 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
632 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
633 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
635 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
636 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
637 CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
638 ${EndIf}
639 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
640 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
641 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
642 ${EndIf}
644 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
645 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
646 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
648 ${If} ${AtLeastWinVista}
649 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_APPREG).lnk" "$INSTDIR\AppRegGUI.exe"
650 ${EndIf}
652 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://muldersoft.com/"
653 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
654 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
656 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
657 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
658 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
659 ${EndIf}
660 !insertmacro MUI_STARTMENU_WRITE_END
661 SectionEnd
663 Section "-ApplyTweaks"
664 ${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
665 DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
667 IntOp $0 $SelectedTweaks & 1
668 ${If} $0 != 0
669 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
670 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
671 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Gonzo"
672 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
673 ${EndIf}
674 ${EndIf}
676 IntOp $0 $SelectedTweaks & 2
677 ${If} $0 != 0
678 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
679 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl:yuv=3 -lavdopts threads=$DetectedCPUCores"
680 ${EndIf}
681 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
682 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl:yuv=3"
683 ${EndIf}
684 ${EndIf}
686 IntOp $0 $SelectedTweaks & 4
687 ${If} $0 != 0
688 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
689 ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
690 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
691 ${EndIf}
692 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
693 WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
694 ${EndIf}
695 ${EndIf}
696 SectionEnd
698 Section "$(MPLAYER_LANG_COMPRESS_FILES)"
699 SectionIn 1 2
700 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
702 File "/oname=$PLUGINSDIR\UPX.exe" "Utils\UPX.exe"
704 ${PackAll} "$INSTDIR" "*.exe"
705 ${PackAll} "$INSTDIR" "*.dll"
706 ${PackAll} "$INSTDIR\codecs" "*.acm"
707 ${PackAll} "$INSTDIR\codecs" "*.ax"
708 ${PackAll} "$INSTDIR\codecs" "*.dll"
709 ${PackAll} "$INSTDIR\codecs" "*.qtx"
711 Delete "$PLUGINSDIR\UPX.exe"
712 SectionEnd
714 Section "-Update Font Cache"
715 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
717 SetShellVarContext current
718 Delete "$APPDATA\fontconfig\cache\*.*"
719 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
721 SetShellVarContext all
722 Delete "$APPDATA\fontconfig\cache\*.*"
723 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
725 File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
726 DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
727 NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
728 Delete "Resources\Sample.avi"
729 SectionEnd
731 Section "-Update Registry"
732 ${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
733 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
735 ; Clean up
736 DeleteRegKey HKLM "${MPlayerRegPath}"
737 DeleteRegKey HKCU "${MPlayerRegPath}"
738 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
739 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
741 ; Uninstaller
742 WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
743 WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
744 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
745 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayIcon" "$INSTDIR\MPlayer.exe,0"
746 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayVersion" "${MPLAYER_DATE}"
747 WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://muldersoft.com/"
748 WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://muldersoft.com/"
749 WriteRegStr HKLM "${MPlayerRegPath}" "Publisher" "The MPlayer Team"
750 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
751 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
753 ; Shell
754 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
755 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
756 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
757 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
758 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\MPUI.exe" "%1"'
759 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\MPUI.exe,0"
760 ${EndIf}
761 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
762 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\shell\open\command" "" '"$INSTDIR\SMPlayer.exe" "%1"'
763 WriteRegStr HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File\DefaultIcon" "" "$INSTDIR\SMPlayer.exe,1"
764 ${EndIf}
766 ; Register App
767 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
768 WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2" "${MPlayerRegPath}\Capabilities"
770 ; Capabilities
771 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationName" "$(MPLAYER_LANG_MPLAYER_WIN32)"
772 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
773 WriteRegStr HKLM "${MPlayerRegPath}\Capabilities" "ApplicationDescription" "$(MPLAYER_LANG_MPLAYER_WIN32)"
775 ; File Associations
776 ${RegisterFileExtCapability} "256"
777 ${RegisterFileExtCapability} "3GP"
778 ${RegisterFileExtCapability} "AAC"
779 ${RegisterFileExtCapability} "ASF"
780 ${RegisterFileExtCapability} "AVI"
781 ${RegisterFileExtCapability} "BIN"
782 ${RegisterFileExtCapability} "DAT"
783 ${RegisterFileExtCapability} "DIVX"
784 ${RegisterFileExtCapability} "EVO"
785 ${RegisterFileExtCapability} "FLV"
786 ${RegisterFileExtCapability} "M2V"
787 ${RegisterFileExtCapability} "M2TS"
788 ${RegisterFileExtCapability} "M4A"
789 ${RegisterFileExtCapability} "MKA"
790 ${RegisterFileExtCapability} "MKV"
791 ${RegisterFileExtCapability} "MOV"
792 ${RegisterFileExtCapability} "MP2"
793 ${RegisterFileExtCapability} "MP3"
794 ${RegisterFileExtCapability} "MP4"
795 ${RegisterFileExtCapability} "MPEG"
796 ${RegisterFileExtCapability} "MPG"
797 ${RegisterFileExtCapability} "MPV"
798 ${RegisterFileExtCapability} "NSV"
799 ${RegisterFileExtCapability} "OGG"
800 ${RegisterFileExtCapability} "OGM"
801 ${RegisterFileExtCapability} "RM"
802 ${RegisterFileExtCapability} "RMVB"
803 ${RegisterFileExtCapability} "TS"
804 ${RegisterFileExtCapability} "VOB"
805 ${RegisterFileExtCapability} "WAV"
806 ${RegisterFileExtCapability} "WEBM"
807 ${RegisterFileExtCapability} "WMV"
809 ; Reset auto update interval
810 DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
811 DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
812 SectionEnd
814 Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
815 SectionIn 1 2
816 DetailPrint "$(MPLAYER_LANG_SCHEDULE_UPDATE)"
817 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
818 SectionEnd
820 Section "-Protect Files"
821 SetFileAttributes "$INSTDIR\MPlayer.exe" FILE_ATTRIBUTE_READONLY
822 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
823 SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
824 SetFileAttributes "$INSTDIR\SMPlayer.exe" FILE_ATTRIBUTE_READONLY
825 SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
826 SetFileAttributes "$INSTDIR\QtCore4.dll" FILE_ATTRIBUTE_READONLY
827 SetFileAttributes "$INSTDIR\QtGui4.dll" FILE_ATTRIBUTE_READONLY
828 SetFileAttributes "$INSTDIR\QtNetwork4.dll" FILE_ATTRIBUTE_READONLY
829 SetFileAttributes "$INSTDIR\QtXml4.dll" FILE_ATTRIBUTE_READONLY
830 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
831 SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
832 SetFileAttributes "$INSTDIR\mingwm10.dll" FILE_ATTRIBUTE_READONLY
833 SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
834 SectionEnd
836 Section "-Finished"
837 ${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
838 SectionEnd
841 ;--------------------------------------------------------------------------------
842 ; UN-INSTALL SECTIONS
843 ;--------------------------------------------------------------------------------
845 Section "Uninstall"
846 SetOutPath "$INSTDIR"
847 ${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
849 ; Startmenu
850 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
851 ${IfNot} "$StartMenuFolder" == ""
852 SetShellVarContext current
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 SetShellVarContext all
864 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
865 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
866 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
867 ${EndIf}
868 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
869 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
870 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
871 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
872 RMDir "$SMPROGRAMS\$StartMenuFolder"
873 ${EndIf}
874 ${EndIf}
876 ; Desktop icons
877 Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
878 Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
880 ; Files
881 Delete /REBOOTOK "$INSTDIR\*.exe"
882 Delete /REBOOTOK "$INSTDIR\*.dll"
883 Delete /REBOOTOK "$INSTDIR\*.ini"
884 Delete /REBOOTOK "$INSTDIR\*.txt"
885 Delete /REBOOTOK "$INSTDIR\*.html"
886 Delete /REBOOTOK "$INSTDIR\*.htm"
887 Delete /REBOOTOK "$INSTDIR\*.ass"
888 Delete /REBOOTOK "$INSTDIR\*.m3u8"
889 Delete /REBOOTOK "$INSTDIR\*.tag"
890 RMDir /r "$INSTDIR\codecs"
891 RMDir /r "$INSTDIR\fonts"
892 RMDir /r "$INSTDIR\imageformats"
893 RMDir /r "$INSTDIR\legal_stuff"
894 RMDir /r "$INSTDIR\locale"
895 RMDir /r "$INSTDIR\mplayer"
896 RMDir /r "$INSTDIR\shortcuts"
897 RMDir /r "$INSTDIR\themes"
898 RMDir /r "$INSTDIR\translations"
899 RMDir "$INSTDIR"
901 ; Virtual Store
902 ${GetVirtualStorePath} $0 "$INSTDIR"
903 ${If} ${FileExists} "$0\*.*"
904 RMDir /r "$0"
905 ${EndIf}
907 ; Registry Keys
908 DeleteRegKey HKLM "${MPlayerRegPath}"
909 DeleteRegKey HKCU "${MPlayerRegPath}"
910 DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
911 DeleteRegValue HKCU "SOFTWARE\RegisteredApplications" "MPlayerForWindowsV2"
913 ; Auto Update
914 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
915 DeleteRegValue HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2"
917 ; Shell
918 DeleteRegKey HKCR "MPlayerForWindowsV2.File"
919 DeleteRegKey HKLM "SOFTWARE\Classes\MPlayerForWindowsV2.File"
920 DeleteRegKey HKCU "SOFTWARE\Classes\MPlayerForWindowsV2.File"
922 ${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
923 SectionEnd
926 ;--------------------------------------------------------------------------------
927 ; SECTION SELECTION CHANGED
928 ;--------------------------------------------------------------------------------
930 Function .onSelChange
931 ${IfNot} ${SectionIsSelected} ${SECID_MPUI}
932 ${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
933 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
934 SectionGetFlags ${SECID_MPUI} $0
935 IntOp $0 $0 | ${SF_SELECTED}
936 SectionSetFlags ${SECID_MPUI} $0
937 ${EndIf}
939 ${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
940 StrCpy $0 "nope"
941 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
942 ${If} "$0" == "ok"
943 SectionGetFlags ${SECID_AUTOUPDATE} $0
944 IntOp $0 $0 | ${SF_SELECTED}
945 SectionSetFlags ${SECID_AUTOUPDATE} $0
946 ${EndIf}
947 ${EndIf}
948 FunctionEnd
951 ;--------------------------------------------------------------------------------
952 ; LOCKED-LIST PLUGIN
953 ;--------------------------------------------------------------------------------
955 !macro LockedListPage_Function
956 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
957 LockedList::AddModule "\MPlayer.exe"
958 LockedList::AddModule "\SMPlayer.exe"
959 LockedList::AddModule "\MPUI.exe"
960 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)"
961 Pop $R0
962 !macroend
964 Function LockedListPage_Show
965 !insertmacro LockedListPage_Function
966 FunctionEnd
968 Function un.LockedListPage_Show
969 !insertmacro LockedListPage_Function
970 FunctionEnd
973 ;--------------------------------------------------------------------------------
974 ; CUSTOME PAGE: CPU SELECTOR
975 ;--------------------------------------------------------------------------------
977 Function SelectCPUPage_Show
978 ; Detect CPU type, if not detected yet
979 ${If} $DetectedCPUType < 2
980 ${OrIf} $DetectedCPUType > 5
981 Call DetectCPUType
982 !insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
983 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <---"
984 ${EndIf}
986 ; Make sure the current selection is valid
987 ${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
988 ${IfThen} $SelectedCPUType > 5 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
990 ; Translate
991 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 1" "Text" "$(MPLAYER_LANG_SELECT_CPU_TYPE)"
992 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 6" "Text" "$(MPLAYER_LANG_SELECT_CPU_HINT)"
994 ; Apply current selection to dialog
995 ${For} $0 2 5
996 ${If} $0 == $SelectedCPUType
997 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "1"
998 ${Else}
999 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "0"
1000 ${EndIf}
1001 ${Next}
1003 ; Display dialog
1004 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_SELECT_CPU_HEAD)" "$(MPLAYER_LANG_SELECT_CPU_TEXT)"
1005 !insertmacro INSTALLOPTIONS_DISPLAY "Page_CPU.ini"
1007 ; Read new selection from dialog
1008 StrCpy $SelectedCPUType 0
1009 ${For} $0 2 5
1010 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
1011 ${IfThen} $1 == 1 ${|} StrCpy $SelectedCPUType $0 ${|}
1012 ${Next}
1013 FunctionEnd
1015 Function SelectCPUPage_Validate
1016 ; Read new selection from dialog
1017 StrCpy $2 0
1018 ${For} $0 2 5
1019 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
1020 ${IfThen} $1 == 1 ${|} StrCpy $2 $0 ${|}
1021 ${Next}
1023 ; Validate selection
1024 ${If} $2 < 2
1025 ${OrIf} $2 > 5
1026 MessageBox MB_ICONSTOP "Oups, invalid selection detected!"
1027 Abort
1028 ${EndIf}
1029 FunctionEnd
1031 Function DetectCPUType
1032 StrCpy $DetectedCPUType 5 ;generic
1033 StrCpy $DetectedCPUCores 2
1035 ${IfNot} ${Silent}
1036 Banner::show /NOUNLOAD "$(MPLAYER_LANG_DETECTING)"
1037 ${EndIf}
1039 ${CPUFeatures.GetCount} $0
1040 ${IfNot} $0 == "error"
1041 StrCpy $DetectedCPUCores $0
1042 ${EndIf}
1044 ; Debug Code
1045 !ifdef CPU_DETECT_DEBUG
1046 ${CPUFeatures.GetVendor} $0
1047 ${CPUFeatures.CheckFeature} "MMX1" $1
1048 ${CPUFeatures.CheckFeature} "3DNOW" $2
1049 ${CPUFeatures.CheckFeature} "SSE3" $3
1050 ${CPUFeatures.CheckFeature} "SSSE3" $4
1051 ${CPUFeatures.CheckFeature} "SSE4.2" $5
1052 ${CPUFeatures.CheckFeature} "AVX1" $6
1053 ${CPUFeatures.CheckFeature} "FMA4" $7
1054 StrCpy $9 `Vendor = $0`
1055 StrCpy $9 `$9$\n"MMX1" = $1`
1056 StrCpy $9 `$9$\n"3DNOW" = $2`
1057 StrCpy $9 `$9$\n"SSE3" = $3`
1058 StrCpy $9 `$9$\n"SSSE3" = $4`
1059 StrCpy $9 `$9$\n"SSE4.2" = $5`
1060 StrCpy $9 `$9$\n"AVX1" = $6`
1061 StrCpy $9 `$9$\n"FMA4" = $7`
1062 MessageBox MB_TOPMOST `$9`
1063 !endif
1065 ; Make sure we have at least MMX
1066 ${IfNot} ${CPUSupports} "MMX1"
1067 Banner::destroy
1068 Return
1069 ${EndIf}
1071 ; Select the "best" model for Intel's
1072 ${If} ${CPUIsIntel}
1073 ; Core2 (SSE3 + SSSE3)
1074 ${If} ${CPUSupportsAll} "SSE3,SSSE3"
1075 StrCpy $DetectedCPUType 2 ;
1076 ${EndIf}
1077 ; Nehalem (SSE3 + SSSE3 + SSE4.2)
1078 ${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2"
1079 StrCpy $DetectedCPUType 3
1080 ${EndIf}
1081 ${EndIf}
1083 ; Select the "best" model for AMD's
1084 ${If} ${CPUIsAMD}
1085 ; K8+SSE3 (3DNow! + SSE3)
1086 ${If} ${CPUSupportsAll} "3DNOW,SSE3"
1087 StrCpy $DetectedCPUType 4
1088 ${EndIf}
1089 ; Bulldozer (SSE3 + SSSE3 + SSE4.2 + AVX + FMA4)
1090 ;${If} ${CPUSupportsAll} "SSE3,SSSE3,SSE4.2,AVX1,FMA4"
1091 ; StrCpy $DetectedCPUType 5 #5 is now generic, as 'bdver1' build got dropped
1092 ;${EndIf}
1093 ${EndIf}
1095 Banner::destroy
1096 FunctionEnd
1099 ;--------------------------------------------------------------------------------
1100 ; CUSTOME PAGE: TWEAKS
1101 ;--------------------------------------------------------------------------------
1103 Function SetTweaksPage_Show
1104 ; Apply current selection to dialog
1105 StrCpy $0 1
1106 ${For} $1 2 4
1107 IntOp $2 $0 & $SelectedTweaks
1108 ${If} $2 != 0
1109 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "1"
1110 ${Else}
1111 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "0"
1112 ${EndIf}
1113 IntOp $0 $0 << 1
1114 ${Next}
1116 ; Translate
1117 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 1" "Text" "$(MPLAYER_LANG_TWEAKS_HINT)"
1118 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 2" "Text" "$(MPLAYER_LANG_TWEAKS_SKINNEDUI)"
1119 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 3" "Text" "$(MPLAYER_LANG_TWEAKS_OPENGL)"
1120 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 4" "Text" "$(MPLAYER_LANG_TWEAKS_VOLNORM)"
1122 ; Display dialog
1123 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_TWEAKS_HEAD)" "$(MPLAYER_LANG_TWEAKS_TEXT)"
1124 !insertmacro INSTALLOPTIONS_DISPLAY "Page_Tweaks.ini"
1126 ; Read new selection from dialog
1127 StrCpy $0 1
1128 ${For} $1 2 4
1129 !insertmacro INSTALLOPTIONS_READ $2 "Page_Tweaks.ini" "Field $1" "State"
1130 ${IfThen} $2 == 1 ${|} IntOp $SelectedTweaks $SelectedTweaks | $0 ${|}
1131 IntOp $0 $0 << 1
1132 ${Next}
1133 FunctionEnd
1136 ;--------------------------------------------------------------------------------
1137 ; CHECK FOR UPDATE MODE
1138 ;--------------------------------------------------------------------------------
1140 !macro EnablePathEditable flag show_msg
1141 ${IfNot} $NotUpdateInstall == ${flag}
1142 !if ${show_msg} == 1
1143 MessageBox MB_OK|MB_ICONINFORMATION "$(MPLAYER_LANG_FORCE_UPDATE)" /SD IDOK
1144 !endif
1145 StrCpy $NotUpdateInstall ${flag}
1146 ${EndIf}
1147 FindWindow $1 "#32770" "" $HWNDPARENT
1148 GetDlgItem $2 $1 1019
1149 EnableWindow $2 ${flag}
1150 GetDlgItem $2 $1 1001
1151 EnableWindow $2 ${flag}
1152 !macroend
1154 Function CheckForUpdate
1155 ${StdUtils.GetParameter} $0 "Update" "?"
1156 ${IfNot} "$0" == "?"
1157 !insertmacro EnablePathEditable 0 0
1158 Return
1159 ${EndIf}
1161 ${If} ${FileExists} "$INSTDIR\MPlayer.exe"
1162 !insertmacro EnablePathEditable 0 1
1163 Return
1164 ${EndIf}
1166 !insertmacro EnablePathEditable 1 0
1167 FunctionEnd
1170 ;--------------------------------------------------------------------------------
1171 ; FINISHED
1172 ;--------------------------------------------------------------------------------
1174 Function RunAppFunction
1175 !insertmacro DisableNextButton $R0
1176 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
1177 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\SMPlayer.exe" "open" "http://lounge-office.rautemusik.fm/"
1178 ${Else}
1179 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\MPUI.exe" "open" "http://lounge-office.rautemusik.fm/"
1180 ${EndIf}
1181 FunctionEnd
1183 Function ShowReadmeFunction
1184 !insertmacro DisableNextButton $R0
1185 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\Readme.html" "open" ""
1186 FunctionEnd
1188 Function .onInstSuccess
1189 ${StdUtils.ExecShellAsUser} $R0 "$SMPROGRAMS\$StartMenuFolder" "explore" ""
1190 FunctionEnd
1193 ### EOF ###