mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
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
|
||||
|
||||
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 TOS = (osWindows, osLinux32, osLinux64);
|
||||
@ -12,7 +12,6 @@ procedure AddStatus(Text: String; Color: TColor; ShowTime: Boolean = True);
|
||||
procedure AddDone(Additional: String = '');
|
||||
procedure AddSkipped;
|
||||
procedure AddNotFound;
|
||||
function DelDir(Dir: string): Boolean;
|
||||
procedure MakeDir(Dir: String);
|
||||
procedure DownloadFile(eFile: String; eDestination: String);
|
||||
|
||||
@ -100,18 +99,6 @@ begin
|
||||
Application.ProcessMessages;
|
||||
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);
|
||||
begin
|
||||
try
|
||||
@ -290,6 +277,7 @@ procedure BasicInstallation(ePath: String; eMod: TMod; SteamInstall: Boolean; OS
|
||||
var eStr: TStringList;
|
||||
i: integer;
|
||||
CopyConfig: Boolean;
|
||||
UpdatePluginsIni: Boolean;
|
||||
begin
|
||||
AddStatus('Scanning for directories...', clBlack);
|
||||
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_i386.so') then DeleteFile(PChar(ePath + '\addons\amxmodx\dlls\metamod_i386.so'));
|
||||
finally
|
||||
UpdatePluginsIni := True;
|
||||
eStr := TStringList.Create;
|
||||
eStr.Add(';; Metamod plugins.ini');
|
||||
eStr.Add('; AMX Mod X ' + VERSION);
|
||||
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');
|
||||
// check if we need to modify mm's plugins.ini
|
||||
if (FileExists(ePath + '\addons\metamod\plugins.ini')) then begin
|
||||
eStr.LoadFromFile(ePath + '\addons\metamod\plugins.ini');
|
||||
if OS = osWindows then begin
|
||||
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||
UpdatePluginsIni := False;
|
||||
end
|
||||
else if OS = osLinux32 then begin
|
||||
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||
UpdatePluginsIni := False;
|
||||
end
|
||||
else begin
|
||||
if (Pos(eStr.Text, 'addons\amxmodx\dlls\amxmodx_mm.dll') <> 0) then
|
||||
UpdatePluginsIni := False;
|
||||
end;
|
||||
end
|
||||
// create a header :o
|
||||
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');
|
||||
eStr.Add(';; Metamod plugins.ini');
|
||||
eStr.Add('; AMX Mod X ' + VERSION);
|
||||
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;
|
||||
eStr.SaveToFile(ePath + 'addons\metamod\plugins.ini');
|
||||
eStr.Free;
|
||||
end;
|
||||
AddDone;
|
||||
@ -785,12 +796,16 @@ begin
|
||||
frmMain.ggeAll.Progress := frmMain.ggeAll.Progress + 1;
|
||||
frmMain.ggeItem.Progress := 0;
|
||||
end;
|
||||
AddStatus('', clBlack, False);
|
||||
AddStatus('Cleaning installation...', clBlack);
|
||||
DelTree(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||
AddDone;
|
||||
|
||||
frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue;
|
||||
frmMain.ggeItem.Progress := frmMain.ggeItem.MaxValue;
|
||||
|
||||
AddStatus('', clBlack, False);
|
||||
AddStatus('Finished installation!', clBlack, False);
|
||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||
frmMain.tmrSpeed.Enabled := False;
|
||||
|
||||
Screen.Cursor := crDefault;
|
||||
|
@ -249,9 +249,21 @@ begin
|
||||
optLinux64.Enabled := False;
|
||||
cboGameAddon.Enabled := False;
|
||||
// preinstall...
|
||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||
MakeDir(ExtractFilePath(ParamStr(0)) + 'temp');
|
||||
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;
|
||||
case cboGameAddon.ItemIndex of
|
||||
1: ChosenMod := modCS;
|
||||
@ -278,8 +290,6 @@ begin
|
||||
ggeAll.Progress := 0;
|
||||
ggeItem.Progress := 0;
|
||||
cmdNext.Hide;
|
||||
if DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp\') then
|
||||
DelDir(ExtractFilePath(ParamStr(0)) + 'temp\');
|
||||
InstallCustom(ExtractFilePath(ParamStr(0)) + 'temp\', ChosenMod, eOS);
|
||||
if Cancel then
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user