Set initial language for MPUI explicitly, as auto-detection doesn't seem to work...
[mplayer-setup-win32.git] / MPUI_Setup.nsi
blobc9c943aa68ce842b795763689288ff79674d8211
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 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Locale" "$(MPLAYER_LANG_MPUI_DEFAULT_LANGUAGE)"
509 ${If} ${Errors}
510 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_MPUI)" IDCANCEL ${||} Abort ${|}
511 ${EndIf}
512 SectionEnd
514 Section "!SMPlayer $(MPLAYER_LANG_FRONT_END) v${SMPLAYER_VERSION}" SECID_SMPLAYER
515 SectionIn 1
516 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
518 ; SMPlayer files
519 SetOutPath "$INSTDIR"
520 File "SMPlayer\SMPlayer.exe"
521 File "SMPlayer\libgcc_s_dw2-1.dll"
522 File "SMPlayer\mingwm10.dll"
523 File "SMPlayer\QtCore4.dll"
524 File "SMPlayer\QtGui4.dll"
525 File "SMPlayer\QtNetwork4.dll"
526 File "SMPlayer\QtXml4.dll"
527 File "SMPlayer\zlib1.dll"
529 ; Additional SMPlayer files
530 SetOutPath "$INSTDIR\translations"
531 File "SMPlayer\translations\*.qm"
532 SetOutPath "$INSTDIR\imageformats"
533 File "SMPlayer\imageformats\*.dll"
534 SetOutPath "$INSTDIR\shortcuts"
535 File "SMPlayer\shortcuts\*.keys"
536 SetOutPath "$INSTDIR\themes"
537 File /r "SMPlayer\themes\*.css"
538 File /r "SMPlayer\themes\*.png"
540 ; Set file access rights
541 ${MakeFilePublic} "$INSTDIR\SMPlayer.ini"
542 ${MakeFilePublic} "$INSTDIR\favorites.m3u8"
543 ${MakeFilePublic} "$INSTDIR\radio.m3u8"
544 ${MakeFilePublic} "$INSTDIR\tv.m3u8"
545 ${MakeFilePublic} "$INSTDIR\styles.ass"
546 ${MakeFilePublic} "$INSTDIR\shortcuts\default.keys"
548 ; Setup initial config
549 ${StrRep} $0 "$INSTDIR\MPlayer.exe" "\" "/"
550 ClearErrors
551 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "mplayer_bin" "$0"
552 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "direct3d"
553 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "DefaultGUI"
554 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Oxygen-Refit"
555 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "style" "Plastique"
556 WriteINIStr "$INSTDIR\SMPlayer.ini" "performance" "threads" "$DetectedCPUCores"
557 ${If} ${Errors}
558 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONSTOP|MB_DEFBUTTON2|MB_OKCANCEL "$(MPLAYER_LANG_CONFIG_SMPLAYER)" IDCANCEL ${||} Abort ${|}
559 ${EndIf}
560 SectionEnd
562 Section "!$(MPLAYER_LANG_BIN_CODECS) (${CODECS_DATE})"
563 SectionIn 1
564 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_CODECS)"
566 SetOutPath "$INSTDIR\codecs"
568 File "Codecs\*.0"
569 File "Codecs\*.acm"
570 File "Codecs\*.ax"
571 File "Codecs\*.dll"
572 File "Codecs\*.qtx"
573 File "Codecs\*.so"
574 File "Codecs\*.vwp"
575 File "Codecs\*.xa"
576 SectionEnd
578 Section "-Write Uninstaller"
579 ${PrintProgress} "$(MPLAYER_LANG_STATUS_MAKEUNINST)"
580 WriteUninstaller "$INSTDIR\Uninstall.exe"
581 SectionEnd
583 Section "-Create Shortcuts"
584 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
585 ${PrintProgress} "$(MPLAYER_LANG_STATUS_SHORTCUTS)"
586 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
588 SetShellVarContext current
589 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
590 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
591 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
593 SetShellVarContext all
594 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
595 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
596 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
598 ${If} ${FileExists} "$INSTDIR\MPUI.exe"
599 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MPUI.lnk" "$INSTDIR\MPUI.exe"
600 CreateShortCut "$DESKTOP\MPUI.lnk" "$INSTDIR\MPUI.exe"
601 ${EndIf}
602 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
603 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
604 CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\SMPlayer.exe"
605 ${EndIf}
607 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_UPDATE).lnk" "$INSTDIR\Updater.exe" "/L=$LANGUAGE"
608 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_README).lnk" "$INSTDIR\Readme.html"
609 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_MANUAL).lnk" "$INSTDIR\Manual.html"
611 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MULDERS).url" "http://www.mulder.at.gg/"
612 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPWIN32).url" "http://oss.netfarm.it/mplayer-win32.php"
613 ${CreateWebLink} "$SMPROGRAMS\$StartMenuFolder\$(MPLAYER_LANG_SHORTCUT_SITE_MPLAYER).url" "http://www.mplayerhq.hu/"
615 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
616 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
617 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
618 ${EndIf}
619 !insertmacro MUI_STARTMENU_WRITE_END
620 SectionEnd
622 Section "-ApplyTweaks"
623 ${PrintProgress} "$(MPLAYER_LANG_STATUS_TWEAKS)"
624 DetailPrint "$(MPLAYER_LANG_APPLYING_TWEAKS)"
626 IntOp $0 $SelectedTweaks & 1
627 ${If} $0 != 0
628 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
629 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "gui" "SkinGUI"
630 WriteINIStr "$INSTDIR\SMPlayer.ini" "gui" "iconset" "Gonzo"
631 ${EndIf}
632 ${EndIf}
634 IntOp $0 $SelectedTweaks & 2
635 ${If} $0 != 0
636 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
637 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "-vo gl:yuv=3 -lavdopts threads=$DetectedCPUCores"
638 ${EndIf}
639 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
640 WriteINIStr "$INSTDIR\SMPlayer.ini" "%General" "driver\vo" "gl:yuv=3"
641 ${EndIf}
642 ${EndIf}
644 IntOp $0 $SelectedTweaks & 4
645 ${If} $0 != 0
646 ${If} ${FileExists} "$INSTDIR\MPUI.ini"
647 ReadINIStr $1 "$INSTDIR\MPUI.ini" "MPUI" "Params"
648 WriteINIStr "$INSTDIR\MPUI.ini" "MPUI" "Params" "$1 -af volnorm=2"
649 ${EndIf}
650 ${If} ${FileExists} "$INSTDIR\SMPlayer.ini"
651 WriteINIStr "$INSTDIR\SMPlayer.ini" "defaults" "initial_volnorm" "true"
652 ${EndIf}
653 ${EndIf}
654 SectionEnd
656 Section "$(MPLAYER_LANG_COMPRESS_FILES)"
657 SectionIn 1 2
658 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_COMPRESS)"
660 File "/oname=$PLUGINSDIR\UPX.exe" "Utils\UPX.exe"
662 ${PackAll} "$INSTDIR" "*.exe"
663 ${PackAll} "$INSTDIR" "*.dll"
664 ${PackAll} "$INSTDIR\codecs" "*.acm"
665 ${PackAll} "$INSTDIR\codecs" "*.ax"
666 ${PackAll} "$INSTDIR\codecs" "*.dll"
667 ${PackAll} "$INSTDIR\codecs" "*.qtx"
669 Delete "$PLUGINSDIR\UPX.exe"
670 SectionEnd
672 Section "-Update Font Cache"
673 ${PrintProgress} "$(MPLAYER_LANG_STATUS_INST_FONTCACHE)"
675 SetShellVarContext current
676 Delete "$APPDATA\fontconfig\cache\*.*"
677 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
679 SetShellVarContext all
680 Delete "$APPDATA\fontconfig\cache\*.*"
681 Delete "$LOCALAPPDATA\fontconfig\cache\*.*"
683 File "/oname=$PLUGINSDIR\Sample.avi" "Resources\Sample.avi"
684 DetailPrint "$(MPLAYER_LANG_UPDATING_FONTCACHE)"
685 NsExec::Exec '"$INSTDIR\MPlayer.exe" -fontconfig -ass -vo null -ao null "$PLUGINSDIR\Sample.avi"'
686 Delete "Resources\Sample.avi"
687 SectionEnd
689 Section "-Update Registry"
690 ${PrintProgress} "$(MPLAYER_LANG_STATUS_REGISTRY)"
692 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
693 WriteRegStr HKLM "${MPlayerRegPath}" "InstallLocation" "$INSTDIR"
694 WriteRegStr HKLM "${MPlayerRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
695 WriteRegStr HKLM "${MPlayerRegPath}" "DisplayName" "MPlayer for Windows"
696 WriteRegStr HKLM "${MPlayerRegPath}" "URLInfoAbout" "http://mulder.at.gg/"
697 WriteRegStr HKLM "${MPlayerRegPath}" "URLUpdateInfo" "http://mulder.at.gg/"
698 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoModify" 1
699 WriteRegDWORD HKLM "${MPlayerRegPath}" "NoRepair" 1
701 ; Reset auto update interval
702 DeleteRegValue HKLM "${MPlayerRegPath}" "LastUpdateCheck"
703 DeleteRegValue HKCU "${MPlayerRegPath}" "LastUpdateCheck"
704 SectionEnd
706 Section "$(MPLAYER_LANG_INST_AUTOUPDATE)" SECID_AUTOUPDATE
707 SectionIn 1 2
708 DetailPrint "$(MPLAYER_LANG_WRITING_REGISTRY)"
709 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "MPlayerForWindows_AutoUpdateV2" '"$INSTDIR\Updater.exe" /L=$LANGUAGE /AutoCheck'
710 SectionEnd
712 Section "-Protect Files"
713 SetFileAttributes "$INSTDIR\MPlayer.exe" FILE_ATTRIBUTE_READONLY
714 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
715 SetFileAttributes "$INSTDIR\MPUI.exe" FILE_ATTRIBUTE_READONLY
716 SetFileAttributes "$INSTDIR\SMPlayer.exe" FILE_ATTRIBUTE_READONLY
717 SetFileAttributes "$INSTDIR\Updater.exe" FILE_ATTRIBUTE_READONLY
718 SetFileAttributes "$INSTDIR\QtCore4.dll" FILE_ATTRIBUTE_READONLY
719 SetFileAttributes "$INSTDIR\QtGui4.dll" FILE_ATTRIBUTE_READONLY
720 SetFileAttributes "$INSTDIR\QtNetwork4.dll" FILE_ATTRIBUTE_READONLY
721 SetFileAttributes "$INSTDIR\QtXml4.dll" FILE_ATTRIBUTE_READONLY
722 SetFileAttributes "$INSTDIR\dsnative.dll" FILE_ATTRIBUTE_READONLY
723 SetFileAttributes "$INSTDIR\libgcc_s_dw2-1.dll" FILE_ATTRIBUTE_READONLY
724 SetFileAttributes "$INSTDIR\mingwm10.dll" FILE_ATTRIBUTE_READONLY
725 SetFileAttributes "$INSTDIR\zlib1.dll" FILE_ATTRIBUTE_READONLY
726 SectionEnd
728 Section "-Finished"
729 ${PrintStatus} "$(MUI_TEXT_FINISH_TITLE)"
730 SectionEnd
733 ;--------------------------------------------------------------------------------
734 ; UN-INSTALL SECTIONS
735 ;--------------------------------------------------------------------------------
737 Section "Uninstall"
738 SetOutPath "$INSTDIR"
739 ${PrintProgress} "$(MPLAYER_LANG_STATUS_UNINSTALL)"
741 ; Startmenu
742 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
743 ${IfNot} "$StartMenuFolder" == ""
744 SetShellVarContext current
745 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
746 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
747 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
748 ${EndIf}
749 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
750 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
751 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
752 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
753 RMDir "$SMPROGRAMS\$StartMenuFolder"
754 ${EndIf}
755 SetShellVarContext all
756 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk"
757 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "SMPlayer.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
758 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\SMPlayer.lnk" -> $R1'
759 ${EndIf}
760 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
761 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
762 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
763 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.pif"
764 RMDir "$SMPROGRAMS\$StartMenuFolder"
765 ${EndIf}
766 ${EndIf}
768 ; Desktop icons
769 Delete /REBOOTOK "$DESKTOP\MPUI.lnk"
770 Delete /REBOOTOK "$DESKTOP\SMPlayer.lnk"
772 ; Files
773 Delete /REBOOTOK "$INSTDIR\*.exe"
774 Delete /REBOOTOK "$INSTDIR\*.dll"
775 Delete /REBOOTOK "$INSTDIR\*.ini"
776 Delete /REBOOTOK "$INSTDIR\*.txt"
777 Delete /REBOOTOK "$INSTDIR\*.html"
778 Delete /REBOOTOK "$INSTDIR\*.htm"
779 Delete /REBOOTOK "$INSTDIR\*.ass"
780 Delete /REBOOTOK "$INSTDIR\*.m3u8"
781 Delete /REBOOTOK "$INSTDIR\*.tag"
782 RMDir /r "$INSTDIR\codecs"
783 RMDir /r "$INSTDIR\fonts"
784 RMDir /r "$INSTDIR\imageformats"
785 RMDir /r "$INSTDIR\legal_stuff"
786 RMDir /r "$INSTDIR\locale"
787 RMDir /r "$INSTDIR\mplayer"
788 RMDir /r "$INSTDIR\shortcuts"
789 RMDir /r "$INSTDIR\themes"
790 RMDir /r "$INSTDIR\translations"
791 RMDir "$INSTDIR"
793 ; Virtual Store
794 ${GetVirtualStorePath} $0 "$INSTDIR"
795 ${If} ${FileExists} "$0\*.*"
796 RMDir /r "$0"
797 ${EndIf}
799 ; Registry
800 DeleteRegKey HKLM "${MPlayerRegPath}"
801 DeleteRegKey HKCU "${MPlayerRegPath}"
803 ${PrintStatus} "$(MUI_UNTEXT_FINISH_TITLE)"
804 SectionEnd
807 ;--------------------------------------------------------------------------------
808 ; SECTION SELECTION CHANGED
809 ;--------------------------------------------------------------------------------
811 Function .onSelChange
812 ${IfNot} ${SectionIsSelected} ${SECID_MPUI}
813 ${AndIfNot} ${SectionIsSelected} ${SECID_SMPLAYER}
814 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "$(MPLAYER_LANG_SELCHANGE)"
815 SectionGetFlags ${SECID_MPUI} $0
816 IntOp $0 $0 | ${SF_SELECTED}
817 SectionSetFlags ${SECID_MPUI} $0
818 ${EndIf}
820 ${IfNot} ${SectionIsSelected} ${SECID_AUTOUPDATE}
821 StrCpy $0 "nope"
822 ${IfCmd} MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_YESNO|MB_DEFBUTTON2 "$(MPLAYER_LANG_SEL_AUTOUPDATE)" IDNO ${||} StrCpy $0 "ok" ${|}
823 ${If} "$0" == "ok"
824 SectionGetFlags ${SECID_AUTOUPDATE} $0
825 IntOp $0 $0 | ${SF_SELECTED}
826 SectionSetFlags ${SECID_AUTOUPDATE} $0
827 ${EndIf}
828 ${EndIf}
829 FunctionEnd
832 ;--------------------------------------------------------------------------------
833 ; LOCKED-LIST PLUGIN
834 ;--------------------------------------------------------------------------------
836 !macro LockedListPage_Function
837 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_LOCKEDLIST_HEADER)" "$(MPLAYER_LANG_LOCKEDLIST_TEXT)"
838 LockedList::AddModule "\MPlayer.exe"
839 LockedList::AddModule "\SMPlayer.exe"
840 LockedList::AddModule "\MPUI.exe"
841 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)"
842 Pop $R0
843 !macroend
845 Function LockedListPage_Show
846 !insertmacro LockedListPage_Function
847 FunctionEnd
849 Function un.LockedListPage_Show
850 !insertmacro LockedListPage_Function
851 FunctionEnd
854 ;--------------------------------------------------------------------------------
855 ; CUSTOME PAGE: CPU SELECTOR
856 ;--------------------------------------------------------------------------------
858 Function SelectCPUPage_Show
859 ; Detect CPU type, if not detected yet
860 ${If} $DetectedCPUType < 2
861 ${OrIf} $DetectedCPUType > 6
862 Call DetectCPUType
863 !insertmacro INSTALLOPTIONS_READ $0 "Page_CPU.ini" "Field $DetectedCPUType" "Text"
864 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $DetectedCPUType" "Text" "$0 <---"
865 ${EndIf}
867 ; Make sure the current selection is valid
868 ${IfThen} $SelectedCPUType < 2 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
869 ${IfThen} $SelectedCPUType > 6 ${|} StrCpy $SelectedCPUType $DetectedCPUType ${|}
871 ; Translate
872 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 1" "Text" "$(MPLAYER_LANG_SELECT_CPU_TYPE)"
873 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field 7" "Text" "$(MPLAYER_LANG_SELECT_CPU_HINT)"
875 ; Apply current selection to dialog
876 ${For} $0 2 6
877 ${If} $0 == $SelectedCPUType
878 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "1"
879 ${Else}
880 !insertmacro INSTALLOPTIONS_WRITE "Page_CPU.ini" "Field $0" "State" "0"
881 ${EndIf}
882 ${Next}
884 ; Display dialog
885 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_SELECT_CPU_HEAD)" "$(MPLAYER_LANG_SELECT_CPU_TEXT)"
886 !insertmacro INSTALLOPTIONS_DISPLAY "Page_CPU.ini"
888 ; Read new selection from dialog
889 StrCpy $SelectedCPUType 0
890 ${For} $0 2 6
891 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
892 ${IfThen} $1 == 1 ${|} StrCpy $SelectedCPUType $0 ${|}
893 ${Next}
894 FunctionEnd
896 Function SelectCPUPage_Validate
897 ; Read new selection from dialog
898 StrCpy $2 0
899 ${For} $0 2 6
900 !insertmacro INSTALLOPTIONS_READ $1 "Page_CPU.ini" "Field $0" "State"
901 ${IfThen} $1 == 1 ${|} StrCpy $2 $0 ${|}
902 ${Next}
904 ; Validate selection
905 ${If} $2 < 2
906 ${OrIf} $2 > 6
907 MessageBox MB_ICONSTOP "Oups, invalid selection detected!"
908 Abort
909 ${EndIf}
910 FunctionEnd
912 Function DetectCPUType
913 StrCpy $DetectedCPUType 6 ;generic
914 StrCpy $DetectedCPUCores 2
916 Banner::show /NOUNLOAD "$(MPLAYER_LANG_DETECTING)"
918 ${CPUFeatures.GetCount} $0
919 ${IfNot} $0 == "error"
920 StrCpy $DetectedCPUCores $0
921 ${EndIf}
923 ; Check supported features
924 ${CPUFeatures.GetVendor} $0
925 ${CPUFeatures.CheckFeature} "MMX1" $1
926 ${CPUFeatures.CheckFeature} "3DNOW" $2
927 ${CPUFeatures.CheckFeature} "SSE3" $3
928 ${CPUFeatures.CheckFeature} "SSSE3" $4
929 ${CPUFeatures.CheckFeature} "SSE4.2" $5
930 ${CPUFeatures.CheckFeature} "AVX1" $6
931 ${CPUFeatures.CheckFeature} "FMA4" $7
933 Banner::destroy
935 !ifdef CPU_DETECT_DEBUG
936 StrCpy $9 `Vendor = $0`
937 StrCpy $9 `$9$\n"MMX1" = $1`
938 StrCpy $9 `$9$\n"3DNOW" = $2`
939 StrCpy $9 `$9$\n"SSE3" = $3`
940 StrCpy $9 `$9$\n"SSSE3" = $4`
941 StrCpy $9 `$9$\n"SSE4.2" = $5`
942 StrCpy $9 `$9$\n"AVX1" = $6`
943 StrCpy $9 `$9$\n"FMA4" = $7`
944 MessageBox MB_TOPMOST `$9`
945 !endif
947 ; Make sure we have at least MMX
948 ${IfThen} $1 != "yes" ${|} Return ${|}
950 ; Select the "best" model for Intel's
951 ${If} $0 == "Intel"
952 ; Core2 (SSE3 + SSSE3)
953 ${If} $3 == "yes"
954 ${AndIf} $4 == "yes"
955 StrCpy $DetectedCPUType 2 ;
956 ${EndIf}
957 ; Nehalem (SSE3 + SSSE3 + SSE4.2)
958 ${If} $3 == "yes"
959 ${AndIf} $4 == "yes"
960 ${AndIf} $5 == "yes"
961 StrCpy $DetectedCPUType 3
962 ${EndIf}
963 ${EndIf}
965 ; Select the "best" model for AMD's
966 ${If} $0 == "AMD"
967 ; K8+SSE3 (3DNow! + SSE3)
968 ${If} $2 == "yes"
969 ${AndIf} $3 == "yes"
970 StrCpy $DetectedCPUType 4
971 ${EndIf}
972 ; Bulldozer (SSE3 + SSSE3 + SSE4.2 + AVX + FMA4)
973 ${If} $3 == "yes"
974 ${AndIf} $4 == "yes"
975 ${AndIf} $5 == "yes"
976 ${AndIf} $6 == "yes"
977 ${AndIf} $7 == "yes"
978 StrCpy $DetectedCPUType 5
979 ${EndIf}
980 ${EndIf}
981 FunctionEnd
984 ;--------------------------------------------------------------------------------
985 ; CUSTOME PAGE: TWEAKS
986 ;--------------------------------------------------------------------------------
988 Function SetTweaksPage_Show
989 ; Apply current selection to dialog
990 StrCpy $0 1
991 ${For} $1 2 4
992 IntOp $2 $0 & $SelectedTweaks
993 ${If} $2 != 0
994 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "1"
995 ${Else}
996 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field $1" "State" "0"
997 ${EndIf}
998 IntOp $0 $0 << 1
999 ${Next}
1001 ; Translate
1002 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 1" "Text" "$(MPLAYER_LANG_TWEAKS_HINT)"
1003 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 2" "Text" "$(MPLAYER_LANG_TWEAKS_SKINNEDUI)"
1004 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 3" "Text" "$(MPLAYER_LANG_TWEAKS_OPENGL)"
1005 !insertmacro INSTALLOPTIONS_WRITE "Page_Tweaks.ini" "Field 4" "Text" "$(MPLAYER_LANG_TWEAKS_VOLNORM)"
1007 ; Display dialog
1008 !insertmacro MUI_HEADER_TEXT "$(MPLAYER_LANG_TWEAKS_HEAD)" "$(MPLAYER_LANG_TWEAKS_TEXT)"
1009 !insertmacro INSTALLOPTIONS_DISPLAY "Page_Tweaks.ini"
1011 ; Read new selection from dialog
1012 StrCpy $0 1
1013 ${For} $1 2 4
1014 !insertmacro INSTALLOPTIONS_READ $2 "Page_Tweaks.ini" "Field $1" "State"
1015 ${IfThen} $2 == 1 ${|} IntOp $SelectedTweaks $SelectedTweaks | $0 ${|}
1016 IntOp $0 $0 << 1
1017 ${Next}
1018 FunctionEnd
1021 ;--------------------------------------------------------------------------------
1022 ; CHECK FOR UPDATE MODE
1023 ;--------------------------------------------------------------------------------
1025 Function CheckForUpdate
1026 ${StdUtils.GetParameter} $0 "Update" "?"
1027 ${IfNot} "$0" == "?"
1028 FindWindow $1 "#32770" "" $HWNDPARENT
1029 GetDlgItem $2 $1 1019
1030 EnableWindow $2 0
1031 GetDlgItem $2 $1 1001
1032 EnableWindow $2 0
1033 ${EndIf}
1034 FunctionEnd
1037 ;--------------------------------------------------------------------------------
1038 ; FINISHED
1039 ;--------------------------------------------------------------------------------
1041 Function RunAppFunction
1042 !insertmacro DisableNextButton $R0
1043 ${If} ${FileExists} "$INSTDIR\SMPlayer.exe"
1044 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\SMPlayer.exe" "open" "http://lounge-office.rautemusik.fm/"
1045 ${Else}
1046 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\MPUI.exe" "open" "http://lounge-office.rautemusik.fm/"
1047 ${EndIf}
1048 FunctionEnd
1050 Function ShowReadmeFunction
1051 !insertmacro DisableNextButton $R0
1052 ${StdUtils.ExecShellAsUser} $R0 "$INSTDIR\Readme.html" "open" ""
1053 FunctionEnd
1055 Function .onInstSuccess
1056 ${StdUtils.ExecShellAsUser} $R0 "$SMPROGRAMS\$StartMenuFolder" "explore" ""
1057 FunctionEnd
1060 ### EOF ###