Trying to untangle the horrible web of file dependencies
This commit is contained in:
parent
695d4aaa0e
commit
e018632901
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
**/
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
static int genie;
|
||||
static int pal_emulation;
|
||||
static int status_icon;
|
||||
extern int eoptions;
|
|
@ -694,6 +694,32 @@
|
|||
<Filter
|
||||
Name="win"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\drivers\win\args.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\$(InputName)1.obj"
|
||||
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\$(InputName)1.obj"
|
||||
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\drivers\win\args.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\drivers\win\aviout.cpp"
|
||||
>
|
||||
|
@ -854,6 +880,10 @@
|
|||
RelativePath="..\src\drivers\win\main.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\drivers\win\main.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\drivers\win\memview.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue