X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Femu.c;h=b1b314eeade50a8b88832a73a0acd3e621887f0e;hb=d2f29611d1379a249c8f3f955ed16a336f9290cd;hp=49f714946ff16a2ba6ab241ab01824e30ae6bc7f;hpb=a96477bb5e1623dc132d632ac51a22cf7bdabfa7;p=libpicofe.git diff --git a/gp2x/emu.c b/gp2x/emu.c index 49f7149..b1b314e 100644 --- a/gp2x/emu.c +++ b/gp2x/emu.c @@ -40,21 +40,6 @@ static int osd_fps_x, osd_y; extern void *gp2x_screens[4]; -int plat_get_root_dir(char *dst, int len) -{ - extern char **g_argv; - int j; - - strncpy(dst, g_argv[0], len); - len -= 32; // reserve - if (len < 0) len = 0; - dst[len] = 0; - for (j = strlen(dst); j > 0; j--) - if (dst[j] == '/') { dst[j+1] = 0; break; } - - return j + 1; -} - static void scaling_update(void) { @@ -76,21 +61,7 @@ void pemu_prep_defconfig(void) { gp2x_soc_t soc; - memset(&defaultConfig, 0, sizeof(defaultConfig)); - defaultConfig.EmuOpt = 0x9d | EOPT_RAM_TIMINGS|EOPT_CONFIRM_SAVE|EOPT_EN_CD_LEDS; - defaultConfig.s_PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 | - POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES | - POPT_EN_32X|POPT_EN_PWM; - defaultConfig.s_PsndRate = 44100; - defaultConfig.s_PicoRegion = 0; // auto - defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP - defaultConfig.s_PicoCDBuffers = 0; - defaultConfig.Frameskip = -1; // auto defaultConfig.CPUclock = default_cpu_clock; - defaultConfig.volume = 50; - defaultConfig.gamma = 100; - defaultConfig.scaling = 0; - defaultConfig.turbo_rate = 15; soc = soc_detect(); if (soc == SOCID_MMSP2) @@ -99,6 +70,23 @@ void pemu_prep_defconfig(void) defaultConfig.EmuOpt |= EOPT_WIZ_TEAR_FIX|EOPT_SHOW_RTC; } +void pemu_validate_config(void) +{ + gp2x_soc_t soc; + + soc = soc_detect(); + if (soc != SOCID_MMSP2) + PicoOpt &= ~POPT_EXT_FM; + if (soc != SOCID_POLLUX) + currentConfig.EmuOpt &= ~EOPT_WIZ_TEAR_FIX; + + if (currentConfig.gamma < 10 || currentConfig.gamma > 300) + currentConfig.gamma = 100; + + if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 1024) + currentConfig.CPUclock = default_cpu_clock; +} + static void (*osd_text)(int x, int y, const char *text); static void osd_text8(int x, int y, const char *text) @@ -346,13 +334,13 @@ void pemu_update_display(const char *fps, const char *notice) } } - if (notice || (emu_opt & 2)) { + if (notice || (emu_opt & EOPT_SHOW_FPS)) { if (notice) osd_text(4, osd_y, notice); if (emu_opt & 2) osd_text(osd_fps_x, osd_y, fps); } - if ((emu_opt & 0x400) && (PicoAHW & PAHW_MCD)) + if ((PicoAHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS)) draw_cd_leds(); if (PicoAHW & PAHW_PICO) draw_pico_ptr();