From ec9157c73be6bbdd5c464b5e81551c0cce7a4596 Mon Sep 17 00:00:00 2001 From: codeimp Date: Fri, 15 Feb 2008 13:22:12 +0000 Subject: [PATCH] updated setup configs for current version and added directx and .net framework checks --- Setup/builder2_setup.iss | 137 ++++++++++++++++++++++++++++++++- Setup/builder2debug_setup.iss | 138 +++++++++++++++++++++++++++++++++- 2 files changed, 271 insertions(+), 4 deletions(-) diff --git a/Setup/builder2_setup.iss b/Setup/builder2_setup.iss index 1a37c521..768104c3 100644 --- a/Setup/builder2_setup.iss +++ b/Setup/builder2_setup.iss @@ -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; + + diff --git a/Setup/builder2debug_setup.iss b/Setup/builder2debug_setup.iss index e6f17a42..341fe8f6 100644 --- a/Setup/builder2debug_setup.iss +++ b/Setup/builder2debug_setup.iss @@ -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; + + +