From e018632901bae4684f52fd748633479a997cc05c Mon Sep 17 00:00:00 2001 From: rheiny Date: Sun, 11 Feb 2007 11:23:20 +0000 Subject: [PATCH] Trying to untangle the horrible web of file dependencies --- src/drivers/common/args.cpp | 100 ++++++++++++++++++------------------ src/drivers/win/args.cpp | 5 ++ src/drivers/win/main.cpp | 4 +- src/drivers/win/main.h | 4 ++ vc8/fceux.vcproj | 30 +++++++++++ 5 files changed, 91 insertions(+), 52 deletions(-) create mode 100644 src/drivers/win/main.h diff --git a/src/drivers/common/args.cpp b/src/drivers/common/args.cpp index 21d4f475..6a787ec3 100644 --- a/src/drivers/common/args.cpp +++ b/src/drivers/common/args.cpp @@ -35,57 +35,57 @@ void ParseEA(int x, int argc, char *argv[], ARGPSTRUCT *argsps) { - int y=0; + int y=0; - do - { - if(!argsps[y].name) - { - ParseEA(x,argc,argv,(ARGPSTRUCT*)argsps[y].var); - y++; - continue; - } - if(!strcmp(argv[x],argsps[y].name)) // A match. - { - if(argsps[y].subs) - { - if((x+1)>=argc) - break; - if(argsps[y].substype&0x2000) - { - ((void (*)(char *))argsps[y].subs)(argv[x+1]); - } - else if(argsps[y].substype&0x8000) - { - *(int *)argsps[y].subs&=~(argsps[y].substype&(~0x8000)); - *(int *)argsps[y].subs|=atoi(argv[x+1])?(argsps[y].substype&(~0x8000)):0; - } - else - switch(argsps[y].substype&(~0x4000)) - { - case 0: // Integer - *(int *)argsps[y].subs=atoi(argv[x+1]); - break; - case 2: // Double float - *(double *)argsps[y].subs=atof(argv[x+1]); - break; - case 1: // String - if(argsps[y].substype&0x4000) - { - if(*(char **)argsps[y].subs) - free(*(char **)argsps[y].subs); - if(!( *(char **)argsps[y].subs=(char*)malloc(strlen(argv[x+1])+1) )) - break; - } - strcpy(*(char **)argsps[y].subs,argv[x+1]); - break; - } - } - if(argsps[y].var) - *argsps[y].var=1; - } - y++; - } while(argsps[y].var || argsps[y].subs); + do + { + if(!argsps[y].name) + { + ParseEA(x,argc,argv,(ARGPSTRUCT*)argsps[y].var); + y++; + continue; + } + if(!strcmp(argv[x],argsps[y].name)) // A match. + { + if(argsps[y].subs) + { + if((x+1)>=argc) + break; + if(argsps[y].substype&0x2000) + { + ((void (*)(char *))argsps[y].subs)(argv[x+1]); + } + else if(argsps[y].substype&0x8000) + { + *(int *)argsps[y].subs&=~(argsps[y].substype&(~0x8000)); + *(int *)argsps[y].subs|=atoi(argv[x+1])?(argsps[y].substype&(~0x8000)):0; + } + else + switch(argsps[y].substype&(~0x4000)) + { + case 0: // Integer + *(int *)argsps[y].subs=atoi(argv[x+1]); + break; + case 2: // Double float + *(double *)argsps[y].subs=atof(argv[x+1]); + break; + case 1: // String + if(argsps[y].substype&0x4000) + { + if(*(char **)argsps[y].subs) + free(*(char **)argsps[y].subs); + if(!( *(char **)argsps[y].subs=(char*)malloc(strlen(argv[x+1])+1) )) + break; + } + strcpy(*(char **)argsps[y].subs,argv[x+1]); + break; + } + } + if(argsps[y].var) + *argsps[y].var=1; + } + y++; + } while(argsps[y].var || argsps[y].subs); } void ParseArguments(int argc, char *argv[], ARGPSTRUCT *argsps) diff --git a/src/drivers/win/args.cpp b/src/drivers/win/args.cpp index 9b499229..a0a4b9cd 100644 --- a/src/drivers/win/args.cpp +++ b/src/drivers/win/args.cpp @@ -18,8 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "main.h" +#include "args.h" +#include "common.h" #include "../common/args.h" +// TODO: Parsing arguments needs to be improved a lot. A LOT. + /** * Parses commandline arguments **/ diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index ba62f0dc..3c7bd4f9 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -51,6 +51,7 @@ #include "cdlogger.h" #include "basicbot.h" +#include "args.h" // #defines @@ -102,7 +103,7 @@ void ApplyDefaultCommandMapping(void); // Internal variables uint8 *xbsave = NULL; -int eoptions=EO_BGRUN | EO_FORCEISCALE; +int eoptions = EO_BGRUN | EO_FORCEISCALE; /** * Handle of the main window. @@ -442,7 +443,6 @@ void DoPriority(void) #include "video.cpp" #include "window.cpp" #include "config.cpp" -#include "args.cpp" int DriverInitialize() { diff --git a/src/drivers/win/main.h b/src/drivers/win/main.h new file mode 100644 index 00000000..cb960192 --- /dev/null +++ b/src/drivers/win/main.h @@ -0,0 +1,4 @@ +static int genie; +static int pal_emulation; +static int status_icon; +extern int eoptions; \ No newline at end of file diff --git a/vc8/fceux.vcproj b/vc8/fceux.vcproj index e469a8bf..7853d00e 100644 --- a/vc8/fceux.vcproj +++ b/vc8/fceux.vcproj @@ -694,6 +694,32 @@ + + + + + + + + + + @@ -854,6 +880,10 @@ RelativePath="..\src\drivers\win\main.cpp" > + +