installer/UnitfrmMain.pas
changeset 411 7c1526f514b3
parent 285 05c677265fbc
child 416 ce19c95e3f93
     1.1 --- a/installer/UnitfrmMain.pas	Wed Oct 10 08:56:00 2007 +0000
     1.2 +++ b/installer/UnitfrmMain.pas	Wed Oct 10 21:48:44 2007 +0000
     1.3 @@ -159,6 +159,7 @@
     1.4      CurNode: TTreeNode;
     1.5      eOS: TOS;
     1.6      i: integer;
     1.7 +    Source: Boolean;
     1.8  begin
     1.9    { FTP }
    1.10    if jplWizard.ActivePage = jspFTP then begin
    1.11 @@ -175,14 +176,27 @@
    1.12      end;
    1.13      IdFTP.ChangeDir(ePath);
    1.14      IdFTP.List(eStr, '', False);
    1.15 -    if eStr.IndexOf('gameinfo.txt') = -1 then begin
    1.16 +    eStr.CaseSensitive := False;
    1.17 +    // check if gameinfo.txt is in the directory -> valid installation
    1.18 +    if (eStr.IndexOf('gameinfo.txt') = -1) then begin
    1.19        MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING);
    1.20        eStr.Free;
    1.21        exit;
    1.22      end
    1.23      else
    1.24        eStr.Free;
    1.25 -
    1.26 +    // check for orangebox directory
    1.27 +    Source := True;
    1.28 +    if (eStr.IndexOf('orangebox') <> -1) then begin
    1.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
    1.30 +        mrYes: Source := False;
    1.31 +        mrNo: Source := True;
    1.32 +        mrCancel: begin
    1.33 +          eStr.Free;
    1.34 +          exit;
    1.35 +        end;
    1.36 +      end;
    1.37 +    end;
    1.38      // design stuff
    1.39      trvDirectories.Enabled := False;
    1.40      cmdConnect.Enabled := False;
    1.41 @@ -198,26 +212,38 @@
    1.42      jspInstallProgress.Show;
    1.43      // installation
    1.44      Screen.Cursor := crAppStart;
    1.45 -    InstallFTP(eOS);
    1.46 +    InstallFTP(eOS, Source);
    1.47    end
    1.48    else if jplWizard.ActivePage = jspInstallProgress then
    1.49      Close
    1.50    else if jplWizard.ActivePage = jspSelectMod then begin
    1.51      { Dedicated Server }
    1.52      if (frbDedicatedServer.Checked) or (frbStandaloneServer.Checked) then begin
    1.53 +      Source := True;
    1.54        ePath := trvMods.Selected.Text;
    1.55        if ePath = 'Counter-Strike:Source' then
    1.56          ePath := 'cstrike'
    1.57        else if ePath = 'Day of Defeat:Source' then
    1.58          ePath := 'dod'
    1.59 -      else
    1.60 -        ePath := 'hl2mp';
    1.61 -      ePath := 'SteamApps\' + trvMods.Selected.Parent.Text + '\source dedicated server\' + ePath;
    1.62 +      else if ePath = 'Half-Life 2 Deathmatch' then
    1.63 +        ePath := 'hl2mp'
    1.64 +      else begin
    1.65 +        { get games }
    1.66 +        if ePath = 'Team Fortress 2' then
    1.67 +          ePath := 'orangebox/tf'; // TODO: !HP! check this path
    1.68 +        { ask user, just in case }
    1.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
    1.70 +          mrYes: Source := False;
    1.71 +          mrNo: Source := True;
    1.72 +          mrCancel: exit;
    1.73 +        end;
    1.74 +      end;
    1.75 +
    1.76        // install it
    1.77        if frbDedicatedServer.Checked then begin
    1.78          if DirectoryExists(SteamPath + ePath) then begin
    1.79            jspInstallProgress.Show;
    1.80 -          InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True);
    1.81 +          InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
    1.82          end
    1.83          else begin
    1.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);
    1.85 @@ -228,7 +254,7 @@
    1.86        else begin
    1.87          if DirectoryExists(StandaloneServer + ePath) then begin
    1.88            jspInstallProgress.Show;
    1.89 -          InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False)
    1.90 +          InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
    1.91          end
    1.92          else begin
    1.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);
    1.94 @@ -239,13 +265,25 @@
    1.95      end;
    1.96      { Listen Server }
    1.97      if frbListenServer.Checked then begin
    1.98 +      Source := True;
    1.99        ePath := trvMods.Selected.Text;
   1.100        if ePath = 'Counter-Strike:Source' then
   1.101          ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\counter-strike source\cstrike'
   1.102        else if ePath = 'Half-Life 2 Deathmatch' then
   1.103          ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\half-life 2 deathmatch\hl2mp'
   1.104 -      else
   1.105 -        ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod';
   1.106 +      else if ePath = 'Day of Defeat:Source' then
   1.107 +        ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\day of defeat source\dod'
   1.108 +      else begin
   1.109 +        { get games }
   1.110 +        if ePath = 'Team Fortress 2' then
   1.111 +          ePath := SteamPath + 'SteamApps\' + trvMods.Selected.Parent.Text + '\team fortress 2\tf';
   1.112 +        { ask user, just in case }
   1.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
   1.114 +          mrYes: Source := False;
   1.115 +          mrNo: Source := True;
   1.116 +          mrCancel: exit;
   1.117 +        end;
   1.118 +      end;
   1.119  
   1.120        if Pos(SteamPath, ePath) = 0 then
   1.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)
   1.122 @@ -256,7 +294,7 @@
   1.123          end;
   1.124  
   1.125          jspInstallProgress.Show;
   1.126 -        InstallListen(IncludeTrailingPathDelimiter(ePath));
   1.127 +        InstallListen(IncludeTrailingPathDelimiter(ePath), Source);
   1.128        end;
   1.129      end;
   1.130      { Custom mod below }
   1.131 @@ -287,6 +325,7 @@
   1.132                  trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
   1.133                if DirectoryExists(ePath + eStr[i] + '\source dedicated server\hl2mp') then
   1.134                  trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
   1.135 +              // TODO: !HP! add "Team Fortress 2" item here
   1.136  
   1.137                if CurNode.Count = 0 then
   1.138                  CurNode.Free
   1.139 @@ -330,6 +369,8 @@
   1.140                  trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
   1.141                if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
   1.142                  trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
   1.143 +              if DirectoryExists(ePath + eStr[i] + '\team fortress 2') then
   1.144 +                trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
   1.145  
   1.146                if CurNode.Count = 0 then
   1.147                  CurNode.Free
   1.148 @@ -362,6 +403,8 @@
   1.149              trvMods.Items.Add(nil, 'Day of Defeat:Source');
   1.150            if DirectoryExists(StandaloneServer + 'hl2mp') then
   1.151              trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
   1.152 +          if DirectoryExists(StandaloneServer + 'orangebox\tf') then
   1.153 +            trvMods.Items.Add(nil, 'Team Fortress 2');
   1.154            jspSelectMod.Show;
   1.155            cmdNext.Enabled := False;
   1.156          end
   1.157 @@ -374,8 +417,19 @@
   1.158      else if frbSelectMod.Checked then begin 
   1.159        { Custom mod }
   1.160        if frmSelectModPath.ShowModal = mrOk then begin
   1.161 +        ePath := IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName);
   1.162 +        { check if this is an orangebox game }
   1.163 +        Source := True;
   1.164 +        if (Pos('orangebox', LowerCase(ePath)) <> 0) then begin
   1.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
   1.166 +            mrYes: Source := False;
   1.167 +            mrNo: Source := True;
   1.168 +            mrCancel: exit;
   1.169 +          end;
   1.170 +        end;
   1.171 +        { install now }
   1.172          jspInstallProgress.Show;
   1.173 -        InstallCustom(IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName), osWindows);
   1.174 +        InstallCustom(ePath, osWindows, Source);
   1.175        end;
   1.176      end
   1.177      else if frbFTP.Checked then // FTP