mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-30 19:52:17 +01:00
updating installer for OrangeBox compatibility
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40502
This commit is contained in:
parent
23459ec6e3
commit
45d217d393
@ -31,8 +31,8 @@
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\programme\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\programme\borland\delphi7\Projects\Bpl"
|
||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,11 +13,11 @@ procedure AddSkipped;
|
||||
procedure AddNotFound;
|
||||
procedure DownloadFile(eFile: String; eDestination: String);
|
||||
|
||||
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS);
|
||||
procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
|
||||
procedure InstallListen(ePath: String);
|
||||
procedure InstallCustom(ePath: String; eOS: TOS);
|
||||
procedure InstallFTP(OS: TOS);
|
||||
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS; const Source: Boolean);
|
||||
procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
|
||||
procedure InstallListen(ePath: String; const Source: Boolean);
|
||||
procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
|
||||
procedure InstallFTP(OS: TOS; const Source: Boolean);
|
||||
|
||||
var StartTime: TDateTime;
|
||||
SteamPath: String;
|
||||
@ -218,7 +218,7 @@ end;
|
||||
|
||||
{ Basic Installation }
|
||||
|
||||
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS);
|
||||
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS; const Source: Boolean);
|
||||
var eStr: TStringList;
|
||||
i: integer;
|
||||
CopyConfig: Boolean;
|
||||
@ -253,7 +253,7 @@ begin
|
||||
{ Unpack }
|
||||
frmMain.ggeItem.Progress := 0;
|
||||
AddStatus('Unpacking files...', clBlack);
|
||||
if not Unpack() then begin
|
||||
if not Unpack(Source) then begin
|
||||
AddStatus('No files attached!', clRed);
|
||||
Screen.Cursor := crDefault;
|
||||
exit;
|
||||
@ -370,37 +370,37 @@ end;
|
||||
|
||||
{ Dedicated Server }
|
||||
|
||||
procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
|
||||
procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
|
||||
begin
|
||||
StartTime := Now;
|
||||
Screen.Cursor := crHourGlass;
|
||||
AddStatus('Starting Metamod:Source installation on dedicated server...', clBlack, False);
|
||||
BasicInstallation(eModPath, UseSteam, False, osWindows);
|
||||
BasicInstallation(eModPath, UseSteam, False, osWindows, Source);
|
||||
end;
|
||||
|
||||
{ Listen Server }
|
||||
|
||||
procedure InstallListen(ePath: String);
|
||||
procedure InstallListen(ePath: String; const Source: Boolean);
|
||||
begin
|
||||
StartTime := Now;
|
||||
Screen.Cursor := crHourGlass;
|
||||
AddStatus('Starting Metamod:Source installation on the listen server...', clBlack);
|
||||
BasicInstallation(ePath, True, True, osWindows);
|
||||
BasicInstallation(ePath, True, True, osWindows, Source);
|
||||
end;
|
||||
|
||||
{ Custom mod }
|
||||
|
||||
procedure InstallCustom(ePath: String; eOS: TOS);
|
||||
procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
|
||||
begin
|
||||
StartTime := Now;
|
||||
Screen.Cursor := crHourGlass;
|
||||
AddStatus('Starting Metamod:Source installation...', clBlack);
|
||||
BasicInstallation(ePath, False, False, eOS);
|
||||
BasicInstallation(ePath, False, False, eOS, Source);
|
||||
end;
|
||||
|
||||
{ FTP }
|
||||
|
||||
procedure InstallFTP(OS: TOS);
|
||||
procedure InstallFTP(OS: TOS; const Source: Boolean);
|
||||
function DoReconnect: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
@ -432,7 +432,7 @@ begin
|
||||
{ Unpack }
|
||||
frmMain.ggeItem.Progress := 0;
|
||||
AddStatus('Unpacking files...', clBlack);
|
||||
if not Unpack() then begin
|
||||
if not Unpack(Source) then begin
|
||||
AddStatus('No files attached!', clRed);
|
||||
Screen.Cursor := crDefault;
|
||||
exit;
|
||||
|
@ -4,11 +4,11 @@ interface
|
||||
|
||||
uses SysUtils, Classes, Zlib;
|
||||
|
||||
procedure CompressFiles(Files : TStrings; const Filename : String);
|
||||
function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
|
||||
procedure CompressFiles(Files: TStrings; const Filename: String);
|
||||
function DecompressStream(Stream: TMemoryStream; DestDirectory: String; const Source: Boolean): Boolean;
|
||||
function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream; Version: String): Boolean;
|
||||
function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
|
||||
function Unpack: Boolean;
|
||||
function Unpack(const Source: Boolean): Boolean;
|
||||
function GetVersion: String;
|
||||
|
||||
implementation
|
||||
@ -68,7 +68,8 @@ begin
|
||||
DeleteFile('tmp');
|
||||
end;
|
||||
end;
|
||||
function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
|
||||
|
||||
function DecompressStream(Stream : TMemoryStream; DestDirectory : String; const Source: Boolean): Boolean;
|
||||
var
|
||||
dest,s : String;
|
||||
decompr : TDecompressionStream;
|
||||
@ -82,13 +83,15 @@ begin
|
||||
try
|
||||
{ number of files }
|
||||
Stream.Read(c,SizeOf(c));
|
||||
for i := 1 to c do
|
||||
begin
|
||||
for i := 1 to c do begin
|
||||
{ read filename }
|
||||
Stream.Read(l,SizeOf(l));
|
||||
SetLength(s,l);
|
||||
Stream.Read(s[1],l);
|
||||
{ read filesize }
|
||||
{ check if this is the right file }
|
||||
if ((Pos('.source', s) <> 0) and (Source)) or ((Pos('.orangebox', s) <> 0) and (not Source)) then begin
|
||||
{ remove extension and read filesize }
|
||||
s := ChangeFileExt(s, '');
|
||||
Stream.Read(l,SizeOf(l));
|
||||
{ decompress the files and store it }
|
||||
s := dest+s; //include the path
|
||||
@ -101,6 +104,7 @@ begin
|
||||
decompr.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Result := True;
|
||||
end;
|
||||
@ -177,14 +181,14 @@ end;
|
||||
|
||||
{ Unpack function }
|
||||
|
||||
function Unpack: Boolean;
|
||||
function Unpack(const Source: Boolean): Boolean;
|
||||
var eStream: TMemoryStream;
|
||||
begin
|
||||
eStream := TMemoryStream.Create;
|
||||
try
|
||||
// Get ZIP
|
||||
LoadFromFile(ParamStr(0), eStream);
|
||||
DecompressStream(eStream, ExtractFilePath(ParamStr(0))); // Unpack files
|
||||
DecompressStream(eStream, ExtractFilePath(ParamStr(0)), Source); // Unpack files
|
||||
|
||||
Result := True;
|
||||
except
|
||||
|
@ -159,6 +159,7 @@ var ePath: String;
|
||||
CurNode: TTreeNode;
|
||||
eOS: TOS;
|
||||
i: integer;
|
||||
Source: Boolean;
|
||||
begin
|
||||
{ FTP }
|
||||
if jplWizard.ActivePage = jspFTP then begin
|
||||
@ -175,14 +176,27 @@ begin
|
||||
end;
|
||||
IdFTP.ChangeDir(ePath);
|
||||
IdFTP.List(eStr, '', False);
|
||||
if eStr.IndexOf('gameinfo.txt') = -1 then begin
|
||||
eStr.CaseSensitive := False;
|
||||
// check if gameinfo.txt is in the directory -> valid installation
|
||||
if (eStr.IndexOf('gameinfo.txt') = -1) then begin
|
||||
MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING);
|
||||
eStr.Free;
|
||||
exit;
|
||||
end
|
||||
else
|
||||
eStr.Free;
|
||||
|
||||
// check for orangebox directory
|
||||
Source := True;
|
||||
if (eStr.IndexOf('orangebox') <> -1) then begin
|
||||
case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
||||
mrYes: Source := False;
|
||||
mrNo: Source := True;
|
||||
mrCancel: begin
|
||||
eStr.Free;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// design stuff
|
||||
trvDirectories.Enabled := False;
|
||||
cmdConnect.Enabled := False;
|
||||
@ -198,26 +212,38 @@ begin
|
||||
jspInstallProgress.Show;
|
||||
// installation
|
||||
Screen.Cursor := crAppStart;
|
||||
InstallFTP(eOS);
|
||||
InstallFTP(eOS, Source);
|
||||
end
|
||||
else if jplWizard.ActivePage = jspInstallProgress then
|
||||
Close
|
||||
else if jplWizard.ActivePage = jspSelectMod then begin
|
||||
{ Dedicated Server }
|
||||
if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin
|
||||
Source := True;
|
||||
ePath := trvMods.Selected.Text;
|
||||
if ePath = 'Counter-Strike:Source' then
|
||||
ePath := 'cstrike'
|
||||
else if ePath = 'Day of Defeat:Source' then
|
||||
ePath := 'dod'
|
||||
else
|
||||
ePath := 'hl2mp';
|
||||
ePath := 'SteamApps\' + trvMods.Selected.Parent.Text + '\source dedicated server\' + ePath;
|
||||
else if ePath = 'Half-Life 2 Deathmatch' then
|
||||
ePath := 'hl2mp'
|
||||
else begin
|
||||
{ get games }
|
||||
if ePath = 'Team Fortress 2' then
|
||||
ePath := 'orangebox/tf'; // TODO: !HP! check this path
|
||||
{ ask user, just in case }
|
||||
case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
||||
mrYes: Source := False;
|
||||
mrNo: Source := True;
|
||||
mrCancel: exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// install it
|
||||
if frbDedicatedServer.Checked then begin
|
||||
if DirectoryExists(SteamPath + ePath) then begin
|
||||
jspInstallProgress.Show;
|
||||
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True);
|
||||
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
|
||||
end
|
||||
else begin
|
||||
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist any more. Run Dedicated Server with the chosen mod and try again.', PChar(Application.Title), MB_ICONERROR);
|
||||
@ -228,7 +254,7 @@ begin
|
||||
else begin
|
||||
if DirectoryExists(StandaloneServer + ePath) then begin
|
||||
jspInstallProgress.Show;
|
||||
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False)
|
||||
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
|
||||
end
|
||||
else begin
|
||||
MessageBox(Handle, 'Error: The directory of the mod you selected doesn''t exist (any more). Run Half-Life Dedicated Server with the chosen mod again and restart.', PChar(Application.Title), MB_ICONERROR);
|
||||
@ -239,13 +265,25 @@ begin
|
||||
end;
|
||||
{ Listen Server }
|
||||
if frbListenServer.Checked then begin
|
||||
Source := True;
|
||||
ePath := trvMods.Selected.Text;
|
||||
if ePath = 'Counter-Strike:Source' then
|
||||
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\counter-strike source\cstrike'
|
||||
else if ePath = 'Half-Life 2 Deathmatch' then
|
||||
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
|
||||
else
|
||||
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod';
|
||||
else if ePath = 'Day of Defeat:Source' then
|
||||
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod'
|
||||
else begin
|
||||
{ get games }
|
||||
if ePath = 'Team Fortress 2' then
|
||||
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\team fortress 2\tf';
|
||||
{ ask user, just in case }
|
||||
case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
||||
mrYes: Source := False;
|
||||
mrNo: Source := True;
|
||||
mrCancel: exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Pos(SteamPath, ePath) = 0 then
|
||||
MessageBox(Handle, 'An error occured. Please report this bug to the Metamod:Source team and post a new thread on the forums of www.amxmodx.org.', PChar(Application.Title), MB_ICONSTOP)
|
||||
@ -256,7 +294,7 @@ begin
|
||||
end;
|
||||
|
||||
jspInstallProgress.Show;
|
||||
InstallListen(IncludeTrailingPathDelimiter(ePath));
|
||||
InstallListen(IncludeTrailingPathDelimiter(ePath), Source);
|
||||
end;
|
||||
end;
|
||||
{ Custom mod below }
|
||||
@ -287,6 +325,7 @@ begin
|
||||
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
|
||||
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
|
||||
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
|
||||
// TODO: !HP! add "Team Fortress 2" item here
|
||||
|
||||
if CurNode.Count = 0 then
|
||||
CurNode.Free
|
||||
@ -330,6 +369,8 @@ begin
|
||||
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
|
||||
if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
|
||||
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
|
||||
if DirectoryExists(ePath + eStr[i] + '\team fortress 2') then
|
||||
trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
|
||||
|
||||
if CurNode.Count = 0 then
|
||||
CurNode.Free
|
||||
@ -362,6 +403,8 @@ begin
|
||||
trvMods.Items.Add(nil, 'Day of Defeat:Source');
|
||||
if DirectoryExists(StandaloneServer + 'hl2mp') then
|
||||
trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
|
||||
if DirectoryExists(StandaloneServer + 'orangebox\tf') then
|
||||
trvMods.Items.Add(nil, 'Team Fortress 2');
|
||||
jspSelectMod.Show;
|
||||
cmdNext.Enabled := False;
|
||||
end
|
||||
@ -374,8 +417,19 @@ begin
|
||||
else if frbSelectMod.Checked then begin
|
||||
{ Custom mod }
|
||||
if frmSelectModPath.ShowModal = mrOk then begin
|
||||
ePath := IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName);
|
||||
{ check if this is an orangebox game }
|
||||
Source := True;
|
||||
if (Pos('orangebox', LowerCase(ePath)) <> 0) then begin
|
||||
case MessageBox(Handle, 'It looks like your server is using the OrangeBox engine. Would you like to install the appropriate binaries for it?', PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
||||
mrYes: Source := False;
|
||||
mrNo: Source := True;
|
||||
mrCancel: exit;
|
||||
end;
|
||||
end;
|
||||
{ install now }
|
||||
jspInstallProgress.Show;
|
||||
InstallCustom(IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName), osWindows);
|
||||
InstallCustom(ePath, osWindows, Source);
|
||||
end;
|
||||
end
|
||||
else if frbFTP.Checked then // FTP
|
||||
|
Loading…
x
Reference in New Issue
Block a user