Fixed loading of ips support in zip files

Fixed ips support in linux
This commit is contained in:
teuf
2001-05-03 20:47:47 +00:00
parent 789914deba
commit d3855ec41f
2 changed files with 46 additions and 2 deletions

View File

@@ -108,6 +108,9 @@ EXTSYM sramaccessbankr16,sramaccessbankr16s,sramaccessbankr8
EXTSYM sramaccessbankr8s,sramaccessbankw16,sramaccessbankw16s EXTSYM sramaccessbankr8s,sramaccessbankw16,sramaccessbankw16s
EXTSYM sramaccessbankw8,sramaccessbankw8s,GenerateBank0TableSA1 EXTSYM sramaccessbankw8,sramaccessbankw8s,GenerateBank0TableSA1
EXTSYM ScrDispl EXTSYM ScrDispl
%ifdef __LINUX__
EXTSYM LoadDir, popdir, pushdir
%endif
NEWSYM InitAsmStart NEWSYM InitAsmStart
@@ -3098,6 +3101,11 @@ NEWSYM RetrieveDataIPS
IPSSL dd 0 IPSSL dd 0
NEWSYM PatchIPS NEWSYM PatchIPS
%ifdef __LINUX__
pushad
call pushdir
popad
%endif
mov byte[IPSPatched],0 mov byte[IPSPatched],0
mov dword[IPSOffset],0 mov dword[IPSOffset],0
cmp byte[Header512],0 cmp byte[Header512],0
@@ -3133,7 +3141,11 @@ NEWSYM PatchIPS
dec eax dec eax
cmp eax,fname cmp eax,fname
je .failfound je .failfound
%ifdef __LINUX__
cmp byte[eax],'/'
%else
cmp byte[eax],'\' cmp byte[eax],'\'
%endif
je .failfound je .failfound
cmp byte[eax],'.' cmp byte[eax],'.'
je .foundokay je .foundokay
@@ -3143,9 +3155,20 @@ NEWSYM PatchIPS
.foundokay .foundokay
mov ebx,[eax] mov ebx,[eax]
mov [Prevextn],ebx mov [Prevextn],ebx
%ifdef __LINUX__
mov dword[eax],'.ips'
%else
mov dword[eax],'.IPS' mov dword[eax],'.IPS'
%endif
mov byte[eax+4],0 mov byte[eax+4],0
push eax push eax
%ifdef __LINUX__
cmp byte [ZipSupport], 1
je .nochangedir
mov ebx,LoadDir
call Change_Dir
.nochangedir:
%endif
mov edx,fname+1 mov edx,fname+1
call Open_File call Open_File
jc near .failed jc near .failed
@@ -3253,6 +3276,11 @@ NEWSYM PatchIPS
; mov byte[esi+edx],0 ; mov byte[esi+edx],0
; inc edx ; inc edx
; loop .ltop ; loop .ltop
%ifdef __LINUX__
pushad
call popdir
popad
%endif
ret ret
.ipsokaymsg db 'IPS PATCHED.',0 .ipsokaymsg db 'IPS PATCHED.',0
.ipsnokaymsg db 'IPS IS CORRUPT.',0 .ipsnokaymsg db 'IPS IS CORRUPT.',0
@@ -4238,7 +4266,7 @@ NEWSYM loadfileGUI
jnc near .nextfile jnc near .nextfile
dec byte[edi-1] dec byte[edi-1]
.nogdformat .nogdformat
mov byte[TextFile], 1
mov byte[IPSPatched],0 mov byte[IPSPatched],0
cmp byte[ZipSupport],1 cmp byte[ZipSupport],1
jne .nottempdirdel jne .nottempdirdel

View File

@@ -507,6 +507,22 @@ void GetFilename()
strcpy(&fnames, tmp); strcpy(&fnames, tmp);
fnames = size; fnames = size;
} }
char *olddir = NULL;
void pushdir()
{
olddir = (char *)malloc(128);
getcwd(olddir, 128);
}
void popdir()
{
CHPath = olddir;
ZFileCHDir();
free(olddir);
olddir = NULL;
}
#endif #endif