1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-26 19:54:14 +01:00

added optional auto-check for Source+OrangeBox binaries to FTP installer

--HG--
branch : sourcemm-1.4.3
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.4.3%40624
This commit is contained in:
Christian Hammacher 2008-01-21 19:22:29 +00:00
parent 87b42d68e8
commit 9f306996d6
3 changed files with 116 additions and 59 deletions

Binary file not shown.

View File

@ -10838,12 +10838,12 @@ object frmMain: TfrmMain
Height = 13
Caption = '2. Connect to server and select the mod directory:'
end
object lblStep4: TLabel
object lblStep5: TLabel
Left = 44
Top = 296
Top = 338
Width = 64
Height = 13
Caption = '4. Click Next.'
Caption = '5. Click Next.'
end
object lblStep3: TLabel
Left = 44
@ -10852,6 +10852,13 @@ object frmMain: TfrmMain
Height = 13
Caption = '3. Select the operating system of your server:'
end
object lblStep4: TLabel
Left = 44
Top = 296
Width = 125
Height = 13
Caption = '4. Select the engine type:'
end
object pnlHeader3: TPanel
Left = 0
Top = 0
@ -11130,7 +11137,7 @@ object frmMain: TfrmMain
TabStop = True
end
object optLinux: TFlatRadioButton
Left = 173
Left = 183
Top = 3
Width = 82
Height = 14
@ -11138,7 +11145,7 @@ object frmMain: TfrmMain
TabOrder = 1
end
object FlatRadioButton1: TFlatRadioButton
Left = 353
Left = 319
Top = 3
Width = 82
Height = 14
@ -11147,6 +11154,40 @@ object frmMain: TfrmMain
TabOrder = 2
end
end
object pnlEngineType: TPanel
Left = 44
Top = 312
Width = 441
Height = 21
BevelOuter = bvLowered
TabOrder = 5
object optAutoDetect: TFlatRadioButton
Left = 1
Top = 3
Width = 154
Height = 14
Caption = 'Auto-Detect (recommended)'
Checked = True
TabOrder = 0
TabStop = True
end
object optSource: TFlatRadioButton
Left = 183
Top = 3
Width = 96
Height = 15
Caption = 'Source'#8482' Engine'
TabOrder = 1
end
object optOrangeBox: TFlatRadioButton
Left = 319
Top = 3
Width = 118
Height = 15
Caption = 'OrangeBox'#8482' Engine'
TabOrder = 2
end
end
end
object jspInstallProgress: TJvStandardPage
Left = 0
@ -11404,8 +11445,8 @@ object frmMain: TfrmMain
end
end
object ilImages: TImageList
Left = 154
Top = 324
Left = 334
Top = 8
Bitmap = {
494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
@ -11555,23 +11596,23 @@ object frmMain: TfrmMain
OnWork = IdFTPWork
ProxySettings.ProxyType = fpcmNone
ProxySettings.Port = 0
Left = 274
Top = 324
Left = 454
Top = 8
end
object IdAntiFreeze: TIdAntiFreeze
IdleTimeOut = 150
Left = 244
Top = 324
Left = 424
Top = 8
end
object tmrSpeed: TTimer
Enabled = False
OnTimer = tmrSpeedTimer
Left = 214
Top = 324
Left = 394
Top = 8
end
object IdLogFile: TIdLogFile
LogTime = False
Left = 184
Top = 324
Left = 364
Top = 8
end
end

View File

@ -63,7 +63,7 @@ type
cmdConnect: TFlatButton;
pnlDirectory: TPanel;
trvDirectories: TTreeView;
lblStep4: TLabel;
lblStep5: TLabel;
jspInstallProgress: TJvStandardPage;
pnlHeader5: TPanel;
imgIcon4: TImage;
@ -101,6 +101,11 @@ type
shpMods: TShape;
trvMods: TTreeView;
FlatRadioButton1: TFlatRadioButton;
pnlEngineType: TPanel;
optAutoDetect: TFlatRadioButton;
optSource: TFlatRadioButton;
optOrangeBox: TFlatRadioButton;
lblStep4: TLabel;
procedure jvwStepsCancelButtonClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure cmdNextClick(Sender: TObject);
@ -136,6 +141,9 @@ var
var VERSION: String = '<none>';
const NormalHeight = 382;
FTPHeight = 422;
implementation
uses UnitFunctions, UnitfrmProxy, UnitInstall, UnitSelectModPath;
@ -162,8 +170,8 @@ var ePath: String;
Source: Boolean;
begin
{ FTP }
if jplWizard.ActivePage = jspFTP then begin
if not IdFTP.Connected then
if (jplWizard.ActivePage = jspFTP) then begin
if (not IdFTP.Connected) then
IdFTP.Connect;
eStr := TStringList.Create;
ePath := '/';
@ -186,17 +194,12 @@ begin
else
eStr.Free;
// check for orangebox directory (!! OrangeBox Check !!)
Source := True;
if (AnsiSameText(trvDirectories.Selected.Text, 'tf')) or (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: begin
eStr.Free;
exit;
end;
end;
end;
if (optAutoDetect.Checked) then
Source := not ((AnsiSameText(trvDirectories.Selected.Text, 'tf')) or (Pos('orangebox', LowerCase(ePath)) <> 0))
else if (optSource.Checked) then
Source := True
else
Source := False;
// design stuff
trvDirectories.Enabled := False;
cmdConnect.Enabled := False;
@ -204,19 +207,28 @@ begin
optLinux.Enabled := False;
Screen.Cursor := crHourGlass;
if optWindows.Checked then
eOS := osWindows
if (optWindows.Checked) then begin
eOS := osWindows;
if (Source) then
rtfDetails.Lines.Text := '* Installing Source binaries for Windows' + #13#10 + #13#10
else
rtfDetails.Lines.Text := '* Installing OrangeBox binaries for Windows' + #13#10 + #13#10
end
else begin
eOS := osLinux;
if (Source) then
rtfDetails.Lines.Text := '* Installing Source binaries for Linux' + #13#10 + #13#10
else
rtfDetails.Lines.Text := '* Installing OrangeBox binaries for Linux' + #13#10 + #13#10
end;
jspInstallProgress.Show;
// installation
Screen.Cursor := crAppStart;
InstallFTP(eOS, Source, trvDirectories.Selected.Text);
end
else if jplWizard.ActivePage = jspInstallProgress then
else if (jplWizard.ActivePage = jspInstallProgress) then
Close
else if jplWizard.ActivePage = jspSelectMod then begin
else if (jplWizard.ActivePage = jspSelectMod) then begin
{ Dedicated Server }
if frbDedicatedServer.Checked then begin
Source := True;
@ -229,7 +241,7 @@ begin
ePath := trvMods.Selected.Parent.Text + '\source dedicated server\hl2mp'
else begin
{ get games }
if ePath = 'Team Fortress 2' then
if (ePath = 'Team Fortress 2') then
ePath := trvMods.Selected.Parent.Text + '\source 2007 dedicated server\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
@ -240,7 +252,7 @@ begin
end;
SteamPath := IncludeTrailingPathDelimiter(SteamPath) + 'steamapps\';
// install it
if DirectoryExists(SteamPath + ePath) then begin
if (DirectoryExists(SteamPath + ePath)) then begin
jspInstallProgress.Show;
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
end
@ -251,7 +263,7 @@ begin
end;
end;
{ Standalone Server }
if frbStandaloneServer.Checked then begin
if (frbStandaloneServer.Checked) then begin
Source := True;
ePath := trvMods.Selected.Text;
if ePath = 'Counter-Strike:Source' then
@ -262,7 +274,7 @@ begin
ePath := 'hl2mp'
else begin
{ get games }
if ePath = 'Team Fortress 2' then
if (ePath = 'Team Fortress 2') then
ePath := 'orangebox\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
@ -272,7 +284,7 @@ begin
end;
end;
// install it
if DirectoryExists(StandaloneServer + ePath) then begin
if (DirectoryExists(StandaloneServer + ePath)) then begin
jspInstallProgress.Show;
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
end
@ -283,18 +295,18 @@ begin
end;
end;
{ Listen Server }
if frbListenServer.Checked then begin
if (frbListenServer.Checked) then begin
Source := True;
ePath := trvMods.Selected.Text;
if ePath = 'Counter-Strike:Source' then
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
else if (ePath = 'Half-Life 2 Deathmatch') then
ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
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
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
@ -304,10 +316,10 @@ begin
end;
end;
if Pos(SteamPath, ePath) = 0 then
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)
else begin
if not FileExists(ePath + '\gameinfo.txt') then begin
if (not FileExists(ePath + '\gameinfo.txt')) then begin
MessageBox(Handle, 'You have to play this game once before installing Metamod:Source. Do that and try again.', PChar(Application.Title), MB_ICONWARNING);
exit;
end;
@ -319,7 +331,7 @@ begin
{ Custom mod below }
end
else if (jplWizard.ActivePage = jspInstallMethod) then begin
if frbDedicatedServer.Checked then begin // Dedicated Server
if (frbDedicatedServer.Checked) then begin // Dedicated Server
eRegistry := TRegistry.Create(KEY_READ);
try
eRegistry.RootKey := HKEY_CURRENT_USER;
@ -329,20 +341,20 @@ begin
SteamPath := ePath;
ePath := ePath + 'SteamApps\';
if DirectoryExists(ePath) then begin
if (DirectoryExists(ePath)) then begin
trvMods.Items.Clear;
// Check Mods
eStr := GetAllFiles(ePath + '*.*', faDirectory, False, True, False);
for i := 0 to eStr.Count -1 do begin
CurNode := trvMods.Items.Add(nil, eStr[i]);
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\cstrike') then
if (DirectoryExists(ePath + eStr[i] + '\source dedicated server\cstrike')) then
trvMods.Items.AddChild(CurNode, 'Counter-Strike:Source');
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\dod') then
if (DirectoryExists(ePath + eStr[i] + '\source dedicated server\dod')) then
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
if (DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp')) then
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
if DirectoryExists(ePath + eStr[i] + '\source 2007 dedicated server\tf') then
if (DirectoryExists(ePath + eStr[i] + '\source 2007 dedicated server\tf')) then
trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
if CurNode.Count = 0 then
@ -364,11 +376,11 @@ begin
eRegistry.Free;
end;
end
else if frbListenServer.Checked then begin // Listen Server
else if (frbListenServer.Checked) then begin // Listen Server
eRegistry := TRegistry.Create(KEY_READ);
try
eRegistry.RootKey := HKEY_CURRENT_USER;
if eRegistry.OpenKey('Software\Valve\Steam', False) then begin
if (eRegistry.OpenKey('Software\Valve\Steam', False)) then begin
ePath := eRegistry.ReadString('SteamPath');
ePath := IncludeTrailingPathDelimiter(StringReplace(ePath, '/', '\', [rfReplaceAll]));
SteamPath := ePath;
@ -409,7 +421,7 @@ begin
eRegistry.Free;
end;
end
else if frbStandaloneServer.Checked then begin // Standalone Server
else if (frbStandaloneServer.Checked) then begin // Standalone Server
eRegistry := TRegistry.Create;
try
eRegistry.RootKey := HKEY_CURRENT_USER;
@ -432,7 +444,7 @@ begin
eRegistry.Free;
end;
end
else if frbSelectMod.Checked then begin
else if (frbSelectMod.Checked) then begin
{ Custom mod }
if frmSelectModPath.ShowModal = mrOk then begin
ePath := frmSelectModPath.trvDirectory.SelectedFolder.PathName;
@ -441,8 +453,10 @@ begin
InstallCustom(IncludeTrailingPathDelimiter(ePath), osWindows, not frmSelectModPath.chkUsesOrangebox.Checked);
end;
end
else if frbFTP.Checked then // FTP
else if (frbFTP.Checked) then begin // FTP
Height := FTPHeight;
jspFTP.Show;
end;
end
else
jplWizard.NextPage
@ -455,8 +469,10 @@ end;
procedure TfrmMain.cmdBackClick(Sender: TObject);
begin
if jplWizard.ActivePage = jspFTP then
jspInstallMethod.Show
if jplWizard.ActivePage = jspFTP then begin
Height := NormalHeight;
jspInstallMethod.Show;
end
else begin
jplWizard.PrevPage;
cmdBack.Visible := jplWizard.ActivePageIndex <> 0;