}\r
\r
\r
+static void make_config_cfg(char *cfg)\r
+{\r
+ strncpy(cfg, PicoConfigFile, 511);\r
+ if (config_slot != 0)\r
+ {\r
+ char *p = strrchr(cfg, '.');\r
+ if (p == NULL) p = cfg + strlen(cfg);\r
+ sprintf(p, ".%i.cfg", config_slot);\r
+ }\r
+ cfg[511] = 0;\r
+}\r
+\r
int emu_ReadConfig(int game, int no_defaults)\r
{\r
char cfg[512];\r
{\r
if (!no_defaults)\r
emu_setDefaultConfig();\r
- strncpy(cfg, PicoConfigFile, 511);\r
- if (config_slot != 0)\r
- {\r
- char *p = strrchr(cfg, '.');\r
- if (p == NULL) p = cfg + strlen(cfg);\r
- sprintf(p, ".%i.cfg", config_slot);\r
- }\r
- cfg[511] = 0;\r
+ make_config_cfg(cfg);\r
ret = config_readsect(cfg, NULL);\r
}\r
else\r
else strcpy(cfg, "game.cfg");\r
\r
ret = -1;\r
- if (config_havesect(cfg, sect)) {\r
+ if (config_havesect(cfg, sect))\r
+ {\r
+ // read user's config\r
int vol = currentConfig.volume;\r
emu_setDefaultConfig();\r
ret = config_readsect(cfg, sect);\r
currentConfig.volume = vol; // make vol global (bah)\r
}\r
else\r
- config_readsect("game_def.cfg", sect);\r
+ {\r
+ // read global config, and apply game_def.cfg on top\r
+ make_config_cfg(cfg);\r
+ config_readsect(cfg, NULL);\r
+ ret = config_readsect("game_def.cfg", sect);\r
+ }\r
\r
if (ret != 0)\r
{\r
- // fall back to old\r
+ // fall back to old game specific cfg\r
char extbuf[16];\r
if (config_slot != 0)\r
sprintf(extbuf, ".%i.pbcfg", config_slot);\r