X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Femu.c;h=167f2f09cc1945e2718f567e81a0d8b4f72dbeb8;hb=4bd165c8d8bce1946558c22bcb9a001754115d81;hp=becc0c267e98ec4953467d6bb5a03f747ca16a84;hpb=7bc9a680a24582b2cb3a82cbdaf383b2330c3b21;p=libpicofe.git diff --git a/common/emu.c b/common/emu.c index becc0c2..167f2f0 100644 --- a/common/emu.c +++ b/common/emu.c @@ -407,8 +407,8 @@ int emu_reload_rom(char *rom_fname) // valid CD image, check for BIOS.. // we need to have config loaded at this point - ret = emu_read_config(1, 1); - if (!ret) emu_read_config(0, 1); + ret = emu_read_config(1, 0); + if (!ret) emu_read_config(0, 0); cfg_loaded = 1; if (PicoRegionOverride) { @@ -465,8 +465,8 @@ int emu_reload_rom(char *rom_fname) if (!(PicoAHW & PAHW_MCD)) memcpy(id_header, rom_data + 0x100, sizeof(id_header)); if (!cfg_loaded) { - ret = emu_read_config(1, 1); - if (!ret) emu_read_config(0, 1); + ret = emu_read_config(1, 0); + if (!ret) emu_read_config(0, 0); } lprintf("PicoCartInsert(%p, %d);\n", rom_data, rom_size); @@ -613,10 +613,11 @@ int emu_read_config(int game, int no_defaults) char cfg[512]; int ret; + if (!no_defaults) + emu_set_defconfig(); + if (!game) { - if (!no_defaults) - emu_set_defconfig(); make_config_cfg(cfg); ret = config_readsect(cfg, NULL); } @@ -643,7 +644,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 +1277,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 +1284,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 +1414,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); } }