Patch from aaronl to make linux port compile with -Wall
This commit is contained in:
@@ -5,3 +5,4 @@ Steven "relnev" Fuller
|
|||||||
Andrew "prometheus" Henderson
|
Andrew "prometheus" Henderson
|
||||||
Dan "theoddone33" Olson
|
Dan "theoddone33" Olson
|
||||||
Shawn "EvilTypeGuy" Walker
|
Shawn "EvilTypeGuy" Walker
|
||||||
|
Aaron Lehmann
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ double tanval;
|
|||||||
double c4x,c4y,c4z;
|
double c4x,c4y,c4z;
|
||||||
double c4x2,c4y2,c4z2;
|
double c4x2,c4y2,c4z2;
|
||||||
|
|
||||||
C4TransfWireFrame()
|
void C4TransfWireFrame()
|
||||||
{
|
{
|
||||||
c4x=(double)C4WFXVal;
|
c4x=(double)C4WFXVal;
|
||||||
c4y=(double)C4WFYVal;
|
c4y=(double)C4WFYVal;
|
||||||
@@ -151,7 +151,7 @@ C4TransfWireFrame()
|
|||||||
C4WFYVal=(short)(c4y*C4WFScale/(0x90*(c4z+0x95))*0x95);
|
C4WFYVal=(short)(c4y*C4WFScale/(0x90*(c4z+0x95))*0x95);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4TransfWireFrame2()
|
void C4TransfWireFrame2()
|
||||||
{
|
{
|
||||||
c4x=(double)C4WFXVal;
|
c4x=(double)C4WFXVal;
|
||||||
c4y=(double)C4WFYVal;
|
c4y=(double)C4WFYVal;
|
||||||
@@ -177,7 +177,7 @@ C4TransfWireFrame2()
|
|||||||
C4WFYVal=(short)(c4y*C4WFScale/0x100);
|
C4WFYVal=(short)(c4y*C4WFScale/0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4CalcWireFrame()
|
void C4CalcWireFrame()
|
||||||
{
|
{
|
||||||
C4WFXVal=C4WFX2Val-C4WFXVal;
|
C4WFXVal=C4WFX2Val-C4WFXVal;
|
||||||
C4WFYVal=C4WFY2Val-C4WFYVal;
|
C4WFYVal=C4WFY2Val-C4WFYVal;
|
||||||
@@ -203,7 +203,7 @@ short C41FAngleRes;
|
|||||||
short C41FDist;
|
short C41FDist;
|
||||||
short C41FDistVal;
|
short C41FDistVal;
|
||||||
|
|
||||||
C4Op1F()
|
void C4Op1F()
|
||||||
{
|
{
|
||||||
if (C41FXVal == 0) {
|
if (C41FXVal == 0) {
|
||||||
if (C41FYVal>0) C41FAngleRes=0x80;
|
if (C41FYVal>0) C41FAngleRes=0x80;
|
||||||
@@ -218,14 +218,14 @@ C4Op1F()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
C4Op15()
|
void C4Op15()
|
||||||
{
|
{
|
||||||
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
||||||
((double)C41FXVal));
|
((double)C41FXVal));
|
||||||
C41FDist=(short)tanval;
|
C41FDist=(short)tanval;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4Op0D()
|
void C4Op0D()
|
||||||
{
|
{
|
||||||
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
tanval=sqrt(((double)C41FYVal)*((double)C41FYVal)+((double)C41FXVal)*
|
||||||
((double)C41FXVal));
|
((double)C41FXVal));
|
||||||
@@ -252,7 +252,7 @@ short Op00Multiplicand;
|
|||||||
short Op00Multiplier;
|
short Op00Multiplier;
|
||||||
short Op00Result;
|
short Op00Result;
|
||||||
|
|
||||||
DSPOp00()
|
void DSPOp00()
|
||||||
{
|
{
|
||||||
Op00Result=Op00Multiplicand*Op00Multiplier/32768;
|
Op00Result=Op00Multiplicand*Op00Multiplier/32768;
|
||||||
#ifdef DebugDSP1
|
#ifdef DebugDSP1
|
||||||
@@ -266,7 +266,7 @@ signed short Op10CoefficientR;
|
|||||||
signed short Op10ExponentR;
|
signed short Op10ExponentR;
|
||||||
float Op10Temp;
|
float Op10Temp;
|
||||||
|
|
||||||
DSPOp10()
|
void DSPOp10()
|
||||||
{
|
{
|
||||||
Op10ExponentR=-Op10Exponent;
|
Op10ExponentR=-Op10Exponent;
|
||||||
Op10Temp = Op10Coefficient / 32768.0;
|
Op10Temp = Op10Coefficient / 32768.0;
|
||||||
@@ -296,7 +296,7 @@ unsigned short Op04Radius;
|
|||||||
short Op04Sin;
|
short Op04Sin;
|
||||||
short Op04Cos;
|
short Op04Cos;
|
||||||
|
|
||||||
DSPOp04()
|
void DSPOp04()
|
||||||
{
|
{
|
||||||
Op04Sin=SinTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
Op04Sin=SinTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
||||||
Op04Cos=CosTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
Op04Cos=CosTable2[(Op04Angle/256)&255]*Op04Radius/65536;
|
||||||
@@ -323,7 +323,7 @@ short Op0CY1;
|
|||||||
short Op0CX2;
|
short Op0CX2;
|
||||||
short Op0CY2;
|
short Op0CY2;
|
||||||
|
|
||||||
DSPOp0C()
|
void DSPOp0C()
|
||||||
{
|
{
|
||||||
Op0CX2=(Op0CX1*CosTable2[(Op0CA/256)&255]+Op0CY1*SinTable2[(Op0CA/256)&255])/65536;
|
Op0CX2=(Op0CX1*CosTable2[(Op0CA/256)&255]+Op0CY1*SinTable2[(Op0CA/256)&255])/65536;
|
||||||
Op0CY2=(Op0CX1*-SinTable2[(Op0CA/256)&255]+Op0CY1*CosTable2[(Op0CA/256)&255])/65536;
|
Op0CY2=(Op0CX1*-SinTable2[(Op0CA/256)&255]+Op0CY1*CosTable2[(Op0CA/256)&255])/65536;
|
||||||
@@ -582,7 +582,7 @@ double ObjPZ2;
|
|||||||
double DivideOp06;
|
double DivideOp06;
|
||||||
int Temp;
|
int Temp;
|
||||||
|
|
||||||
DSPOp06()
|
void DSPOp06()
|
||||||
{
|
{
|
||||||
|
|
||||||
/* ObjPX=(Op06X-CenterX);
|
/* ObjPX=(Op06X-CenterX);
|
||||||
@@ -710,7 +710,7 @@ short Op21Xr;
|
|||||||
short Op21Yr;
|
short Op21Yr;
|
||||||
double sc,sc2,sc3;
|
double sc,sc2,sc3;
|
||||||
|
|
||||||
DSPOp01()
|
void DSPOp01()
|
||||||
{
|
{
|
||||||
double zr,yr,xr;
|
double zr,yr,xr;
|
||||||
|
|
||||||
@@ -745,7 +745,7 @@ DSPOp01()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPOp11()
|
void DSPOp11()
|
||||||
{
|
{
|
||||||
double zr,yr,xr;
|
double zr,yr,xr;
|
||||||
|
|
||||||
@@ -779,7 +779,7 @@ DSPOp11()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPOp21()
|
void DSPOp21()
|
||||||
{
|
{
|
||||||
double zr,yr,xr;
|
double zr,yr,xr;
|
||||||
|
|
||||||
@@ -973,7 +973,7 @@ void DSPOp13()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPOp23()
|
void DSPOp23()
|
||||||
{
|
{
|
||||||
double F,L,U;
|
double F,L,U;
|
||||||
F=Op23F; L=Op23L; U=Op23U;
|
F=Op23F; L=Op23L; U=Op23U;
|
||||||
@@ -996,7 +996,7 @@ short Op14Xrr;
|
|||||||
short Op14Yrr;
|
short Op14Yrr;
|
||||||
|
|
||||||
double Op14Temp;
|
double Op14Temp;
|
||||||
DSPOp14()
|
void DSPOp14()
|
||||||
{
|
{
|
||||||
Op14Temp=(Op14Zr*6.2832/65536.0)+(1/cos(Op14Xr*6.2832/65536.0))*((Op14U*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0)-(Op14F*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0));
|
Op14Temp=(Op14Zr*6.2832/65536.0)+(1/cos(Op14Xr*6.2832/65536.0))*((Op14U*6.2832/65536.0)*cos(Op14Yr*6.2832/65536.0)-(Op14F*6.2832/65536.0)*sin(Op14Yr*6.2832/65536.0));
|
||||||
Op14Zrr=(short)(Op14Temp*65536.0/6.2832);
|
Op14Zrr=(short)(Op14Temp*65536.0/6.2832);
|
||||||
@@ -1015,7 +1015,7 @@ short Op0EV;
|
|||||||
short Op0EX;
|
short Op0EX;
|
||||||
short Op0EY;
|
short Op0EY;
|
||||||
|
|
||||||
DSPOp0E()
|
void DSPOp0E()
|
||||||
{
|
{
|
||||||
|
|
||||||
// screen Directions UP
|
// screen Directions UP
|
||||||
@@ -1100,7 +1100,7 @@ short Op28Y;
|
|||||||
short Op28Z;
|
short Op28Z;
|
||||||
short Op28R;
|
short Op28R;
|
||||||
|
|
||||||
DSPOp28()
|
void DSPOp28()
|
||||||
{
|
{
|
||||||
Op28R=(short)sqrt(Op28X*Op28X+Op28Y*Op28Y+Op28Z*Op28Z);
|
Op28R=(short)sqrt(Op28X*Op28X+Op28Y*Op28Y+Op28Z*Op28Z);
|
||||||
#ifdef DebugDSP1
|
#ifdef DebugDSP1
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ EXTSYM keyboardhit
|
|||||||
EXTSYM GUIkeydelay2
|
EXTSYM GUIkeydelay2
|
||||||
;EXTSYM _kbhit
|
;EXTSYM _kbhit
|
||||||
;EXTSYM _getch
|
;EXTSYM _getch
|
||||||
EXTSYM _chdrive
|
;EXTSYM _chdrive
|
||||||
EXTSYM ZFileMKDir,ZFileCHDir,ZFileRMDir,CHPath,MKPath,RMPath
|
EXTSYM ZFileMKDir,ZFileCHDir,ZFileRMDir,CHPath,MKPath,RMPath
|
||||||
EXTSYM ZFileGetDir,DriveNumber,DirName
|
EXTSYM ZFileGetDir,DriveNumber,DirName
|
||||||
EXTSYM _getdrive
|
EXTSYM _getdrive
|
||||||
@@ -799,11 +799,11 @@ KeyConvTableS
|
|||||||
|
|
||||||
NEWSYM Change_Drive
|
NEWSYM Change_Drive
|
||||||
; change to drive in dl (0 = A, 1 = B, etc.)
|
; change to drive in dl (0 = A, 1 = B, etc.)
|
||||||
and edx,0FFh
|
;and edx,0FFh
|
||||||
add edx,1
|
;add edx,1
|
||||||
push edx
|
;push edx
|
||||||
call _chdrive
|
;call _chdrive
|
||||||
pop edx
|
;pop edx
|
||||||
; mov ah,0Eh
|
; mov ah,0Eh
|
||||||
; int 21h
|
; int 21h
|
||||||
ret
|
ret
|
||||||
|
|||||||
@@ -411,7 +411,6 @@ int ReInitSound(void)
|
|||||||
BOOL InitJoystickInput(void)
|
BOOL InitJoystickInput(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDL_Event *event;
|
|
||||||
|
|
||||||
// STUB_FUNCTION;
|
// STUB_FUNCTION;
|
||||||
|
|
||||||
@@ -498,10 +497,10 @@ int startgame(void)
|
|||||||
surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, flags);
|
surface = SDL_SetVideoMode(WindowWidth, WindowHeight, BitDepth, flags);
|
||||||
if (surface == NULL) {
|
if (surface == NULL) {
|
||||||
if (BitDepth)
|
if (BitDepth)
|
||||||
fprintf (stderr, "Could not set %dx%dx%d video mode.\n",
|
fprintf (stderr, "Could not set %ld%ld%ld video mode.\n",
|
||||||
WindowWidth,WindowHeight,BitDepth);
|
WindowWidth,WindowHeight,BitDepth);
|
||||||
else
|
else
|
||||||
fprintf (stderr, "Could not set %dx%d video mode.\n",WindowWidth,
|
fprintf (stderr, "Could not set %ldx%ld video mode.\n",WindowWidth,
|
||||||
WindowHeight);
|
WindowHeight);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1027,7 +1026,6 @@ extern unsigned char newengen;
|
|||||||
|
|
||||||
void clearwin()
|
void clearwin()
|
||||||
{
|
{
|
||||||
DWORD i,j,color32;
|
|
||||||
DWORD *SURFDW;
|
DWORD *SURFDW;
|
||||||
|
|
||||||
Temp1=LockSurface();
|
Temp1=LockSurface();
|
||||||
@@ -1475,21 +1473,6 @@ void LinuxExit (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern char fulladdtab[65536*2];
|
extern char fulladdtab[65536*2];
|
||||||
extern WORD vesa2_usbit;
|
|
||||||
extern WORD vesa2_clbit;
|
|
||||||
extern WORD vesa2_rpos;
|
|
||||||
extern WORD vesa2_rfull;
|
|
||||||
extern WORD vesa2_rtrcl;
|
|
||||||
extern WORD vesa2_rtrcla;
|
|
||||||
extern WORD vesa2_gpos;
|
|
||||||
extern WORD vesa2_gfull;
|
|
||||||
extern WORD vesa2_gtrcl;
|
|
||||||
extern WORD vesa2_gtrcla;
|
|
||||||
extern WORD vesa2_bpos;
|
|
||||||
extern WORD vesa2_bfull;
|
|
||||||
extern WORD vesa2_btrcl;
|
|
||||||
extern WORD vesa2_btrcla;
|
|
||||||
extern WORD nojoystickpoll;
|
|
||||||
|
|
||||||
extern void SwitchFullScreen(void);
|
extern void SwitchFullScreen(void);
|
||||||
|
|
||||||
@@ -1532,8 +1515,6 @@ void WinUpdateDevices()
|
|||||||
// keys[1]=keys[16];
|
// keys[1]=keys[16];
|
||||||
keys[0]=0;
|
keys[0]=0;
|
||||||
|
|
||||||
// if (nojoystickpoll) return;
|
|
||||||
|
|
||||||
for(i=0;i<4;i++)
|
for(i=0;i<4;i++)
|
||||||
{
|
{
|
||||||
if(JoystickInput[i])
|
if(JoystickInput[i])
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
@@ -171,7 +173,6 @@ DWORD ZCloseFile()
|
|||||||
|
|
||||||
DWORD ZFileSeek()
|
DWORD ZFileSeek()
|
||||||
{
|
{
|
||||||
int res = 0;
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
if (ZFileSeekMode==0)
|
if (ZFileSeekMode==0)
|
||||||
mode = SEEK_SET;
|
mode = SEEK_SET;
|
||||||
@@ -319,7 +320,7 @@ DWORD ZFileFindNext()
|
|||||||
stat ( globbuf.gl_pathv[globcur], &filetype );
|
stat ( globbuf.gl_pathv[globcur], &filetype );
|
||||||
|
|
||||||
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||||
if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||||
|
|
||||||
if ( S_ISDIR ( filetype.st_mode ))
|
if ( S_ISDIR ( filetype.st_mode ))
|
||||||
*(char *)(DTALocPos + 0x15) = 0x10;
|
*(char *)(DTALocPos + 0x15) = 0x10;
|
||||||
@@ -362,7 +363,7 @@ DWORD ZFileFindFirst()
|
|||||||
stat ( globbuf.gl_pathv[globcur], &filetype );
|
stat ( globbuf.gl_pathv[globcur], &filetype );
|
||||||
|
|
||||||
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||||
if((ZFileFindATTRIB&0x10==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||||
|
|
||||||
if ( S_ISDIR ( filetype.st_mode ))
|
if ( S_ISDIR ( filetype.st_mode ))
|
||||||
*(char *)(DTALocPos + 0x15) = 0x10;
|
*(char *)(DTALocPos + 0x15) = 0x10;
|
||||||
@@ -441,14 +442,6 @@ DWORD GetDate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
int _chdrive( int drive )
|
|
||||||
{
|
|
||||||
// STUB_FUNCTION;
|
|
||||||
}
|
|
||||||
int _getdrive( void )
|
|
||||||
{
|
|
||||||
// STUB_FUNCTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern char SRAMDir;
|
extern char SRAMDir;
|
||||||
extern char InitDir;
|
extern char InitDir;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ Initial Linux Command Line Parsing by EvilTypeGuy (drevil@warpcore.org) April 20
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
|
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
|
||||||
#define DWORD unsigned long
|
#define DWORD unsigned long
|
||||||
@@ -76,8 +78,23 @@ char ucase(char ch){
|
|||||||
return(ch);
|
return(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int my_atoi(char *nptr) {
|
||||||
|
int p,c;
|
||||||
|
|
||||||
|
c = 0;
|
||||||
|
for(p = 0; nptr[p]; p++) {
|
||||||
|
if ( !isdigit(nptr[p]) ) c += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c) return -1;
|
||||||
|
|
||||||
|
return atoi(nptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void UnProtectMemory (void);
|
||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
int opt,hasroom,p,pp,arg;
|
int opt,hasroom,p,pp;
|
||||||
|
|
||||||
char *fvar;
|
char *fvar;
|
||||||
|
|
||||||
@@ -342,22 +359,12 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zstart();
|
zstart();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_atoi(char *nptr) {
|
int pccmdline(void) {
|
||||||
int p,c;
|
return 0;
|
||||||
|
|
||||||
c = 0;
|
|
||||||
for(p = 0; nptr[p]; p++) {
|
|
||||||
if ( !isdigit(nptr[p]) ) c += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c) return -1;
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
return atoi(nptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -389,7 +396,3 @@ void ccmdline(void) {
|
|||||||
printf("cmdline returned %i\n",p);
|
printf("cmdline returned %i\n",p);
|
||||||
DosExit();
|
DosExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
int pccmdline(void) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
// In-game chat will be moved to a separate packet in TCP/IP
|
// In-game chat will be moved to a separate packet in TCP/IP
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@@ -234,7 +235,6 @@ void DeInitTCP()
|
|||||||
|
|
||||||
void GetUDPStatus() {
|
void GetUDPStatus() {
|
||||||
int retval;
|
int retval;
|
||||||
char NoSend = 0;
|
|
||||||
|
|
||||||
UDPEnable=UDPConfig;
|
UDPEnable=UDPConfig;
|
||||||
|
|
||||||
@@ -268,7 +268,6 @@ void GetUDPStatus() {
|
|||||||
|
|
||||||
int isipval(char *name){
|
int isipval(char *name){
|
||||||
int i;
|
int i;
|
||||||
int tcperr;
|
|
||||||
i=0;
|
i=0;
|
||||||
while(name[i]!=0){
|
while(name[i]!=0){
|
||||||
if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9'))))
|
if (!((name[i]=='.') || ((name[i]>='0') && (name[i]<='9'))))
|
||||||
@@ -283,7 +282,6 @@ int ConnectServer(char *servername, unsigned int port)
|
|||||||
char blah[255];
|
char blah[255];
|
||||||
int retval,i;
|
int retval,i;
|
||||||
LPHOSTENT host1;
|
LPHOSTENT host1;
|
||||||
unsigned long addr1;
|
|
||||||
int yesip;
|
int yesip;
|
||||||
#ifndef __LINUX__
|
#ifndef __LINUX__
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
@@ -451,7 +449,7 @@ int WaitForServer(){
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (UDPEnable){
|
if (UDPEnable){
|
||||||
if (i=GetData(1,blah)){
|
if ((i=GetData(1,blah))){
|
||||||
if ((i==1) && (blah[0]==1))
|
if ((i==1) && (blah[0]==1))
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@@ -492,7 +490,7 @@ void Disconnect()
|
|||||||
|
|
||||||
int StartServerCycle(unsigned short port)
|
int StartServerCycle(unsigned short port)
|
||||||
{
|
{
|
||||||
int retval,sizet,i;
|
int retval,i;
|
||||||
|
|
||||||
portval = port;
|
portval = port;
|
||||||
packetnum = 0;
|
packetnum = 0;
|
||||||
@@ -621,10 +619,6 @@ int StartServerCycle(unsigned short port)
|
|||||||
|
|
||||||
int acceptzuser()
|
int acceptzuser()
|
||||||
{
|
{
|
||||||
int retval,r,i;
|
|
||||||
LPHOSTENT host1;
|
|
||||||
int yesip;
|
|
||||||
|
|
||||||
if (UDPEnable)
|
if (UDPEnable)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
@@ -724,6 +718,32 @@ void StopServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GetLeftUDP()
|
||||||
|
{
|
||||||
|
#ifdef __LINUX__
|
||||||
|
fd_set zrf;
|
||||||
|
#else
|
||||||
|
FD_SET zrf;
|
||||||
|
#endif
|
||||||
|
struct timeval nto;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
nto.tv_sec=0;
|
||||||
|
nto.tv_usec=0; /* return immediately */
|
||||||
|
|
||||||
|
FD_ZERO(&zrf);
|
||||||
|
FD_SET(userversocket,&zrf);
|
||||||
|
r=select(userversocket+1,&zrf,0,0,&nto);
|
||||||
|
|
||||||
|
if (r == SOCKET_ERROR)
|
||||||
|
{
|
||||||
|
closesocket(userversocket);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
return(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************\
|
/**********************************************************\
|
||||||
* Send data *
|
* Send data *
|
||||||
* - parameters : *
|
* - parameters : *
|
||||||
@@ -887,7 +907,6 @@ extern void UpdateVFrame(void);
|
|||||||
int SendData(int dsize,unsigned char *dptr)
|
int SendData(int dsize,unsigned char *dptr)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
char message1[256];
|
|
||||||
|
|
||||||
if (UDPEnable){
|
if (UDPEnable){
|
||||||
/* retval = sendto(ugamesocket,dptr,dsize,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress));
|
/* retval = sendto(ugamesocket,dptr,dsize,0,(struct sockaddr *)&ugameaddress,sizeof(ugameaddress));
|
||||||
@@ -1105,32 +1124,6 @@ int GetLeft()
|
|||||||
return(tempsize);
|
return(tempsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLeftUDP()
|
|
||||||
{
|
|
||||||
#ifdef __LINUX__
|
|
||||||
fd_set zrf;
|
|
||||||
#else
|
|
||||||
FD_SET zrf;
|
|
||||||
#endif
|
|
||||||
struct timeval nto;
|
|
||||||
int r;
|
|
||||||
int tempsize;
|
|
||||||
|
|
||||||
nto.tv_sec=0;
|
|
||||||
nto.tv_usec=0; /* return immediately */
|
|
||||||
|
|
||||||
FD_ZERO(&zrf);
|
|
||||||
FD_SET(userversocket,&zrf);
|
|
||||||
r=select(userversocket+1,&zrf,0,0,&nto);
|
|
||||||
|
|
||||||
if (r == SOCKET_ERROR)
|
|
||||||
{
|
|
||||||
closesocket(userversocket);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
return(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************\
|
/**********************************************************\
|
||||||
* Receive data *
|
* Receive data *
|
||||||
|
|||||||
@@ -57,8 +57,10 @@ ZIPOBJ=${ZIPDIR}/zzip.o ${ZIPDIR}/unzip.o
|
|||||||
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
|
MAINOBJ=cfgload.o endmem.o fixsin.o init.o ui.o vcache.o water.o
|
||||||
|
|
||||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ}
|
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${WINDOSOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ}
|
||||||
LIBS=`sdl-config --libs` -lz
|
SDLLIBS := $(shell sdl-config --libs)
|
||||||
CFLAGS=-g -D__LINUX__ `sdl-config --cflags`
|
SDLCFLAGS := $(shell sdl-config --cflags)
|
||||||
|
LIBS=${SDLLIBS} -lz
|
||||||
|
CFLAGS=-g -Wall -D__LINUX__ ${SDLCFLAGS}
|
||||||
ASM=nasm
|
ASM=nasm
|
||||||
ASMFLAGS=-f elf -D__LINUX__ -g -w-orphan-labels
|
ASMFLAGS=-f elf -D__LINUX__ -g -w-orphan-labels
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ MAINOBJ=cfgload.obj endmem.obj fixsin.obj init.obj ui.obj vcache.obj water.obj
|
|||||||
|
|
||||||
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ}
|
OBJS=${CHIPSOBJ} ${CPUOBJ} ${WINOBJ} ${GUIOBJ} ${VIDEOBJ} ${ZIPOBJ} ${MAINOBJ} ${WINDOSOBJ}
|
||||||
LIBS=
|
LIBS=
|
||||||
CFLAGS=/c /D__WIN32__
|
CFLAGS=/c /Wall /D__WIN32__
|
||||||
ASM=nasm
|
ASM=nasm
|
||||||
ASMFLAGS=-f win32 -D__WIN32__
|
ASMFLAGS=-f win32 -D__WIN32__
|
||||||
CC=cl
|
CC=cl
|
||||||
|
|||||||
@@ -536,10 +536,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
|
|
||||||
/* we check the magic */
|
/* we check the magic */
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK)
|
||||||
|
{
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x02014b50)
|
else if (uMagic!=0x02014b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
|
|
||||||
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -616,10 +618,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
uSizeRead = extraFieldBufferSize;
|
uSizeRead = extraFieldBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
|
{
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
||||||
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -641,10 +645,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
|||||||
uSizeRead = commentBufferSize;
|
uSizeRead = commentBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0)
|
||||||
|
{
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
||||||
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -825,10 +831,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
|||||||
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK)
|
||||||
|
{
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x04034b50)
|
else if (uMagic!=0x04034b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
|
|
||||||
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
@@ -1267,7 +1275,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
|
|||||||
char *szComment;
|
char *szComment;
|
||||||
uLong uSizeBuf;
|
uLong uSizeBuf;
|
||||||
{
|
{
|
||||||
int err=UNZ_OK;
|
|
||||||
unz_s* s;
|
unz_s* s;
|
||||||
uLong uReadThis ;
|
uLong uReadThis ;
|
||||||
if (file==NULL)
|
if (file==NULL)
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#include <utime.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -37,10 +42,12 @@ unsigned int ZipError=0;
|
|||||||
// 5 : Error opening file
|
// 5 : Error opening file
|
||||||
// 6 : Error Writing file
|
// 6 : Error Writing file
|
||||||
|
|
||||||
|
#ifndef __LINUX__
|
||||||
struct utimbuf {
|
struct utimbuf {
|
||||||
time_t actime;
|
time_t actime;
|
||||||
time_t modtime;
|
time_t modtime;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
|
void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
|
||||||
{
|
{
|
||||||
@@ -64,9 +71,11 @@ void change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date)
|
|||||||
|
|
||||||
int mymkdir(const char *dirname)
|
int mymkdir(const char *dirname)
|
||||||
{
|
{
|
||||||
int ret=0;
|
#ifdef __LINUX__
|
||||||
ret = mkdir (dirname);
|
return(mkdir(dirname, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
|
||||||
return ret;
|
#else
|
||||||
|
return(mkdir(dirname));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int makedir (char *newdir)
|
int makedir (char *newdir)
|
||||||
@@ -129,7 +138,6 @@ int do_extract_currentfile(unzFile uf,
|
|||||||
uInt size_buf;
|
uInt size_buf;
|
||||||
|
|
||||||
unz_file_info file_info;
|
unz_file_info file_info;
|
||||||
uLong ratio=0;
|
|
||||||
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
|
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
@@ -263,7 +271,6 @@ int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite)
|
|||||||
uLong i;
|
uLong i;
|
||||||
unz_global_info gi;
|
unz_global_info gi;
|
||||||
int err;
|
int err;
|
||||||
FILE* fout=NULL;
|
|
||||||
|
|
||||||
err = unzGetGlobalInfo (uf,&gi);
|
err = unzGetGlobalInfo (uf,&gi);
|
||||||
if (err!=UNZ_OK)
|
if (err!=UNZ_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user