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 Height = 13
Caption = '2. Connect to server and select the mod directory:' Caption = '2. Connect to server and select the mod directory:'
end end
object lblStep4: TLabel object lblStep5: TLabel
Left = 44 Left = 44
Top = 296 Top = 338
Width = 64 Width = 64
Height = 13 Height = 13
Caption = '4. Click Next.' Caption = '5. Click Next.'
end end
object lblStep3: TLabel object lblStep3: TLabel
Left = 44 Left = 44
@ -10852,6 +10852,13 @@ object frmMain: TfrmMain
Height = 13 Height = 13
Caption = '3. Select the operating system of your server:' Caption = '3. Select the operating system of your server:'
end end
object lblStep4: TLabel
Left = 44
Top = 296
Width = 125
Height = 13
Caption = '4. Select the engine type:'
end
object pnlHeader3: TPanel object pnlHeader3: TPanel
Left = 0 Left = 0
Top = 0 Top = 0
@ -11130,7 +11137,7 @@ object frmMain: TfrmMain
TabStop = True TabStop = True
end end
object optLinux: TFlatRadioButton object optLinux: TFlatRadioButton
Left = 173 Left = 183
Top = 3 Top = 3
Width = 82 Width = 82
Height = 14 Height = 14
@ -11138,7 +11145,7 @@ object frmMain: TfrmMain
TabOrder = 1 TabOrder = 1
end end
object FlatRadioButton1: TFlatRadioButton object FlatRadioButton1: TFlatRadioButton
Left = 353 Left = 319
Top = 3 Top = 3
Width = 82 Width = 82
Height = 14 Height = 14
@ -11147,6 +11154,40 @@ object frmMain: TfrmMain
TabOrder = 2 TabOrder = 2
end end
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 end
object jspInstallProgress: TJvStandardPage object jspInstallProgress: TJvStandardPage
Left = 0 Left = 0
@ -11404,8 +11445,8 @@ object frmMain: TfrmMain
end end
end end
object ilImages: TImageList object ilImages: TImageList
Left = 154 Left = 334
Top = 324 Top = 8
Bitmap = { Bitmap = {
494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010 0000000000003600000028000000400000001000000001002000000000000010
@ -11555,23 +11596,23 @@ object frmMain: TfrmMain
OnWork = IdFTPWork OnWork = IdFTPWork
ProxySettings.ProxyType = fpcmNone ProxySettings.ProxyType = fpcmNone
ProxySettings.Port = 0 ProxySettings.Port = 0
Left = 274 Left = 454
Top = 324 Top = 8
end end
object IdAntiFreeze: TIdAntiFreeze object IdAntiFreeze: TIdAntiFreeze
IdleTimeOut = 150 IdleTimeOut = 150
Left = 244 Left = 424
Top = 324 Top = 8
end end
object tmrSpeed: TTimer object tmrSpeed: TTimer
Enabled = False Enabled = False
OnTimer = tmrSpeedTimer OnTimer = tmrSpeedTimer
Left = 214 Left = 394
Top = 324 Top = 8
end end
object IdLogFile: TIdLogFile object IdLogFile: TIdLogFile
LogTime = False LogTime = False
Left = 184 Left = 364
Top = 324 Top = 8
end end
end end

View File

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