This will hopefully fix problems people have been having with getopt

This commit is contained in:
theoddone33
2001-04-15 18:53:23 +00:00
parent 8390fd710a
commit 892c382d23
3 changed files with 10 additions and 263 deletions

View File

@@ -1327,7 +1327,7 @@ void initwinvideo(void)
//RECT rc1, swrect;
DWORD newmode=0;
STUB_FUNCTION;
//STUB_FUNCTION;
if(CurMode!=cvidmode)
{
@@ -2218,7 +2218,11 @@ void drawscreenwin(void)
UnlockSurface();
}
void LinuxExit (void)
{
SDL_Quit();
exit(0);
}
extern char fulladdtab[65536*2];
extern WORD vesa2_usbit;

View File

@@ -67,8 +67,8 @@ char *ers[] =
};
int argc;
char **argv;
//int argc;
//char **argv;
char ucase(char ch){
if ((ch>='a') && (ch<='z')) ch-='a'-'A';
@@ -394,259 +394,5 @@ void ccmdline(void) {
}
int pccmdline(void) {
int gfnm = 0;
int opt,hasroom,p,pp,errflg;
char *fvar;
while((opt = getopt(argc, argv, "01:2:789ac:d:ef:g:hijk:lmno:p:r:s:tuv:wyz?")) != -1) {
switch(opt) {
/* Palette 0 disable */
case '0': {
Palette0 = 1;
break;
}
/* Player 1 Input */
case '1': {
if (!hasroom) return 4;
pl1contrl = my_atoi(optarg);
if (pl1contrl > 6) return 15;
p++;
ConvertJoyMap1();
break;
}
/* Player 2 Input */
case '2': {
if (!hasroom) return 4;
pl2contrl=my_atoi(optarg);
if (pl2contrl > 6) return 15;
p++;
ConvertJoyMap2();
break;
}
/* SPC700 speed hack disable */
case '7': {
SPC700sh = 1;
break;
}
case '8': {
Force8b = 1;
break;
}
/* Off by 1 line */
case '9': {
OffBy1Line = 1;
break;
}
case 'b': {
SoundCompD = 1;
break;
}
case 'c': {
if (strcmp(optarg,"b") == 0) {
printf("\nRemove background color in 256 modes not implemented!\n");
}
else
if (strcmp(optarg,"c") == 0) {
smallscreenon = 1;
pp++;
} else {
ScreenScale = 1;
}
break;
}
case 'd': {
if (strcmp(optarg,"d") == 0) {
DSPDisable = 1;
pp++;
} else {
/* debugger will never work under linux, since it's full of bios interrupt calls */
printf("\nDebugger not implemented for Linux version!\n");
}
break;
}
case 'e': {
enterpress = 1;
break;
}
case 'f': {
if (!hasroom) return 4;
frameskip = my_atoi(optarg);
if (frameskip > 9) return 10;
p++;
break;
}
case 'g': {
if (!hasroom) return 4;
gammalevel = my_atoi(optarg);
if (gammalevel > 5) return 11;
p++;
break;
}
case 'h': {
romtype = 2;
break;
}
case 'i': {
finterleave = 1;
break;
}
case 'j': {
GUIClick = 0;
MouseDis = 1;
break;
}
case 'k': {
if (!hasroom) return 4;
MusicRelVol = my_atoi(optarg);
if (MusicRelVol > 100) return 16;
p++;
break;
}
case 'l': {
romtype = 1;
break;
}
/* disables GUI */
case 'm': {
guioff = 1;
break;
}
case 'n': {
scanlines = 1;
break;
}
case 'o': {
if (strcmp(optarg,"m") == 0) {
FPUCopy = 2;
pp++;
} else {
FPUCopy = 0;
}
break;
}
case 'p': {
if (!hasroom) return 4;
per2exec = my_atoi(optarg);
if (per2exec > 150) return 14;
if (per2exec < 50) return 14;
p++;
break;
}
case 'r': {
if (!hasroom) return 4;
SoundQuality = my_atoi(optarg);
if (SoundQuality > 5) return 12;
p++;
break;
}
case 's': {
if (strcmp(optarg,"p") == 0) {
DisplayS = 1;
pp++;
}
else
if (strcmp(optarg,"a") == 0) {
showallext = 1;
pp++;
}
else
if (strcmp(optarg,"n") == 0) {
SnowOn = 1;
pp++;
} else {
spcon = 1;
soundon = 1;
}
break;
}
case 't': {
ForcePal = 1;
break;
}
case 'u': {
ForcePal = 2;
break;
}
case 'v': {
if (strcmp(optarg,"8") == 0) {
V8Mode = 1;
pp++;
} else {
if (!hasroom) return 4;
cvidmode = my_atoi(optarg);
if (cvidmode > 10) return 13;
p++;
}
break;
}
case 'w': {
vsyncon = 1;
break;
}
case 'y': {
antienab = 1;
break;
}
case 'z': {
StereoSound = 1;
break;
}
case '?': {
displayparams();
return 9;
}
}
}
if (gfnm == 1) {
filefound = 0;
makeextension();
}
return 0;
}

View File

@@ -37,7 +37,7 @@ EXTSYM cfgloadgdir,cfgloadsdir
EXTSYM init18_2hz
%ifdef __LINUX__
EXTSYM SDL_Quit
EXTSYM LinuxExit
%endif
NEWSYM UIAsmStart
@@ -1452,10 +1452,7 @@ SECTION .text
NEWSYM DosExit ; Terminate Program
%ifdef __LINUX__
call SDL_Quit ; Properly terminate video stuff
mov ebx,0 ; first syscall argument: exit code
mov eax,1 ; system call number (sys_exit)
int 0x80 ; call kernel
call LinuxExit
%else
jmp .nodeallocate