this should fix the bug where metamod's plugins.ini is being overwritten even if it already contains an entry of amxx's mm dll
This commit is contained in:
parent
3c379469d5
commit
14a068532f
Binary file not shown.
|
@ -3,7 +3,7 @@ unit UnitInstall;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses SysUtils, Classes, Windows, Graphics, Forms, ShellAPI, Controls, Messages,
|
uses SysUtils, Classes, Windows, Graphics, Forms, ShellAPI, Controls, Messages,
|
||||||
TlHelp32, IdFTPCommon, ComCtrls;
|
TlHelp32, IdFTPCommon, ComCtrls, JclFileUtils;
|
||||||
|
|
||||||
type TMod = (modNone, modCS, modDoD, modTFC, modNS, modTS, modESF);
|
type TMod = (modNone, modCS, modDoD, modTFC, modNS, modTS, modESF);
|
||||||
type TOS = (osWindows, osLinux32, osLinux64);
|
type TOS = (osWindows, osLinux32, osLinux64);
|
||||||
|
@ -12,7 +12,6 @@ procedure AddStatus(Text: String; Color: TColor; ShowTime: Boolean = True);
|
||||||
procedure AddDone(Additional: String = '');
|
procedure AddDone(Additional: String = '');
|
||||||
procedure AddSkipped;
|
procedure AddSkipped;
|
||||||
procedure AddNotFound;
|
procedure AddNotFound;
|
||||||
function DelDir(Dir: string): Boolean;
|
|
||||||
procedure MakeDir(Dir: String);
|
procedure MakeDir(Dir: String);
|
||||||
procedure DownloadFile(eFile: String; eDestination: String);
|
procedure DownloadFile(eFile: String; eDestination: String);
|
||||||
|
|
||||||
|
@ -100,18 +99,6 @@ begin
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function DelDir(Dir: string): Boolean;
|
|
||||||
var Fos: TSHFileOpStruct;
|
|
||||||
begin
|
|
||||||
ZeroMemory(@Fos, SizeOf(Fos));
|
|
||||||
with Fos do begin
|
|
||||||
wFunc := FO_DELETE;
|
|
||||||
fFlags := FOF_SILENT or FOF_NOCONFIRMATION;
|
|
||||||
pFrom := PChar(Dir + #0);
|
|
||||||
end;
|
|
||||||
Result := (ShFileOperation(fos) = 0);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure MakeDir(Dir: String);
|
procedure MakeDir(Dir: String);
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
|
@ -290,6 +277,7 @@ procedure BasicInstallation(ePath: String; eMod: TMod; SteamInstall: Boolean; OS
|
||||||
var eStr: TStringList;
|
var eStr: TStringList;
|
||||||
i: integer;
|
i: integer;
|
||||||
CopyConfig: Boolean;
|
CopyConfig: Boolean;
|
||||||
|
UpdatePluginsIni: Boolean;
|
||||||
begin
|
begin
|
||||||
AddStatus('Scanning for directories...', clBlack);
|
AddStatus('Scanning for directories...', clBlack);
|
||||||
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'files\*.*', faDirectory, True, True) do begin
|
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'files\*.*', faDirectory, True, True) do begin
|
||||||
|
@ -506,25 +494,48 @@ begin
|
||||||
if FileExists(ePath + '\addons\amxmodx\dlls\metamod_amd64.so') then DeleteFile(PChar(ePath + '\addons\amxmodx\dlls\metamod_amd64.so'));
|
if FileExists(ePath + '\addons\amxmodx\dlls\metamod_amd64.so') then DeleteFile(PChar(ePath + '\addons\amxmodx\dlls\metamod_amd64.so'));
|
||||||
if FileExists(ePath + '\addons\amxmodx\dlls\metamod_i386.so') then DeleteFile(PChar(ePath + '\addons\amxmodx\dlls\metamod_i386.so'));
|
if FileExists(ePath + '\addons\amxmodx\dlls\metamod_i386.so') then DeleteFile(PChar(ePath + '\addons\amxmodx\dlls\metamod_i386.so'));
|
||||||
finally
|
finally
|
||||||
|
UpdatePluginsIni := True;
|
||||||
eStr := TStringList.Create;
|
eStr := TStringList.Create;
|
||||||
eStr.Add(';; Metamod plugins.ini');
|
// check if we need to modify mm's plugins.ini
|
||||||
eStr.Add('; AMX Mod X ' + VERSION);
|
if (FileExists(ePath + '\addons\metamod\plugins.ini')) then begin
|
||||||
if OS = osWindows then begin
|
eStr.LoadFromFile(ePath + '\addons\metamod\plugins.ini');
|
||||||
eStr.Add('win32 addons\amxmodx\dlls\amxmodx_mm.dll');
|
if OS = osWindows then begin
|
||||||
eStr.Add('; Enable this instead for binary logging');
|
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||||
eStr.Add('; win32 addons\amxmodx\dlls\amxmodx_bl_mm.dll');
|
UpdatePluginsIni := False;
|
||||||
end
|
end
|
||||||
else if OS = osLinux32 then begin
|
else if OS = osLinux32 then begin
|
||||||
eStr.Add('linux addons/amxmodx/dlls/amxmodx_mm_i386.so');
|
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||||
eStr.Add('; Enable this instead for binary logging');
|
UpdatePluginsIni := False;
|
||||||
eStr.Add('; linux addons/amxmodx/dlls/amxmodx_bl_mm_i386.so');
|
end
|
||||||
|
else begin
|
||||||
|
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||||
|
UpdatePluginsIni := False;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
|
// create a header :o
|
||||||
else begin
|
else begin
|
||||||
eStr.Add('linux addons/amxmodx/dlls/amxmodx_mm_amd64.so');
|
eStr.Add(';; Metamod plugins.ini');
|
||||||
eStr.Add('; Enable this instead for binary logging');
|
eStr.Add('; AMX Mod X ' + VERSION);
|
||||||
eStr.Add('; linux addons/amxmodx/dlls/amxmodx_bl_mm_amd64.so');
|
end;
|
||||||
|
// if there's no
|
||||||
|
if (not UpdatePluginsIni) then begin
|
||||||
|
if OS = osWindows then begin
|
||||||
|
eStr.Add('win32 addons\amxmodx\dlls\amxmodx_mm.dll');
|
||||||
|
eStr.Add('; Enable this instead for binary logging');
|
||||||
|
eStr.Add('; win32 addons\amxmodx\dlls\amxmodx_bl_mm.dll');
|
||||||
|
end
|
||||||
|
else if OS = osLinux32 then begin
|
||||||
|
eStr.Add('linux addons/amxmodx/dlls/amxmodx_mm_i386.so');
|
||||||
|
eStr.Add('; Enable this instead for binary logging');
|
||||||
|
eStr.Add('; linux addons/amxmodx/dlls/amxmodx_bl_mm_i386.so');
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
eStr.Add('linux addons/amxmodx/dlls/amxmodx_mm_amd64.so');
|
||||||
|
eStr.Add('; Enable this instead for binary logging');
|
||||||
|
eStr.Add('; linux addons/amxmodx/dlls/amxmodx_bl_mm_amd64.so');
|
||||||
|
end;
|
||||||
|
eStr.SaveToFile(ePath + 'addons\metamod\plugins.ini');
|
||||||
end;
|
end;
|
||||||
eStr.SaveToFile(ePath + 'addons\metamod\plugins.ini');
|
|
||||||
eStr.Free;
|
eStr.Free;
|
||||||
end;
|
end;
|
||||||
AddDone;
|
AddDone;
|
||||||
|
@ -785,12 +796,16 @@ begin
|
||||||
frmMain.ggeAll.Progress := frmMain.ggeAll.Progress + 1;
|
frmMain.ggeAll.Progress := frmMain.ggeAll.Progress + 1;
|
||||||
frmMain.ggeItem.Progress := 0;
|
frmMain.ggeItem.Progress := 0;
|
||||||
end;
|
end;
|
||||||
|
AddStatus('', clBlack, False);
|
||||||
|
AddStatus('Cleaning installation...', clBlack);
|
||||||
|
DelTree(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||||
|
AddDone;
|
||||||
|
|
||||||
frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue;
|
frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue;
|
||||||
frmMain.ggeItem.Progress := frmMain.ggeItem.MaxValue;
|
frmMain.ggeItem.Progress := frmMain.ggeItem.MaxValue;
|
||||||
|
|
||||||
AddStatus('', clBlack, False);
|
AddStatus('', clBlack, False);
|
||||||
AddStatus('Finished installation!', clBlack, False);
|
AddStatus('Finished installation!', clBlack, False);
|
||||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
|
||||||
frmMain.tmrSpeed.Enabled := False;
|
frmMain.tmrSpeed.Enabled := False;
|
||||||
|
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
|
|
|
@ -249,9 +249,21 @@ begin
|
||||||
optLinux64.Enabled := False;
|
optLinux64.Enabled := False;
|
||||||
cboGameAddon.Enabled := False;
|
cboGameAddon.Enabled := False;
|
||||||
// preinstall...
|
// preinstall...
|
||||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
|
||||||
MakeDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
MakeDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||||
DownloadFile('liblist.gam', ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam');
|
DownloadFile('liblist.gam', ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam');
|
||||||
|
try
|
||||||
|
IdFTP.ChangeDir(ePath + 'addons/metamod/');
|
||||||
|
ForceDirectories(ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\');
|
||||||
|
DownloadFile('plugins.ini', ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\plugins.ini');
|
||||||
|
except
|
||||||
|
try
|
||||||
|
IdFTP.ChangeDir(ePath);
|
||||||
|
except
|
||||||
|
MessageBox(Handle, PChar('Cannot change directory to "' + ePath + '". Please check your settings and try again.'), 'Error', MB_ICONWARNING);
|
||||||
|
Screen.Cursor := crDefault;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
ChosenMod := modNone;
|
ChosenMod := modNone;
|
||||||
case cboGameAddon.ItemIndex of
|
case cboGameAddon.ItemIndex of
|
||||||
1: ChosenMod := modCS;
|
1: ChosenMod := modCS;
|
||||||
|
@ -278,8 +290,6 @@ begin
|
||||||
ggeAll.Progress := 0;
|
ggeAll.Progress := 0;
|
||||||
ggeItem.Progress := 0;
|
ggeItem.Progress := 0;
|
||||||
cmdNext.Hide;
|
cmdNext.Hide;
|
||||||
if DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp\') then
|
|
||||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp\');
|
|
||||||
InstallCustom(ExtractFilePath(ParamStr(0)) + 'temp\', ChosenMod, eOS);
|
InstallCustom(ExtractFilePath(ParamStr(0)) + 'temp\', ChosenMod, eOS);
|
||||||
if Cancel then
|
if Cancel then
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user