1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
; $Id$
;
; (C) 2009-2011 see AUTHORS
;
; This file is part of MPC-HC.
;
; MPC-HC 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 3 of the License, or
; (at your option) any later version.
;
; MPC-HC is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
; Requirements:
; Inno Setup Unicode: http://www.jrsoftware.org/isdl.php
;If you want to compile the 64bit version and/or the MSVC2010 build installer,
;define "x64build" and/or "VS2010build" (or uncomment the defines below)
#define include_license
#define localize
;#define x64Build
;#define VS2010build
;Don't forget to update the DirectX SDK number in include\Version.h (not updated so often)
;From now on you shouldn't need to change anything
#if VER < 0x05040200
#error Update your Inno Setup version
#endif
#define ISPP_IS_BUGGY
#include "..\include\Version.h"
#define app_name "Media Player Classic - Home Cinema"
#define app_version str(MPC_VERSION_MAJOR) + "." + str(MPC_VERSION_MINOR) + "." + str(MPC_VERSION_PATCH) + "." + str(MPC_VERSION_REV)
#ifdef x64Build
#define mpchc_exe = 'mpc-hc64.exe'
#define mpchc_ini = 'mpc-hc64.ini'
#else
#define mpchc_exe = 'mpc-hc.exe'
#define mpchc_ini = 'mpc-hc.ini'
#endif
#ifdef VS2010build
#define bindir = '..\bin10'
#define sse_required
#else
#define bindir = '..\bin'
#define sse_required
#endif
[Setup]
#ifdef x64Build
AppId={{2ACBF1FA-F5C3-4B19-A774-B22A31F231B9}
DefaultGroupName={#app_name} x64
UninstallDisplayName={#app_name} v{#app_version} x64
#ifdef VS2010build
OutputBaseFilename=MPC-HomeCinema.{#app_version}.x64.MSVC2010
#else
OutputBaseFilename=MPC-HomeCinema.{#app_version}.x64
#endif
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#else
AppId={{2624B969-7135-4EB1-B0F6-2D8C397B45F7}
DefaultGroupName={#app_name}
UninstallDisplayName={#app_name} v{#app_version}
#ifdef VS2010build
OutputBaseFilename=MPC-HomeCinema.{#app_version}.x86.MSVC2010
#else
OutputBaseFilename=MPC-HomeCinema.{#app_version}.x86
#endif
#endif
AppName={#app_name}
AppVersion={#app_version}
AppVerName={#app_name} v{#app_version}
AppPublisher=MPC-HC Team
AppPublisherURL=http://mpc-hc.sourceforge.net/
AppSupportURL=http://mpc-hc.sourceforge.net/
AppUpdatesURL=http://mpc-hc.sourceforge.net/
AppContact=http://mpc-hc.sourceforge.net/
AppCopyright=Copyright © 2002-2011 all contributors, see AUTHORS file
VersionInfoCompany=MPC-HC Team
VersionInfoCopyright=Copyright © 2002-2011, MPC-HC Team
VersionInfoDescription={#app_name} {#app_version} Setup
VersionInfoTextVersion={#app_version}
VersionInfoVersion={#app_version}
VersionInfoProductName={#app_name}
VersionInfoProductVersion={#app_version}
VersionInfoProductTextVersion={#app_version}
UninstallDisplayIcon={app}\{#mpchc_exe}
DefaultDirName={code:GetInstallFolder}
#ifdef include_license
LicenseFile=..\COPYING.txt
#endif
OutputDir=.
SetupIconFile=..\src\apps\mplayerc\res\icon.ico
WizardImageFile=WizardImageFile.bmp
WizardSmallImageFile=WizardSmallImageFile.bmp
Compression=lzma/ultra
SolidCompression=yes
EnableDirDoesntExistWarning=no
AllowNoIcons=yes
ShowTasksTreeLines=yes
AlwaysShowDirOnReadyPage=yes
AlwaysShowGroupOnReadyPage=yes
ShowLanguageDialog=yes
DisableDirPage=auto
DisableProgramGroupPage=auto
MinVersion=0,5.01.2600
AppMutex=MediaPlayerClassicW
[Languages]
Name: en; MessagesFile: compiler:Default.isl
#ifdef localize
Name: br; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
Name: by; MessagesFile: Languages\Belarusian.isl
Name: ca; MessagesFile: compiler:Languages\Catalan.isl
Name: cz; MessagesFile: compiler:Languages\Czech.isl
Name: de; MessagesFile: compiler:Languages\German.isl
Name: es; MessagesFile: compiler:Languages\Spanish.isl
Name: fr; MessagesFile: compiler:Languages\French.isl
Name: he; MessagesFile: compiler:Languages\Hebrew.isl
Name: hu; MessagesFile: Languages\Hungarian.isl
Name: hy; MessagesFile: Languages\Armenian.islu
Name: it; MessagesFile: compiler:Languages\Italian.isl
Name: ja; MessagesFile: compiler:Languages\Japanese.isl
Name: kr; MessagesFile: Languages\Korean.isl
Name: nl; MessagesFile: compiler:Languages\Dutch.isl
Name: pl; MessagesFile: compiler:Languages\Polish.isl
Name: ru; MessagesFile: compiler:Languages\Russian.isl
Name: sc; MessagesFile: Languages\ChineseSimp.isl
Name: se; MessagesFile: Languages\Swedish.isl
Name: sk; MessagesFile: compiler:Languages\Slovak.isl
Name: tc; MessagesFile: Languages\ChineseTrad.isl
Name: tr; MessagesFile: Languages\Turkish.isl
Name: ua; MessagesFile: Languages\Ukrainian.isl
#endif
; Include installer's custom messages
#include "custom_messages.iss"
[Messages]
BeveledLabel={#app_name} v{#app_version}
[Types]
Name: default; Description: {cm:types_DefaultInstallation}
Name: custom; Description: {cm:types_CustomInstallation}; Flags: iscustom
[Components]
Name: main; Description: {#app_name} v{#app_version}; Types: default custom; Flags: fixed
Name: mpciconlib; Description: {cm:comp_mpciconlib}; Types: default custom
#ifdef localize
Name: mpcresources; Description: {cm:comp_mpcresources}; Types: default custom
#endif
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: exclusive
Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; OnlyBelowVersion: 0,6.01; Flags: unchecked
Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Check: SettingsExistCheck(); Flags: checkedonce unchecked
[Files]
; For CPU detection
#if defined(sse_required) || defined(sse2_required)
Source: WinCPUID.dll; DestDir: {tmp}; Flags: dontcopy noencryption
#endif
#ifdef x64Build
Source: {#bindir}\mpc-hc_x64\mpc-hc64.exe; DestDir: {app}; Components: main; Flags: ignoreversion
Source: {#bindir}\mpc-hc_x64\mpciconlib.dll; DestDir: {app}; Components: mpciconlib; Flags: ignoreversion
#ifdef localize
Source: {#bindir}\mpc-hc_x64\mpcresources.??.dll; DestDir: {app}; Components: mpcresources; Flags: ignoreversion
#endif
#else
Source: {#bindir}\mpc-hc_x86\mpc-hc.exe; DestDir: {app}; Components: main; Flags: ignoreversion
Source: {#bindir}\mpc-hc_x86\mpciconlib.dll; DestDir: {app}; Components: mpciconlib; Flags: ignoreversion
#ifdef localize
Source: {#bindir}\mpc-hc_x86\mpcresources.??.dll; DestDir: {app}; Components: mpcresources; Flags: ignoreversion
#endif
#endif
Source: ..\src\apps\mplayerc\Authors.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\src\apps\mplayerc\Changelog.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\COPYING.txt; DestDir: {app}; Components: main; Flags: ignoreversion
[Icons]
#ifdef x64Build
Name: {group}\{#app_name} x64; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version} x64; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0
Name: {commondesktop}\{#app_name} x64; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version} x64; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: desktopicon\common
Name: {userdesktop}\{#app_name} x64; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version} x64; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: desktopicon\user
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#app_name} x64; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version} x64; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: quicklaunchicon
#else
Name: {group}\{#app_name}; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version}; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0
Name: {commondesktop}\{#app_name}; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version}; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: desktopicon\common
Name: {userdesktop}\{#app_name}; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version}; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: desktopicon\user
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#app_name}; Filename: {app}\{#mpchc_exe}; Comment: {#app_name} v{#app_version}; WorkingDir: {app}; IconFilename: {app}\{#mpchc_exe}; IconIndex: 0; Tasks: quicklaunchicon
#endif
Name: {group}\Changelog; Filename: {app}\Changelog.txt; Comment: {cm:ViewChangelog}; WorkingDir: {app}
Name: {group}\{cm:ProgramOnTheWeb,{#app_name}}; Filename: http://mpc-hc.sourceforge.net/
Name: {group}\{cm:UninstallProgram,{#app_name}}; Filename: {uninstallexe}; Comment: {cm:UninstallProgram,{#app_name}}; WorkingDir: {app}
[Run]
Filename: {app}\{#mpchc_exe}; Description: {cm:LaunchProgram,{#app_name}}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked
Filename: {app}\Changelog.txt; Description: {cm:ViewChangelog}; WorkingDir: {app}; Flags: shellexec nowait postinstall skipifsilent unchecked
[InstallDelete]
Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: NOT IsTaskSelected('desktopicon\user') AND IsUpdate()
Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: NOT IsTaskSelected('desktopicon\common') AND IsUpdate()
Type: files; Name: {app}\AUTHORS; Check: IsUpdate()
Type: files; Name: {app}\ChangeLog; Check: IsUpdate()
Type: files; Name: {app}\COPYING; Check: IsUpdate()
[Code]
// CPU detection functions
#if defined(sse_required) || defined(sse2_required)
#include "innosetup_cpu_detection.iss"
#endif
// Global variables and constants
const installer_mutex_name = 'mpchc_setup_mutex';
var
is_update: Boolean;
function GetInstallFolder(Default: String): String;
var
InstallPath: String;
begin
if NOT RegQueryStringValue(HKLM, 'SOFTWARE\Gabest\Media Player Classic', 'ExePath', InstallPath) then begin
Result := ExpandConstant('{pf}\Media Player Classic - Home Cinema');
end else begin
RegQueryStringValue(HKLM, 'SOFTWARE\Gabest\Media Player Classic', 'ExePath', InstallPath)
Result := ExtractFileDir(InstallPath);
if (Result = '') OR NOT DirExists(Result) then begin
Result := ExpandConstant('{pf}\Media Player Classic - Home Cinema');
end;
end;
end;
function D3DX9DLLExists(): Boolean;
begin
if FileExists(ExpandConstant('{sys}\D3DX9_{#DIRECTX_SDK_NUMBER}.dll')) then begin
Result := True;
end else
Result := False;
end;
function IsUpdate(): Boolean;
begin
Result := is_update;
end;
// Check if MPC-HC's settings exist
function SettingsExistCheck(): Boolean;
begin
if RegKeyExists(HKEY_CURRENT_USER, 'Software\Gabest\Media Player Classic') OR FileExists(ExpandConstant('{app}\{#mpchc_ini}')) then begin
Result := True;
end else
Result := False;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if IsUpdate then begin
Case PageID of
// Hide the license page
wpLicense: Result := True;
else
Result := False;
end;
end;
end;
procedure CleanUpSettingsAndFiles();
begin
DeleteFile(ExpandConstant('{app}\*.bak'));
DeleteFile(ExpandConstant('{app}\{#mpchc_ini}'));
DeleteFile(ExpandConstant('{userappdata}\Media Player Classic\default.mpcpl'));
RemoveDir(ExpandConstant('{userappdata}\Media Player Classic'));
RegDeleteKeyIncludingSubkeys(HKCU, 'Software\Gabest\Filters');
RegDeleteKeyIncludingSubkeys(HKCU, 'Software\Gabest\Media Player Classic');
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Gabest\Media Player Classic');
RegDeleteKeyIfEmpty(HKCU, 'Software\Gabest');
RegDeleteKeyIfEmpty(HKLM, 'SOFTWARE\Gabest');
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
lang : Integer;
begin
if CurStep = ssPostInstall then begin
if IsTaskSelected('reset_settings') then begin
CleanUpSettingsAndFiles;
end;
lang := StrToInt(ExpandConstant('{cm:langid}'));
RegWriteStringValue(HKLM, 'SOFTWARE\Gabest\Media Player Classic', 'ExePath', ExpandConstant('{app}\{#mpchc_exe}'));
if IsComponentSelected ('mpcresources') then begin
if FileExists(ExpandConstant('{app}\{#mpchc_ini}')) then
SetIniInt('Settings', 'InterfaceLanguage', lang, ExpandConstant('{app}\{#mpchc_ini}'))
else
RegWriteDWordValue(HKCU, 'Software\Gabest\Media Player Classic\Settings', 'InterfaceLanguage', lang);
end;
end;
if CurStep = ssDone then begin
if NOT WizardSilent() AND NOT D3DX9DLLExists() then begin
MsgBox(ExpandConstant('{cm:msg_NoD3DX9DLL_found}'), mbCriticalError, MB_OK)
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
// When uninstalling, ask the user to delete MPC-HC settings
if CurUninstallStep = usUninstall then begin
if SettingsExistCheck() then begin
if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin
CleanUpSettingsAndFiles;
end;
end;
end;
end;
function InitializeSetup(): Boolean;
begin
Result := True;
// Create a mutex for the installer and if it's already running display a message and stop installation
if CheckForMutexes(installer_mutex_name) then begin
if NOT WizardSilent() then
MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK);
Result := False;
end else begin
CreateMutex(installer_mutex_name);
#if defined(sse_required) || defined(sse2_required)
// Acquire CPU information
CPUCheck;
#if defined(sse2_required)
if Result AND NOT Is_SSE2_Supported() then begin
Result := False;
MsgBox(CustomMessage('msg_simd_sse2'), mbError, MB_OK);
end;
#elif defined(sse_required)
if Result AND NOT Is_SSE_Supported() then begin
Result := False;
MsgBox(CustomMessage('msg_simd_sse'), mbError, MB_OK);
end;
#endif
#endif
#ifdef x64Build
is_update := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2ACBF1FA-F5C3-4B19-A774-B22A31F231B9}_is1');
#else
is_update := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2624B969-7135-4EB1-B0F6-2D8C397B45F7}_is1');
#endif
end;
end;
|