1 | ;Installer script for win32/win64 SMPlayer
|
---|
2 | ;Written by redxii (redxii@users.sourceforge.net)
|
---|
3 | ;Tested/Developed with Unicode NSIS 2.46.5
|
---|
4 |
|
---|
5 | !ifndef VER_MAJOR | VER_MINOR | VER_BUILD
|
---|
6 | !error "Version information not defined (or incomplete). You must define: VER_MAJOR, VER_MINOR, VER_BUILD."
|
---|
7 | !endif
|
---|
8 |
|
---|
9 | !ifdef WIN64
|
---|
10 | !define DISABLE_CODECS
|
---|
11 | !endif
|
---|
12 |
|
---|
13 | ;--------------------------------
|
---|
14 | ;Compressor
|
---|
15 |
|
---|
16 | SetCompressor /SOLID lzma
|
---|
17 | SetCompressorDictSize 32
|
---|
18 |
|
---|
19 | ;--------------------------------
|
---|
20 | ;Additional plugin folders
|
---|
21 |
|
---|
22 | !addplugindir .
|
---|
23 | !addincludedir .
|
---|
24 |
|
---|
25 | ;--------------------------------
|
---|
26 | ;Defines
|
---|
27 |
|
---|
28 | !ifdef VER_REVISION
|
---|
29 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
30 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.${VER_REVISION}"
|
---|
31 | !else ifndef VER_REVISION
|
---|
32 | !define SMPLAYER_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
|
---|
33 | !define SMPLAYER_PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}.0"
|
---|
34 | !endif
|
---|
35 |
|
---|
36 | !ifdef WIN64
|
---|
37 | !define SMPLAYER_BUILD_DIR "smplayer-build64"
|
---|
38 | !else
|
---|
39 | !define SMPLAYER_BUILD_DIR "smplayer-build"
|
---|
40 | !endif
|
---|
41 |
|
---|
42 | !define SMPLAYER_REG_KEY "Software\SMPlayer"
|
---|
43 | !define SMPLAYER_APP_PATHS_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\smplayer.exe"
|
---|
44 | !define SMPLAYER_DEF_PROGS_KEY "Software\Clients\Media\SMPlayer"
|
---|
45 |
|
---|
46 | !define SMPLAYER_UNINST_EXE "uninst.exe"
|
---|
47 | !define SMPLAYER_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SMPlayer"
|
---|
48 |
|
---|
49 | !define CODEC_VERSION "windows-essential-20071007"
|
---|
50 |
|
---|
51 | ;--------------------------------
|
---|
52 | ;General
|
---|
53 |
|
---|
54 | ;Name and file
|
---|
55 | Name "SMPlayer ${SMPLAYER_VERSION}"
|
---|
56 | BrandingText "SMPlayer for Windows v${SMPLAYER_VERSION}"
|
---|
57 | !ifdef WIN64
|
---|
58 | OutFile "output\smplayer-${SMPLAYER_VERSION}-x64.exe"
|
---|
59 | !else
|
---|
60 | OutFile "output\smplayer-${SMPLAYER_VERSION}-win32.exe"
|
---|
61 | !endif
|
---|
62 |
|
---|
63 | ;Version tab properties
|
---|
64 | VIProductVersion "${SMPLAYER_PRODUCT_VERSION}"
|
---|
65 | VIAddVersionKey "ProductName" "SMPlayer"
|
---|
66 | VIAddVersionKey "ProductVersion" "${SMPLAYER_VERSION}"
|
---|
67 | VIAddVersionKey "FileVersion" "${SMPLAYER_VERSION}"
|
---|
68 | VIAddVersionKey "LegalCopyright" ""
|
---|
69 | !ifdef WIN64
|
---|
70 | VIAddVersionKey "FileDescription" "SMPlayer Installer (64-bit)"
|
---|
71 | !else
|
---|
72 | VIAddVersionKey "FileDescription" "SMPlayer Installer (32-bit)"
|
---|
73 | !endif
|
---|
74 |
|
---|
75 | ;Default installation folder
|
---|
76 | !ifdef WIN64
|
---|
77 | InstallDir "$PROGRAMFILES64\SMPlayer"
|
---|
78 | !else
|
---|
79 | InstallDir "$PROGRAMFILES\SMPlayer"
|
---|
80 | !endif
|
---|
81 |
|
---|
82 | ;Get installation folder from registry if available
|
---|
83 | InstallDirRegKey HKLM "${SMPLAYER_REG_KEY}" "Path"
|
---|
84 |
|
---|
85 | ;Vista+ XML manifest, does not affect older OSes
|
---|
86 | RequestExecutionLevel admin
|
---|
87 |
|
---|
88 | ShowInstDetails show
|
---|
89 | ShowUnInstDetails show
|
---|
90 |
|
---|
91 | ;--------------------------------
|
---|
92 | ;Variables
|
---|
93 |
|
---|
94 | Var Dialog_Reinstall
|
---|
95 | Var Inst_Type
|
---|
96 | Var Previous_Version
|
---|
97 | Var Previous_Version_State
|
---|
98 | Var Reinstall_ChgSettings
|
---|
99 | Var Reinstall_ChgSettings_State
|
---|
100 | Var Reinstall_Message
|
---|
101 | Var Reinstall_OverwriteButton
|
---|
102 | Var Reinstall_OverwriteButton_State
|
---|
103 | Var Reinstall_RemoveSettings
|
---|
104 | Var Reinstall_RemoveSettings_State
|
---|
105 | Var Reinstall_Uninstall
|
---|
106 | Var Reinstall_UninstallButton
|
---|
107 | Var Reinstall_UninstallButton_State
|
---|
108 | !ifndef DISABLE_CODECS
|
---|
109 | Var Restore_Codecs
|
---|
110 | !endif
|
---|
111 | Var SMPlayer_Path
|
---|
112 | Var SMPlayer_UnStrPath
|
---|
113 | Var SMPlayer_StartMenuFolder
|
---|
114 |
|
---|
115 | ;--------------------------------
|
---|
116 | ;Interface Settings
|
---|
117 |
|
---|
118 | ;Installer/Uninstaller icons
|
---|
119 | !define MUI_ICON "smplayer-orange-installer.ico"
|
---|
120 | !define MUI_UNICON "smplayer-orange-uninstaller.ico"
|
---|
121 |
|
---|
122 | ;Misc
|
---|
123 | !define MUI_WELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard.bmp"
|
---|
124 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP "smplayer-orange-wizard-un.bmp"
|
---|
125 | !define MUI_ABORTWARNING
|
---|
126 |
|
---|
127 | ;Welcome page
|
---|
128 | !define MUI_WELCOMEPAGE_TITLE $(WelcomePage_Title)
|
---|
129 | !define MUI_WELCOMEPAGE_TEXT $(WelcomePage_Text)
|
---|
130 |
|
---|
131 | ;License page
|
---|
132 | !define MUI_LICENSEPAGE_RADIOBUTTONS
|
---|
133 |
|
---|
134 | ;Components page
|
---|
135 | !define MUI_COMPONENTSPAGE_SMALLDESC
|
---|
136 |
|
---|
137 | ;Finish page
|
---|
138 | !define MUI_FINISHPAGE_LINK "http://smplayer.sourceforge.net"
|
---|
139 | !define MUI_FINISHPAGE_LINK_LOCATION "http://smplayer.sourceforge.net"
|
---|
140 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
---|
141 | !define MUI_FINISHPAGE_RUN $INSTDIR\smplayer.exe
|
---|
142 | !define MUI_FINISHPAGE_RUN_NOTCHECKED
|
---|
143 | !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Release_notes.txt
|
---|
144 | !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
---|
145 |
|
---|
146 | ;Language Selection Dialog Settings
|
---|
147 | !define MUI_LANGDLL_REGISTRY_ROOT HKLM
|
---|
148 | !define MUI_LANGDLL_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
---|
149 | !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
---|
150 |
|
---|
151 | ;Memento Settings
|
---|
152 | !define MEMENTO_REGISTRY_ROOT HKLM
|
---|
153 | !define MEMENTO_REGISTRY_KEY "${SMPLAYER_REG_KEY}"
|
---|
154 |
|
---|
155 | ;Start Menu Settings
|
---|
156 | !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SMPlayer"
|
---|
157 | !define MUI_STARTMENUPAGE_NODISABLE
|
---|
158 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
|
---|
159 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "${SMPLAYER_UNINST_KEY}"
|
---|
160 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenu"
|
---|
161 |
|
---|
162 | ;--------------------------------
|
---|
163 | ;Include Modern UI and functions
|
---|
164 |
|
---|
165 | !include MUI2.nsh
|
---|
166 | !include FileFunc.nsh
|
---|
167 | !include Memento.nsh
|
---|
168 | !include nsDialogs.nsh
|
---|
169 | !include Sections.nsh
|
---|
170 | !include WinVer.nsh
|
---|
171 | !include WordFunc.nsh
|
---|
172 | !include x64.nsh
|
---|
173 |
|
---|
174 | ;--------------------------------
|
---|
175 | ;Pages
|
---|
176 |
|
---|
177 | ;Install pages
|
---|
178 | #Welcome
|
---|
179 | !insertmacro MUI_PAGE_WELCOME
|
---|
180 |
|
---|
181 | #License
|
---|
182 | !insertmacro MUI_PAGE_LICENSE "license.txt"
|
---|
183 |
|
---|
184 | #Upgrade/Reinstall
|
---|
185 | Page custom PageReinstall PageReinstallLeave
|
---|
186 |
|
---|
187 | #Components
|
---|
188 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
|
---|
189 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
190 |
|
---|
191 | #Install Directory
|
---|
192 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
---|
193 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
194 |
|
---|
195 | #Start Menu
|
---|
196 | !define MUI_PAGE_CUSTOMFUNCTION_PRE PageStartMenuPre
|
---|
197 | !insertmacro MUI_PAGE_STARTMENU "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
198 |
|
---|
199 | !insertmacro MUI_PAGE_INSTFILES
|
---|
200 | !insertmacro MUI_PAGE_FINISH
|
---|
201 |
|
---|
202 | ;Uninstall pages
|
---|
203 | !define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
|
---|
204 | !insertmacro MUI_UNPAGE_CONFIRM
|
---|
205 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
206 | !insertmacro MUI_UNPAGE_FINISH
|
---|
207 |
|
---|
208 | ;--------------------------------
|
---|
209 | ;Languages
|
---|
210 |
|
---|
211 | !insertmacro MUI_LANGUAGE "English"
|
---|
212 | !insertmacro MUI_LANGUAGE "Albanian"
|
---|
213 | !insertmacro MUI_LANGUAGE "Arabic"
|
---|
214 | !insertmacro MUI_LANGUAGE "Basque"
|
---|
215 | !insertmacro MUI_LANGUAGE "Bulgarian"
|
---|
216 | !insertmacro MUI_LANGUAGE "Catalan"
|
---|
217 | !insertmacro MUI_LANGUAGE "Croatian"
|
---|
218 | !insertmacro MUI_LANGUAGE "Czech"
|
---|
219 | !insertmacro MUI_LANGUAGE "Danish"
|
---|
220 | !insertmacro MUI_LANGUAGE "Dutch"
|
---|
221 | !insertmacro MUI_LANGUAGE "Finnish"
|
---|
222 | !insertmacro MUI_LANGUAGE "French"
|
---|
223 | !insertmacro MUI_LANGUAGE "German"
|
---|
224 | !insertmacro MUI_LANGUAGE "Hebrew"
|
---|
225 | !insertmacro MUI_LANGUAGE "Hungarian"
|
---|
226 | !insertmacro MUI_LANGUAGE "Italian"
|
---|
227 | !insertmacro MUI_LANGUAGE "Japanese"
|
---|
228 | !insertmacro MUI_LANGUAGE "Korean"
|
---|
229 | !insertmacro MUI_LANGUAGE "Malay"
|
---|
230 | !insertmacro MUI_LANGUAGE "Norwegian"
|
---|
231 | !insertmacro MUI_LANGUAGE "Polish"
|
---|
232 | !insertmacro MUI_LANGUAGE "Portuguese"
|
---|
233 | !insertmacro MUI_LANGUAGE "PortugueseBR"
|
---|
234 | !insertmacro MUI_LANGUAGE "Russian"
|
---|
235 | !insertmacro MUI_LANGUAGE "Serbian"
|
---|
236 | !insertmacro MUI_LANGUAGE "SimpChinese"
|
---|
237 | !insertmacro MUI_LANGUAGE "Slovak"
|
---|
238 | !insertmacro MUI_LANGUAGE "Slovenian"
|
---|
239 | !insertmacro MUI_LANGUAGE "Spanish"
|
---|
240 | !insertmacro MUI_LANGUAGE "Thai"
|
---|
241 | !insertmacro MUI_LANGUAGE "TradChinese"
|
---|
242 | !insertmacro MUI_LANGUAGE "Ukrainian"
|
---|
243 |
|
---|
244 | ;Custom translations for setup
|
---|
245 |
|
---|
246 | !insertmacro LANGFILE_INCLUDE "translations\english.nsh"
|
---|
247 | !insertmacro LANGFILE_INCLUDE "translations\albanian.nsh"
|
---|
248 | !insertmacro LANGFILE_INCLUDE "translations\arabic.nsh"
|
---|
249 | !insertmacro LANGFILE_INCLUDE "translations\basque.nsh"
|
---|
250 | !insertmacro LANGFILE_INCLUDE "translations\bulgarian.nsh"
|
---|
251 | !insertmacro LANGFILE_INCLUDE "translations\catalan.nsh"
|
---|
252 | !insertmacro LANGFILE_INCLUDE "translations\croatian.nsh"
|
---|
253 | !insertmacro LANGFILE_INCLUDE "translations\czech.nsh"
|
---|
254 | !insertmacro LANGFILE_INCLUDE "translations\danish.nsh"
|
---|
255 | !insertmacro LANGFILE_INCLUDE "translations\dutch.nsh"
|
---|
256 | !insertmacro LANGFILE_INCLUDE "translations\finnish.nsh"
|
---|
257 | !insertmacro LANGFILE_INCLUDE "translations\french.nsh"
|
---|
258 | !insertmacro LANGFILE_INCLUDE "translations\german.nsh"
|
---|
259 | !insertmacro LANGFILE_INCLUDE "translations\hebrew.nsh"
|
---|
260 | !insertmacro LANGFILE_INCLUDE "translations\hungarian.nsh"
|
---|
261 | !insertmacro LANGFILE_INCLUDE "translations\italian.nsh"
|
---|
262 | !insertmacro LANGFILE_INCLUDE "translations\japanese.nsh"
|
---|
263 | !insertmacro LANGFILE_INCLUDE "translations\korean.nsh"
|
---|
264 | !insertmacro LANGFILE_INCLUDE "translations\malay.nsh"
|
---|
265 | !insertmacro LANGFILE_INCLUDE "translations\norwegian.nsh"
|
---|
266 | !insertmacro LANGFILE_INCLUDE "translations\polish.nsh"
|
---|
267 | !insertmacro LANGFILE_INCLUDE "translations\portuguese.nsh"
|
---|
268 | !insertmacro LANGFILE_INCLUDE "translations\portuguesebrazil.nsh"
|
---|
269 | !insertmacro LANGFILE_INCLUDE "translations\russian.nsh"
|
---|
270 | !insertmacro LANGFILE_INCLUDE "translations\serbian.nsh"
|
---|
271 | !insertmacro LANGFILE_INCLUDE "translations\simpchinese.nsh"
|
---|
272 | !insertmacro LANGFILE_INCLUDE "translations\slovak.nsh"
|
---|
273 | !insertmacro LANGFILE_INCLUDE "translations\slovenian.nsh"
|
---|
274 | !insertmacro LANGFILE_INCLUDE "translations\spanish.nsh"
|
---|
275 | !insertmacro LANGFILE_INCLUDE "translations\thai.nsh"
|
---|
276 | !insertmacro LANGFILE_INCLUDE "translations\tradchinese.nsh"
|
---|
277 | !insertmacro LANGFILE_INCLUDE "translations\ukrainian.nsh"
|
---|
278 |
|
---|
279 | ;--------------------------------
|
---|
280 | ;Reserve Files
|
---|
281 |
|
---|
282 | ;These files should be inserted before other files in the data block
|
---|
283 | ;Keep these lines before any File command
|
---|
284 | ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
---|
285 |
|
---|
286 | !insertmacro MUI_RESERVEFILE_LANGDLL
|
---|
287 | ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
|
---|
288 |
|
---|
289 | ;--------------------------------
|
---|
290 | ;Installer Sections
|
---|
291 |
|
---|
292 | ;--------------------------------
|
---|
293 | ;Main SMPlayer files
|
---|
294 | Section $(Section_SMPlayer) SecSMPlayer
|
---|
295 |
|
---|
296 | SectionIn RO
|
---|
297 |
|
---|
298 | ${If} $Reinstall_Uninstall == 1
|
---|
299 |
|
---|
300 | ${If} $Reinstall_UninstallButton_State == 1
|
---|
301 | Exec '"$SMPlayer_UnStrPath" /X'
|
---|
302 | Quit
|
---|
303 | ${ElseIf} $Reinstall_OverwriteButton_State == 1
|
---|
304 |
|
---|
305 | !ifndef DISABLE_CODECS
|
---|
306 | Call Backup_Codecs
|
---|
307 | !endif
|
---|
308 |
|
---|
309 | ${If} "$INSTDIR" == "$SMPlayer_Path"
|
---|
310 | ExecWait '"$SMPlayer_UnStrPath" /S /R _?=$SMPlayer_Path'
|
---|
311 | ${Else}
|
---|
312 | ExecWait '"$SMPlayer_UnStrPath" /S /R'
|
---|
313 | ${EndIf}
|
---|
314 |
|
---|
315 | Sleep 2500
|
---|
316 |
|
---|
317 | ${EndIf}
|
---|
318 |
|
---|
319 | ${EndIf}
|
---|
320 |
|
---|
321 | SetOutPath "$INSTDIR"
|
---|
322 | File "${SMPLAYER_BUILD_DIR}\*"
|
---|
323 |
|
---|
324 | ;SMPlayer docs
|
---|
325 | SetOutPath "$INSTDIR\docs"
|
---|
326 | File /r "${SMPLAYER_BUILD_DIR}\docs\*.*"
|
---|
327 |
|
---|
328 | ;Qt imageformats
|
---|
329 | SetOutPath "$INSTDIR\imageformats"
|
---|
330 | File /r "${SMPLAYER_BUILD_DIR}\imageformats\*.*"
|
---|
331 |
|
---|
332 | ;Qt platforms (Qt 5+)
|
---|
333 | SetOutPath "$INSTDIR\platforms"
|
---|
334 | File /nonfatal /r "${SMPLAYER_BUILD_DIR}\platforms\*.*"
|
---|
335 |
|
---|
336 | ;SMPlayer key shortcuts
|
---|
337 | SetOutPath "$INSTDIR\shortcuts"
|
---|
338 | File /r "${SMPLAYER_BUILD_DIR}\shortcuts\*.*"
|
---|
339 |
|
---|
340 | !ifndef DISABLE_CODECS
|
---|
341 | SetOutPath "$PLUGINSDIR"
|
---|
342 | File 7za.exe
|
---|
343 | !endif
|
---|
344 |
|
---|
345 | ;Initialize to 0 if don't exist (based on error flag)
|
---|
346 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer
|
---|
347 | ${If} ${Errors}
|
---|
348 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x0
|
---|
349 | ${EndIf}
|
---|
350 |
|
---|
351 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs
|
---|
352 | ${If} ${Errors}
|
---|
353 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
354 | ${EndIf}
|
---|
355 |
|
---|
356 | SectionEnd
|
---|
357 |
|
---|
358 | ;--------------------------------
|
---|
359 | ;Shortcuts
|
---|
360 | SectionGroup $(ShortcutGroupTitle)
|
---|
361 |
|
---|
362 | ${MementoSection} $(Section_DesktopShortcut) SecDesktopShortcut
|
---|
363 |
|
---|
364 | SetOutPath "$INSTDIR"
|
---|
365 | CreateShortCut "$DESKTOP\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
366 |
|
---|
367 | ${MementoSectionEnd}
|
---|
368 |
|
---|
369 | ${MementoSection} $(Section_StartMenu) SecStartMenuShortcut
|
---|
370 |
|
---|
371 | SetOutPath "$INSTDIR"
|
---|
372 | !insertmacro MUI_STARTMENU_WRITE_BEGIN SMP_SMenu
|
---|
373 | CreateDirectory "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
---|
374 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk" "$INSTDIR\smplayer.exe"
|
---|
375 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk" "$INSTDIR\smtube.exe"
|
---|
376 | WriteINIStr "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url" "InternetShortcut" "URL" "http://smplayer.sourceforge.net"
|
---|
377 | CreateShortCut "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
378 | !insertmacro MUI_STARTMENU_WRITE_END
|
---|
379 |
|
---|
380 | ${MementoSectionEnd}
|
---|
381 |
|
---|
382 | SectionGroupEnd
|
---|
383 |
|
---|
384 | ;--------------------------------
|
---|
385 | ;MPlayer & MPlayer Codecs
|
---|
386 | SectionGroup $(MPlayerGroupTitle)
|
---|
387 |
|
---|
388 | Section $(Section_MPlayer) SecMPlayer
|
---|
389 |
|
---|
390 | SectionIn RO
|
---|
391 |
|
---|
392 | SetOutPath "$INSTDIR\mplayer"
|
---|
393 | File /r /x mplayer.exe /x mencoder.exe /x mplayer64.exe /x mencoder64.exe /x *.exe.debug /x buildinfo /x buildinfo64 "${SMPLAYER_BUILD_DIR}\mplayer\*.*"
|
---|
394 | !ifdef WIN64
|
---|
395 | File /oname=mplayer.exe "${SMPLAYER_BUILD_DIR}\mplayer\mplayer64.exe"
|
---|
396 | !else
|
---|
397 | File "${SMPLAYER_BUILD_DIR}\mplayer\mplayer.exe"
|
---|
398 | !endif
|
---|
399 |
|
---|
400 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_MPlayer 0x1
|
---|
401 |
|
---|
402 | SectionEnd
|
---|
403 |
|
---|
404 | !ifndef DISABLE_CODECS
|
---|
405 | Section /o $(Section_MPlayerCodecs) SecCodecs
|
---|
406 |
|
---|
407 | AddSize 22931
|
---|
408 |
|
---|
409 | ${If} $Restore_Codecs == 1
|
---|
410 | DetailPrint $(Info_Codecs_Restore)
|
---|
411 | CopyFiles /SILENT "$PLUGINSDIR\codecbak\*" "$INSTDIR\mplayer\codecs"
|
---|
412 | Goto check_codecs
|
---|
413 | ${ElseIf} ${FileExists} "$EXEDIR\${CODEC_VERSION}.zip"
|
---|
414 | CopyFiles /SILENT "$EXEDIR\${CODEC_VERSION}.zip" "$PLUGINSDIR"
|
---|
415 | Goto extract_codecs
|
---|
416 | ${EndIf}
|
---|
417 |
|
---|
418 | retry_codecs_dl:
|
---|
419 |
|
---|
420 | DetailPrint $(Codecs_DL_Msg)
|
---|
421 | !ifdef USE_INETC
|
---|
422 | inetc::get /CONNECTTIMEOUT 15000 /RESUME "" /BANNER $(Codecs_DL_Msg) /CAPTION $(Codecs_DL_Msg) \
|
---|
423 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/${CODEC_VERSION}.zip" \
|
---|
424 | "$PLUGINSDIR\${CODEC_VERSION}.zip" /END
|
---|
425 | Pop $R0
|
---|
426 | StrCmp $R0 OK +4 0
|
---|
427 | !else
|
---|
428 | NSISdl::download /TIMEOUT=15000 \
|
---|
429 | "http://www.mplayerhq.hu/MPlayer/releases/codecs/${CODEC_VERSION}.zip" \
|
---|
430 | "$PLUGINSDIR\${CODEC_VERSION}.zip" /END
|
---|
431 | Pop $R0
|
---|
432 | StrCmp $R0 "success" +4 0
|
---|
433 | !endif
|
---|
434 | DetailPrint $(Codecs_DL_Failed)
|
---|
435 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(Codecs_DL_Retry) /SD IDCANCEL IDRETRY retry_codecs_dl
|
---|
436 | Goto check_codecs
|
---|
437 |
|
---|
438 | extract_codecs:
|
---|
439 |
|
---|
440 | DetailPrint $(Info_Files_Extract)
|
---|
441 | nsExec::Exec '"$PLUGINSDIR\7za.exe" x "$PLUGINSDIR\${CODEC_VERSION}.zip" -y -o"$PLUGINSDIR"'
|
---|
442 |
|
---|
443 | CreateDirectory "$INSTDIR\mplayer\codecs"
|
---|
444 | CopyFiles /SILENT "$PLUGINSDIR\${CODEC_VERSION}\*" "$INSTDIR\mplayer\codecs"
|
---|
445 |
|
---|
446 | check_codecs:
|
---|
447 |
|
---|
448 | IfFileExists "$INSTDIR\mplayer\codecs\*.dll" 0 codecsInstFailed
|
---|
449 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x1
|
---|
450 | Goto done
|
---|
451 | codecsInstFailed:
|
---|
452 | DetailPrint $(Codecs_Inst_Failed)
|
---|
453 | WriteRegDWORD HKLM "${SMPLAYER_REG_KEY}" Installed_Codecs 0x0
|
---|
454 | Sleep 5000
|
---|
455 |
|
---|
456 | done:
|
---|
457 |
|
---|
458 | SectionEnd
|
---|
459 | !endif
|
---|
460 |
|
---|
461 | SectionGroupEnd
|
---|
462 |
|
---|
463 | ;--------------------------------
|
---|
464 | ;Icon themes
|
---|
465 | ${MementoSection} $(Section_IconThemes) SecThemes
|
---|
466 |
|
---|
467 | SetOutPath "$INSTDIR\themes"
|
---|
468 | File /r "${SMPLAYER_BUILD_DIR}\themes\*.*"
|
---|
469 |
|
---|
470 | ${MementoSectionEnd}
|
---|
471 |
|
---|
472 | ;--------------------------------
|
---|
473 | ;Translations
|
---|
474 | ${MementoSection} $(Section_Translations) SecTranslations
|
---|
475 |
|
---|
476 | SetOutPath "$INSTDIR\translations"
|
---|
477 | File /r "${SMPLAYER_BUILD_DIR}\translations\*.*"
|
---|
478 |
|
---|
479 | ${MementoSectionEnd}
|
---|
480 |
|
---|
481 | Section /o $(Reinstall_Msg5) SecResetSettings
|
---|
482 |
|
---|
483 | NsExec::Exec '"$INSTDIR\smplayer.exe" -delete-config'
|
---|
484 |
|
---|
485 | SectionEnd
|
---|
486 |
|
---|
487 | ;--------------------------------
|
---|
488 | ;Install/Uninstall information
|
---|
489 | Section -Post
|
---|
490 |
|
---|
491 | ;Uninstall file
|
---|
492 | WriteUninstaller "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
493 |
|
---|
494 | ;Store installed path & version
|
---|
495 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Path" "$INSTDIR"
|
---|
496 | WriteRegStr HKLM "${SMPLAYER_REG_KEY}" "Version" "${SMPLAYER_VERSION}"
|
---|
497 |
|
---|
498 | ;Allows user to use 'start smplayer.exe'
|
---|
499 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "" "$INSTDIR\smplayer.exe"
|
---|
500 | WriteRegStr HKLM "${SMPLAYER_APP_PATHS_KEY}" "Path" "$INSTDIR"
|
---|
501 |
|
---|
502 | ;Default Programs Registration (Vista & later)
|
---|
503 | ${If} ${AtLeastWinVista}
|
---|
504 | Call RegisterDefaultPrograms
|
---|
505 | ${EndIf}
|
---|
506 |
|
---|
507 | ;Registry Uninstall information
|
---|
508 | !ifdef WIN64
|
---|
509 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name) (x64)"
|
---|
510 | !else
|
---|
511 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayName" "$(^Name)"
|
---|
512 | !endif
|
---|
513 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayIcon" "$INSTDIR\smplayer.exe"
|
---|
514 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "DisplayVersion" "${SMPLAYER_VERSION}"
|
---|
515 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "HelpLink" "http://forum.smplayer.info"
|
---|
516 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "Publisher" "Ricardo Villalba"
|
---|
517 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString" "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
518 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLInfoAbout" "http://smplayer.sourceforge.net"
|
---|
519 | WriteRegStr HKLM "${SMPLAYER_UNINST_KEY}" "URLUpdateInfo" "http://smplayer.sourceforge.net"
|
---|
520 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoModify" "1"
|
---|
521 | WriteRegDWORD HKLM "${SMPLAYER_UNINST_KEY}" "NoRepair" "1"
|
---|
522 |
|
---|
523 | ;Clean up empty directories
|
---|
524 | RMDir "$INSTDIR\platforms"
|
---|
525 | !ifdef WIN64
|
---|
526 | RMDir "$INSTDIR\mplayer\codecs"
|
---|
527 | !endif
|
---|
528 |
|
---|
529 | SectionEnd
|
---|
530 |
|
---|
531 | ${MementoSectionDone}
|
---|
532 |
|
---|
533 | ;--------------------------------
|
---|
534 | ;Section descriptions
|
---|
535 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
536 | !insertmacro MUI_DESCRIPTION_TEXT ${SecSMPlayer} $(Section_SMPlayer_Desc)
|
---|
537 | !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(Section_DesktopShortcut_Desc)
|
---|
538 | !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} $(Section_StartMenu_Desc)
|
---|
539 | !insertmacro MUI_DESCRIPTION_TEXT ${SecMPlayer} $(Section_MPlayer_Desc)
|
---|
540 | !ifndef DISABLE_CODECS
|
---|
541 | !insertmacro MUI_DESCRIPTION_TEXT ${SecCodecs} $(Section_MPlayerCodecs_Desc)
|
---|
542 | !endif
|
---|
543 | !insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(Section_IconThemes_Desc)
|
---|
544 | !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(Section_Translations_Desc)
|
---|
545 | !insertmacro MUI_DESCRIPTION_TEXT ${SecResetSettings} $(Section_ResetSettings_Desc)
|
---|
546 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
547 |
|
---|
548 | ;--------------------------------
|
---|
549 | ;Macros
|
---|
550 |
|
---|
551 | !macro MacroAllExtensions _action
|
---|
552 | !insertmacro ${_action} ".3gp"
|
---|
553 | !insertmacro ${_action} ".aac"
|
---|
554 | !insertmacro ${_action} ".ac3"
|
---|
555 | !insertmacro ${_action} ".ape"
|
---|
556 | !insertmacro ${_action} ".asf"
|
---|
557 | !insertmacro ${_action} ".avi"
|
---|
558 | !insertmacro ${_action} ".bik"
|
---|
559 | !insertmacro ${_action} ".bin"
|
---|
560 | !insertmacro ${_action} ".dat"
|
---|
561 | !insertmacro ${_action} ".divx"
|
---|
562 | !insertmacro ${_action} ".dts"
|
---|
563 | !insertmacro ${_action} ".dv"
|
---|
564 | !insertmacro ${_action} ".dvr-ms"
|
---|
565 | !insertmacro ${_action} ".f4v"
|
---|
566 | !insertmacro ${_action} ".flac"
|
---|
567 | !insertmacro ${_action} ".flv"
|
---|
568 | !insertmacro ${_action} ".hdmov"
|
---|
569 | !insertmacro ${_action} ".iso"
|
---|
570 | !insertmacro ${_action} ".m1v"
|
---|
571 | !insertmacro ${_action} ".m2t"
|
---|
572 | !insertmacro ${_action} ".m2ts"
|
---|
573 | !insertmacro ${_action} ".mts"
|
---|
574 | !insertmacro ${_action} ".m2v"
|
---|
575 | !insertmacro ${_action} ".m3u"
|
---|
576 | !insertmacro ${_action} ".m3u8"
|
---|
577 | !insertmacro ${_action} ".m4a"
|
---|
578 | !insertmacro ${_action} ".m4v"
|
---|
579 | !insertmacro ${_action} ".mka"
|
---|
580 | !insertmacro ${_action} ".mkv"
|
---|
581 | !insertmacro ${_action} ".mov"
|
---|
582 | !insertmacro ${_action} ".mp3"
|
---|
583 | !insertmacro ${_action} ".mp4"
|
---|
584 | !insertmacro ${_action} ".mpeg"
|
---|
585 | !insertmacro ${_action} ".mpg"
|
---|
586 | !insertmacro ${_action} ".mpv"
|
---|
587 | !insertmacro ${_action} ".mqv"
|
---|
588 | !insertmacro ${_action} ".nsv"
|
---|
589 | !insertmacro ${_action} ".oga"
|
---|
590 | !insertmacro ${_action} ".ogg"
|
---|
591 | !insertmacro ${_action} ".ogm"
|
---|
592 | !insertmacro ${_action} ".ogv"
|
---|
593 | !insertmacro ${_action} ".ogx"
|
---|
594 | !insertmacro ${_action} ".pls"
|
---|
595 | !insertmacro ${_action} ".ra"
|
---|
596 | !insertmacro ${_action} ".ram"
|
---|
597 | !insertmacro ${_action} ".rec"
|
---|
598 | !insertmacro ${_action} ".rm"
|
---|
599 | !insertmacro ${_action} ".rmvb"
|
---|
600 | !insertmacro ${_action} ".smk"
|
---|
601 | !insertmacro ${_action} ".swf"
|
---|
602 | !insertmacro ${_action} ".thd"
|
---|
603 | !insertmacro ${_action} ".ts"
|
---|
604 | !insertmacro ${_action} ".vcd"
|
---|
605 | !insertmacro ${_action} ".vfw"
|
---|
606 | !insertmacro ${_action} ".vob"
|
---|
607 | !insertmacro ${_action} ".vp8"
|
---|
608 | !insertmacro ${_action} ".wav"
|
---|
609 | !insertmacro ${_action} ".webm"
|
---|
610 | !insertmacro ${_action} ".wma"
|
---|
611 | !insertmacro ${_action} ".wmv"
|
---|
612 | !insertmacro ${_action} ".wtv"
|
---|
613 | !macroend
|
---|
614 |
|
---|
615 | !macro WriteRegStrSupportedTypes EXT
|
---|
616 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities\FileAssociations" ${EXT} "MPlayerFileVideo"
|
---|
617 | !macroend
|
---|
618 |
|
---|
619 | !macro MacroRemoveSMPlayer
|
---|
620 | ;Delete desktop and start menu shortcuts
|
---|
621 | SetDetailsPrint textonly
|
---|
622 | DetailPrint $(Info_Del_Shortcuts)
|
---|
623 | SetDetailsPrint listonly
|
---|
624 |
|
---|
625 | SetShellVarContext all
|
---|
626 | Delete "$DESKTOP\SMPlayer.lnk"
|
---|
627 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer.lnk"
|
---|
628 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMTube.lnk"
|
---|
629 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\SMPlayer on the Web.url"
|
---|
630 | Delete "$SMPROGRAMS\$SMPlayer_StartMenuFolder\Uninstall SMPlayer.lnk"
|
---|
631 | RMDir "$SMPROGRAMS\$SMPlayer_StartMenuFolder"
|
---|
632 |
|
---|
633 | ;Delete directories recursively except for main directory
|
---|
634 | ;Do not recursively delete $INSTDIR
|
---|
635 | SetDetailsPrint textonly
|
---|
636 | DetailPrint $(Info_Del_Files)
|
---|
637 | SetDetailsPrint listonly
|
---|
638 |
|
---|
639 | RMDir /r "$INSTDIR\docs"
|
---|
640 | RMDir /r "$INSTDIR\imageformats"
|
---|
641 | RMDir /r "$INSTDIR\mplayer"
|
---|
642 | RMDir /r "$INSTDIR\platforms"
|
---|
643 | RMDir /r "$INSTDIR\shortcuts"
|
---|
644 | RMDir /r "$INSTDIR\themes"
|
---|
645 | RMDir /r "$INSTDIR\translations"
|
---|
646 | Delete "$INSTDIR\*.txt"
|
---|
647 | Delete "$INSTDIR\icudt51.dll"
|
---|
648 | Delete "$INSTDIR\icuin51.dll"
|
---|
649 | Delete "$INSTDIR\icuuc51.dll"
|
---|
650 | Delete "$INSTDIR\libgcc_s_*.dll"
|
---|
651 | Delete "$INSTDIR\libstdc++-6.dll"
|
---|
652 | Delete "$INSTDIR\libwinpthread-1.dll"
|
---|
653 | Delete "$INSTDIR\mingwm10.dll"
|
---|
654 | Delete "$INSTDIR\zlib1.dll"
|
---|
655 | Delete "$INSTDIR\Qt*.dll"
|
---|
656 | Delete "$INSTDIR\libeay32.dll"
|
---|
657 | Delete "$INSTDIR\ssleay32.dll"
|
---|
658 | Delete "$INSTDIR\sample.avi"
|
---|
659 | Delete "$INSTDIR\smplayer.exe"
|
---|
660 | Delete "$INSTDIR\smtube.exe"
|
---|
661 | Delete "$INSTDIR\dxlist.exe"
|
---|
662 |
|
---|
663 | ;Delete registry keys
|
---|
664 | SetDetailsPrint textonly
|
---|
665 | DetailPrint $(Info_Del_Registry)
|
---|
666 | SetDetailsPrint listonly
|
---|
667 |
|
---|
668 | DeleteRegKey HKLM "${SMPLAYER_REG_KEY}"
|
---|
669 | DeleteRegKey HKLM "${SMPLAYER_APP_PATHS_KEY}"
|
---|
670 | DeleteRegKey HKLM "${SMPLAYER_DEF_PROGS_KEY}"
|
---|
671 | DeleteRegKey HKLM "${SMPLAYER_UNINST_KEY}"
|
---|
672 | DeleteRegKey HKCR "MPlayerFileVideo"
|
---|
673 | DeleteRegValue HKLM "Software\RegisteredApplications" "SMPlayer"
|
---|
674 |
|
---|
675 | SetDetailsPrint both
|
---|
676 | !macroend
|
---|
677 |
|
---|
678 | ;--------------------------------
|
---|
679 | ;Shared functions
|
---|
680 |
|
---|
681 | !ifdef USE_RUNCHECK
|
---|
682 | !macro RunCheckMacro UN
|
---|
683 | Function ${UN}RunCheck
|
---|
684 |
|
---|
685 | retry_runcheck:
|
---|
686 | FindWindow $0 "QWidget" "SMPlayer"
|
---|
687 | StrCmp $0 0 notRunning
|
---|
688 | MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(SMPlayer_Is_Running) /SD IDCANCEL IDRETRY retry_runcheck
|
---|
689 | Abort
|
---|
690 | notrunning:
|
---|
691 |
|
---|
692 | FunctionEnd
|
---|
693 | !macroend
|
---|
694 | !insertmacro RunCheckMacro ""
|
---|
695 | !insertmacro RunCheckMacro "un."
|
---|
696 | !endif
|
---|
697 |
|
---|
698 | ;--------------------------------
|
---|
699 | ;Installer functions
|
---|
700 |
|
---|
701 | Function .onInit
|
---|
702 |
|
---|
703 | ${Unless} ${AtLeastWinXP}
|
---|
704 | MessageBox MB_YESNO|MB_ICONSTOP $(OS_Not_Supported) /SD IDNO IDYES installonoldwindows
|
---|
705 | Abort
|
---|
706 | installonoldwindows:
|
---|
707 | ${EndIf}
|
---|
708 |
|
---|
709 | !ifdef WIN64
|
---|
710 | ${IfNot} ${RunningX64}
|
---|
711 | MessageBox MB_OK|MB_ICONSTOP $(Win64_Required)
|
---|
712 | Abort
|
---|
713 | ${EndIf}
|
---|
714 |
|
---|
715 | SetRegView 32
|
---|
716 | ClearErrors
|
---|
717 | ReadRegStr $R0 HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
718 |
|
---|
719 | IfErrors +3 0
|
---|
720 | MessageBox MB_OK|MB_ICONSTOP $(Existing_32bitInst)
|
---|
721 | Abort
|
---|
722 |
|
---|
723 | SetRegView 64
|
---|
724 | !else
|
---|
725 | ${If} ${RunningX64}
|
---|
726 | SetRegView 64
|
---|
727 | ClearErrors
|
---|
728 | ReadRegStr $R0 HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
729 |
|
---|
730 | IfErrors +3 0
|
---|
731 | MessageBox MB_OK|MB_ICONSTOP $(Existing_64bitInst)
|
---|
732 | Abort
|
---|
733 |
|
---|
734 | SetRegView 32
|
---|
735 | ${EndIf}
|
---|
736 | !endif
|
---|
737 |
|
---|
738 | ;Check if setup is already running
|
---|
739 | System::Call 'kernel32::CreateMutexW(i 0, i 0, t "SMPlayerSetup") i .r1 ?e'
|
---|
740 | Pop $R0
|
---|
741 |
|
---|
742 | StrCmp $R0 0 +3
|
---|
743 | MessageBox MB_OK|MB_ICONEXCLAMATION $(Installer_Is_Running)
|
---|
744 | Abort
|
---|
745 |
|
---|
746 | !ifdef USE_RUNCHECK
|
---|
747 | ;Check if SMPlayer is running
|
---|
748 | ;Allow skipping check using /NORUNCHECK
|
---|
749 | ${GetParameters} $R0
|
---|
750 | ${GetOptions} $R0 "/NORUNCHECK" $R1
|
---|
751 | IfErrors 0 +2
|
---|
752 | Call RunCheck
|
---|
753 | !endif
|
---|
754 |
|
---|
755 | ;Check for admin on < Vista
|
---|
756 | UserInfo::GetAccountType
|
---|
757 | Pop $R0
|
---|
758 | ${If} $R0 != "admin"
|
---|
759 | MessageBox MB_OK|MB_ICONSTOP $(Installer_No_Admin)
|
---|
760 | Abort
|
---|
761 | ${EndIf}
|
---|
762 |
|
---|
763 | ;Setup language selection
|
---|
764 | !insertmacro MUI_LANGDLL_DISPLAY
|
---|
765 |
|
---|
766 | Call LoadPreviousSettings
|
---|
767 |
|
---|
768 | Call CheckPreviousVersion
|
---|
769 |
|
---|
770 | SetShellVarContext all
|
---|
771 |
|
---|
772 | FunctionEnd
|
---|
773 |
|
---|
774 | Function .onInstSuccess
|
---|
775 |
|
---|
776 | ${MementoSectionSave}
|
---|
777 |
|
---|
778 | FunctionEnd
|
---|
779 |
|
---|
780 | Function .onInstFailed
|
---|
781 |
|
---|
782 | SetDetailsPrint textonly
|
---|
783 | DetailPrint $(Info_RollBack)
|
---|
784 | SetDetailsPrint listonly
|
---|
785 |
|
---|
786 | !insertmacro MacroRemoveSMPlayer
|
---|
787 |
|
---|
788 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
789 | RMDir "$INSTDIR"
|
---|
790 |
|
---|
791 | FunctionEnd
|
---|
792 |
|
---|
793 | Function CheckPreviousVersion
|
---|
794 |
|
---|
795 | ClearErrors
|
---|
796 | ReadRegStr $Previous_Version HKLM "${SMPLAYER_REG_KEY}" "Version"
|
---|
797 | ReadRegStr $SMPlayer_UnStrPath HKLM "${SMPLAYER_UNINST_KEY}" "UninstallString"
|
---|
798 | ReadRegStr $SMPlayer_Path HKLM "${SMPLAYER_REG_KEY}" "Path"
|
---|
799 |
|
---|
800 | ${IfNot} ${Errors}
|
---|
801 | StrCpy $Reinstall_Uninstall 1
|
---|
802 | !ifdef WIN64
|
---|
803 | ;Workaround for InstallDirRegKey on 64-bit
|
---|
804 | StrCpy $INSTDIR $SMPlayer_Path
|
---|
805 | !endif
|
---|
806 |
|
---|
807 | ;Since we can't get input from a silent install to initialize the variables, prefer upgrading
|
---|
808 | ${If} ${Silent}
|
---|
809 | StrCpy $Reinstall_UninstallButton_State 0
|
---|
810 | StrCpy $Reinstall_OverwriteButton_State 1
|
---|
811 | ${EndIf}
|
---|
812 | ${EndIf}
|
---|
813 |
|
---|
814 | /* $Previous_Version_State Assignments:
|
---|
815 | $Previous_Version_State=0 This installer is the same version as the installed copy
|
---|
816 | $Previous_Version_State=1 A newer version than this installer is already installed
|
---|
817 | $Previous_Version_State=2 An older version than this installer is already installed */
|
---|
818 | ${VersionCompare} $Previous_Version ${SMPLAYER_VERSION} $Previous_Version_State
|
---|
819 |
|
---|
820 | ${If} $Previous_Version_State == 0
|
---|
821 | StrCpy $Inst_Type $(Type_Reinstall)
|
---|
822 | ${ElseIf} $Previous_Version_State == 1
|
---|
823 | StrCpy $Inst_Type $(Type_Downgrade)
|
---|
824 | ${ElseIf} $Previous_Version_State == 2
|
---|
825 | StrCpy $Inst_Type $(Type_Upgrade)
|
---|
826 | ${EndIf}
|
---|
827 |
|
---|
828 | FunctionEnd
|
---|
829 |
|
---|
830 | !ifndef DISABLE_CODECS
|
---|
831 | Function Backup_Codecs
|
---|
832 |
|
---|
833 | ${IfNot} ${SectionIsSelected} ${SecCodecs}
|
---|
834 | Return
|
---|
835 | ${EndIf}
|
---|
836 |
|
---|
837 | IfFileExists "$SMPlayer_Path\mplayer\codecs\*.dll" 0 NoBackup
|
---|
838 | DetailPrint $(Info_Codecs_Backup)
|
---|
839 | CreateDirectory "$PLUGINSDIR\codecbak"
|
---|
840 | CopyFiles /SILENT "$SMPlayer_Path\mplayer\codecs\*" "$PLUGINSDIR\codecbak"
|
---|
841 | StrCpy $Restore_Codecs 1
|
---|
842 | Return
|
---|
843 | NoBackup:
|
---|
844 | StrCpy $Restore_Codecs 0
|
---|
845 |
|
---|
846 | FunctionEnd
|
---|
847 | !endif
|
---|
848 |
|
---|
849 | Function LoadPreviousSettings
|
---|
850 |
|
---|
851 | ;MPlayer codecs section doesn't use Memento so we need to restore it manually
|
---|
852 | ;32-bit only
|
---|
853 | !ifndef DISABLE_CODECS
|
---|
854 | ReadRegDWORD $R0 HKLM "${SMPLAYER_REG_KEY}" "Installed_Codecs"
|
---|
855 | ${If} $R0 == 1
|
---|
856 | !insertmacro SelectSection ${SecCodecs}
|
---|
857 | ${EndIf}
|
---|
858 | !endif
|
---|
859 |
|
---|
860 | ;Gets start menu folder name
|
---|
861 | !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
862 |
|
---|
863 | ${MementoSectionRestore}
|
---|
864 |
|
---|
865 | FunctionEnd
|
---|
866 |
|
---|
867 | Function PageReinstall
|
---|
868 |
|
---|
869 | ${If} $Reinstall_Uninstall != 1
|
---|
870 | Abort
|
---|
871 | ${EndIf}
|
---|
872 |
|
---|
873 | nsDialogs::Create /NOUNLOAD 1018
|
---|
874 | Pop $Dialog_Reinstall
|
---|
875 |
|
---|
876 | nsDialogs::SetRTL $(^RTL)
|
---|
877 |
|
---|
878 | !insertmacro MUI_HEADER_TEXT $(Reinstall_Header_Text) $(Reinstall_Header_SubText)
|
---|
879 |
|
---|
880 | ${NSD_CreateLabel} 0 0 225u 8u $(Reinstall_Msg1)
|
---|
881 |
|
---|
882 | ${NSD_CreateText} 10u 15u 290u 14u "$SMPlayer_Path"
|
---|
883 | Pop $R0
|
---|
884 |
|
---|
885 | ${NSD_CreateLabel} 0 40u 100u 8u $(Reinstall_Msg2)
|
---|
886 |
|
---|
887 | ${NSD_CreateRadioButton} 10u 58u 200u 8u $(Reinstall_Overwrite)
|
---|
888 | Pop $Reinstall_OverwriteButton
|
---|
889 | ${NSD_CreateRadioButton} 10u 73u 200u 8u $(Reinstall_Uninstall)
|
---|
890 | Pop $Reinstall_UninstallButton
|
---|
891 |
|
---|
892 | ${NSD_CreateCheckBox} 0 90u 100% 8u $(Reinstall_Msg4)
|
---|
893 | Pop $Reinstall_ChgSettings
|
---|
894 |
|
---|
895 | ${NSD_CreateCheckBox} 0 102u 100% 8u $(Reinstall_Msg5)
|
---|
896 | Pop $Reinstall_RemoveSettings
|
---|
897 |
|
---|
898 | ${NSD_CreateLabel} 0 121u 100% 16u
|
---|
899 | Pop $Reinstall_Message
|
---|
900 |
|
---|
901 | SendMessage $Reinstall_OverwriteButton ${BM_SETCHECK} 1 0
|
---|
902 | EnableWindow $R0 0
|
---|
903 |
|
---|
904 | ${If} $Reinstall_ChgSettings_State == 1
|
---|
905 | SendMessage $Reinstall_ChgSettings ${BM_SETCHECK} 1 0
|
---|
906 | ${Endif}
|
---|
907 |
|
---|
908 | ${If} $Reinstall_RemoveSettings_State == 1
|
---|
909 | SendMessage $Reinstall_RemoveSettings ${BM_SETCHECK} 1 0
|
---|
910 | ${Endif}
|
---|
911 |
|
---|
912 | ${NSD_OnClick} $Reinstall_OverwriteButton PageReinstallUpdate
|
---|
913 | ${NSD_OnClick} $Reinstall_UninstallButton PageReinstallUpdate
|
---|
914 | ${NSD_OnClick} $Reinstall_ChgSettings PageReinstallUpdate
|
---|
915 |
|
---|
916 | Call PageReinstallUpdate
|
---|
917 |
|
---|
918 | nsDialogs::Show
|
---|
919 |
|
---|
920 | FunctionEnd
|
---|
921 |
|
---|
922 | Function PageReinstallLeave
|
---|
923 |
|
---|
924 | ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
|
---|
925 | ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
|
---|
926 | ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
|
---|
927 | ${NSD_GetState} $Reinstall_RemoveSettings $Reinstall_RemoveSettings_State
|
---|
928 |
|
---|
929 | ${If} $Reinstall_RemoveSettings_State == 1
|
---|
930 | !insertmacro SelectSection ${SecResetSettings}
|
---|
931 | ${EndIf}
|
---|
932 |
|
---|
933 | FunctionEnd
|
---|
934 |
|
---|
935 | Function PageReinstallUpdate
|
---|
936 |
|
---|
937 | ${NSD_GetState} $Reinstall_OverwriteButton $Reinstall_OverwriteButton_State
|
---|
938 | ${NSD_GetState} $Reinstall_UninstallButton $Reinstall_UninstallButton_State
|
---|
939 | ${NSD_GetState} $Reinstall_ChgSettings $Reinstall_ChgSettings_State
|
---|
940 |
|
---|
941 | ${If} $Reinstall_OverwriteButton_State == 1
|
---|
942 |
|
---|
943 | EnableWindow $Reinstall_ChgSettings 1
|
---|
944 | EnableWindow $Reinstall_RemoveSettings 1
|
---|
945 |
|
---|
946 | GetDlgItem $R0 $HWNDPARENT 1
|
---|
947 | ${If} $Reinstall_ChgSettings_State != 1
|
---|
948 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(StartBtn)"
|
---|
949 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_1)
|
---|
950 | ${ElseIf} $Reinstall_ChgSettings_State == 1
|
---|
951 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
|
---|
952 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_2)
|
---|
953 | ${EndIf}
|
---|
954 |
|
---|
955 | ${ElseIf} $Reinstall_UninstallButton_State == 1
|
---|
956 |
|
---|
957 | EnableWindow $Reinstall_ChgSettings 0
|
---|
958 | ${NSD_SetState} $Reinstall_ChgSettings 0
|
---|
959 |
|
---|
960 | EnableWindow $Reinstall_RemoveSettings 0
|
---|
961 | ${NSD_SetState} $Reinstall_RemoveSettings 0
|
---|
962 |
|
---|
963 | GetDlgItem $R0 $HWNDPARENT 1
|
---|
964 | SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(^UninstallBtn)"
|
---|
965 |
|
---|
966 | ${NSD_SetText} $Reinstall_Message $(Reinstall_Msg3_3)
|
---|
967 |
|
---|
968 | ${EndIf}
|
---|
969 |
|
---|
970 | FunctionEnd
|
---|
971 |
|
---|
972 | Function PageComponentsPre
|
---|
973 |
|
---|
974 | ${If} $Reinstall_Uninstall == 1
|
---|
975 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
976 | Abort
|
---|
977 | ${EndIf}
|
---|
978 |
|
---|
979 | FunctionEnd
|
---|
980 |
|
---|
981 | Function PageDirectoryPre
|
---|
982 |
|
---|
983 | ${If} $Reinstall_Uninstall == 1
|
---|
984 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
985 | Abort
|
---|
986 | ${EndIf}
|
---|
987 |
|
---|
988 | FunctionEnd
|
---|
989 |
|
---|
990 | Function PageStartMenuPre
|
---|
991 |
|
---|
992 | ${If} $Reinstall_Uninstall == 1
|
---|
993 | ${AndIf} $Reinstall_ChgSettings_State != 1
|
---|
994 | Abort
|
---|
995 | ${EndIf}
|
---|
996 |
|
---|
997 | ${IfNot} ${SectionIsSelected} ${SecStartMenuShortcut}
|
---|
998 | Abort
|
---|
999 | ${EndIf}
|
---|
1000 |
|
---|
1001 | FunctionEnd
|
---|
1002 |
|
---|
1003 | Function RegisterDefaultPrograms
|
---|
1004 |
|
---|
1005 | WriteRegStr HKCR "MPlayerFileVideo\DefaultIcon" "" '"$INSTDIR\smplayer.exe",1'
|
---|
1006 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue" "" "Enqueue in SMPlayer"
|
---|
1007 | WriteRegStr HKCR "MPlayerFileVideo\shell\enqueue\command" "" '"$INSTDIR\smplayer.exe" -add-to-playlist "%1"'
|
---|
1008 | WriteRegStr HKCR "MPlayerFileVideo\shell\open" "FriendlyAppName" "SMPlayer Media Player"
|
---|
1009 | WriteRegStr HKCR "MPlayerFileVideo\shell\open\command" "" '"$INSTDIR\smplayer.exe" "%1"'
|
---|
1010 |
|
---|
1011 | ;Modify the list of extensions added in the MacroAllExtensions macro
|
---|
1012 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}" "" "SMPlayer"
|
---|
1013 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities" "ApplicationDescription" $(Application_Description)
|
---|
1014 | WriteRegStr HKLM "${SMPLAYER_DEF_PROGS_KEY}\Capabilities" "ApplicationName" "SMPlayer"
|
---|
1015 | WriteRegStr HKLM "Software\RegisteredApplications" "SMPlayer" "${SMPLAYER_DEF_PROGS_KEY}\Capabilities"
|
---|
1016 | !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
|
---|
1017 |
|
---|
1018 | FunctionEnd
|
---|
1019 |
|
---|
1020 | /*************************************** Uninstaller *******************************************/
|
---|
1021 |
|
---|
1022 | Section Uninstall
|
---|
1023 |
|
---|
1024 | ;Make sure SMPlayer is installed from where the uninstaller is being executed.
|
---|
1025 | IfFileExists "$INSTDIR\smplayer.exe" +2
|
---|
1026 | Abort $(Uninstaller_InvalidDirectory)
|
---|
1027 |
|
---|
1028 | SetDetailsPrint textonly
|
---|
1029 | DetailPrint $(Info_Rest_Assoc)
|
---|
1030 | SetDetailsPrint listonly
|
---|
1031 |
|
---|
1032 | ;Don't restore file associations if reinstalling
|
---|
1033 | ${un.GetParameters} $R0
|
---|
1034 | ${un.GetOptionsS} $R0 "/R" $R1
|
---|
1035 |
|
---|
1036 | IfErrors 0 +2
|
---|
1037 | ExecWait '"$INSTDIR\smplayer.exe" -uninstall'
|
---|
1038 |
|
---|
1039 | !insertmacro MacroRemoveSMPlayer
|
---|
1040 |
|
---|
1041 | Delete "$INSTDIR\${SMPLAYER_UNINST_EXE}"
|
---|
1042 | RMDir "$INSTDIR"
|
---|
1043 |
|
---|
1044 | SectionEnd
|
---|
1045 |
|
---|
1046 | ;--------------------------------
|
---|
1047 | ;Required functions
|
---|
1048 |
|
---|
1049 | !insertmacro un.GetParameters
|
---|
1050 | !insertmacro un.GetOptions
|
---|
1051 |
|
---|
1052 | ;--------------------------------
|
---|
1053 | ;Uninstaller functions
|
---|
1054 |
|
---|
1055 | Function un.onInit
|
---|
1056 |
|
---|
1057 | !ifdef WIN64
|
---|
1058 | ${IfNot} ${RunningX64}
|
---|
1059 | MessageBox MB_OK|MB_ICONSTOP $(Uninstaller_64bitOnly)
|
---|
1060 | Abort
|
---|
1061 | ${EndIf}
|
---|
1062 |
|
---|
1063 | SetRegView 64
|
---|
1064 | !endif
|
---|
1065 |
|
---|
1066 | ;Check for admin on < Vista
|
---|
1067 | UserInfo::GetAccountType
|
---|
1068 | Pop $R0
|
---|
1069 | ${If} $R0 != "admin"
|
---|
1070 | MessageBox MB_OK|MB_ICONSTOP $(Uninstaller_No_Admin)
|
---|
1071 | Abort
|
---|
1072 | ${EndIf}
|
---|
1073 |
|
---|
1074 | !ifdef USE_RUNCHECK
|
---|
1075 | ;Check if SMPlayer is running
|
---|
1076 | ;Allow skipping check using /NORUNCHECK
|
---|
1077 | ${un.GetParameters} $R0
|
---|
1078 | ${un.GetOptions} $R0 "/NORUNCHECK" $R1
|
---|
1079 | IfErrors 0 +2
|
---|
1080 | Call un.RunCheck
|
---|
1081 | !endif
|
---|
1082 |
|
---|
1083 | ;Gets start menu folder name
|
---|
1084 | !insertmacro MUI_STARTMENU_GETFOLDER "SMP_SMenu" $SMPlayer_StartMenuFolder
|
---|
1085 |
|
---|
1086 | ;Get the stored language preference
|
---|
1087 | !insertmacro MUI_UNGETLANGUAGE
|
---|
1088 |
|
---|
1089 | FunctionEnd
|
---|
1090 |
|
---|
1091 | Function un.ConfirmPagePre
|
---|
1092 |
|
---|
1093 | ${un.GetParameters} $R0
|
---|
1094 |
|
---|
1095 | ${un.GetOptionsS} $R0 "/X" $R1
|
---|
1096 | ${Unless} ${Errors}
|
---|
1097 | Abort
|
---|
1098 | ${EndUnless}
|
---|
1099 |
|
---|
1100 | FunctionEnd
|
---|