X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=common%2Femu.c;h=71f6716a46c1da32982cf366385ba771080c7db3;hb=0480e6c9696e4d4cbd451a91a7ef63d96f60542d;hp=117ec6d2f0800ccfb88f82bd42a03d7fc8bcc6ca;hpb=a6df06b7633a061862258ec47fa0f6b0efcbe26f;p=libpicofe.git diff --git a/common/emu.c b/common/emu.c index 117ec6d..71f6716 100644 --- a/common/emu.c +++ b/common/emu.c @@ -137,6 +137,19 @@ int emu_findBios(int region, char **bios_file) } } +/* check if the name begins with BIOS name */ +static int emu_isBios(const char *name) +{ + int i; + for (i = 0; i < sizeof(biosfiles_us)/sizeof(biosfiles_us[0]); i++) + if (strstr(name, biosfiles_us[i]) != NULL) return 1; + for (i = 0; i < sizeof(biosfiles_eu)/sizeof(biosfiles_eu[0]); i++) + if (strstr(name, biosfiles_eu[i]) != NULL) return 1; + for (i = 0; i < sizeof(biosfiles_jp)/sizeof(biosfiles_jp[0]); i++) + if (strstr(name, biosfiles_jp[i]) != NULL) return 1; + return 0; +} + /* checks if romFileName points to valid MegaCD image * if so, checks for suitable BIOS */ int emu_cdCheck(int *pregion) @@ -340,9 +353,12 @@ int emu_ReloadRom(void) menu_romload_end(); - // emu_ReadConfig() might have messed currentConfig.lastRomFile - strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1); - currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0; + if (!emu_isBios(romFileName)) + { + // emu_ReadConfig() might have messed currentConfig.lastRomFile + strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1); + currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0; + } if (PicoPatches) { PicoPatchPrepare(); @@ -452,7 +468,11 @@ int emu_ReadConfig(int game, int no_defaults) //scaling_update(); // some sanity checks if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200; +#ifdef PSP + if (currentConfig.gamma < -4 || currentConfig.gamma > 16) currentConfig.gamma = 0; +#else if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100; +#endif if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50; #ifdef __GP2X__ // if volume keys are unbound, bind them to volume control