X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Femu.c;h=cab0925e00f0e9ff4b0e5969be8c00cd3c24e2d1;hb=8b8d9463fa57d3165a50923e665888d1353c3eec;hp=a075abdf01620dedc36a65ce7f42c0642f77ddaf;hpb=0c9ae59222a6fa9af18dcc072fdfb06cfca124d6;p=libpicofe.git diff --git a/common/emu.c b/common/emu.c index a075abd..cab0925 100644 --- a/common/emu.c +++ b/common/emu.c @@ -453,11 +453,14 @@ static void shutdown_MCD(void) static void system_announce(void) { - const char *sys_name, *tv_standard; + const char *sys_name, *tv_standard, *extra = ""; int fps; if (PicoAHW & PAHW_SMS) { sys_name = "Master System"; +#ifdef NO_SMS + extra = " [no support]"; +#endif } else if (PicoAHW & PAHW_PICO) { sys_name = "Pico"; } else if (PicoAHW & PAHW_MCD) { @@ -474,7 +477,7 @@ static void system_announce(void) tv_standard = Pico.m.pal ? "PAL" : "NTSC"; fps = Pico.m.pal ? 50 : 60; - emu_status_msg("%s %s / %dFPS", tv_standard, sys_name, fps); + emu_status_msg("%s %s / %dFPS%s", tv_standard, sys_name, fps, extra); } // note: this function might mangle rom_fname @@ -494,11 +497,13 @@ int emu_reload_rom(char *rom_fname) get_ext(rom_fname, ext); - // check for movie file + // early cleanup + PicoPatchUnload(); if (movie_data) { free(movie_data); movie_data = 0; } + if (!strcmp(ext, ".gmv")) { // check for both gmv and rom @@ -555,7 +560,6 @@ int emu_reload_rom(char *rom_fname) } shutdown_MCD(); - PicoPatchUnload(); PicoCartUnload(); rom_loaded = 0; @@ -1008,7 +1012,7 @@ char *emu_get_save_fname(int load, int is_sram, int slot) return NULL; } -int emu_check_save_file(int slot) +int emu_check_save_file(int slot, int *time) { return emu_get_save_fname(1, 0, slot) ? 1 : 0; } @@ -1137,8 +1141,11 @@ static void emu_tray_close(void) void emu_32x_startup(void) { - plat_video_toggle_renderer(0, 0); + plat_video_toggle_renderer(0, 0); // HACK system_announce(); + + // force mode change event + rendstatus_old = -1; } void emu_reset_game(void) @@ -1232,7 +1239,7 @@ static void run_events_ui(unsigned int which) if (which & (PEV_STATE_LOAD|PEV_STATE_SAVE)) { int do_it = 1; - if ( emu_check_save_file(state_slot) && + if ( emu_check_save_file(state_slot, NULL) && (((which & PEV_STATE_LOAD) && (currentConfig.confirm_save & EOPT_CONFIRM_LOAD)) || ((which & PEV_STATE_SAVE) && (currentConfig.confirm_save & EOPT_CONFIRM_SAVE))) ) { @@ -1250,7 +1257,7 @@ static void run_events_ui(unsigned int which) plat_status_msg_busy_first(tmp); - in_set_blocking(1); + in_set_config_int(0, IN_CFG_BLOCKING, 1); while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK)) ; while ( !((keys = in_menu_wait_any(50)) & (PBTN_MA3|PBTN_MBACK)) ) @@ -1259,7 +1266,7 @@ static void run_events_ui(unsigned int which) do_it = 0; while (in_menu_wait_any(50) & (PBTN_MA3|PBTN_MBACK)) ; - in_set_blocking(0); + in_set_config_int(0, IN_CFG_BLOCKING, 0); } if (do_it) { plat_status_msg_busy_first((which & PEV_STATE_LOAD) ? "LOADING STATE" : "SAVING STATE"); @@ -1285,7 +1292,7 @@ static void run_events_ui(unsigned int which) } emu_status_msg("SAVE SLOT %i [%s]", state_slot, - emu_check_save_file(state_slot) ? "USED" : "FREE"); + emu_check_save_file(state_slot, NULL) ? "USED" : "FREE"); } if (which & PEV_MENU) engineState = PGS_Menu; @@ -1344,6 +1351,27 @@ static void mkdir_path(char *path_with_reserve, int pos, const char *name) lprintf("failed to create: %s\n", path_with_reserve); } +void emu_cmn_forced_frame(int no_scale, int do_emu) +{ + int po_old = PicoOpt; + + memset32(g_screen_ptr, 0, g_screen_width * g_screen_height * 2 / 4); + + PicoOpt &= ~POPT_ALT_RENDERER; + PicoOpt |= POPT_ACC_SPRITES; + if (!no_scale) + PicoOpt |= POPT_EN_SOFTSCALE; + + PicoDrawSetOutFormat(PDF_RGB555, 1); + Pico.m.dirtyPal = 1; + if (do_emu) + PicoFrame(); + else + PicoFrameDrawOnly(); + + PicoOpt = po_old; +} + void emu_init(void) { char path[512]; @@ -1428,6 +1456,14 @@ void emu_loop(void) Pico.m.dirtyPal = 1; rendstatus_old = -1; + PicoLoopPrepare(); + + // prepare CD buffer + if (PicoAHW & PAHW_MCD) + PicoCDBufferInit(); + + pemu_loop_prep(); + /* number of ticks per frame */ if (Pico.m.pal) { target_fps = 50; @@ -1437,13 +1473,6 @@ void emu_loop(void) target_frametime = ms_to_ticks(1000) / 60 + 1; } - // prepare CD buffer - if (PicoAHW & PAHW_MCD) - PicoCDBufferInit(); - PicoLoopPrepare(); - - pemu_loop_prep(); - timestamp_fps = get_ticks(); reset_timing = 1;