Code cleanup

This commit is contained in:
pagefault
2001-08-29 07:23:51 +00:00
parent 8feda898ab
commit 204c74a383
4 changed files with 3144 additions and 3144 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,334 +1,334 @@
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) //Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
// //
//This program is free software; you can redistribute it and/or //This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License //modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either //as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later //version 2 of the License, or (at your option) any later
//version. //version.
// //
//This program is distributed in the hope that it will be useful, //This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of //but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details. //GNU General Public License for more details.
// //
//You should have received a copy of the GNU General Public License //You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <zlib.h> #include <zlib.h>
#include <dos.h> #include <dos.h>
#include <fcntl.h> #include <fcntl.h>
#include <share.h> #include <share.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
/* #ifdef ZDOS /* #ifdef ZDOS
#include <dos.h> #include <dos.h>
#endif */ #endif */
#define DWORD unsigned int #define DWORD unsigned int
#define BYTE unsigned char #define BYTE unsigned char
FILE *FILEHANDLE[16]; FILE *FILEHANDLE[16];
DWORD CurrentHandle=0; DWORD CurrentHandle=0;
//Indicate whether the file must be opened using //Indicate whether the file must be opened using
//zlib or not (used for gzip support) //zlib or not (used for gzip support)
BYTE TextFile; BYTE TextFile;
// ZFileSystemInit // ZFileSystemInit
// return 0 // return 0
// ZOpenFile info : // ZOpenFile info :
BYTE * ZOpenFileName; BYTE * ZOpenFileName;
DWORD ZOpenMode; DWORD ZOpenMode;
// Open modes : 0 read/write in // Open modes : 0 read/write in
// 1 write (create file, overwrite) // 1 write (create file, overwrite)
// return file handle if success, 0xFFFFFFFF if error // return file handle if success, 0xFFFFFFFF if error
// ZCloseFile info : // ZCloseFile info :
DWORD ZCloseFileHandle; DWORD ZCloseFileHandle;
// return 0 // return 0
// ZFileSeek info : // ZFileSeek info :
DWORD ZFileSeekHandle; DWORD ZFileSeekHandle;
DWORD ZFileSeekPos; DWORD ZFileSeekPos;
DWORD ZFileSeekMode; // 0 start, 1 end DWORD ZFileSeekMode; // 0 start, 1 end
// return 0 // return 0
// ZFileReadBlock info : // ZFileReadBlock info :
BYTE * ZFileReadBlock; BYTE * ZFileReadBlock;
DWORD ZFileReadSize; DWORD ZFileReadSize;
DWORD ZFileReadHandle; DWORD ZFileReadHandle;
// return 0 // return 0
// ZFileWriteBlock info : // ZFileWriteBlock info :
BYTE * ZFileWriteBlock; BYTE * ZFileWriteBlock;
DWORD ZFileWriteSize; DWORD ZFileWriteSize;
DWORD ZFileWriteHandle; DWORD ZFileWriteHandle;
// return 0 // return 0
// ZFileTell // ZFileTell
DWORD ZFileTellHandle; DWORD ZFileTellHandle;
// ZFileGetftime // ZFileGetftime
BYTE * ZFFTimeFName; BYTE * ZFFTimeFName;
DWORD ZFTimeHandle; DWORD ZFTimeHandle;
DWORD ZFDate; DWORD ZFDate;
DWORD ZFTime; DWORD ZFTime;
// MKDir/CHDir // MKDir/CHDir
BYTE * MKPath; BYTE * MKPath;
BYTE * CHPath; BYTE * CHPath;
BYTE * RMPath; BYTE * RMPath;
// GetDir // GetDir
BYTE * DirName; BYTE * DirName;
DWORD DriveNumber; DWORD DriveNumber;
// ZFileDelete // ZFileDelete
BYTE * ZFileDelFName; BYTE * ZFileDelFName;
// return current position // return current position
DWORD ZFileSystemInit() DWORD ZFileSystemInit()
{ {
#ifdef __GZIP__ #ifdef __GZIP__
TextFile = 0; TextFile = 0;
#else #else
TextFile = 1; TextFile = 1;
#endif #endif
CurrentHandle=0; CurrentHandle=0;
return(0); return(0);
} }
DWORD ZOpenFile() DWORD ZOpenFile()
{ {
if(ZOpenMode==0) if(ZOpenMode==0)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
} }
return(0xFFFFFFFF); return(0xFFFFFFFF);
} }
if(ZOpenMode==1) if(ZOpenMode==1)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
} }
return(0xFFFFFFFF); return(0xFFFFFFFF);
} }
if(ZOpenMode==2) if(ZOpenMode==2)
{ {
if (TextFile) if (TextFile)
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
else else
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"r+b"); FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"r+b");
if(FILEHANDLE[CurrentHandle]!=NULL) if(FILEHANDLE[CurrentHandle]!=NULL)
{ {
CurrentHandle+=1; CurrentHandle+=1;
return(CurrentHandle-1); return(CurrentHandle-1);
} }
return(0xFFFFFFFF); return(0xFFFFFFFF);
} }
return(0xFFFFFFFF); return(0xFFFFFFFF);
} }
DWORD ZCloseFile() DWORD ZCloseFile()
{ {
if (TextFile) if (TextFile)
fclose(FILEHANDLE[ZCloseFileHandle]); fclose(FILEHANDLE[ZCloseFileHandle]);
else else
gzclose(FILEHANDLE[ZCloseFileHandle]); gzclose(FILEHANDLE[ZCloseFileHandle]);
CurrentHandle-=1; CurrentHandle-=1;
return(0); return(0);
} }
DWORD ZFileSeek() DWORD ZFileSeek()
{ {
/*int res = 0;*/ /*int res = 0;*/
int mode = 0; int mode = 0;
if (ZFileSeekMode==0) if (ZFileSeekMode==0)
mode = SEEK_SET; mode = SEEK_SET;
else if (ZFileSeekMode==1) { else if (ZFileSeekMode==1) {
mode = SEEK_END; mode = SEEK_END;
if (TextFile==0) if (TextFile==0)
printf("Warning : gzseek(SEEK_END) not supported"); printf("Warning : gzseek(SEEK_END) not supported");
} else return (0xFFFFFFFF); } else return (0xFFFFFFFF);
if (TextFile) { if (TextFile) {
fseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode); fseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode);
return 0; return 0;
} else { } else {
gzseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode); gzseek(FILEHANDLE[ZFileSeekHandle], ZFileSeekPos, mode);
return 0; return 0;
} }
return(0xFFFFFFFF); return(0xFFFFFFFF);
} }
DWORD ZFileRead() DWORD ZFileRead()
{ {
if (TextFile) if (TextFile)
return(fread(ZFileReadBlock, return(fread(ZFileReadBlock,
1, 1,
ZFileReadSize, ZFileReadSize,
FILEHANDLE[ZFileReadHandle])); FILEHANDLE[ZFileReadHandle]));
else else
return(gzread(FILEHANDLE[ZFileReadHandle], return(gzread(FILEHANDLE[ZFileReadHandle],
ZFileReadBlock, ZFileReadBlock,
ZFileReadSize)); ZFileReadSize));
} }
DWORD ZFileWrite() DWORD ZFileWrite()
{ {
int res=0; int res=0;
if (TextFile) if (TextFile)
res = fwrite(ZFileWriteBlock, res = fwrite(ZFileWriteBlock,
1, 1,
ZFileWriteSize, ZFileWriteSize,
FILEHANDLE[ZFileWriteHandle]); FILEHANDLE[ZFileWriteHandle]);
else else
res = gzwrite(FILEHANDLE[ZFileWriteHandle], res = gzwrite(FILEHANDLE[ZFileWriteHandle],
ZFileWriteBlock, ZFileWriteBlock,
ZFileWriteSize); ZFileWriteSize);
if (res!=ZFileWriteSize) if (res!=ZFileWriteSize)
return(0xFFFFFFFF); return(0xFFFFFFFF);
return(0); return(0);
} }
DWORD ZFileTell() DWORD ZFileTell()
{ {
int res = 0; int res = 0;
if (TextFile) { if (TextFile) {
res = ftell(FILEHANDLE[ZFileTellHandle]); res = ftell(FILEHANDLE[ZFileTellHandle]);
if (res == -1) fprintf(stderr, "Oups!! gzTell\n"); if (res == -1) fprintf(stderr, "Oups!! gzTell\n");
return(res); return(res);
} else return gztell(FILEHANDLE[ZFileTellHandle]); } else return gztell(FILEHANDLE[ZFileTellHandle]);
} }
DWORD ZFileDelete() DWORD ZFileDelete()
{ {
return(remove(ZFileDelFName)); return(remove(ZFileDelFName));
} }
DWORD ZFileGetFTime() DWORD ZFileGetFTime()
{ {
_dos_open(ZFFTimeFName, 0,&ZFTimeHandle); _dos_open(ZFFTimeFName, 0,&ZFTimeHandle);
_dos_getftime(ZFTimeHandle,&ZFDate,&ZFTime); _dos_getftime(ZFTimeHandle,&ZFDate,&ZFTime);
_dos_close(ZFTimeHandle); _dos_close(ZFTimeHandle);
return(0); return(0);
} }
DWORD ZFileMKDir() DWORD ZFileMKDir()
{ {
/*return(mkdir(MKPath));*/ /*return(mkdir(MKPath));*/
return (mkdir(MKPath, S_IWUSR)); return (mkdir(MKPath, S_IWUSR));
} }
DWORD ZFileCHDir() DWORD ZFileCHDir()
{ {
return(chdir(CHPath)); return(chdir(CHPath));
} }
DWORD ZFileRMDir() DWORD ZFileRMDir()
{ {
return(rmdir(RMPath)); return(rmdir(RMPath));
} }
DWORD ZFileGetDir() DWORD ZFileGetDir()
{ {
/*return(getcwd(DirName,128));*/ /*return(getcwd(DirName,128));*/
return(*getcwd(DirName,128)); return(*getcwd(DirName,128));
} }
BYTE * ZFileFindPATH; BYTE * ZFileFindPATH;
DWORD ZFileFindATTRIB; DWORD ZFileFindATTRIB;
DWORD DTALocPos; DWORD DTALocPos;
//struct _find_t { //struct _find_t {
// char reserved[21] __attribute__((packed)); // char reserved[21] __attribute__((packed));
// unsigned char attrib __attribute__((packed)); // unsigned char attrib __attribute__((packed));
// unsigned short wr_time __attribute__((packed)); // unsigned short wr_time __attribute__((packed));
// unsigned short wr_date __attribute__((packed)); // unsigned short wr_date __attribute__((packed));
// unsigned long size __attribute__((packed)); // unsigned long size __attribute__((packed));
// char name[256] __attribute__((packed)); // char name[256] __attribute__((packed));
//}; //};
DWORD ZFileFindFirst() DWORD ZFileFindFirst()
{ {
/*return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,DTALocPos));*/ /*return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,DTALocPos));*/
return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,((struct find_t *)DTALocPos))); return(_dos_findfirst(ZFileFindPATH,ZFileFindATTRIB,((struct find_t *)DTALocPos)));
} }
DWORD ZFileFindNext() DWORD ZFileFindNext()
{ {
/*return(_dos_findnext(DTALocPos));*/ /*return(_dos_findnext(DTALocPos));*/
return(_dos_findnext(((struct find_t *) DTALocPos))); return(_dos_findnext(((struct find_t *) DTALocPos)));
} }
DWORD ZFileFindEnd() // for compatibility with windows later DWORD ZFileFindEnd() // for compatibility with windows later
{ {
return(0); return(0);
} }
//BYTE * DirName; //BYTE * DirName;
//DWORD DriveNumber; //DWORD DriveNumber;
//unsigned int _dos_findfirst(char *_name, unsigned int _attr, struct _find_t *_result); //unsigned int _dos_findfirst(char *_name, unsigned int _attr, struct _find_t *_result);
//unsigned int _dos_findnext(struct _find_t *_result); //unsigned int _dos_findnext(struct _find_t *_result);
DWORD GetTime() DWORD GetTime()
{ {
DWORD value; DWORD value;
struct tm *newtime; struct tm *newtime;
time_t long_time; time_t long_time;
time( &long_time ); time( &long_time );
newtime = localtime( &long_time ); newtime = localtime( &long_time );
value = ((newtime->tm_sec) % 10)+((newtime->tm_sec)/10)*16 value = ((newtime->tm_sec) % 10)+((newtime->tm_sec)/10)*16
+((((newtime->tm_min) % 10)+((newtime->tm_min)/10)*16) << 8) +((((newtime->tm_min) % 10)+((newtime->tm_min)/10)*16) << 8)
+((((newtime->tm_hour) % 10)+((newtime->tm_hour)/10)*16) << 16); +((((newtime->tm_hour) % 10)+((newtime->tm_hour)/10)*16) << 16);
return(value); return(value);
} }
DWORD GetDate() DWORD GetDate()
{ {
DWORD value; DWORD value;
struct tm *newtime; struct tm *newtime;
time_t long_time; time_t long_time;
/*time( &long_time );*/ /*time( &long_time );*/
long_time = time (NULL); long_time = time (NULL);
newtime = localtime( &long_time ); newtime = localtime( &long_time );
value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16 value = ((newtime->tm_mday) % 10)+((newtime->tm_mday)/10)*16
+(((newtime->tm_mon)+1) << 8) +(((newtime->tm_mon)+1) << 8)
+((((newtime->tm_year) % 10)+((newtime->tm_year)/10)*16) << 16); +((((newtime->tm_year) % 10)+((newtime->tm_year)/10)*16) << 16);
+((newtime->tm_wday) << 28); +((newtime->tm_wday) << 28);
return(value); return(value);
} }

View File

@@ -1,401 +1,401 @@
//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) //Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
// //
//This program is free software; you can redistribute it and/or //This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License //modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either //as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later //version 2 of the License, or (at your option) any later
//version. //version.
// //
//This program is distributed in the hope that it will be useful, //This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of //but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details. //GNU General Public License for more details.
// //
//You should have received a copy of the GNU General Public License //You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int pccmdline(void); int pccmdline(void);
extern void zstart(void); extern void zstart(void);
extern void DosExit(void); extern void DosExit(void);
extern void ConvertJoyMap1(void); extern void ConvertJoyMap1(void);
extern void ConvertJoyMap2(void); extern void ConvertJoyMap2(void);
extern void displayparams(void); extern void displayparams(void);
extern void makeextension(void); extern void makeextension(void);
extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable, extern unsigned char Palette0, SPC700sh, OffBy1Line, DSPDisable,
FPUCopy, Force8b, ForcePal, GUIClick, MouseDis, FPUCopy, Force8b, ForcePal, GUIClick, MouseDis,
MusicRelVol, ScreenScale, SoundCompD, SoundQuality, MusicRelVol, ScreenScale, SoundCompD, SoundQuality,
StereoSound, V8Mode, antienab, cvidmode, debugdisble, StereoSound, V8Mode, antienab, cvidmode, debugdisble,
debugger, enterpress, finterleave, frameskip, debugger, enterpress, finterleave, frameskip,
gammalevel, guioff, per2exec, pl1contrl, pl2contrl, gammalevel, guioff, per2exec, pl1contrl, pl2contrl,
romtype, scanlines, showallext, smallscreenon, soundon, romtype, scanlines, showallext, smallscreenon, soundon,
spcon, vsyncon, DisplayS, fname, filefound, SnowOn; spcon, vsyncon, DisplayS, fname, filefound, SnowOn;
void ccmdline(void); void ccmdline(void);
char *ers[] = char *ers[] =
{ {
"Frame Skip must be a value of 0 to 9!\n", "Frame Skip must be a value of 0 to 9!\n",
"Gamma Correction Level must be a value of 0 to 5!\n", "Gamma Correction Level must be a value of 0 to 5!\n",
"Sound Sampling Rate must be a value of 0 to 6!\n", "Sound Sampling Rate must be a value of 0 to 6!\n",
"Invalid Video Mode!\n", "Invalid Video Mode!\n",
"Percentage of instructions to execute must be a number from 50 to 150!\n", "Percentage of instructions to execute must be a number from 50 to 150!\n",
"Player Input must be a value from 0 to 6!\n", "Player Input must be a value from 0 to 6!\n",
"Volume must be a number from 0 to 100!\n" "Volume must be a number from 0 to 100!\n"
}; };
int argc; int argc;
char **argv; char **argv;
int main(int margc, char **margv) int main(int margc, char **margv)
{ {
argc=margc; argc=margc;
argv=margv; argv=margv;
zstart(); zstart();
return(0); return(0);
} }
int my_atoi(char *nptr) int my_atoi(char *nptr)
{ {
int p,c; int p,c;
c=0; c=0;
for(p=0;nptr[p];p++) for(p=0;nptr[p];p++)
{ {
if( !isdigit(nptr[p]) ) c+=1; if( !isdigit(nptr[p]) ) c+=1;
} }
if(c) return -1; if(c) return -1;
else return atoi(nptr); else return atoi(nptr);
} }
void ccmdline(void) void ccmdline(void)
{ {
int p=0; int p=0;
p=pccmdline(); p=pccmdline();
if(p == 0) return; if(p == 0) return;
if(p == 9) if(p == 9)
{ {
displayparams(); displayparams();
} }
if(p == 4) if(p == 4)
{ {
// printf("Mangled command line, did you forget a parm?\n"); // printf("Mangled command line, did you forget a parm?\n");
printf("Invalid Commandline!\n"); printf("Invalid Commandline!\n");
DosExit(); DosExit();
} }
if((p > 9) && (p < 17)) if((p > 9) && (p < 17))
{ {
printf(ers[p-10]); printf(ers[p-10]);
DosExit(); DosExit();
} }
if(p == 2) if(p == 2)
{ {
DosExit(); DosExit();
} }
printf("cmdline returned %i\n",p); printf("cmdline returned %i\n",p);
DosExit(); DosExit();
} }
int pccmdline(void) int pccmdline(void)
{ {
int p; int p;
int gfnm=0; int gfnm=0;
for(p=1;p<argc;p++) for(p=1;p<argc;p++)
{ {
/* /*
printf("(%i/%i): %s\n",p,argc,argv[p]); printf("(%i/%i): %s\n",p,argc,argv[p]);
*/ */
if(argv[p][0] == '-') if(argv[p][0] == '-')
{ {
int hasroom=0; int hasroom=0;
int pp=1; int pp=1;
int cp=p; int cp=p;
int nn='_'; int nn='_';
for(pp=1;argv[cp][pp];pp++) for(pp=1;argv[cp][pp];pp++)
{ {
if( (p+1) < argc) hasroom=1; if( (p+1) < argc) hasroom=1;
nn=tolower(argv[cp][pp+1]); nn=tolower(argv[cp][pp+1]);
switch(tolower(argv[cp][pp])) switch(tolower(argv[cp][pp]))
{ {
case '1': /* Player 1 Input */ case '1': /* Player 1 Input */
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
pl1contrl=my_atoi(argv[p+1]); pl1contrl=my_atoi(argv[p+1]);
if(pl1contrl > 6) return 15; if(pl1contrl > 6) return 15;
p++; p++;
ConvertJoyMap1(); ConvertJoyMap1();
break; break;
} }
case '2': /* Player 2 Input */ case '2': /* Player 2 Input */
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
pl2contrl=my_atoi(argv[p+1]); pl2contrl=my_atoi(argv[p+1]);
if(pl2contrl > 6) return 15; if(pl2contrl > 6) return 15;
p++; p++;
ConvertJoyMap2(); ConvertJoyMap2();
break; break;
} }
case 'f': case 'f':
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
frameskip=my_atoi(argv[p+1]); frameskip=my_atoi(argv[p+1]);
if(frameskip > 9) return 10; if(frameskip > 9) return 10;
frameskip++; frameskip++;
p++; p++;
break; break;
} }
case 'g': case 'g':
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
gammalevel=my_atoi(argv[p+1]); gammalevel=my_atoi(argv[p+1]);
if(gammalevel > 5) return 11; if(gammalevel > 5) return 11;
p++; p++;
break; break;
} }
case 'p': case 'p':
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
per2exec=my_atoi(argv[p+1]); per2exec=my_atoi(argv[p+1]);
if(per2exec > 150) return 14; if(per2exec > 150) return 14;
if(per2exec < 50) return 14; if(per2exec < 50) return 14;
p++; p++;
break; break;
} }
case 'r': case 'r':
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
SoundQuality=my_atoi(argv[p+1]); SoundQuality=my_atoi(argv[p+1]);
if(SoundQuality > 6) return 12; if(SoundQuality > 6) return 12;
p++; p++;
break; break;
} }
case 'v': case 'v':
{ {
if(nn == '8') if(nn == '8')
{ {
V8Mode=1; V8Mode=1;
pp++; pp++;
} }
else else
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
cvidmode=my_atoi(argv[p+1]); cvidmode=my_atoi(argv[p+1]);
if(cvidmode > 10) return 13; if(cvidmode > 10) return 13;
p++; p++;
} }
break; break;
} }
case 'k': case 'k':
{ {
if(!hasroom) return 4; if(!hasroom) return 4;
MusicRelVol=my_atoi(argv[p+1]); MusicRelVol=my_atoi(argv[p+1]);
if(MusicRelVol > 100) return 16; if(MusicRelVol > 100) return 16;
p++; p++;
break; break;
} }
case '8': case '8':
{ {
Force8b=1; Force8b=1;
break; break;
} }
case '0': /* Palette 0 disable */ case '0': /* Palette 0 disable */
{ {
Palette0=1; Palette0=1;
break; break;
} }
case '7': /* SPC700 speed hack disable */ case '7': /* SPC700 speed hack disable */
{ {
SPC700sh=1; SPC700sh=1;
break; break;
} }
case '9': /* Off by 1 line */ case '9': /* Off by 1 line */
{ {
OffBy1Line=1; OffBy1Line=1;
break; break;
} }
case 'e': case 'e':
{ {
enterpress=1; enterpress=1;
break; break;
} }
case 'h': case 'h':
{ {
romtype=2; romtype=2;
break; break;
} }
case 'l': case 'l':
{ {
romtype=1; romtype=1;
break; break;
} }
case 'm': case 'm':
{ {
guioff=1; /* disables GUI */ guioff=1; /* disables GUI */
break; break;
} }
case 'n': case 'n':
{ {
scanlines=1; scanlines=1;
break; break;
} }
case 's': case 's':
{ {
if(nn == 'p') if(nn == 'p')
{ {
DisplayS=1; DisplayS=1;
pp++; pp++;
} }
else else
if(nn == 'a') if(nn == 'a')
{ {
showallext=1; showallext=1;
pp++; pp++;
} }
else else
if(nn == 'n') if(nn == 'n')
{ {
SnowOn=1; SnowOn=1;
pp++; pp++;
} }
else else
{ {
spcon=1; spcon=1;
soundon=1; soundon=1;
} }
break; break;
} }
case 't': case 't':
{ {
ForcePal=1; ForcePal=1;
break; break;
} }
case 'u': case 'u':
{ {
ForcePal=2; ForcePal=2;
break; break;
} }
case 'w': case 'w':
{ {
vsyncon=1; vsyncon=1;
break; break;
} }
case 'z': case 'z':
{ {
StereoSound=1; StereoSound=1;
break; break;
} }
case 'd': case 'd':
{ {
if(nn == 'd') if(nn == 'd')
{ {
DSPDisable=1; DSPDisable=1;
pp++; pp++;
} }
else else
{ {
debugger=1; debugger=1;
debugdisble=0; debugdisble=0;
} }
break; break;
} }
case 'b': case 'b':
{ {
SoundCompD=1; SoundCompD=1;
break; break;
} }
case 'c': case 'c':
{ {
if(nn == 'c') if(nn == 'c')
{ {
smallscreenon=1; smallscreenon=1;
pp++; pp++;
} }
else else
{ {
ScreenScale=1; ScreenScale=1;
} }
break; break;
} }
case 'y': case 'y':
{ {
antienab=1; antienab=1;
break; break;
} }
case 'o': case 'o':
{ {
if(nn == 'm') if(nn == 'm')
{ {
FPUCopy=2; FPUCopy=2;
pp++; pp++;
} }
else else
{ {
FPUCopy=0; FPUCopy=0;
} }
break; break;
} }
case 'i': case 'i':
{ {
finterleave=1; finterleave=1;
break; break;
} }
case 'j': case 'j':
{ {
GUIClick=0; GUIClick=0;
MouseDis=1; MouseDis=1;
break; break;
} }
case '?': case '?':
{ {
return 9; return 9;
} }
} }
} }
} }
else else
{ {
if(gfnm > 0) if(gfnm > 0)
{ {
printf("Limit yourself to one filename\n"); printf("Limit yourself to one filename\n");
return 2; return 2;
} }
else else
{ {
char *fvar; char *fvar;
fvar=&fname; fvar=&fname;
fvar[0] = strlen(argv[p]); fvar[0] = strlen(argv[p]);
strncpy(&fvar[1],argv[p],127); strncpy(&fvar[1],argv[p],127);
gfnm++; gfnm++;
} }
} }
} }
if(gfnm == 1) if(gfnm == 1)
{ {
filefound=0; filefound=0;
makeextension(); makeextension();
} }
return 0; return 0;
} }