X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Femu.c;h=118dc38314b923114606186f4668d9ae69b766ee;hb=f71361b521c9c64351ea99ed97627a606c642008;hp=7de2aa99a2be211c505ee228b7b04453dd513498;hpb=6b8796e2a8aae2d41aeec2be4d385b4905c8c19b;p=libpicofe.git diff --git a/common/emu.c b/common/emu.c index 7de2aa9..118dc38 100644 --- a/common/emu.c +++ b/common/emu.c @@ -643,7 +643,8 @@ int emu_read_config(int game, int no_defaults) // 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); + emu_make_path(cfg, "game_def.cfg", sizeof(cfg)); + ret = config_readsect(cfg, sect); } if (ret == 0) @@ -1275,9 +1276,6 @@ void emu_loop(void) if (PicoAHW & PAHW_MCD) PicoCDBufferInit(); - if (currentConfig.EmuOpt & EOPT_PSYNC) - plat_video_wait_vsync(); - pemu_loop_prep(); timestamp_fps = get_ticks(); @@ -1285,6 +1283,8 @@ void emu_loop(void) frames_done = frames_shown = pframes_done = 0; + plat_video_wait_vsync(); + /* loop with resync every 1 sec. */ while (engineState == PGS_Running) { @@ -1413,12 +1413,9 @@ void emu_loop(void) if (diff < diff_lim) { // we are too fast - if (currentConfig.EmuOpt & EOPT_PSYNC) { - if (diff_lim - diff > target_frametime/2) - plat_wait_till_us(timestamp_base + target_frametime/4); + plat_wait_till_us(timestamp_base + diff_lim - target_frametime / 4); + if (currentConfig.EmuOpt & EOPT_VSYNC) plat_video_wait_vsync(); - } else - plat_wait_till_us(timestamp_base + diff_lim); } } @@ -1429,9 +1426,6 @@ void emu_loop(void) emu_set_fastforward(0); - if (PicoAHW & PAHW_MCD) - PicoCDBufferFree(); - // save SRAM if ((currentConfig.EmuOpt & EOPT_EN_SRAM) && SRam.changed) { plat_status_msg_busy_first("Writing SRAM/BRAM..."); @@ -1439,9 +1433,11 @@ void emu_loop(void) SRam.changed = 0; } - // do menu background to be sure it's right - pemu_forced_frame(POPT_EN_SOFTSCALE); - pemu_loop_end(); + + // pemu_loop_end() might want to do 1 frame for bg image, + // so free CD buffer here + if (PicoAHW & PAHW_MCD) + PicoCDBufferFree(); }