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