Added command line option to specify config file to use on startup.
This commit is contained in:
parent
79bf197d34
commit
67dea77677
1 changed files with 15 additions and 6 deletions
21
src/pc.c
21
src/pc.c
|
|
@ -193,6 +193,7 @@ void pc_reset()
|
||||||
void initpc(int argc, char *argv[])
|
void initpc(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
char *config_file = NULL;
|
||||||
int c;
|
int c;
|
||||||
// allegro_init();
|
// allegro_init();
|
||||||
get_executable_name(pcempath,511);
|
get_executable_name(pcempath,511);
|
||||||
|
|
@ -206,22 +207,34 @@ void initpc(int argc, char *argv[])
|
||||||
if (!strcasecmp(argv[c], "--help"))
|
if (!strcasecmp(argv[c], "--help"))
|
||||||
{
|
{
|
||||||
printf("PCem command line options :\n\n");
|
printf("PCem command line options :\n\n");
|
||||||
printf("-fullscreen - start in fullscreen mode\n");
|
printf("--config file.cfg - use given config file as initial configuration\n");
|
||||||
|
printf("--fullscreen - start in fullscreen mode\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(argv[c], "--fullscreen"))
|
else if (!strcasecmp(argv[c], "--fullscreen"))
|
||||||
{
|
{
|
||||||
start_in_fullscreen = 1;
|
start_in_fullscreen = 1;
|
||||||
}
|
}
|
||||||
|
else if (!strcasecmp(argv[c], "--config"))
|
||||||
|
{
|
||||||
|
if ((c+1) == argc)
|
||||||
|
break;
|
||||||
|
config_file = argv[c+1];
|
||||||
|
c++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
mouse_init();
|
mouse_init();
|
||||||
joystick_init();
|
joystick_init();
|
||||||
midi_init();
|
midi_init();
|
||||||
|
|
||||||
|
append_filename(config_file_default, pcempath, "pcem.cfg", 511);
|
||||||
|
|
||||||
loadconfig(NULL);
|
loadconfig(config_file);
|
||||||
pclog("Config loaded\n");
|
pclog("Config loaded\n");
|
||||||
|
if (config_file)
|
||||||
|
saveconfig();
|
||||||
|
|
||||||
codegen_init();
|
codegen_init();
|
||||||
|
|
||||||
|
|
@ -508,11 +521,7 @@ void loadconfig(char *fn)
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!fn)
|
if (!fn)
|
||||||
{
|
|
||||||
append_filename(config_file_default, pcempath, "pcem.cfg", 511);
|
|
||||||
|
|
||||||
config_load(config_file_default);
|
config_load(config_file_default);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
config_load(fn);
|
config_load(fn);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue