mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
1.40a fixes, pt2
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@403 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
558d8e1fdd
commit
2b1fd5202c
1 changed files with 23 additions and 11 deletions
34
common/emu.c
34
common/emu.c
|
@ -481,6 +481,18 @@ static void romfname_ext(char *dst, const char *prefix, const char *ext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void make_config_cfg(char *cfg)
|
||||||
|
{
|
||||||
|
strncpy(cfg, PicoConfigFile, 511);
|
||||||
|
if (config_slot != 0)
|
||||||
|
{
|
||||||
|
char *p = strrchr(cfg, '.');
|
||||||
|
if (p == NULL) p = cfg + strlen(cfg);
|
||||||
|
sprintf(p, ".%i.cfg", config_slot);
|
||||||
|
}
|
||||||
|
cfg[511] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int emu_ReadConfig(int game, int no_defaults)
|
int emu_ReadConfig(int game, int no_defaults)
|
||||||
{
|
{
|
||||||
char cfg[512];
|
char cfg[512];
|
||||||
|
@ -491,14 +503,7 @@ int emu_ReadConfig(int game, int no_defaults)
|
||||||
{
|
{
|
||||||
if (!no_defaults)
|
if (!no_defaults)
|
||||||
emu_setDefaultConfig();
|
emu_setDefaultConfig();
|
||||||
strncpy(cfg, PicoConfigFile, 511);
|
make_config_cfg(cfg);
|
||||||
if (config_slot != 0)
|
|
||||||
{
|
|
||||||
char *p = strrchr(cfg, '.');
|
|
||||||
if (p == NULL) p = cfg + strlen(cfg);
|
|
||||||
sprintf(p, ".%i.cfg", config_slot);
|
|
||||||
}
|
|
||||||
cfg[511] = 0;
|
|
||||||
ret = config_readsect(cfg, NULL);
|
ret = config_readsect(cfg, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -511,18 +516,25 @@ int emu_ReadConfig(int game, int no_defaults)
|
||||||
else strcpy(cfg, "game.cfg");
|
else strcpy(cfg, "game.cfg");
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
if (config_havesect(cfg, sect)) {
|
if (config_havesect(cfg, sect))
|
||||||
|
{
|
||||||
|
// read user's config
|
||||||
int vol = currentConfig.volume;
|
int vol = currentConfig.volume;
|
||||||
emu_setDefaultConfig();
|
emu_setDefaultConfig();
|
||||||
ret = config_readsect(cfg, sect);
|
ret = config_readsect(cfg, sect);
|
||||||
currentConfig.volume = vol; // make vol global (bah)
|
currentConfig.volume = vol; // make vol global (bah)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
config_readsect("game_def.cfg", sect);
|
{
|
||||||
|
// read global config, and apply game_def.cfg on top
|
||||||
|
make_config_cfg(cfg);
|
||||||
|
config_readsect(cfg, NULL);
|
||||||
|
ret = config_readsect("game_def.cfg", sect);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
// fall back to old
|
// fall back to old game specific cfg
|
||||||
char extbuf[16];
|
char extbuf[16];
|
||||||
if (config_slot != 0)
|
if (config_slot != 0)
|
||||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue