Some updater simplifications.
[mplayer-setup-win32.git] / MPUI_Setup.nsi
blob8de9246afd83dbc69c5b7761471151ae7b952c03
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 "$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 ; Other MPlayer-related files
454 File ".Compile\Updater.exe"
455 File "Builds\MPlayer-generic\dsnative.dll"
456 SetOutPath "$INSTDIR\mplayer"
457 File "Builds\MPlayer-generic\mplayer\config"
458 SetOutPath "$INSTDIR\fonts"
459 File "Builds\MPlayer-generic\fonts\fonts.conf"
460 SetOutPath "$INSTDIR\fonts\conf.d"
461 File "Builds\MPlayer-generic\fonts\conf.d\*.conf"
463 ; Documents
464 SetOutPath "$INSTDIR"
465 File "GPL.txt"
466 File "/oname=Manual.html" "Builds\MPlayer-generic\MPlayer.man.html"
467 File "Docs\Readme.html"
468 SetOutPath "$INSTDIR\legal_stuff"
469 File "Docs\legal_stuff\*.txt"
471 ; Write version tag
472 ${Do}
473 ClearErrors
474 Delete "$INSTDIR\version.tag"
475 ${If} ${Errors}
476 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(MPLAYER_LANG_TAG_WRITE)" IDCANCEL ${||} Abort ${|}
477 ${Else}
478 ${Break}
479 ${EndIf}
480 ${Loop}
481 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "build_no" "${MPLAYER_BUILDNO}"
482 WriteINIStr "$INSTDIR\version.tag" "mplayer_version" "pkg_date" "${MPLAYER_DATE}"
483 SetFileAttributes "$INSTDIR\version.tag" FILE_ATTRIBUTE_READONLY
485 ; Set file access rights
486 ${MakeFilePublic} "$INSTDIR\mplayer\config"
487 ${MakeFilePublic} "$INSTDIR\fonts\fonts.conf"
488 SectionEnd
490 Section "!MPUI $(MPLAYER_LANG_FRONT_END) v${MPUI_VERSION}" SECID_MPUI
491 SectionIn 1 2
492 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_MPUI)"
494 ; Extract files
495 SetOutPath "$INSTDIR"
496 File "MPUI\MPUI.exe"
498 ; Extract locales
499 SetOutPath "$INSTDIR\locale"
500 File "MPUI\locale\*.txt"
502 ; Set file access rights
503 ${MakeFilePublic} "$INSTDIR\MPUI.ini"
505 ; Setup initial config
506 ClearErrors
507 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo direct3d -lavdopts threads=$DetectedCPUCores"
508 ${If} ${Errors}
509 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
510 ${EndIf}
511 SectionEnd
513 Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
514 SectionIn 1
515 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
517 ; SMPlayer files
518 SetOutPath "$INSTDIR"
519 File "SMPlayer\SMPlayer.exe"
520 File "SMPlayer\libgcc_s_dw2-1.dll"
521 File "SMPlayer\mingwm10.dll"
522 File "SMPlayer\QtCore4.dll"
523 File "SMPlayer\QtGui4.dll"
524 File "SMPlayer\QtNetwork4.dll"
525 File "SMPlayer\QtXml4.dll"
526 File "SMPlayer\zlib1.dll"
528 ; Additional SMPlayer files
529 SetOutPath "$INSTDIR\translations"
530 File "SMPlayer\translations\*.qm"
531 SetOutPath "$INSTDIR\imageformats"
532 File "SMPlayer\imageformats\*.dll"
533 SetOutPath "$INSTDIR\shortcuts"
534 File "SMPlayer\shortcuts\*.keys"
535 SetOutPath "$INSTDIR\themes"
536 File /r "SMPlayer\themes\*.css"
537 File /r "SMPlayer\themes\*.png"
539 ; Set file access rights
540 ${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
541 ${MakeFilePublic} "$INSTDIR\favorites.m3u8"
542 ${MakeFilePublic} "$INSTDIR\radio.m3u8"
543 ${MakeFilePublic} "$INSTDIR\tv.m3u8"
544 ${MakeFilePublic} "$INSTDIR\styles.ass"
545 ${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
547 ; Setup initial config
548 ${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
549 ClearErrors
550 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
551 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
552 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
553 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Oxygen-Refit"
554 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
555 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
556 ${If} ${Errors}
557 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
558 ${EndIf}
559 SectionEnd
561 Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
562 SectionIn 1
563 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
565 SetOutPath "$INSTDIR\codecs"
567 File "Codecs\*.0"
568 File "Codecs\*.acm"
569 File "Codecs\*.ax"
570 File "Codecs\*.dll"
571 File "Codecs\*.qtx"
572 File "Codecs\*.so"
573 File "Codecs\*.vwp"
574 File "Codecs\*.xa"
575 SectionEnd
577 Section "-Write Uninstaller"
578 ${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
579 WriteUninstaller "$INSTDIR\Uninstall.exe"
580 SectionEnd
582 Section "-Create Shortcuts"
583 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
584 ${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
585 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
587 SetShellVarContext current
588 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
589 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
590 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
592 SetShellVarContext all
593 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
594 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
595 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
597 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
598 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
599 CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
600 ${EndIf}
601 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
602 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
603 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
604 ${EndIf}
606 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
607 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
608 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
610 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://www.mulder.at.gg/"
611 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
612 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
614 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
615 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
616 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
617 ${EndIf}
618 !insertmacro MUI_STARTMENU_WRITE_END
619 SectionEnd
621 Section "-ApplyTweaks"
622 ${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
623 DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
625 IntOp $0 $SelectedTweaks & 1
626 ${If} $0 != 0
627 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
628 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
629 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Gonzo"
630 ${EndIf}
631 ${EndIf}
633 IntOp $0 $SelectedTweaks & 2
634 ${If} $0 != 0
635 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
636 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl:yuv=3 -lavdopts threads=$DetectedCPUCores"
637 ${EndIf}
638 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
639 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl:yuv=3"
640 ${EndIf}
641 ${EndIf}
643 IntOp $0 $SelectedTweaks & 4
644 ${If} $0 != 0
645 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
646 ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
647 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
648 ${EndIf}
649 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
650 WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
651 ${EndIf}
652 ${EndIf}
653 SectionEnd
655 Section "$(MPLAYER_LANG_COMPRESS_FILES)"
656 SectionIn 1 2
657 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
659 File "/oname=$PLUGINSDIR\UPX.exe" "Utils\UPX.exe"
661 ${PackAll} "$INSTDIR" "*.exe"
662 ${PackAll} "$INSTDIR" "*.dll"
663 ${PackAll} "$INSTDIR\codecs" "*.acm"
664 ${PackAll} "$INSTDIR\codecs" "*.ax"
665 ${PackAll} "$INSTDIR\codecs" "*.dll"
666 ${PackAll} "$INSTDIR\codecs" "*.qtx"
668 Delete "$PLUGINSDIR\UPX.exe"
669 SectionEnd
671 Section "-Update Font Cache"
672 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
674 SetShellVarContext current
675 Delete "$APPDATA\fontconfig\cache\*.*"
676 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
678 SetShellVarContext all
679 Delete "$APPDATA\fontconfig\cache\*.*"
680 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
682 File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
683 DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
684 NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
685 Delete "Resources\Sample.avi"
686 SectionEnd
688 Section "-Update Registry"
689 ${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
691 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
692 WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
693 WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
694 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "MPlayer for Windows"
695 WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://mulder.at.gg/"
696 WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://mulder.at.gg/"
697 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
698 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
700 ; Reset auto update interval
701 DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
702 DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
703 SectionEnd
705 Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
706 SectionIn 1 2
707 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
708 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
709 SectionEnd
711 Section "-Protect Files"
712 SetFileAttributes "$INSTDIR\MPlayer.exe" FILE_ATTRIBUTE_READONLY
713 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
714 SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
715 SetFileAttributes "$INSTDIR\SMPlayer.exe" FILE_ATTRIBUTE_READONLY
716 SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
717 SetFileAttributes "$INSTDIR\QtCore4.dll" FILE_ATTRIBUTE_READONLY
718 SetFileAttributes "$INSTDIR\QtGui4.dll" FILE_ATTRIBUTE_READONLY
719 SetFileAttributes "$INSTDIR\QtNetwork4.dll" FILE_ATTRIBUTE_READONLY
720 SetFileAttributes "$INSTDIR\QtXml4.dll" FILE_ATTRIBUTE_READONLY
721 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
722 SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
723 SetFileAttributes "$INSTDIR\mingwm10.dll" FILE_ATTRIBUTE_READONLY
724 SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
725 SectionEnd
727 Section "-Finished"
728 ${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
729 SectionEnd
732 ;--------------------------------------------------------------------------------
733 ; UN-INSTALL SECTIONS
734 ;--------------------------------------------------------------------------------
736 Section "Uninstall"
737 SetOutPath "$INSTDIR"
738 ${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
740 ; Startmenu
741 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
742 ${IfNot} "$StartMenuFolder" == ""
743 SetShellVarContext current
744 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
745 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
746 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
747 ${EndIf}
748 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
749 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
750 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
751 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
752 RMDir "$SMPROGRAMS\$StartMenuFolder"
753 ${EndIf}
754 SetShellVarContext all
755 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
756 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
757 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
758 ${EndIf}
759 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
760 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
761 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
762 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
763 RMDir "$SMPROGRAMS\$StartMenuFolder"
764 ${EndIf}
765 ${EndIf}
767 ; Desktop icons
768 Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
769 Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
771 ; Files
772 Delete /REBOOTOK "$INSTDIR\*.exe"
773 Delete /REBOOTOK "$INSTDIR\*.dll"
774 Delete /REBOOTOK "$INSTDIR\*.ini"
775 Delete /REBOOTOK "$INSTDIR\*.txt"
776 Delete /REBOOTOK "$INSTDIR\*.html"
777 Delete /REBOOTOK "$INSTDIR\*.htm"
778 Delete /REBOOTOK "$INSTDIR\*.ass"
779 Delete /REBOOTOK "$INSTDIR\*.m3u8"
780 Delete /REBOOTOK "$INSTDIR\*.tag"
781 RMDir /r "$INSTDIR\codecs"
782 RMDir /r "$INSTDIR\fonts"
783 RMDir /r "$INSTDIR\imageformats"
784 RMDir /r "$INSTDIR\legal_stuff"
785 RMDir /r "$INSTDIR\locale"
786 RMDir /r "$INSTDIR\mplayer"
787 RMDir /r "$INSTDIR\shortcuts"
788 RMDir /r "$INSTDIR\themes"
789 RMDir /r "$INSTDIR\translations"
790 RMDir "$INSTDIR"
792 ; Virtual Store
793 ${GetVirtualStorePath} $0 "$INSTDIR"
794 ${If} ${FileExists} "$0\*.*"
795 RMDir /r "$0"
796 ${EndIf}
798 ; Registry
799 DeleteRegKey HKLM "${MPlayerRegPath}"
800 DeleteRegKey HKCU "${MPlayerRegPath}"
802 ${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
803 SectionEnd
806 ;--------------------------------------------------------------------------------
807 ; SECTION SELECTION CHANGED
808 ;--------------------------------------------------------------------------------
810 Function .onSelChange
811 ${IfNot} ${SectionIsSelected} ${SECID_MPUI}
812 ${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
813 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
814 SectionGetFlags ${SECID_MPUI} $0
815 IntOp $0 $0 | ${SF_SELECTED}
816 SectionSetFlags ${SECID_MPUI} $0
817 ${EndIf}
819 ${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
820 StrCpy $0 "nope"
821 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
822 ${If} "$0" == "ok"
823 SectionGetFlags ${SECID_AUTOUPDATE} $0
824 IntOp $0 $0 | ${SF_SELECTED}
825 SectionSetFlags ${SECID_AUTOUPDATE} $0
826 ${EndIf}
827 ${EndIf}
828 FunctionEnd
831 ;--------------------------------------------------------------------------------
832 ; LOCKED-LIST PLUGIN
833 ;--------------------------------------------------------------------------------
835 !macro LockedListPage_Function
836 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
837 LockedList::AddModule "\MPlayer.exe"
838 LockedList::AddModule "\SMPlayer.exe"
839 LockedList::AddModule "\MPUI.exe"
840 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)"
841 Pop $R0
842 !macroend
844 Function LockedListPage_Show
845 !insertmacro LockedListPage_Function
846 FunctionEnd
848 Function un.LockedListPage_Show
849 !insertmacro LockedListPage_Function
850 FunctionEnd
853 ;--------------------------------------------------------------------------------
854 ; CUSTOME PAGE: CPU SELECTOR
855 ;--------------------------------------------------------------------------------
857 Function SelectCPUPage_Show
858 ; Detect CPU type, if not detected yet
859 ${If} $DetectedCPUType < 2
860 ${OrIf} $DetectedCPUType > 6
861 Call DetectCPUType
862 !insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
863 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <---"
864 ${EndIf}
866 ; Make sure the current selection is valid
867 ${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
868 ${IfThen} $SelectedCPUType > 6 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
870 ; Translate
871 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 1" "Text" "$(MPLAYER_LANG_SELECT_CPU_TYPE)"
872 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 7" "Text" "$(MPLAYER_LANG_SELECT_CPU_HINT)"
874 ; Apply current selection to dialog
875 ${For} $0 2 6
876 ${If} $0 == $SelectedCPUType
877 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "1"
878 ${Else}
879 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "0"
880 ${EndIf}
881 ${Next}
883 ; Display dialog
884 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_SELECT_CPU_HEAD)" "$(MPLAYER_LANG_SELECT_CPU_TEXT)"
885 !insertmacro INSTALLOPTIONS_DISPLAY "Page_CPU.ini"
887 ; Read new selection from dialog
888 StrCpy $SelectedCPUType 0
889 ${For} $0 2 6
890 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
891 ${IfThen} $1 == 1 ${|} StrCpy $SelectedCPUType $0 ${|}
892 ${Next}
893 FunctionEnd
895 Function SelectCPUPage_Validate
896 ; Read new selection from dialog
897 StrCpy $2 0
898 ${For} $0 2 6
899 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
900 ${IfThen} $1 == 1 ${|} StrCpy $2 $0 ${|}
901 ${Next}
903 ; Validate selection
904 ${If} $2 < 2
905 ${OrIf} $2 > 6
906 MessageBox MB_ICONSTOP "Oups, invalid selection detected!"
907 Abort
908 ${EndIf}
909 FunctionEnd
911 Function DetectCPUType
912 StrCpy $DetectedCPUType 6 ;generic
913 StrCpy $DetectedCPUCores 2
915 Banner::show /NOUNLOAD "$(MPLAYER_LANG_DETECTING)"
917 ${CPUFeatures.GetCount} $0
918 ${IfNot} $0 == "error"
919 StrCpy $DetectedCPUCores $0
920 ${EndIf}
922 ; Check supported features
923 ${CPUFeatures.GetVendor} $0
924 ${CPUFeatures.CheckFeature} "MMX1" $1
925 ${CPUFeatures.CheckFeature} "SSE3" $2
926 ${CPUFeatures.CheckFeature} "SSSE3" $3
927 ${CPUFeatures.CheckFeature} "SSE4.2" $4
928 ${CPUFeatures.CheckFeature} "AVX1" $5
929 ${CPUFeatures.CheckFeature} "FMA4" $6
931 !ifdef CPU_DETECT_DEBUG
932 MessageBox MB_TOPMOST `Vendor = $0`
933 MessageBox MB_TOPMOST `"MMX1" = $1`
934 MessageBox MB_TOPMOST `"SSE3" = $2`
935 MessageBox MB_TOPMOST `"SSSE3" = $3`
936 MessageBox MB_TOPMOST `"SSE4.2" = $4`
937 MessageBox MB_TOPMOST `""AVX1" = $5`
938 MessageBox MB_TOPMOST `"FMA4" = $6`
939 !endif
941 ; Make sure we have at least MMX
942 ${IfThen} $1 != "yes" ${|} Return ${|}
944 ; Select the "best" model for Intel's
945 ${If} $0 == "Intel"
946 ${If} $2 == "yes"
947 ${AndIf} $3 == "yes"
948 StrCpy $DetectedCPUType 2 ;Core2
949 ${IfThen} $4 == "yes" ${|} StrCpy $DetectedCPUType 3 ${|} ;Nehalem
950 ${EndIf}
951 ${EndIf}
953 ; Select the "best" model for AMD's
954 ${If} $0 == "AMD"
955 ${If} $2 == "yes"
956 StrCpy $DetectedCPUType 4 ;K8+SSE3
957 ${If} $3 == "yes"
958 ${AndIf} $4 == "yes"
959 ${AndIf} $5 == "yes"
960 ${AndIf} $6 == "yes"
961 StrCpy $DetectedCPUType 5 ;Bulldozer
962 ${EndIf}
963 ${EndIf}
964 ${EndIf}
966 Banner::destroy
967 FunctionEnd
970 ;--------------------------------------------------------------------------------
971 ; CUSTOME PAGE: TWEAKS
972 ;--------------------------------------------------------------------------------
974 Function SetTweaksPage_Show
975 ; Apply current selection to dialog
976 StrCpy $0 1
977 ${For} $1 2 4
978 IntOp $2 $0 & $SelectedTweaks
979 ${If} $2 != 0
980 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "1"
981 ${Else}
982 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "0"
983 ${EndIf}
984 IntOp $0 $0 << 1
985 ${Next}
987 ; Translate
988 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 1" "Text" "$(MPLAYER_LANG_TWEAKS_HINT)"
989 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 2" "Text" "$(MPLAYER_LANG_TWEAKS_SKINNEDUI)"
990 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 3" "Text" "$(MPLAYER_LANG_TWEAKS_OPENGL)"
991 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 4" "Text" "$(MPLAYER_LANG_TWEAKS_VOLNORM)"
993 ; Display dialog
994 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_TWEAKS_HEAD)" "$(MPLAYER_LANG_TWEAKS_TEXT)"
995 !insertmacro INSTALLOPTIONS_DISPLAY "Page_Tweaks.ini"
997 ; Read new selection from dialog
998 StrCpy $0 1
999 ${For} $1 2 4
1000 !insertmacro INSTALLOPTIONS_READ $2 "Page_Tweaks.ini" "Field $1" "State"
1001 ${IfThen} $2 == 1 ${|} IntOp $SelectedTweaks $SelectedTweaks | $0 ${|}
1002 IntOp $0 $0 << 1
1003 ${Next}
1004 FunctionEnd
1007 ;--------------------------------------------------------------------------------
1008 ; CHECK FOR UPDATE MODE
1009 ;--------------------------------------------------------------------------------
1011 Function CheckForUpdate
1012 ${StdUtils.GetParameter} $0 "Update" "?"
1013 ${IfNot} "$0" == "?"
1014 FindWindow $1 "#32770" "" $HWNDPARENT
1015 GetDlgItem $2 $1 1019
1016 EnableWindow $2 0
1017 GetDlgItem $2 $1 1001
1018 EnableWindow $2 0
1019 ${EndIf}
1020 FunctionEnd
1023 ;--------------------------------------------------------------------------------
1024 ; FINISHED
1025 ;--------------------------------------------------------------------------------
1027 Function RunAppFunction
1028 !insertmacro DisableNextButton $R0
1029 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
1030 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\SMPlayer.exe" "open" "http://lounge-office.rautemusik.fm/"
1031 ${Else}
1032 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\MPUI.exe" "open" "http://lounge-office.rautemusik.fm/"
1033 ${EndIf}
1034 FunctionEnd
1036 Function ShowReadmeFunction
1037 !insertmacro DisableNextButton $R0
1038 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\Readme.html" "open" ""
1039 FunctionEnd
1041 Function .onInstSuccess
1042 ${StdUtils.ExecShellAsUser} $R0 "$SMPROGRAMS\$StartMenuFolder" "explore" ""
1043 FunctionEnd
1046 ### EOF ###