X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Femu.c;h=2994fdbf0e07ef71a5f55970abb381239aed9ddb;hb=2239662e540d460859ef50c7e2137ae1822eb8d9;hp=49f714946ff16a2ba6ab241ab01824e30ae6bc7f;hpb=b2f512cab27fa3ac45d2aa944899b1c2b582906d;p=libpicofe.git diff --git a/gp2x/emu.c b/gp2x/emu.c index 49f7149..2994fdb 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) @@ -314,7 +302,7 @@ static int make_local_pal_sms(int fast_mode) return 0x40; } -void pemu_update_display(const char *fps, const char *notice) +void pemu_finalize_frame(const char *fps, const char *notice) { int emu_opt = currentConfig.EmuOpt; int ret; @@ -346,17 +334,20 @@ 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(); +} +void plat_video_flip(void) +{ gp2x_video_flip(); } @@ -423,7 +414,8 @@ void plat_status_msg_clear(void) void plat_status_msg_busy_next(const char *msg) { plat_status_msg_clear(); - pemu_update_display("", msg); + pemu_finalize_frame("", msg); + plat_video_flip(); emu_status_msg(""); /* assumption: msg_busy_next gets called only when