Added gzip support to windows and linux version
Renamed linux/winintrf.asm to linux/sdlintrf.asm
This commit is contained in:
@@ -568,9 +568,7 @@ GetNormalEntries2:
|
||||
GUIGetEntry2 GUIsfcfind
|
||||
GUIGetEntry2 GUIswcfind
|
||||
GUIGetEntry2 GUIfigfind
|
||||
%ifdef __GZIP__
|
||||
GUIGetEntry2 GUIfindGZIP
|
||||
%endif
|
||||
GUIGetEntry2 GUIfind058
|
||||
GUIGetEntry2 GUIfind078
|
||||
GUIGetEntry2 GUIfindUSA
|
||||
@@ -594,9 +592,7 @@ GetNormalEntries:
|
||||
GUIGetEntry GUIsfcfind
|
||||
GUIGetEntry GUIswcfind
|
||||
GUIGetEntry GUIfigfind
|
||||
%ifdef __GZIP__
|
||||
GUIGetEntry GUIfindGZIP
|
||||
%endif
|
||||
GUIGetEntry GUIfind058
|
||||
GUIGetEntry GUIfind078
|
||||
GUIGetEntry GUIfindUSA
|
||||
@@ -758,9 +754,7 @@ GetLoadLfn:
|
||||
GUIGetEntryLFN GUIsfcfind
|
||||
GUIGetEntryLFN GUIswcfind
|
||||
GUIGetEntryLFN GUIfigfind
|
||||
%ifdef __GZIP__
|
||||
GUIGetEntryLFN GUIfindGZIP
|
||||
%endif
|
||||
GUIGetEntryLFN GUIfind058
|
||||
GUIGetEntryLFN GUIfind078
|
||||
GUIGetEntryLFN GUIfindUSA
|
||||
|
||||
@@ -31,6 +31,7 @@ EXTSYM SnowData,SnowVelDist
|
||||
EXTSYM cvidmode, newengen, cfgnewgfx, GUI16VID
|
||||
EXTSYM NewEngEnForce
|
||||
EXTSYM PrintChar
|
||||
EXTSYM TextFile
|
||||
EXTSYM mode7tab
|
||||
EXTSYM per2exec
|
||||
EXTSYM MovieCounter
|
||||
@@ -3356,6 +3357,7 @@ NEWSYM SaveCombFile
|
||||
ret
|
||||
|
||||
NEWSYM loadfile
|
||||
mov byte[TextFile], 0
|
||||
call GetCurDir
|
||||
mov byte[InGUI],0
|
||||
jmp loadfileGUI.nogui
|
||||
@@ -3547,6 +3549,7 @@ NEWSYM loadfile
|
||||
je .notfailed
|
||||
mov byte[yesoutofmemory],1
|
||||
.notfailed
|
||||
mov byte[TextFile], 1
|
||||
call PatchIPS
|
||||
ret
|
||||
|
||||
@@ -3997,19 +4000,19 @@ NEWSYM loadfileGUI
|
||||
cmp byte[eax],0
|
||||
jne .ziploop
|
||||
sub eax,4
|
||||
cmp byte[eax+1],'.'
|
||||
jne .finishzipd2
|
||||
cmp byte[eax+2],'g'
|
||||
je .zokay4
|
||||
cmp byte[eax+2],'G'
|
||||
jne .finishzipd2
|
||||
.zokay4
|
||||
cmp byte[eax+3],'z'
|
||||
je .zokay5
|
||||
cmp byte[eax+3],'Z'
|
||||
jne .finishzipd2
|
||||
.zokay5
|
||||
jmp .zokay3
|
||||
; cmp byte[eax+1],'.'
|
||||
; jne .finishzipd2
|
||||
; cmp byte[eax+2],'g'
|
||||
; je .zokay4
|
||||
; cmp byte[eax+2],'G'
|
||||
; jne .finishzipd2
|
||||
;.zokay4
|
||||
; cmp byte[eax+3],'z'
|
||||
; je .zokay5
|
||||
; cmp byte[eax+3],'Z'
|
||||
; jne .finishzipd2
|
||||
;.zokay5
|
||||
; jmp .zokay3
|
||||
.finishzipd2
|
||||
cmp byte[eax],'.'
|
||||
jne near .finishzipd
|
||||
@@ -4040,6 +4043,7 @@ NEWSYM loadfileGUI
|
||||
.zipfail
|
||||
ret
|
||||
.finishzipd
|
||||
mov byte[TextFile], 0
|
||||
mov dword[MessageOn],0
|
||||
mov byte[loadedfromgui],1
|
||||
mov byte[Header512],0
|
||||
@@ -4314,6 +4318,7 @@ NEWSYM loadfileGUI
|
||||
.nosramtof
|
||||
cmp byte[IPSPatched],0
|
||||
jne .patched
|
||||
mov byte[TextFile], 1
|
||||
call PatchIPS
|
||||
.patched
|
||||
ret
|
||||
|
||||
@@ -1307,7 +1307,7 @@ db '256X224 R WIN ',0 ;2
|
||||
db '256x224 R FULL',0 ;3
|
||||
db '512X448 R WIN ',0 ;4
|
||||
db '512X448 DR WIN ',0 ;5
|
||||
db '640x480 S WIN ',0 ;6
|
||||
;db '640x480 S WIN ',0 ;6
|
||||
db '640x480 DR FULL',0 ;7
|
||||
db '640X480 DS FULL',0 ;8
|
||||
db '640X480 S FULL',0 ;9
|
||||
@@ -1323,22 +1323,22 @@ db '1024x768 DS FULL',0 ;17
|
||||
|
||||
; Video Mode Feature Availability (1 = Available, 0 = Not Available)
|
||||
; Left side starts with Video Mode 0
|
||||
NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode
|
||||
NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available
|
||||
NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines
|
||||
NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation
|
||||
NEWSYM GUII2VID, db 0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1 ; Interpolation(w)
|
||||
NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle
|
||||
NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle)
|
||||
NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen
|
||||
NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen
|
||||
NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering
|
||||
NEWSYM GUIHSVID, db 0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0 ; Half/Quarter Scanlines
|
||||
NEWSYM GUI2xVID, db 0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1 ; 2xSaI/Super Eagle Engines
|
||||
NEWSYM GUIM7VID, db 0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1 ; ?Mode 7 video thing?
|
||||
NEWSYM GUIWFVID, db 0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,1,1 ; If Windows Full Screen
|
||||
NEWSYM GUIDSIZE, db 0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1
|
||||
NEWSYM GUIRATIO, db 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode
|
||||
NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available
|
||||
NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines
|
||||
NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation
|
||||
NEWSYM GUII2VID, db 0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1 ; Interpolation(w)
|
||||
NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle
|
||||
NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle)
|
||||
NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen
|
||||
NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen
|
||||
NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering
|
||||
NEWSYM GUIHSVID, db 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0 ; Half/Quarter Scanlines
|
||||
NEWSYM GUI2xVID, db 0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1 ; 2xSaI/Super Eagle Engines
|
||||
NEWSYM GUIM7VID, db 0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1 ; ?Mode 7 video thing?
|
||||
NEWSYM GUIWFVID, db 0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1 ; If Windows Full Screen
|
||||
NEWSYM GUIDSIZE, db 0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1
|
||||
NEWSYM GUIRATIO, db 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
SECTION .text
|
||||
|
||||
@@ -653,58 +653,54 @@ void initwinvideo(void)
|
||||
case 6:
|
||||
WindowWidth=640;
|
||||
WindowHeight=480;
|
||||
SurfaceX=640;
|
||||
SurfaceY=480;
|
||||
break;
|
||||
case 7:
|
||||
WindowWidth=640;
|
||||
WindowHeight=480;
|
||||
SurfaceX=640;
|
||||
SurfaceY=480;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 8:
|
||||
WindowWidth=640;
|
||||
WindowHeight=480;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 9:
|
||||
WindowWidth=640;
|
||||
WindowHeight=480;
|
||||
WindowWidth=800;
|
||||
WindowHeight=600;
|
||||
break;
|
||||
case 10:
|
||||
WindowWidth=800;
|
||||
WindowHeight=600;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 11:
|
||||
WindowWidth=800;
|
||||
WindowHeight=600;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 12:
|
||||
WindowWidth=800;
|
||||
WindowHeight=600;
|
||||
break;
|
||||
case 13:
|
||||
WindowWidth=800;
|
||||
WindowHeight=600;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 13:
|
||||
WindowWidth=1024;
|
||||
WindowHeight=768;
|
||||
break;
|
||||
case 14:
|
||||
WindowWidth=1024;
|
||||
WindowHeight=768;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 15:
|
||||
WindowWidth=1024;
|
||||
WindowHeight=768;
|
||||
SurfaceX=512;
|
||||
SurfaceY=448;
|
||||
break;
|
||||
case 16:
|
||||
WindowWidth=1024;
|
||||
WindowHeight=768;
|
||||
break;
|
||||
case 17:
|
||||
WindowWidth=1024;
|
||||
WindowHeight=768;
|
||||
SurfaceX=512;
|
||||
@@ -1770,3 +1766,4 @@ void GetLocalTime(void *pointer)
|
||||
STUB_FUNCTION;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __GZIP__
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef __LINUX__
|
||||
#include <sys/types.h>
|
||||
@@ -43,11 +41,7 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __GZIP__
|
||||
gzFile *FILEHANDLE[16];
|
||||
#else
|
||||
FILE *FILEHANDLE[16];
|
||||
#endif
|
||||
|
||||
DWORD CurrentHandle=0;
|
||||
|
||||
@@ -97,7 +91,11 @@ DWORD ZFTime;
|
||||
BYTE * MKPath;
|
||||
BYTE * CHPath;
|
||||
BYTE * RMPath;
|
||||
|
||||
//Indicate whether the file must be opened using
|
||||
//zlib or not (used for gzip support)
|
||||
BYTE TextFile;
|
||||
|
||||
// GetDir
|
||||
BYTE * DirName;
|
||||
DWORD DriveNumber;
|
||||
@@ -124,7 +122,7 @@ DWORD ZOpenFile()
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"rb");
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
@@ -137,7 +135,7 @@ DWORD ZOpenFile()
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"wb");
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
|
||||
@@ -43,7 +43,7 @@ VIDEOBJ=${VIDEODIR}/makev16b.o ${VIDEODIR}/makev16t.o ${VIDEODIR}/makevid.o\
|
||||
${VIDEODIR}/m716text.o ${VIDEODIR}/2xsaiw.o\
|
||||
${VIDEODIR}/procvid.o
|
||||
|
||||
WINOBJ=${WINDIR}/copyvwin.o ${WINDIR}/winintrf.o ${WINDIR}/sdllink.o\
|
||||
WINOBJ=${WINDIR}/copyvwin.o ${WINDIR}/sdlintrf.o ${WINDIR}/sdllink.o\
|
||||
${WINDIR}/zloaderw.o ${WINDIR}/ztcp.o ${WINDIR}/zipxw.o\
|
||||
${WINDIR}/zfilew.o ${WINDIR}/protect.o
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define DWORD unsigned int
|
||||
#define BYTE unsigned char
|
||||
@@ -28,6 +29,9 @@
|
||||
FILE *FILEHANDLE[16];
|
||||
DWORD CurrentHandle=0;
|
||||
|
||||
//Indicate whether the file must be opened using
|
||||
//zlib or not (used for gzip support)
|
||||
BYTE TextFile;
|
||||
|
||||
|
||||
// ZFileSystemInit
|
||||
@@ -84,8 +88,14 @@ DWORD DriveNumber;
|
||||
BYTE * ZFileDelFName;
|
||||
// return current position
|
||||
|
||||
|
||||
DWORD ZFileSystemInit()
|
||||
{
|
||||
#ifdef __GZIP__
|
||||
TextFile = 0;
|
||||
#else
|
||||
TextFile = 1;
|
||||
#endif
|
||||
CurrentHandle=0;
|
||||
return(0);
|
||||
}
|
||||
@@ -94,7 +104,11 @@ DWORD ZOpenFile()
|
||||
{
|
||||
if(ZOpenMode==0)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"))!=NULL)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
@@ -103,7 +117,11 @@ DWORD ZOpenFile()
|
||||
}
|
||||
if(ZOpenMode==1)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"))!=NULL)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
@@ -112,7 +130,11 @@ DWORD ZOpenFile()
|
||||
}
|
||||
if(ZOpenMode==2)
|
||||
{
|
||||
if((FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"))!=NULL)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
@@ -124,43 +146,80 @@ DWORD ZOpenFile()
|
||||
|
||||
DWORD ZCloseFile()
|
||||
{
|
||||
if (TextFile)
|
||||
fclose(FILEHANDLE[ZCloseFileHandle]);
|
||||
else
|
||||
gzclose(FILEHANDLE[ZCloseFileHandle]);
|
||||
CurrentHandle-=1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZFileSeek()
|
||||
{
|
||||
int res = 0;
|
||||
int mode = 0;
|
||||
if (ZFileSeekMode==0)
|
||||
{
|
||||
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
if(ZFileSeekMode==1)
|
||||
{
|
||||
fseek(FILEHANDLE[ZFileSeekHandle],ZFileSeekPos,SEEK_END);
|
||||
return(0);
|
||||
mode = SEEK_SET;
|
||||
else if (ZFileSeekMode==1) {
|
||||
mode = SEEK_END;
|
||||
if (TextFile==0)
|
||||
printf("Warning : gzseek(SEEK_END) not supported");
|
||||
} else return (0xFFFFFFFF);
|
||||
|
||||
if (TextFile) {
|
||||
fseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode);
|
||||
return 0;
|
||||
} else {
|
||||
gzseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode);
|
||||
return 0;
|
||||
}
|
||||
return(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
DWORD ZFileRead()
|
||||
{
|
||||
return(fread(ZFileReadBlock,1,ZFileReadSize,FILEHANDLE[ZFileReadHandle]));
|
||||
if (TextFile)
|
||||
return(fread(ZFileReadBlock,
|
||||
1,
|
||||
ZFileReadSize,
|
||||
FILEHANDLE[ZFileReadHandle]));
|
||||
else
|
||||
return(gzread(FILEHANDLE[ZFileReadHandle],
|
||||
ZFileReadBlock,
|
||||
ZFileReadSize));
|
||||
}
|
||||
|
||||
|
||||
DWORD ZFileWrite()
|
||||
{
|
||||
if((fwrite(ZFileWriteBlock,1,ZFileWriteSize,FILEHANDLE[ZFileWriteHandle]))!=ZFileWriteSize) return(0xFFFFFFFF);
|
||||
int res=0;
|
||||
if (TextFile)
|
||||
res = fwrite(ZFileWriteBlock,
|
||||
1,
|
||||
ZFileWriteSize,
|
||||
FILEHANDLE[ZFileWriteHandle]);
|
||||
else
|
||||
res = gzwrite(FILEHANDLE[ZFileWriteHandle],
|
||||
ZFileWriteBlock,
|
||||
ZFileWriteSize);
|
||||
|
||||
if (res!=ZFileWriteSize)
|
||||
return(0xFFFFFFFF);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
DWORD ZFileTell()
|
||||
{
|
||||
return(ftell(FILEHANDLE[ZFileTellHandle]));
|
||||
int res = 0;
|
||||
if (TextFile) {
|
||||
res = ftell(FILEHANDLE[ZFileTellHandle]);
|
||||
if (res == -1) fprintf(stderr, "Oups!! gzTell\n");
|
||||
return(res);
|
||||
} else return gztell(FILEHANDLE[ZFileTellHandle]);
|
||||
}
|
||||
|
||||
|
||||
DWORD ZFileDelete()
|
||||
{
|
||||
return(remove(ZFileDelFName));
|
||||
|
||||
Reference in New Issue
Block a user