X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Femu.c;h=cc450d8245187d014c0f282491db57206427ca0a;hb=81bfc1c5dc85f118ba037c671b0d04ec8f458711;hp=4fcb792264879473bcb8a785397840148dcc54aa;hpb=4182d35d5d7b51882e47c7865bdfdff8c0b2b8fc;p=libpicofe.git diff --git a/common/emu.c b/common/emu.c index 4fcb792..cc450d8 100644 --- a/common/emu.c +++ b/common/emu.c @@ -409,6 +409,32 @@ static void shutdown_MCD(void) PicoAHW &= ~PAHW_MCD; } +static void system_announce(void) +{ + const char *sys_name, *tv_standard; + int fps; + + if (PicoAHW & PAHW_SMS) { + sys_name = "Master System"; + } else if (PicoAHW & PAHW_PICO) { + sys_name = "Pico"; + } else if (PicoAHW & PAHW_MCD) { + sys_name = "Mega CD"; + if ((Pico.m.hardware & 0xc0) == 0x80) + sys_name = "Sega CD"; + } else if (PicoAHW & PAHW_32X) { + sys_name = "32X"; + } else { + sys_name = "MegaDrive"; + if ((Pico.m.hardware & 0xc0) == 0x80) + sys_name = "Genesis"; + } + tv_standard = Pico.m.pal ? "PAL" : "NTSC"; + fps = Pico.m.pal ? 50 : 60; + + emu_status_msg("%s %s / %dFPS", tv_standard, sys_name, fps); +} + // note: this function might mangle rom_fname // XXX: portions of this code should move to pico/ int emu_reload_rom(char *rom_fname) @@ -488,6 +514,9 @@ int emu_reload_rom(char *rom_fname) shutdown_MCD(); PicoPatchUnload(); + PicoCartUnload(); + rom_loaded = 0; + PicoAHW = 0; if (media_type == PM_CD) @@ -532,9 +561,6 @@ int emu_reload_rom(char *rom_fname) menu_romload_prepare(used_rom_name); // also CD load - PicoCartUnload(); - rom_loaded = 0; - ret = PicoCartLoad(rom, &rom_data, &rom_size, (PicoAHW & PAHW_SMS) ? 1 : 0); pm_close(rom); if (ret != 0) { @@ -612,21 +638,7 @@ int emu_reload_rom(char *rom_fname) } else { - const char *sys_name, *tv_standard; - int fps; - - if (PicoAHW & PAHW_SMS) { - sys_name = "Master System"; - } else { - sys_name = "MegaDrive"; - if ((Pico.m.hardware&0xc0) == 0x80) - sys_name = "Genesis"; - } - tv_standard = Pico.m.pal ? "PAL" : "NTSC"; - fps = Pico.m.pal ? 50 : 60; - - emu_status_msg("%s %s / %dFPS", tv_standard, sys_name, fps); - + system_announce(); PicoOpt &= ~POPT_DIS_VDP_FIFO; } @@ -977,7 +989,7 @@ int emu_save_load_game(int load, int sram) int truncate = 1; if (PicoAHW & PAHW_MCD) { - if (PicoOpt&POPT_EN_MCD_RAMCART) { + if (PicoOpt & POPT_EN_MCD_RAMCART) { sram_size = 0x12000; sram_data = SRam.data; if (sram_data) @@ -988,9 +1000,7 @@ int emu_save_load_game(int load, int sram) truncate = 0; // the .brm may contain RAM cart data after normal brm } } else { - sram_size = SRam.end-SRam.start+1; - if (Pico.m.sram_status & SRS_EEPROM) - sram_size = 0x2000; + sram_size = SRam.size; sram_data = SRam.data; } if (!sram_data) return 0; // SRam forcefully disabled for this game @@ -1075,6 +1085,12 @@ static void emu_tray_close(void) emu_status_msg("CD tray closed."); } +void emu_32x_startup(void) +{ + plat_video_toggle_renderer(0, 1, 0); + system_announce(); +} + void emu_reset_game(void) { PicoReset(); @@ -1202,9 +1218,9 @@ static void run_events_ui(unsigned int which) PicoStateProgressCB = NULL; } } - if (which & PEV_SWITCH_RND) + if ((which & PEV_SWITCH_RND) && !(PicoAHW & PAHW_32X)) { - plat_video_toggle_renderer(1, 0); + plat_video_toggle_renderer(1, 0, 0); } if (which & (PEV_SSLOT_PREV|PEV_SSLOT_NEXT)) {