updated setup configs for current version and added directx and .net framework checks

This commit is contained in:
codeimp 2008-02-15 13:22:12 +00:00
parent 882c45d425
commit ec9157c73b
2 changed files with 271 additions and 4 deletions

View file

@ -30,13 +30,15 @@ Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:Ad
[Files]
Source: Builder.exe; DestDir: {app}; Flags: ignoreversion
Source: d3dx9_35.dll; DestDir: {app}; Flags: ignoreversion
Source: d3dx9_36.dll; DestDir: {app}; Flags: ignoreversion
Source: SlimDX.dll; DestDir: {app}; Flags: ignoreversion
Source: Sharpzip.dll; DestDir: {app}; Flags: ignoreversion
Source: Builder.cfg; DestDir: {app}; Flags: ignoreversion
Source: Compilers\*; DestDir: {app}\Compilers; Flags: ignoreversion
Source: Configurations\*; DestDir: {app}\Configurations; Flags: ignoreversion
Source: Scripting\*; DestDir: {app}\Scripting; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: Plugins\*; DestDir: {app}\Plugins; Flags: ignoreversion
[Icons]
Name: {group}\Doom Builder; Filename: {app}\Builder.exe
@ -44,9 +46,140 @@ Name: {group}\{cm:UninstallProgram,Doom Builder}; Filename: {uninstallexe}
Name: {commondesktop}\Doom Builder; Filename: {app}\Builder.exe; Tasks: desktopicon
[Run]
Filename: {app}\Builder.exe; Description: {cm:LaunchProgram,Doom Builder}; Flags: nowait postinstall skipifsilent
Filename: {app}\Builder.exe; Description: {cm:LaunchProgram,Doom Builder}; Flags: nowait postinstall skipifsilent; Check: IsAllInstalled
Filename: http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en; Flags: nowait shellexec postinstall skipifsilent; Check: not IsNetInstalled; Description: Open Microsoft .NET Framework download website
Filename: http://www.microsoft.com/directx/; Description: Open DirectX download website; Flags: nowait shellexec postinstall skipifsilent; Check: not IsDXInstalled
[UninstallDelete]
Name: {app}\Builder.log; Type: files
[InstallDelete]
Name: {app}\Builder.pdb; Type: files
[Code]
var
dxinstalled: Boolean;
netinstalled: Boolean;
// This decodes a DirectX version
procedure DecodeVersion( verstr: String; var verint: array of Integer );
var
i,p: Integer; s: string;
begin
// initialize array
verint := [0,0,0,0];
i := 0;
while ( (Length(verstr) > 0) and (i < 4) ) do
begin
p := pos('.', verstr);
if p > 0 then
begin
if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
verint[i] := StrToInt(s);
i := i + 1;
verstr := Copy( verstr, p+1, Length(verstr));
end
else
begin
verint[i] := StrToInt( verstr );
verstr := '';
end;
end;
end;
// This function compares version string
// return -1 if ver1 < ver2
// return 0 if ver1 = ver2
// return 1 if ver1 > ver2
function CompareVersion( ver1, ver2: String ) : Integer;
var
verint1, verint2: array of Integer;
i: integer;
begin
SetArrayLength( verint1, 4 );
DecodeVersion( ver1, verint1 );
SetArrayLength( verint2, 4 );
DecodeVersion( ver2, verint2 );
Result := 0; i := 0;
while ( (Result = 0) and ( i < 4 ) ) do
begin
if verint1[i] > verint2[i] then
Result := 1
else
if verint1[i] < verint2[i] then
Result := -1
else
Result := 0;
i := i + 1;
end;
end;
// DirectX version is stored in registry as 4.majorversion.minorversion
// DirectX 8.0 is 4.8.0
// DirectX 8.1 is 4.8.1
// DirectX 9.0 is 4.9.0
function GetDirectXVersion(): String;
var
sVersion: String;
begin
sVersion := '';
RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\DirectX', 'Version', sVersion );
Result := sVersion;
end;
// This will look for installed components when Setup starts up
function InitializeSetup(): Boolean;
begin
// Test dependencies
netinstalled := (RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0') = true);
dxinstalled := (CompareVersion(GetDirectXVersion(), '4.9.0.904') >= 0);
// Always continue
Result := true;
end;
// Here follow methods to check the result of installed components.
function IsDXInstalled(): Boolean;
begin
Result := dxinstalled;
end;
function IsNetInstalled(): Boolean;
begin
Result := netinstalled;
end;
function IsAllInstalled(): Boolean;
begin
Result := dxinstalled and netinstalled;
end;
// This will show messages depending on installed components, after installation.
procedure CurPageChanged(CurPageID: Integer);
begin
// Installation done page?
if(CurPageID = wpFinished) then
begin
// Test .NET 2.0
if (IsNetInstalled() = false) then
MsgBox('Microsoft .NET Framework 2.0 is not installed.'#10'Please download and install Microsoft .NET Framework 2.0 before using Doom Builder.', mbError, MB_OK);
// Test DirectX 9.0
if (IsDXInstalled() = false) then
MsgBox('Microsoft DirectX 9 is not installed. You need Microsoft DirectX 9 or later for this program to run properly.'#10'Please upgrade your DirectX version at http://www.microsoft.com/directx.', mbError, MB_OK);
end
end;

View file

@ -31,13 +31,15 @@ Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:Ad
[Files]
Source: Builder.exe; DestDir: {app}; Flags: ignoreversion
Source: Builder.pdb; DestDir: {app}; Flags: ignoreversion
Source: d3dx9_35.dll; DestDir: {app}; Flags: ignoreversion
Source: d3dx9_36.dll; DestDir: {app}; Flags: ignoreversion
Source: SlimDX.dll; DestDir: {app}; Flags: ignoreversion
Source: Sharpzip.dll; DestDir: {app}; Flags: ignoreversion
Source: Builder.cfg; DestDir: {app}; Flags: ignoreversion
Source: Compilers\*; DestDir: {app}\Compilers; Flags: ignoreversion
Source: Configurations\*; DestDir: {app}\Configurations; Flags: ignoreversion
Source: Scripting\*; DestDir: {app}\Scripting; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: Plugins\*; DestDir: {app}\Plugins; Flags: ignoreversion
[Icons]
Name: {group}\Doom Builder; Filename: {app}\Builder.exe
@ -45,7 +47,139 @@ Name: {group}\{cm:UninstallProgram,Doom Builder}; Filename: {uninstallexe}
Name: {commondesktop}\Doom Builder; Filename: {app}\Builder.exe; Tasks: desktopicon
[Run]
Filename: {app}\Builder.exe; Description: {cm:LaunchProgram,Doom Builder}; Flags: nowait postinstall skipifsilent
Filename: {app}\Builder.exe; Description: {cm:LaunchProgram,Doom Builder}; Flags: nowait postinstall skipifsilent; Check: IsAllInstalled
Filename: http://www.microsoft.com/directx/; Description: Open DirectX download website; Flags: nowait shellexec postinstall skipifsilent; Check: not IsDXInstalled
Filename: http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en; Flags: nowait shellexec postinstall skipifsilent; Check: not IsNetInstalled; Description: Open Microsoft .NET Framework download website
[UninstallDelete]
Name: {app}\Builder.log; Type: files
[Code]
var
dxinstalled: Boolean;
netinstalled: Boolean;
// This decodes a DirectX version
procedure DecodeVersion( verstr: String; var verint: array of Integer );
var
i,p: Integer; s: string;
begin
// initialize array
verint := [0,0,0,0];
i := 0;
while ( (Length(verstr) > 0) and (i < 4) ) do
begin
p := pos('.', verstr);
if p > 0 then
begin
if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
verint[i] := StrToInt(s);
i := i + 1;
verstr := Copy( verstr, p+1, Length(verstr));
end
else
begin
verint[i] := StrToInt( verstr );
verstr := '';
end;
end;
end;
// This function compares version string
// return -1 if ver1 < ver2
// return 0 if ver1 = ver2
// return 1 if ver1 > ver2
function CompareVersion( ver1, ver2: String ) : Integer;
var
verint1, verint2: array of Integer;
i: integer;
begin
SetArrayLength( verint1, 4 );
DecodeVersion( ver1, verint1 );
SetArrayLength( verint2, 4 );
DecodeVersion( ver2, verint2 );
Result := 0; i := 0;
while ( (Result = 0) and ( i < 4 ) ) do
begin
if verint1[i] > verint2[i] then
Result := 1
else
if verint1[i] < verint2[i] then
Result := -1
else
Result := 0;
i := i + 1;
end;
end;
// DirectX version is stored in registry as 4.majorversion.minorversion
// DirectX 8.0 is 4.8.0
// DirectX 8.1 is 4.8.1
// DirectX 9.0 is 4.9.0
function GetDirectXVersion(): String;
var
sVersion: String;
begin
sVersion := '';
RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\DirectX', 'Version', sVersion );
Result := sVersion;
end;
// This will look for installed components when Setup starts up
function InitializeSetup(): Boolean;
begin
// Test dependencies
netinstalled := (RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0') = true);
dxinstalled := (CompareVersion(GetDirectXVersion(), '4.9.0.904') >= 0);
// Always continue
Result := true;
end;
// Here follow methods to check the result of installed components.
function IsDXInstalled(): Boolean;
begin
Result := dxinstalled;
end;
function IsNetInstalled(): Boolean;
begin
Result := netinstalled;
end;
function IsAllInstalled(): Boolean;
begin
Result := dxinstalled and netinstalled;
end;
// This will show messages depending on installed components, after installation.
procedure CurPageChanged(CurPageID: Integer);
begin
// Installation done page?
if(CurPageID = wpFinished) then
begin
// Test .NET 2.0
if (IsNetInstalled() = false) then
MsgBox('Microsoft .NET Framework 2.0 is not installed.'#10'Please download and install Microsoft .NET Framework 2.0 before using Doom Builder.', mbError, MB_OK);
// Test DirectX 9.0
if (IsDXInstalled() = false) then
MsgBox('Microsoft DirectX 9 is not installed. You need Microsoft DirectX 9 or later for this program to run properly.'#10'Please upgrade your DirectX version at http://www.microsoft.com/directx.', mbError, MB_OK);
end
end;