X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Femu.c;h=4098bd25dcdd923fa1fb495057b2fd83cb16feb4;hb=e8b6193660a3227fcd113a1eb82ed48727ca8195;hp=e7a99129c83a868c7ccbcfa7c08d7dd16937fc6c;hpb=504e2f5688f14a35bb6d7a080811889d465dbd75;p=picodrive.git diff --git a/platform/common/emu.c b/platform/common/emu.c index e7a9912..4098bd2 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -10,7 +10,7 @@ #include #include #include -#ifndef NO_SYNC +#ifdef __GP2X__ #include #endif @@ -28,22 +28,28 @@ #include #include +#ifndef _WIN32 +#define PATH_SEP "/" +#define PATH_SEP_C '/' +#else +#define PATH_SEP "\\" +#define PATH_SEP_C '\\' +#endif #define STATUS_MSG_TIMEOUT 2000 void *g_screen_ptr; -#if !SCREEN_SIZE_FIXED -int g_screen_width = SCREEN_WIDTH; -int g_screen_height = SCREEN_HEIGHT; -#endif +int g_screen_width = 320; +int g_screen_height = 240; char *PicoConfigFile = "config.cfg"; currentConfig_t currentConfig, defaultConfig; int state_slot = 0; int config_slot = 0, config_slot_current = 0; int pico_pen_x = 320/2, pico_pen_y = 240/2; -int pico_inp_mode = 0; +int pico_inp_mode; +int flip_after_sync; int engineState = PGS_Menu; static short __attribute__((aligned(4))) sndBuffer[2*44100/50]; @@ -548,6 +554,8 @@ void emu_prep_defconfig(void) defaultConfig.gamma = 100; defaultConfig.scaling = 0; defaultConfig.turbo_rate = 15; + defaultConfig.msh2_khz = PICO_MSH2_HZ / 1000; + defaultConfig.ssh2_khz = PICO_SSH2_HZ / 1000; // platform specific overrides pemu_prep_defconfig(); @@ -561,8 +569,6 @@ void emu_set_defconfig(void) PicoRegionOverride = currentConfig.s_PicoRegion; PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder; PicoCDBuffers = currentConfig.s_PicoCDBuffers; - p32x_msh2_multiplier = MSH2_MULTI_DEFAULT; - p32x_ssh2_multiplier = SSH2_MULTI_DEFAULT; } int emu_read_config(const char *rom_fname, int no_defaults) @@ -649,7 +655,7 @@ int emu_write_config(int is_game) lprintf("emu_write_config: %s ", cfg); ret = config_write(cfg); if (write_lrom) config_writelrom(cfg); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif lprintf((ret == 0) ? "(ok)\n" : "(failed)\n"); @@ -859,7 +865,7 @@ int emu_save_load_game(int load, int sram) ret = fwrite(sram_data, 1, sram_size, sramFile); ret = (ret != sram_size) ? -1 : 0; fclose(sramFile); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif } @@ -870,7 +876,7 @@ int emu_save_load_game(int load, int sram) { ret = PicoState(saveFname, !load); if (!ret) { -#ifndef NO_SYNC +#ifdef __GP2X__ if (!load) sync(); #endif emu_status_msg(load ? "STATE LOADED" : "STATE SAVED"); @@ -1198,7 +1204,7 @@ void emu_finish(void) char cfg[512]; make_config_cfg(cfg); config_writelrom(cfg); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif } @@ -1426,7 +1432,8 @@ void emu_loop(void) PicoFrame(); pemu_finalize_frame(fpsbuff, notice_msg); - // plat_video_flip(); + if (!flip_after_sync) + plat_video_flip(); /* frame limiter */ if (!reset_timing && !(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT))) @@ -1444,9 +1451,8 @@ void emu_loop(void) } } - // XXX: for some plats it might be better to flip before vsync - // (due to shadow registers in display hw) - plat_video_flip(); + if (flip_after_sync) + plat_video_flip(); pframes_done++; frames_done++; frames_shown++;