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