mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-26 19:54:14 +01:00
now creates VDF plugin, removed most of the gameinfo.txt stuff, removed hl2launch as it's no longer needed
--HG-- branch : sourcemm-1.4.3 extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.4.3%40601
This commit is contained in:
parent
8c15b8d5da
commit
cf6b8f8378
@ -31,8 +31,8 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-LE"c:\programme\borland\delphi7\Projects\Bpl"
|
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
-LN"c:\programme\borland\delphi7\Projects\Bpl"
|
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
-w-UNSAFE_TYPE
|
-w-UNSAFE_TYPE
|
||||||
-w-UNSAFE_CODE
|
-w-UNSAFE_CODE
|
||||||
-w-UNSAFE_CAST
|
-w-UNSAFE_CAST
|
||||||
|
@ -14,24 +14,31 @@ begin
|
|||||||
WriteLn('');
|
WriteLn('');
|
||||||
WriteLn('// Looking up files...');
|
WriteLn('// Looking up files...');
|
||||||
{ Check files }
|
{ Check files }
|
||||||
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe') then
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source') then
|
||||||
WriteLn('// Found files\hl2launch.exe')
|
WriteLn('// Found files\server.dll.source')
|
||||||
else begin
|
else begin
|
||||||
WriteLn('// Error: Couldn''t find files\hl2launch.exe!');
|
WriteLn('// Error: Couldn''t find files\server.dll.source!');
|
||||||
ReadLn;
|
ReadLn;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll') then
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source') then
|
||||||
WriteLn('// Found files\server.dll')
|
WriteLn('// Found files\server_i486.so.source')
|
||||||
else begin
|
else begin
|
||||||
WriteLn('// Error: Couldn''t find files\server.dll!');
|
WriteLn('// Error: Couldn''t find files\server_i486.so.source!');
|
||||||
ReadLn;
|
ReadLn;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so') then
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox') then
|
||||||
WriteLn('// Found files\server_i486.so')
|
WriteLn('// Found files\server.dll.orangebox')
|
||||||
else begin
|
else begin
|
||||||
WriteLn('// Error: Couldn''t find files\server_i486.so!');
|
WriteLn('// Error: Couldn''t find files\server.dll.orangebox!');
|
||||||
|
ReadLn;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if FileExists(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox') then
|
||||||
|
WriteLn('// Found files\server_i486.so.orangebox')
|
||||||
|
else begin
|
||||||
|
WriteLn('// Error: Couldn''t find files\server_i486.so.orangebox!');
|
||||||
ReadLn;
|
ReadLn;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -53,9 +60,10 @@ begin
|
|||||||
{ Compress files }
|
{ Compress files }
|
||||||
WriteLn('// Compressing files...');
|
WriteLn('// Compressing files...');
|
||||||
eFiles := TStringList.Create;
|
eFiles := TStringList.Create;
|
||||||
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\hl2launch.exe');
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.source');
|
||||||
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll');
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.source');
|
||||||
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so');
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server.dll.orangebox');
|
||||||
|
eFiles.Add(ExtractFilePath(ParamStr(0)) + 'files\server_i486.so.orangebox');
|
||||||
eStream := TMemoryStream.Create;
|
eStream := TMemoryStream.Create;
|
||||||
CompressFiles(eFiles, ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
CompressFiles(eFiles, ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
||||||
eStream.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
eStream.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
||||||
@ -63,6 +71,7 @@ begin
|
|||||||
AttachToFile(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe', eStream, Version);
|
AttachToFile(ExtractFilePath(ParamStr(0)) + 'MMS_Installer.exe', eStream, Version);
|
||||||
DeleteFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
DeleteFile(ExtractFilePath(ParamStr(0)) + 'temp.zip');
|
||||||
eStream.Free;
|
eStream.Free;
|
||||||
|
eFiles.Free;
|
||||||
WriteLn('// Done.');
|
WriteLn('// Done.');
|
||||||
ReadLn;
|
ReadLn;
|
||||||
end.
|
end.
|
||||||
|
Binary file not shown.
@ -1,38 +0,0 @@
|
|||||||
-$A8
|
|
||||||
-$B-
|
|
||||||
-$C+
|
|
||||||
-$D+
|
|
||||||
-$E-
|
|
||||||
-$F-
|
|
||||||
-$G+
|
|
||||||
-$H+
|
|
||||||
-$I+
|
|
||||||
-$J-
|
|
||||||
-$K-
|
|
||||||
-$L+
|
|
||||||
-$M-
|
|
||||||
-$N+
|
|
||||||
-$O+
|
|
||||||
-$P+
|
|
||||||
-$Q-
|
|
||||||
-$R-
|
|
||||||
-$S-
|
|
||||||
-$T-
|
|
||||||
-$U-
|
|
||||||
-$V+
|
|
||||||
-$W-
|
|
||||||
-$X+
|
|
||||||
-$YD
|
|
||||||
-$Z1
|
|
||||||
-cg
|
|
||||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
|
||||||
-H+
|
|
||||||
-W+
|
|
||||||
-M
|
|
||||||
-$M16384,1048576
|
|
||||||
-K$00400000
|
|
||||||
-LE"c:\programme\borland\delphi7\Projects\Bpl"
|
|
||||||
-LN"c:\programme\borland\delphi7\Projects\Bpl"
|
|
||||||
-w-UNSAFE_TYPE
|
|
||||||
-w-UNSAFE_CODE
|
|
||||||
-w-UNSAFE_CAST
|
|
@ -1,189 +0,0 @@
|
|||||||
program HL2Launch;
|
|
||||||
|
|
||||||
{$APPTYPE CONSOLE}
|
|
||||||
|
|
||||||
uses
|
|
||||||
SysUtils,
|
|
||||||
ShellApi,
|
|
||||||
Windows,
|
|
||||||
Classes;
|
|
||||||
|
|
||||||
procedure LaunchFile(eFile, eStartDir, eParams: String);
|
|
||||||
var eStartInfo: TStartupInfo;
|
|
||||||
eProcInfo: TProcessInformation;
|
|
||||||
begin
|
|
||||||
FillChar(eStartInfo, SizeOf(TStartupInfo), 0);
|
|
||||||
with eStartInfo do begin
|
|
||||||
cb := SizeOf(eStartInfo);
|
|
||||||
dwFlags := STARTF_USESHOWWINDOW;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if (CreateProcess(nil, PChar(eFile + #32 + eParams), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, PChar(eStartDir), eStartInfo, eProcInfo)) then begin
|
|
||||||
try
|
|
||||||
WaitForSingleObject(eProcInfo.hProcess, INFINITE);
|
|
||||||
finally
|
|
||||||
CloseHandle(eProcInfo.hProcess);
|
|
||||||
CloseHandle(eProcInfo.hThread);
|
|
||||||
end;
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
Write(' Done.' + #13#10);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
|
|
||||||
Write(' Couldn''t start hl2.exe!' + #13#10);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function GetFileSize(eFile: String): Int64;
|
|
||||||
var eFindHandle: THandle;
|
|
||||||
eFindData: TWIN32FINDDATA;
|
|
||||||
begin
|
|
||||||
Result := 0;
|
|
||||||
if not FileExists(eFile) then exit;
|
|
||||||
eFindHandle := FindFirstFile(PChar(eFile), eFindData);
|
|
||||||
if eFindHandle = INVALID_HANDLE_VALUE then exit;
|
|
||||||
Result := (eFindData.nFileSizeHigh * (Int64(MAXDWORD) + 1)) + eFindData.nFileSizeLow;
|
|
||||||
FindClose(eFindHandle);
|
|
||||||
end;
|
|
||||||
|
|
||||||
var eStream: TFileStream;
|
|
||||||
ePath, eParams: String;
|
|
||||||
eModDir: String;
|
|
||||||
eSearchRec: TSearchRec;
|
|
||||||
eStr: TStringList;
|
|
||||||
i: integer;
|
|
||||||
CheckSuccessful: Boolean;
|
|
||||||
StartTime: Cardinal;
|
|
||||||
begin
|
|
||||||
ePath := ExtractFilePath(ParamStr(0));
|
|
||||||
for i := 1 to ParamCount do
|
|
||||||
eParams := eParams + #32 + ParamStr(i);
|
|
||||||
Delete(eParams, 1, 1);
|
|
||||||
if Pos('console', LowerCase(eParams)) = 0 then
|
|
||||||
eParams := eParams + ' -console';
|
|
||||||
eStream := nil;
|
|
||||||
eModDir := '';
|
|
||||||
|
|
||||||
SetConsoleTitle('HL2 Launcher');
|
|
||||||
Sleep(200); // wait a few ms until the launch program is closed
|
|
||||||
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
WriteLn(' _ _ _ ____ _ _ ');
|
|
||||||
WriteLn('| | | | | |___ \ | | __ _ _ _ _ __ ___| |__ ___ _ __ ');
|
|
||||||
WriteLn('| |_| | | __) | | | / _` | | | | ''_ \ / __| ''_ \ / _ \ ''__|');
|
|
||||||
WriteLn('| _ | |___ / __/ | |__| (_| | |_| | | | | (__| | | | __/ | ');
|
|
||||||
WriteLn('|_| |_|_____|_____| |_____\__,_|\__,_|_| |_|\___|_| |_|\___|_| ');
|
|
||||||
WriteLn(' for listen servers using Metamod:Source');
|
|
||||||
WriteLn('');
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
||||||
{ Check files }
|
|
||||||
WriteLn('Checking files...');
|
|
||||||
if not FileExists(ePath + 'hl2.exe') then begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
|
|
||||||
WriteLn('Error: hl2.exe is missing! Maybe wrong directory? If not, start your HL2 Mod again via Steam and try again.');
|
|
||||||
ReadLn;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
if not FileExists(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath))) + 'steam.exe') then begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
|
|
||||||
WriteLn('Error: Cannot find steam.exe! Make sure this application is located in your listen server''s directory.');
|
|
||||||
ReadLn;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{ Verify GameInfo.txt ... }
|
|
||||||
Write('Verifying GameInfo.txt...');
|
|
||||||
if (FindFirst(ePath + '*.*', faDirectory, eSearchRec) = 0) then begin
|
|
||||||
repeat
|
|
||||||
if (FileExists(ePath + eSearchRec.Name + '\GameInfo.txt')) then begin
|
|
||||||
eModDir := eSearchRec.Name;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
until (FindNext(eSearchRec) <> 0);
|
|
||||||
end;
|
|
||||||
FindClose(eSearchRec.FindHandle);
|
|
||||||
if eModDir = '' then begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
|
|
||||||
WriteLn('');
|
|
||||||
WriteLn('Error: Couldn''t find GameInfo.txt!');
|
|
||||||
ReadLn;
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if Pos('game', LowerCase(eParams)) = 0 then // a small test which isn't worth a notice
|
|
||||||
eParams := '-game ' + eSearchRec.Name + #32 + eParams;
|
|
||||||
|
|
||||||
eStr := TStringList.Create;
|
|
||||||
eStr.LoadFromFile(ePath + eModDir + '\GameInfo.txt');
|
|
||||||
if Pos('|gameinfo_path|addons/metamod/bin', LowerCase(eStr.Text)) = 0 then begin
|
|
||||||
CheckSuccessful := False;
|
|
||||||
for i := 0 to eStr.Count -1 do begin
|
|
||||||
if Pos('searchpaths', LowerCase(Trim(eStr[i]))) = 1 then begin
|
|
||||||
if i+3 >= eStr.Count then
|
|
||||||
break;
|
|
||||||
eStr.Insert(i+2, ' GameBin |gameinfo_path|addons/metamod/bin');
|
|
||||||
CheckSuccessful := True;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if CheckSuccessful then begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
SetFileAttributes(PChar(ePath + eModDir + '\GameInfo.txt'), 0);
|
|
||||||
eStr.SaveToFile(ePath + eModDir + '\GameInfo.txt');
|
|
||||||
SetFileAttributes(PChar(ePath + eModDir + '\GameInfo.txt'), faReadOnly);
|
|
||||||
Write(' Registered MM:S sucessfully' + #13#10);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
|
|
||||||
Write(' Unexpected EOF, your GameInfo.txt seems to be corrupt' + #13#10);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
Write(' Done' + #13#10);
|
|
||||||
end;
|
|
||||||
eStr.Free;
|
|
||||||
end;
|
|
||||||
{ ... and set it to write-protected }
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
||||||
Write('Setting GameInfo.txt to write-protected...');
|
|
||||||
try
|
|
||||||
eStream := TFileStream.Create(ePath + eModDir + '\GameInfo.txt', fmShareDenyWrite);
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
Write(' Done.' + #13#10);
|
|
||||||
except
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
|
|
||||||
WriteLn('');
|
|
||||||
WriteLn('Warning: Couldn''t set GameInfo.txt to write-protected!');
|
|
||||||
eStream := nil;
|
|
||||||
end;
|
|
||||||
{ Launch Steam if not opened }
|
|
||||||
ShellExecute(0, 'open', PChar(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath))) + 'steam.exe'), nil, PChar(Copy(ePath, 1, Pos('\steamapps\', LowerCase(ePath)))), SW_SHOW);
|
|
||||||
{ Launch game }
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
||||||
Write('Starting HL2...');
|
|
||||||
StartTime := GetTickCount;
|
|
||||||
LaunchFile(ePath + 'hl2.exe', Copy(ePath, 1, Pos('Steam', ePath)+5), eParams);
|
|
||||||
if (GetTickCount - StartTime < 10000) then begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
|
|
||||||
WriteLn('Important: If you experience any problems starting HL2 using this program, please start it once via Steam and try again.');
|
|
||||||
ReadLn;
|
|
||||||
end;
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
||||||
{ Free GameInfo.txt }
|
|
||||||
Write('Removing read-only again from GameInfo.txt...');
|
|
||||||
if Assigned(eStream) then begin
|
|
||||||
eStream.Free;
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
|
|
||||||
Write(' Done' + #13#10);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
|
|
||||||
Write(' Skipped' + #13#10);
|
|
||||||
end;
|
|
||||||
{ End message }
|
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
|
|
||||||
WriteLn('');
|
|
||||||
WriteLn('Thanks for using Metamod:Source! Visit http://www.sourcemm.net/');
|
|
||||||
Sleep(2500);
|
|
||||||
end.
|
|
Binary file not shown.
@ -31,8 +31,8 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||||
-w-UNSAFE_TYPE
|
-w-UNSAFE_TYPE
|
||||||
-w-UNSAFE_CODE
|
-w-UNSAFE_CODE
|
||||||
-w-UNSAFE_CAST
|
-w-UNSAFE_CAST
|
||||||
|
Binary file not shown.
@ -10,6 +10,8 @@ function GetAllFiles(Mask: String; Attr: Integer; Recursive: Boolean; ShowDirs:
|
|||||||
// ftp
|
// ftp
|
||||||
function GetAllDirs: TStringList;
|
function GetAllDirs: TStringList;
|
||||||
|
|
||||||
|
function GetModName(const Path: String): String;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses UnitfrmMain;
|
uses UnitfrmMain;
|
||||||
@ -121,6 +123,20 @@ begin
|
|||||||
Result := eList;
|
Result := eList;
|
||||||
end; }
|
end; }
|
||||||
|
|
||||||
|
function GetModName(const Path: String): String;
|
||||||
|
var i: integer;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
for i := Length(Path) -1 downto 1 do begin
|
||||||
|
if (Path[i] = '\') or (Path[i] = '/') then begin
|
||||||
|
Result := Copy(Path, i +1, Length(Path) -i);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (Copy(Result, Length(Result), 1) = '\') or (Copy(Result, Length(Result), 1) = '/') then
|
||||||
|
Result := Copy(Result, 1, Length(Result) -1);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@ procedure AddSkipped;
|
|||||||
procedure AddNotFound;
|
procedure AddNotFound;
|
||||||
procedure DownloadFile(eFile: String; eDestination: String);
|
procedure DownloadFile(eFile: String; eDestination: String);
|
||||||
|
|
||||||
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS);
|
procedure BasicInstallation(ePath: String; SteamInstall, ListenInstall: Boolean; OS: TOS; const Source: Boolean);
|
||||||
procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
|
procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
|
||||||
procedure InstallListen(ePath: String);
|
procedure InstallListen(ePath: String; const Source: Boolean);
|
||||||
procedure InstallCustom(ePath: String; eOS: TOS);
|
procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
|
||||||
procedure InstallFTP(OS: TOS);
|
procedure InstallFTP(OS: TOS; const Source: Boolean; const ModDir: String);
|
||||||
|
|
||||||
var StartTime: TDateTime;
|
var StartTime: TDateTime;
|
||||||
SteamPath: String;
|
SteamPath: String;
|
||||||
@ -32,7 +32,7 @@ uses UnitfrmMain, UnitfrmProxy, UnitFunctions, UnitPackSystem;
|
|||||||
|
|
||||||
function InstallTime: String;
|
function InstallTime: String;
|
||||||
begin
|
begin
|
||||||
Result := FormatDateTime('HH:MM:SS', Now - StartTime);
|
Result := Copy(FormatDateTime('HH:MM:SS', Now - StartTime), 4, 5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddStatus(Text: String; Color: TColor; ShowTime: Boolean = True);
|
procedure AddStatus(Text: String; Color: TColor; ShowTime: Boolean = True);
|
||||||
@ -218,18 +218,16 @@ end;
|
|||||||
|
|
||||||
{ Basic Installation }
|
{ 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;
|
var eStr: TStringList;
|
||||||
i: integer;
|
|
||||||
CopyConfig: Boolean;
|
CopyConfig: Boolean;
|
||||||
eFound: Boolean;
|
|
||||||
begin
|
begin
|
||||||
frmMain.ggeAll.MaxValue := 8;
|
frmMain.ggeAll.MaxValue := 8;
|
||||||
frmMain.ggeAll.Progress := 0;
|
frmMain.ggeAll.Progress := 0;
|
||||||
frmMain.ggeItem.MaxValue := 1;
|
frmMain.ggeItem.MaxValue := 1;
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
|
|
||||||
if (GetProcessID('Steam.exe') <> -1) and (SteamInstall) then begin
|
{if (GetProcessID('Steam.exe') <> -1) and (SteamInstall) then begin
|
||||||
if MessageBox(frmMain.Handle, 'Steam is still running. It is necersarry to shut it down before you install Metamod:Source. Shut it down now?', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNO) = mrYes then begin
|
if MessageBox(frmMain.Handle, 'Steam is still running. It is necersarry to shut it down before you install Metamod:Source. Shut it down now?', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNO) = mrYes then begin
|
||||||
AddStatus('Shutting down Steam...', clBlack, False);
|
AddStatus('Shutting down Steam...', clBlack, False);
|
||||||
if GetProcessID('Steam.exe') = -1 then
|
if GetProcessID('Steam.exe') = -1 then
|
||||||
@ -247,13 +245,13 @@ begin
|
|||||||
Application.Terminate;
|
Application.Terminate;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;}
|
||||||
frmMain.ggeAll.Progress := 1;
|
frmMain.ggeAll.Progress := 1;
|
||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
{ Unpack }
|
{ Unpack }
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
AddStatus('Unpacking files...', clBlack);
|
AddStatus('Unpacking files...', clBlack);
|
||||||
if not Unpack() then begin
|
if not Unpack(Source) then begin
|
||||||
AddStatus('No files attached!', clRed);
|
AddStatus('No files attached!', clRed);
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
exit;
|
exit;
|
||||||
@ -282,7 +280,7 @@ begin
|
|||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
frmMain.ggeAll.Progress := 3;
|
frmMain.ggeAll.Progress := 3;
|
||||||
|
|
||||||
{ gameinfo.txt }
|
{ gameinfo.txt for check / create VDF file }
|
||||||
if not FileExists(ePath + 'gameinfo.txt') then begin
|
if not FileExists(ePath + 'gameinfo.txt') then begin
|
||||||
if MessageBox(frmMain.Handle, 'The file "gameinfo.txt" couldn''t be found. Continue installation?', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNO) = mrNo then begin
|
if MessageBox(frmMain.Handle, 'The file "gameinfo.txt" couldn''t be found. Continue installation?', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNO) = mrNo then begin
|
||||||
AddStatus('Installation canceled by user!', clRed, False);
|
AddStatus('Installation canceled by user!', clRed, False);
|
||||||
@ -304,33 +302,32 @@ begin
|
|||||||
AddSkipped;
|
AddSkipped;
|
||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
frmMain.ggeAll.Progress := 4;
|
frmMain.ggeAll.Progress := 4;
|
||||||
{ Gameinfo.txt }
|
{ CDF Plugin }
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
eFound := False;
|
AddStatus('Creating VDF Plugin...', clBlack);
|
||||||
AddStatus('Editing gameinfo.txt...', clBlack);
|
if (FileExists(ePath + 'addons\metamod.vdf')) then begin
|
||||||
eStr.LoadFromFile(ePath + 'gameinfo.txt');
|
eStr.LoadFromFile(ePath + 'addons\metamod.vdf');
|
||||||
for i := 0 to eStr.Count -1 do begin
|
if (Pos('server.dll', eStr.Text) <> 0) then
|
||||||
if Trim(LowerCase(eStr[i])) = 'gamebin |gameinfo_path|addons/metamod/bin' then begin
|
AddSkipped
|
||||||
eFound := True;
|
else begin
|
||||||
break;
|
eStr.Add('');
|
||||||
end;
|
eStr.Add('"Plugin"');
|
||||||
end;
|
eStr.Add('{');
|
||||||
|
eStr.Add(' "file" "..\' + GetModName(ePath) + '\addons\metamod\bin\server.dll"');
|
||||||
if not eFound then begin
|
eStr.Add('}');
|
||||||
for i := 0 to eStr.Count -1 do begin
|
eStr.SaveToFile(ePath + 'addons\metamod.vdf');
|
||||||
if Trim(eStr[i]) = 'SearchPaths' then begin
|
|
||||||
eStr.Insert(i +2, ' GameBin |gameinfo_path|addons/metamod/bin');
|
|
||||||
AddDone;
|
AddDone;
|
||||||
break;
|
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
SetFileAttributes(PChar(ePath + 'gameinfo.txt'), 0);
|
|
||||||
eStr.SaveToFile(ePath + 'gameinfo.txt');
|
|
||||||
SetFileAttributes(PChar(ePath + 'gameinfo.txt'), faReadOnly); // important for listen servers
|
|
||||||
AddDone;
|
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
AddSkipped;
|
eStr.Add('');
|
||||||
|
eStr.Add('"Plugin"');
|
||||||
|
eStr.Add('{');
|
||||||
|
eStr.Add(' "file" "..\' + GetModName(ePath) + '\addons\metamod\bin\server.dll"');
|
||||||
|
eStr.Add('}');
|
||||||
|
eStr.SaveToFile(ePath + 'addons\metamod.vdf');
|
||||||
|
AddDone;
|
||||||
|
end;
|
||||||
eStr.Free;
|
eStr.Free;
|
||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
frmMain.ggeAll.Progress := 5;
|
frmMain.ggeAll.Progress := 5;
|
||||||
@ -342,16 +339,9 @@ begin
|
|||||||
AddDone;
|
AddDone;
|
||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
frmMain.ggeAll.Progress := 6;
|
frmMain.ggeAll.Progress := 6;
|
||||||
if ListenInstall then begin
|
|
||||||
ePath := ExtractFilePath(Copy(ePath, 1, Length(ePath)-1));
|
|
||||||
AddStatus('Copying hl2launch.exe...', clBlack);
|
|
||||||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'hl2launch.exe'), PChar(ePath + 'hl2launch.exe'), False);
|
|
||||||
AddDone;
|
|
||||||
end;
|
|
||||||
{ Remove files }
|
{ Remove files }
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
AddStatus('Removing temporary files...', clBlack);
|
AddStatus('Removing temporary files...', clBlack);
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'hl2launch.exe'));
|
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server.dll'));
|
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server.dll'));
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server_i486.so'));
|
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server_i486.so'));
|
||||||
AddDone;
|
AddDone;
|
||||||
@ -363,44 +353,41 @@ begin
|
|||||||
frmMain.cmdNext.Enabled := True;
|
frmMain.cmdNext.Enabled := True;
|
||||||
frmMain.cmdCancel.Hide;
|
frmMain.cmdCancel.Hide;
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
|
||||||
if ListenInstall then
|
|
||||||
MessageBox(frmMain.Handle, PChar('hl2launch.exe has been copied to ' + ePath + '. You can use it if you want to start your Source game with Metamod:Source enabled.'), PChar(Application.Title), MB_ICONINFORMATION);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Dedicated Server }
|
{ Dedicated Server }
|
||||||
|
|
||||||
procedure InstallDedicated(eModPath: String; UseSteam: Boolean);
|
procedure InstallDedicated(eModPath: String; const UseSteam, Source: Boolean);
|
||||||
begin
|
begin
|
||||||
StartTime := Now;
|
StartTime := Now;
|
||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
AddStatus('Starting Metamod:Source installation on dedicated server...', clBlack, False);
|
AddStatus('Starting Metamod:Source installation on dedicated server...', clBlack, False);
|
||||||
BasicInstallation(eModPath, UseSteam, False, osWindows);
|
BasicInstallation(eModPath, UseSteam, False, osWindows, Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Listen Server }
|
{ Listen Server }
|
||||||
|
|
||||||
procedure InstallListen(ePath: String);
|
procedure InstallListen(ePath: String; const Source: Boolean);
|
||||||
begin
|
begin
|
||||||
StartTime := Now;
|
StartTime := Now;
|
||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
AddStatus('Starting Metamod:Source installation on the listen server...', clBlack);
|
AddStatus('Starting Metamod:Source installation on the listen server...', clBlack);
|
||||||
BasicInstallation(ePath, True, True, osWindows);
|
BasicInstallation(ePath, True, True, osWindows, Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Custom mod }
|
{ Custom mod }
|
||||||
|
|
||||||
procedure InstallCustom(ePath: String; eOS: TOS);
|
procedure InstallCustom(ePath: String; eOS: TOS; const Source: Boolean);
|
||||||
begin
|
begin
|
||||||
StartTime := Now;
|
StartTime := Now;
|
||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
AddStatus('Starting Metamod:Source installation...', clBlack);
|
AddStatus('Starting Metamod:Source installation...', clBlack);
|
||||||
BasicInstallation(ePath, False, False, eOS);
|
BasicInstallation(ePath, False, False, eOS, Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ FTP }
|
{ FTP }
|
||||||
|
|
||||||
procedure InstallFTP(OS: TOS);
|
procedure InstallFTP(OS: TOS; const Source: Boolean; const ModDir: String);
|
||||||
function DoReconnect: Boolean;
|
function DoReconnect: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -414,8 +401,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
label CreateAgain;
|
label CreateAgain;
|
||||||
label UploadAgain;
|
label UploadAgain;
|
||||||
|
|
||||||
var eStr: TStringList;
|
var eStr: TStringList;
|
||||||
i: integer;
|
i: integer;
|
||||||
CopyConfig, eFound: Boolean;
|
CopyConfig, eFound: Boolean;
|
||||||
@ -426,70 +415,24 @@ begin
|
|||||||
|
|
||||||
frmMain.ggeAll.MaxValue := 6;
|
frmMain.ggeAll.MaxValue := 6;
|
||||||
frmMain.ggeAll.Progress := 0;
|
frmMain.ggeAll.Progress := 0;
|
||||||
frmMain.ggeItem.MaxValue := 1;
|
frmMain.ggeItem.MaxValue := 3;
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
|
|
||||||
{ Unpack }
|
{ Unpack }
|
||||||
frmMain.ggeItem.Progress := 0;
|
|
||||||
AddStatus('Unpacking files...', clBlack);
|
AddStatus('Unpacking files...', clBlack);
|
||||||
if not Unpack() then begin
|
if not Unpack(Source) then begin
|
||||||
AddStatus('No files attached!', clRed);
|
AddStatus('No files attached!', clRed);
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
AddDone;
|
AddDone;
|
||||||
frmMain.ggeAll.Progress := 2;
|
frmMain.ggeAll.Progress := 1;
|
||||||
frmMain.ggeItem.Progress := 1;
|
frmMain.ggeItem.Progress := 1;
|
||||||
{ Check for installation }
|
Sleep(250);
|
||||||
AddStatus('Editing gameinfo.txt...', clBlack);
|
|
||||||
eStr := TStringList.Create;
|
|
||||||
DownloadFile('gameinfo.txt', ExtractFilePath(ParamStr(0)) + 'gameinfo.txt');
|
|
||||||
eStr.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'gameinfo.txt');
|
|
||||||
|
|
||||||
CopyConfig := True;
|
|
||||||
eFound := False;
|
|
||||||
for i := 0 to eStr.Count -1 do begin
|
|
||||||
if Trim(LowerCase(eStr[i])) = 'gamebin |gameinfo_path|addons/metamod/bin' then begin
|
|
||||||
eFound := True;
|
|
||||||
case MessageBox(frmMain.Handle, 'A Metamod:Source installation was already detected. If you choose to reinstall, your configuration files will be erased. Click Yes to continue, No to Upgrade, or Cancel to abort the install.', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
|
||||||
mrNo: CopyConfig := False;
|
|
||||||
mrCancel: begin
|
|
||||||
Application.Terminate;
|
|
||||||
eStr.Free;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if not eFound then begin
|
|
||||||
for i := 0 to eStr.Count -1 do begin
|
|
||||||
if Trim(eStr[i]) = 'SearchPaths' then begin
|
|
||||||
eStr.Insert(i +2, ' GameBin |gameinfo_path|addons/metamod/bin');
|
|
||||||
AddDone;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'gameinfo.txt');
|
|
||||||
UploadFile(ExtractFilePath(ParamStr(0)) + 'gameinfo.txt', 'gameinfo.txt');
|
|
||||||
try
|
|
||||||
AddStatus('Trying to set gameinfo.txt to read-only...', clBlack);
|
|
||||||
frmMain.IdFTP.Site('CHMOD 744 gameinfo.txt');
|
|
||||||
AddDone;
|
|
||||||
except
|
|
||||||
AddStatus('Warning: CHMOD not supported.', clMaroon);
|
|
||||||
end;
|
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'gameinfo.txt'));
|
|
||||||
end
|
|
||||||
else
|
|
||||||
AddSkipped;
|
|
||||||
frmMain.ggeAll.Progress := 3;
|
|
||||||
frmMain.ggeItem.Progress := 1;
|
|
||||||
|
|
||||||
{ Create directories }
|
{ Create directories }
|
||||||
|
frmMain.ggeAll.Progress := 2;
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
frmMain.ggeItem.MaxValue := 3;
|
|
||||||
AddStatus('Creating directories...', clBlack);
|
AddStatus('Creating directories...', clBlack);
|
||||||
if not eFound then begin
|
if not eFound then begin
|
||||||
FTPMakeDir('addons');
|
FTPMakeDir('addons');
|
||||||
@ -504,8 +447,50 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
AddSkipped;
|
AddSkipped;
|
||||||
frmMain.ggeAll.Progress := 4;
|
{ Create/Edit VDF Plugin }
|
||||||
|
CopyConfig := True;
|
||||||
|
eFound := False;
|
||||||
|
|
||||||
|
frmMain.ggeAll.Progress := 3;
|
||||||
|
frmMain.ggeItem.Progress := 0;
|
||||||
|
|
||||||
|
AddStatus('Creating VDF Plugin...', clBlack);
|
||||||
|
eStr := TStringList.Create;
|
||||||
|
try
|
||||||
|
frmMain.IdFTP.ChangeDir('addons');
|
||||||
|
frmMain.ggeItem.Progress := 1;
|
||||||
|
DownloadFile('metamod.vdf', ExtractFilePath(ParamStr(0)) + 'metamod.vdf');
|
||||||
|
eStr.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'metamod.vdf');
|
||||||
|
frmMain.ggeItem.Progress := 2;
|
||||||
|
if (((Pos('server.dll', eStr.Text) <> 0) and (OS = osWindows)) or ((Pos('server_i486.so', eStr.Text) <> 0) and (OS = osLinux))) then begin
|
||||||
|
AddSkipped;
|
||||||
|
|
||||||
|
eFound := True;
|
||||||
|
case MessageBox(frmMain.Handle, 'A Metamod:Source installation was already detected. If you choose to reinstall, your configuration files will be erased. Click Yes to continue, No to Upgrade, or Cancel to abort the install.', PChar(frmMain.Caption), MB_ICONQUESTION + MB_YESNOCANCEL) of
|
||||||
|
mrNo: CopyConfig := False;
|
||||||
|
mrCancel: begin
|
||||||
|
Application.Terminate;
|
||||||
|
eStr.Free;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
raise Exception.Create('Create config now!');
|
||||||
|
except
|
||||||
|
frmMain.ggeItem.Progress := 2;
|
||||||
|
eStr.Add('"Plugin"');
|
||||||
|
eStr.Add('{');
|
||||||
|
if (OS = osWindows) then
|
||||||
|
eStr.Add(' "file" "..\' + ModDir + '\addons\metamod\bin\server.dll"')
|
||||||
|
else
|
||||||
|
eStr.Add(' "file" "../' + ModDir + '/addons/metamod/bin/server_i486.so"');
|
||||||
|
eStr.Add('}');
|
||||||
|
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'metamod.vdf');
|
||||||
|
UploadFile(ExtractFilePath(ParamStr(0)) + 'metamod.vdf', 'metamod.vdf');
|
||||||
frmMain.ggeItem.Progress := 3;
|
frmMain.ggeItem.Progress := 3;
|
||||||
|
AddDone;
|
||||||
|
end;
|
||||||
{ Upload metaplugins.ini }
|
{ Upload metaplugins.ini }
|
||||||
frmMain.ggeAll.Progress := 4;
|
frmMain.ggeAll.Progress := 4;
|
||||||
frmMain.ggeItem.MaxValue := 1;
|
frmMain.ggeItem.MaxValue := 1;
|
||||||
@ -537,7 +522,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ Remove created files }
|
{ Remove created files }
|
||||||
AddStatus('Removing temporary files...', clBlack);
|
AddStatus('Removing temporary files...', clBlack);
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'hl2launch.exe'));
|
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server.dll'));
|
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server.dll'));
|
||||||
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server_i486.so'));
|
DeleteFile(PChar(ExtractFilePath(ParamStr(0)) + 'server_i486.so'));
|
||||||
AddDone;
|
AddDone;
|
||||||
|
@ -4,11 +4,11 @@ interface
|
|||||||
|
|
||||||
uses SysUtils, Classes, Zlib;
|
uses SysUtils, Classes, Zlib;
|
||||||
|
|
||||||
procedure CompressFiles(Files : TStrings; const Filename : String);
|
procedure CompressFiles(Files: TStrings; const Filename: String);
|
||||||
function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
|
function DecompressStream(Stream: TMemoryStream; DestDirectory: String; const Source: Boolean): Boolean;
|
||||||
function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream; Version: String): Boolean;
|
function AttachToFile(const AFileName: string; MemoryStream: TMemoryStream; Version: String): Boolean;
|
||||||
function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
|
function LoadFromFile(const AFileName: string; MemoryStream: TMemoryStream): Boolean;
|
||||||
function Unpack: Boolean;
|
function Unpack(const Source: Boolean): Boolean;
|
||||||
function GetVersion: String;
|
function GetVersion: String;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -54,6 +54,8 @@ begin
|
|||||||
{ append the compressed file to the destination file }
|
{ append the compressed file to the destination file }
|
||||||
tmpFile := TFileStream.Create('tmp',fmOpenRead);
|
tmpFile := TFileStream.Create('tmp',fmOpenRead);
|
||||||
try
|
try
|
||||||
|
l := tmpFile.Size;
|
||||||
|
outfile.WriteBuffer(l, SizeOf(l));
|
||||||
outfile.CopyFrom(tmpFile,0);
|
outfile.CopyFrom(tmpFile,0);
|
||||||
finally
|
finally
|
||||||
tmpFile.Free;
|
tmpFile.Free;
|
||||||
@ -68,12 +70,13 @@ begin
|
|||||||
DeleteFile('tmp');
|
DeleteFile('tmp');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
function DecompressStream(Stream : TMemoryStream; DestDirectory : String): Boolean;
|
|
||||||
|
function DecompressStream(Stream : TMemoryStream; DestDirectory : String; const Source: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
dest,s : String;
|
dest,s : String;
|
||||||
decompr : TDecompressionStream;
|
decompr : TDecompressionStream;
|
||||||
outfile : TFilestream;
|
outfile : TFilestream;
|
||||||
i,l,c : Integer;
|
i,l,lr,c : Integer;
|
||||||
begin
|
begin
|
||||||
// IncludeTrailingPathDelimiter (D6/D7 only)
|
// IncludeTrailingPathDelimiter (D6/D7 only)
|
||||||
dest := IncludeTrailingPathDelimiter(DestDirectory);
|
dest := IncludeTrailingPathDelimiter(DestDirectory);
|
||||||
@ -82,14 +85,17 @@ begin
|
|||||||
try
|
try
|
||||||
{ number of files }
|
{ number of files }
|
||||||
Stream.Read(c,SizeOf(c));
|
Stream.Read(c,SizeOf(c));
|
||||||
for i := 1 to c do
|
for i := 1 to c do begin
|
||||||
begin
|
|
||||||
{ read filename }
|
{ read filename }
|
||||||
Stream.Read(l,SizeOf(l));
|
Stream.Read(l,SizeOf(l));
|
||||||
SetLength(s,l);
|
SetLength(s,l);
|
||||||
Stream.Read(s[1],l);
|
Stream.Read(s[1],l);
|
||||||
{ read filesize }
|
|
||||||
Stream.Read(l,SizeOf(l));
|
Stream.Read(l,SizeOf(l));
|
||||||
|
Stream.Read(lr,SizeOf(lr));
|
||||||
|
{ 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, '');
|
||||||
{ decompress the files and store it }
|
{ decompress the files and store it }
|
||||||
s := dest+s; //include the path
|
s := dest+s; //include the path
|
||||||
outfile := TFileStream.Create(s,fmCreate);
|
outfile := TFileStream.Create(s,fmCreate);
|
||||||
@ -100,6 +106,9 @@ begin
|
|||||||
outfile.Free;
|
outfile.Free;
|
||||||
decompr.Free;
|
decompr.Free;
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Stream.Position := Stream.Position + lr;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
Result := True;
|
Result := True;
|
||||||
@ -114,6 +123,7 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
if not FileExists(AFileName) then
|
if not FileExists(AFileName) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
try
|
try
|
||||||
aStream := TFileStream.Create(AFileName, fmOpenWrite or fmShareDenyWrite);
|
aStream := TFileStream.Create(AFileName, fmOpenWrite or fmShareDenyWrite);
|
||||||
MemoryStream.Seek(0, soFromBeginning);
|
MemoryStream.Seek(0, soFromBeginning);
|
||||||
@ -177,14 +187,14 @@ end;
|
|||||||
|
|
||||||
{ Unpack function }
|
{ Unpack function }
|
||||||
|
|
||||||
function Unpack: Boolean;
|
function Unpack(const Source: Boolean): Boolean;
|
||||||
var eStream: TMemoryStream;
|
var eStream: TMemoryStream;
|
||||||
begin
|
begin
|
||||||
eStream := TMemoryStream.Create;
|
eStream := TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
// Get ZIP
|
// Get ZIP
|
||||||
LoadFromFile(ParamStr(0), eStream);
|
LoadFromFile(ParamStr(0), eStream);
|
||||||
DecompressStream(eStream, ExtractFilePath(ParamStr(0))); // Unpack files
|
DecompressStream(eStream, ExtractFilePath(ParamStr(0)), Source); // Unpack files
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
except
|
except
|
||||||
|
@ -159,6 +159,7 @@ var ePath: String;
|
|||||||
CurNode: TTreeNode;
|
CurNode: TTreeNode;
|
||||||
eOS: TOS;
|
eOS: TOS;
|
||||||
i: integer;
|
i: integer;
|
||||||
|
Source: Boolean;
|
||||||
begin
|
begin
|
||||||
{ FTP }
|
{ FTP }
|
||||||
if jplWizard.ActivePage = jspFTP then begin
|
if jplWizard.ActivePage = jspFTP then begin
|
||||||
@ -175,14 +176,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
IdFTP.ChangeDir(ePath);
|
IdFTP.ChangeDir(ePath);
|
||||||
IdFTP.List(eStr, '', False);
|
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);
|
MessageBox(Handle, 'Invalid directory. Please select your mod directory and try again.', PChar(Application.Title), MB_ICONWARNING);
|
||||||
eStr.Free;
|
eStr.Free;
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
eStr.Free;
|
eStr.Free;
|
||||||
|
// check for orangebox directory
|
||||||
|
Source := True;
|
||||||
|
if (AnsiSameText(trvDirectories.Selected.Text, 'tf')) 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
|
// design stuff
|
||||||
trvDirectories.Enabled := False;
|
trvDirectories.Enabled := False;
|
||||||
cmdConnect.Enabled := False;
|
cmdConnect.Enabled := False;
|
||||||
@ -198,37 +212,69 @@ begin
|
|||||||
jspInstallProgress.Show;
|
jspInstallProgress.Show;
|
||||||
// installation
|
// installation
|
||||||
Screen.Cursor := crAppStart;
|
Screen.Cursor := crAppStart;
|
||||||
InstallFTP(eOS);
|
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) or (frbStandaloneServer.Checked) then begin
|
if frbDedicatedServer.Checked then begin
|
||||||
|
Source := True;
|
||||||
ePath := trvMods.Selected.Text;
|
ePath := trvMods.Selected.Text;
|
||||||
if ePath = 'Counter-Strike:Source' then
|
if ePath = 'Counter-Strike:Source' then
|
||||||
ePath := 'cstrike'
|
ePath := trvMods.Selected.Parent.Text + '\source dedicated server\cstrike'
|
||||||
else if ePath = 'Day of Defeat:Source' then
|
else if ePath = 'Day of Defeat:Source' then
|
||||||
ePath := 'dod'
|
ePath := trvMods.Selected.Parent.Text + '\source dedicated server\dod'
|
||||||
else
|
else if ePath = 'Half-Life 2 Deathmatch' then
|
||||||
ePath := 'hl2mp';
|
ePath := trvMods.Selected.Parent.Text + '\source dedicated server\hl2mp'
|
||||||
ePath := 'SteamApps\' + trvMods.Selected.Parent.Text + '\source dedicated server\' + ePath;
|
else begin
|
||||||
|
{ get games }
|
||||||
|
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
|
||||||
|
mrYes: Source := False;
|
||||||
|
mrNo: Source := True;
|
||||||
|
mrCancel: exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
SteamPath := IncludeTrailingPathDelimiter(SteamPath) + 'steamapps\';
|
||||||
// install it
|
// install it
|
||||||
if frbDedicatedServer.Checked then begin
|
|
||||||
if DirectoryExists(SteamPath + ePath) then begin
|
if DirectoryExists(SteamPath + ePath) then begin
|
||||||
jspInstallProgress.Show;
|
jspInstallProgress.Show;
|
||||||
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True);
|
InstallDedicated(IncludeTrailingPathDelimiter(SteamPath + ePath), True, Source);
|
||||||
end
|
end
|
||||||
else begin
|
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);
|
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);
|
||||||
jspSelectMod.Show;
|
jspSelectMod.Show;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
|
{ Standalone Server }
|
||||||
|
if 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 if ePath = 'Half-Life 2 Deathmatch' then
|
||||||
|
ePath := 'hl2mp'
|
||||||
else begin
|
else begin
|
||||||
|
{ get games }
|
||||||
|
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
|
||||||
|
mrYes: Source := False;
|
||||||
|
mrNo: Source := True;
|
||||||
|
mrCancel: exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
// install it
|
||||||
if DirectoryExists(StandaloneServer + ePath) then begin
|
if DirectoryExists(StandaloneServer + ePath) then begin
|
||||||
jspInstallProgress.Show;
|
jspInstallProgress.Show;
|
||||||
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False)
|
InstallDedicated(IncludeTrailingPathDelimiter(StandaloneServer + ePath), False, Source)
|
||||||
end
|
end
|
||||||
else begin
|
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);
|
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);
|
||||||
@ -236,16 +282,27 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
{ Listen Server }
|
{ Listen Server }
|
||||||
if frbListenServer.Checked then begin
|
if frbListenServer.Checked then begin
|
||||||
|
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
|
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
|
||||||
|
{ 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
|
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)
|
||||||
@ -256,7 +313,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
jspInstallProgress.Show;
|
jspInstallProgress.Show;
|
||||||
InstallListen(IncludeTrailingPathDelimiter(ePath));
|
InstallListen(IncludeTrailingPathDelimiter(ePath), Source);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ Custom mod below }
|
{ Custom mod below }
|
||||||
@ -287,6 +344,8 @@ begin
|
|||||||
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
|
||||||
|
trvMods.Items.AddChild(CurNode, 'Team Fortress 2');
|
||||||
|
|
||||||
if CurNode.Count = 0 then
|
if CurNode.Count = 0 then
|
||||||
CurNode.Free
|
CurNode.Free
|
||||||
@ -330,6 +389,8 @@ begin
|
|||||||
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
|
trvMods.Items.AddChild(CurNode, 'Day of Defeat:Source');
|
||||||
if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
|
if DirectoryExists(ePath + eStr[i] + '\half-life 2 deathmatch') then
|
||||||
trvMods.Items.AddChild(CurNode, 'Half-Life 2 Deatmatch');
|
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
|
if CurNode.Count = 0 then
|
||||||
CurNode.Free
|
CurNode.Free
|
||||||
@ -362,6 +423,8 @@ begin
|
|||||||
trvMods.Items.Add(nil, 'Day of Defeat:Source');
|
trvMods.Items.Add(nil, 'Day of Defeat:Source');
|
||||||
if DirectoryExists(StandaloneServer + 'hl2mp') then
|
if DirectoryExists(StandaloneServer + 'hl2mp') then
|
||||||
trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
|
trvMods.Items.Add(nil, 'Half-Life 2 Deatmatch');
|
||||||
|
if DirectoryExists(StandaloneServer + 'orangebox\tf') then
|
||||||
|
trvMods.Items.Add(nil, 'Team Fortress 2');
|
||||||
jspSelectMod.Show;
|
jspSelectMod.Show;
|
||||||
cmdNext.Enabled := False;
|
cmdNext.Enabled := False;
|
||||||
end
|
end
|
||||||
@ -374,8 +437,19 @@ begin
|
|||||||
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;
|
||||||
|
{ check if this is an orangebox game }
|
||||||
|
Source := True;
|
||||||
|
if (AnsiSameText(ExtractFileName(ePath), 'tf')) 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;
|
jspInstallProgress.Show;
|
||||||
InstallCustom(IncludeTrailingPathDelimiter(frmSelectModPath.trvDirectory.SelectedFolder.PathName), osWindows);
|
InstallCustom(IncludeTrailingPathDelimiter(ePath), osWindows, Source);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else if frbFTP.Checked then // FTP
|
else if frbFTP.Checked then // FTP
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
In this folder should be server.dll and server_i486.so.
|
Every MM:S library should be located in this directory.
|
||||||
|
|
||||||
How you prepare a release:
|
How to prepare a release:
|
||||||
1) Copy the latest MM:S dlls and hl2launch.exe into this folder
|
1) Copy the latest MM:S dlls into this folder
|
||||||
2) Run Attach.exe
|
2) Append .source to the Source binaries and .orangebox to the OrangeBox binaries
|
||||||
3) Test MMS_Installer.exe once (should work but nobody wants bug releases, especially not in the installer)
|
3) Run Attach.exe
|
||||||
4) If everything worked fine, release it, otherwise pm me (Basic-Master)
|
4) Test MMS_Installer.exe once (recommended)
|
||||||
|
5) Release it or e-Mail me if you find a bug
|
Loading…
x
Reference in New Issue
Block a user