1.1 --- a/installer/Attach.cfg Wed Oct 10 08:56:00 2007 +0000
1.2 +++ b/installer/Attach.cfg Wed Oct 10 21:48:44 2007 +0000
1.3 @@ -31,8 +31,8 @@
1.4 -M
1.5 -$M16384,1048576
1.6 -K$00400000
1.7 --LE"c:\programme\borland\delphi7\Projects\Bpl"
1.8 --LN"c:\programme\borland\delphi7\Projects\Bpl"
1.9 +-LE"c:\program files\borland\delphi7\Projects\Bpl"
1.10 +-LN"c:\program files\borland\delphi7\Projects\Bpl"
1.11 -w-UNSAFE_TYPE
1.12 -w-UNSAFE_CODE
1.13 -w-UNSAFE_CAST
2.1 Binary file installer/Attach.exe has changed
3.1 Binary file installer/HL2Launch.exe has changed
4.1 Binary file installer/MMS_Installer.exe has changed
5.1 --- a/installer/UnitInstall.pas Wed Oct 10 08:56:00 2007 +0000
5.2 +++ b/installer/UnitInstall.pas Wed Oct 10 21:48:44 2007 +0000
5.3 @@ -13,11 +13,11 @@
5.4 procedure AddNotFound;
5.5 procedure DownloadFile(eFile: String; eDestination: String);
5.6
5.7 -procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS);
5.8 -procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
5.9 -procedure InstallListen(ePath: String);
5.10 -procedure InstallCustom(ePath: String; eOS: TOS);
5.11 -procedure InstallFTP(OS: TOS);
5.12 +procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS; const Source: Boolean);
5.13 +procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
5.14 +procedure InstallListen(ePath: String; const Source: Boolean);
5.15 +procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
5.16 +procedure InstallFTP(OS: TOS; const Source: Boolean);
5.17
5.18 var StartTime: TDateTime;
5.19 SteamPath: String;
5.20 @@ -218,7 +218,7 @@
5.21
5.22 { Basic Installation }
5.23
5.24 -procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS);
5.25 +procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS; const Source: Boolean);
5.26 var eStr: TStringList;
5.27 i: integer;
5.28 CopyConfig: Boolean;
5.29 @@ -253,7 +253,7 @@
5.30 { Unpack }
5.31 frmMain.ggeItem.Progress := 0;
5.32 AddStatus('Unpacking files...', clBlack);
5.33 - if not Unpack() then begin
5.34 + if not Unpack(Source) then begin
5.35 AddStatus('No files attached!', clRed);
5.36 Screen.Cursor := crDefault;
5.37 exit;
5.38 @@ -370,37 +370,37 @@
5.39
5.40 { Dedicated Server }
5.41
5.42 -procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
5.43 +procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
5.44 begin
5.45 StartTime := Now;
5.46 Screen.Cursor := crHourGlass;
5.47 AddStatus('Starting Metamod:Source installation on dedicated server...', clBlack, False);
5.48 - BasicInstallation(eModPath, UseSteam, False, osWindows);
5.49 + BasicInstallation(eModPath, UseSteam, False, osWindows, Source);
5.50 end;
5.51
5.52 { Listen Server }
5.53
5.54 -procedure InstallListen(ePath: String);
5.55 +procedure InstallListen(ePath: String; const Source: Boolean);
5.56 begin
5.57 StartTime := Now;
5.58 Screen.Cursor := crHourGlass;
5.59 AddStatus('Starting Metamod:Source installation on the listen server...', clBlack);
5.60 - BasicInstallation(ePath, True, True, osWindows);
5.61 + BasicInstallation(ePath, True, True, osWindows, Source);
5.62 end;
5.63
5.64 { Custom mod }
5.65
5.66 -procedure InstallCustom(ePath: String; eOS: TOS);
5.67 +procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
5.68 begin
5.69 StartTime := Now;
5.70 Screen.Cursor := crHourGlass;
5.71 AddStatus('Starting Metamod:Source installation...', clBlack);
5.72 - BasicInstallation(ePath, False, False, eOS);
5.73 + BasicInstallation(ePath, False, False, eOS, Source);
5.74 end;
5.75
5.76 { FTP }
5.77
5.78 -procedure InstallFTP(OS: TOS);
5.79 +procedure InstallFTP(OS: TOS; const Source: Boolean);
5.80 function DoReconnect: Boolean;
5.81 begin
5.82 Result := False;
5.83 @@ -432,7 +432,7 @@
5.84 { Unpack }
5.85 frmMain.ggeItem.Progress := 0;
5.86 AddStatus('Unpacking files...', clBlack);
5.87 - if not Unpack() then begin
5.88 + if not Unpack(Source) then begin
5.89 AddStatus('No files attached!', clRed);
5.90 Screen.Cursor := crDefault;
5.91 exit;
6.1 --- a/installer/UnitPackSystem.pas Wed Oct 10 08:56:00 2007 +0000
6.2 +++ b/installer/UnitPackSystem.pas Wed Oct 10 21:48:44 2007 +0000
6.3 @@ -4,11 +4,11 @@
6.4
6.5 uses SysUtils, Classes, Zlib;
6.6
6.7 -procedure CompressFiles(Files : TStrings; const Filename : String);
6.8 -function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
6.9 +procedure CompressFiles(Files: TStrings; const Filename: String);
6.10 +function DecompressStream(Stream: TMemoryStream; DestDirectory: String; const Source: Boolean): Boolean;
6.11 function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream; Version: String): Boolean;
6.12 function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
6.13 -function Unpack: Boolean;
6.14 +function Unpack(const Source: Boolean): Boolean;
6.15 function GetVersion: String;
6.16
6.17 implementation
6.18 @@ -68,7 +68,8 @@
6.19 DeleteFile('tmp');
6.20 end;
6.21 end;
6.22 -function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
6.23 +
6.24 +function DecompressStream(Stream : TMemoryStream; DestDirectory : String; const Source: Boolean): Boolean;
6.25 var
6.26 dest,s : String;
6.27 decompr : TDecompressionStream;
6.28 @@ -82,23 +83,26 @@
6.29 try
6.30 { number of files }
6.31 Stream.Read(c,SizeOf(c));
6.32 - for i := 1 to c do
6.33 - begin
6.34 + for i := 1 to c do begin
6.35 { read filename }
6.36 Stream.Read(l,SizeOf(l));
6.37 SetLength(s,l);
6.38 Stream.Read(s[1],l);
6.39 - { read filesize }
6.40 - Stream.Read(l,SizeOf(l));
6.41 - { decompress the files and store it }
6.42 - s := dest+s; //include the path
6.43 - outfile := TFileStream.Create(s,fmCreate);
6.44 - decompr := TDecompressionStream.Create(Stream);
6.45 - try
6.46 - outfile.CopyFrom(decompr,l);
6.47 - finally
6.48 - outfile.Free;
6.49 - decompr.Free;
6.50 + { check if this is the right file }
6.51 + if ((Pos('.source', s) <> 0) and (Source)) or ((Pos('.orangebox', s) <> 0) and (not Source)) then begin
6.52 + { remove extension and read filesize }
6.53 + s := ChangeFileExt(s, '');
6.54 + Stream.Read(l,SizeOf(l));
6.55 + { decompress the files and store it }
6.56 + s := dest+s; //include the path
6.57 + outfile := TFileStream.Create(s,fmCreate);
6.58 + decompr := TDecompressionStream.Create(Stream);
6.59 + try
6.60 + outfile.CopyFrom(decompr,l);
6.61 + finally
6.62 + outfile.Free;
6.63 + decompr.Free;
6.64 + end;
6.65 end;
6.66 end;
6.67 finally
6.68 @@ -177,14 +181,14 @@
6.69
6.70 { Unpack function }
6.71
6.72 -function Unpack: Boolean;
6.73 +function Unpack(const Source: Boolean): Boolean;
6.74 var eStream: TMemoryStream;
6.75 begin
6.76 eStream := TMemoryStream.Create;
6.77 try
6.78 // Get ZIP
6.79 LoadFromFile(ParamStr(0), eStream);
6.80 - DecompressStream(eStream, ExtractFilePath(ParamStr(0))); // Unpack files
6.81 + DecompressStream(eStream, ExtractFilePath(ParamStr(0)), Source); // Unpack files
6.82
6.83 Result := True;
6.84 except
7.1 --- a/installer/UnitfrmMain.pas Wed Oct 10 08:56:00 2007 +0000
7.2 +++ b/installer/UnitfrmMain.pas Wed Oct 10 21:48:44 2007 +0000
7.3 @@ -159,6 +159,7 @@
7.4 CurNode: TTreeNode;
7.5 eOS: TOS;
7.6 i: integer;
7.7 + Source: Boolean;
7.8 begin
7.9 { FTP }
7.10 if jplWizard.ActivePage = jspFTP then begin
7.11 @@ -175,14 +176,27 @@
7.12 end;
7.13 IdFTP.ChangeDir(ePath);
7.14 IdFTP.List(eStr, '', False);
7.15 - if eStr.IndexOf('gameinfo.txt') = -1 then begin
7.16 + eStr.CaseSensitive := False;
7.17 + // check if gameinfo.txt is in the directory -> valid installation
7.18 + if (eStr.IndexOf('gameinfo.txt') = -1) then begin
7.19 MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING);
7.20 eStr.Free;
7.21 exit;
7.22 end
7.23 else
7.24 eStr.Free;
7.25 -
7.26 + // check for orangebox directory
7.27 + Source := True;
7.28 + if (eStr.IndexOf('orangebox') <> -1) then begin
7.29 + 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
7.30 + mrYes: Source := False;
7.31 + mrNo: Source := True;
7.32 + mrCancel: begin
7.33 + eStr.Free;
7.34 + exit;
7.35 + end;
7.36 + end;
7.37 + end;
7.38 // design stuff
7.39 trvDirectories.Enabled := False;
7.40 cmdConnect.Enabled := False;
7.41 @@ -198,26 +212,38 @@
7.42 jspInstallProgress.Show;
7.43 // installation
7.44 Screen.Cursor := crAppStart;
7.45 - InstallFTP(eOS);
7.46 + InstallFTP(eOS, Source);
7.47 end
7.48 else if jplWizard.ActivePage = jspInstallProgress then
7.49 Close
7.50 else if jplWizard.ActivePage = jspSelectMod then begin
7.51 { Dedicated Server }
7.52 if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin
7.53 + Source := True;
7.54 ePath := trvMods.Selected.Text;
7.55 if ePath = 'Counter-Strike:Source' then
7.56 ePath := 'cstrike'
7.57 else if ePath = 'Day of Defeat:Source' then
7.58 ePath := 'dod'
7.59 - else
7.60 - ePath := 'hl2mp';
7.61 - ePath := 'SteamApps\' + trvMods.Selected.Parent.Text + '\source dedicated server\' + ePath;
7.62 + else if ePath = 'Half-Life 2 Deathmatch' then
7.63 + ePath := 'hl2mp'
7.64 + else begin
7.65 + { get games }
7.66 + if ePath = 'Team Fortress 2' then
7.67 + ePath := 'orangebox/tf'; // TODO: !HP! check this path
7.68 + { ask user, just in case }
7.69 + 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
7.70 + mrYes: Source := False;
7.71 + mrNo: Source := True;
7.72 + mrCancel: exit;
7.73 + end;
7.74 + end;
7.75 +
7.76 // install it
7.77 if frbDedicatedServer.Checked then begin
7.78 if DirectoryExists(SteamPath + ePath) then begin
7.79 jspInstallProgress.Show;
7.80 - InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True);
7.81 + InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
7.82 end
7.83 else begin
7.84 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);
7.85 @@ -228,7 +254,7 @@
7.86 else begin
7.87 if DirectoryExists(StandaloneServer + ePath) then begin
7.88 jspInstallProgress.Show;
7.89 - InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False)
7.90 + InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
7.91 end
7.92 else begin
7.93 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);
7.94 @@ -239,13 +265,25 @@
7.95 end;
7.96 { Listen Server }
7.97 if frbListenServer.Checked then begin
7.98 + Source := True;
7.99 ePath := trvMods.Selected.Text;
7.100 if ePath = 'Counter-Strike:Source' then
7.101 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\counter-strike source\cstrike'
7.102 else if ePath = 'Half-Life 2 Deathmatch' then
7.103 ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
7.104 - else
7.105 - ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod';
7.106 + else if ePath = 'Day of Defeat:Source' then
7.107 + ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod'
7.108 + else begin
7.109 + { get games }
7.110 + if ePath = 'Team Fortress 2' then
7.111 + ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\team fortress 2\tf';
7.112 + { ask user, just in case }
7.113 + 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
7.114 + mrYes: Source := False;
7.115 + mrNo: Source := True;
7.116 + mrCancel: exit;
7.117 + end;
7.118 + end;
7.119
7.120 if Pos(SteamPath, ePath) = 0 then
7.121 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)
7.122 @@ -256,7 +294,7 @@
7.123 end;
7.124
7.125 jspInstallProgress.Show;
7.126 - InstallListen(IncludeTrailingPathDelimiter(ePath));
7.127 + InstallListen(IncludeTrailingPathDelimiter(ePath), Source);
7.128 end;
7.129 end;
7.130 { Custom mod below }
7.131 @@ -287,6 +325,7 @@
7.132 trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
7.133 if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
7.134 trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
7.135 + // TODO: !HP! add "Team Fortress 2" item here
7.136
7.137 if CurNode.Count = 0 then
7.138 CurNode.Free
7.139 @@ -330,6 +369,8 @@
7.140 trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
7.141 if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
7.142 trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
7.143 + if DirectoryExists(ePath + eStr[i] + '\team fortress 2') then
7.144 + trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
7.145
7.146 if CurNode.Count = 0 then
7.147 CurNode.Free
7.148 @@ -362,6 +403,8 @@
7.149 trvMods.Items.Add(nil, 'Day of Defeat:Source');
7.150 if DirectoryExists(StandaloneServer + 'hl2mp') then
7.151 trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
7.152 + if DirectoryExists(StandaloneServer + 'orangebox\tf') then
7.153 + trvMods.Items.Add(nil, 'Team Fortress 2');
7.154 jspSelectMod.Show;
7.155 cmdNext.Enabled := False;
7.156 end
7.157 @@ -374,8 +417,19 @@
7.158 else if frbSelectMod.Checked then begin
7.159 { Custom mod }
7.160 if frmSelectModPath.ShowModal = mrOk then begin
7.161 + ePath := IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName);
7.162 + { check if this is an orangebox game }
7.163 + Source := True;
7.164 + if (Pos('orangebox', LowerCase(ePath)) <> 0) then begin
7.165 + 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
7.166 + mrYes: Source := False;
7.167 + mrNo: Source := True;
7.168 + mrCancel: exit;
7.169 + end;
7.170 + end;
7.171 + { install now }
7.172 jspInstallProgress.Show;
7.173 - InstallCustom(IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName), osWindows);
7.174 + InstallCustom(ePath, osWindows, Source);
7.175 end;
7.176 end
7.177 else if frbFTP.Checked then // FTP