From 22b2271a09c970cf2d4c9ba28460f7a5aa2a6127 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 3 Aug 2009 20:56:30 +0000 Subject: [PATCH] various pre-release tweaks git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@729 be3aeb3a-fb24-0410-a615-afba39da0efa --- common/emu.c | 30 +++++++++++++++++++++--------- common/menu.c | 4 ++++ gp2x/emu.c | 2 +- gp2x/plat.c | 1 + 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/common/emu.c b/common/emu.c index 7c406b5..cee9f2d 100644 --- a/common/emu.c +++ b/common/emu.c @@ -25,6 +25,8 @@ #include +#define STATUS_MSG_TIMEOUT 2000 + void *g_screen_ptr; #if !SCREEN_SIZE_FIXED @@ -92,23 +94,29 @@ static void get_ext(char *file, char *ext) void emu_status_msg(const char *format, ...) { va_list vl; + int ret; va_start(vl, format); - vsnprintf(noticeMsg, sizeof(noticeMsg), format, vl); + ret = vsnprintf(noticeMsg, sizeof(noticeMsg), format, vl); va_end(vl); + /* be sure old text gets overwritten */ + for (; ret < 28; ret++) + noticeMsg[ret] = ' '; + noticeMsg[ret] = 0; + notice_msg_time = plat_get_ticks_ms(); } -static const char *biosfiles_us[] = { "us_scd1_9210", "us_scd2_9306", "SegaCDBIOS9303" }; -static const char *biosfiles_eu[] = { "eu_mcd1_9210", "eu_mcd2_9306", "eu_mcd2_9303" }; -static const char *biosfiles_jp[] = { "jp_mcd1_9112", "jp_mcd1_9111" }; +static const char * const biosfiles_us[] = { "us_scd1_9210", "us_scd2_9306", "SegaCDBIOS9303" }; +static const char * const biosfiles_eu[] = { "eu_mcd1_9210", "eu_mcd2_9306", "eu_mcd2_9303" }; +static const char * const biosfiles_jp[] = { "jp_mcd1_9112", "jp_mcd1_9111" }; static int find_bios(int region, char **bios_file) { static char bios_path[1024]; int i, count; - const char **files; + const char * const *files; FILE *f = NULL; if (region == 4) { // US @@ -924,7 +932,7 @@ int emu_save_load_game(int load, int sram) } else ret = -1; if (!ret) - emu_status_msg(load ? "GAME LOADED" : "GAME SAVED"); + emu_status_msg(load ? "STATE LOADED" : "STATE SAVED"); else { emu_status_msg(load ? "LOAD FAILED" : "SAVE FAILED"); @@ -1086,7 +1094,7 @@ static void run_events_ui(unsigned int which) in_set_blocking(0); } if (do_it) { - plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING GAME" : "SAVING GAME"); + plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE"); PicoStateProgressCB = plat_status_msg_busy_next; emu_save_load_game((which & PEV_STATE_LOAD) ? 1 : 0, 0); PicoStateProgressCB = NULL; @@ -1276,7 +1284,7 @@ void emu_loop(void) if (notice_msg_time != 0) { static int noticeMsgSum; - if (timestamp - ms_to_ticks(notice_msg_time) > ms_to_ticks(2000)) { + if (timestamp - ms_to_ticks(notice_msg_time) > ms_to_ticks(STATUS_MSG_TIMEOUT)) { notice_msg_time = 0; plat_status_msg_clear(); notice_msg = NULL; @@ -1330,6 +1338,10 @@ void emu_loop(void) else { pframes_done -= target_fps; /* don't allow it to drift during heavy slowdowns */ + if (pframes_done < -5) { + reset_timing = 1; + continue; + } if (pframes_done < -2) pframes_done = -2; } @@ -1358,7 +1370,7 @@ void emu_loop(void) else if (diff > diff_lim) { /* no time left for this frame - skip */ - if (diff - diff_lim >= ms_to_ticks(300)) { + if (diff - diff_lim >= ms_to_ticks(200)) { /* if too much behind, reset instead */ reset_timing = 1; continue; diff --git a/common/menu.c b/common/menu.c index e679f5e..5fc2a57 100644 --- a/common/menu.c +++ b/common/menu.c @@ -2043,6 +2043,8 @@ void menu_plat_setup(int is_wiz) if (!is_wiz) { me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 0); + i = me_id2offset(e_menu_gfx_options, MA_OPT_TEARING_FIX); + e_menu_gfx_options[i].need_to_save = 0; return; } @@ -2052,6 +2054,8 @@ void menu_plat_setup(int is_wiz) i = me_id2offset(e_menu_gfx_options, MA_OPT_SCALING); e_menu_gfx_options[i].max = 1; /* only off and sw */ + i = me_id2offset(e_menu_gfx_options, MA_OPT_ARM940_SOUND); + e_menu_gfx_options[i].need_to_save = 0; } /* TODO: rename */ diff --git a/gp2x/emu.c b/gp2x/emu.c index 0700e81..82f1c1d 100644 --- a/gp2x/emu.c +++ b/gp2x/emu.c @@ -576,7 +576,7 @@ void plat_update_volume(int has_changed, int is_up) prev_frame = Pico.m.frame_count; } - if (need_low_volume) + if (!need_low_volume) return; /* set the right mixer func */ diff --git a/gp2x/plat.c b/gp2x/plat.c index aa60412..fe7b6fa 100644 --- a/gp2x/plat.c +++ b/gp2x/plat.c @@ -160,6 +160,7 @@ void plat_init(void) { case SOCID_MMSP2: mmsp2_init(); + menu_plat_setup(0); break; case SOCID_POLLUX: pollux_init(); -- 2.39.2