X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Femu.c;h=14cc52aeeea38a5715582d34134b6791c86dcf16;hb=1cb1584b86a5679b8d32ccfc190f6e76c920810f;hp=50cfd2e65262d9594b04d18603c5d63d3f43b021;hpb=2d2247c26080ed9009b3d8c650cfc647fd1fb162;p=picodrive.git diff --git a/platform/common/emu.c b/platform/common/emu.c index 50cfd2e..14cc52a 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -434,7 +434,7 @@ int emu_ReloadRom(void) } else { PicoRegionOverride = 4; } - PicoReset(0); + PicoReset(); // TODO: bits 6 & 5 } movie_data[0x18+30] = 0; @@ -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) { char cfg[512]; @@ -491,14 +503,7 @@ int emu_ReadConfig(int game, int no_defaults) { if (!no_defaults) emu_setDefaultConfig(); - 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; + make_config_cfg(cfg); ret = config_readsect(cfg, NULL); } else @@ -511,16 +516,25 @@ int emu_ReadConfig(int game, int no_defaults) else strcpy(cfg, "game.cfg"); ret = -1; - if (config_havesect(cfg, sect)) { + if (config_havesect(cfg, sect)) + { + // read user's config int vol = currentConfig.volume; emu_setDefaultConfig(); ret = config_readsect(cfg, sect); currentConfig.volume = vol; // make vol global (bah) } + else + { + // 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) { - // fall back to old + // fall back to old game specific cfg char extbuf[16]; if (config_slot != 0) sprintf(extbuf, ".%i.pbcfg", config_slot);