From: notaz Date: Wed, 27 Jan 2010 16:30:41 +0000 (+0000) Subject: 32x and sms savestates. Core-independent z80 state. SS bugfixing/refactoring. X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d227571356afae37e5ed67b1356b2a5a310bd204;p=libpicofe.git 32x and sms savestates. Core-independent z80 state. SS bugfixing/refactoring. git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@868 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/common/common.mak b/common/common.mak index 061771e..2a240b0 100644 --- a/common/common.mak +++ b/common/common.mak @@ -25,13 +25,13 @@ endif # === Pico core === # Pico -OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \ +OBJS += pico/state.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \ pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o pico/sms.o \ pico/misc.o pico/eeprom.o pico/patch.o pico/debug.o # CD OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ - pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o + pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o # 32X OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o # Pico @@ -62,11 +62,6 @@ OBJS += cpu/fame/famec.o endif # --- Z80 --- -ifeq "$(use_mz80)" "1" -DEFINES += _USE_MZ80 -OBJS += cpu/mz80/mz80.o -endif -# ifeq "$(use_drz80)" "1" DEFINES += _USE_DRZ80 OBJS += cpu/DrZ80/drz80.o diff --git a/common/menu.c b/common/menu.c index 34d5b49..5b0474a 100644 --- a/common/menu.c +++ b/common/menu.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include static char static_buff[64]; @@ -1039,34 +1039,22 @@ static void state_check_slots(void) static void draw_savestate_bg(int slot) { - struct PicoVideo tmp_pv; - unsigned short tmp_cram[0x40]; - unsigned short tmp_vsram[0x40]; - void *tmp_vram; const char *fname; + void *tmp_state; fname = emu_get_save_fname(1, 0, slot); - if (!fname) return; - - tmp_vram = malloc(sizeof(Pico.vram)); - if (tmp_vram == NULL) return; + if (!fname) + return; - memcpy(tmp_vram, Pico.vram, sizeof(Pico.vram)); - memcpy(tmp_cram, Pico.cram, sizeof(Pico.cram)); - memcpy(tmp_vsram, Pico.vsram, sizeof(Pico.vsram)); - memcpy(&tmp_pv, &Pico.video, sizeof(Pico.video)); + tmp_state = PicoTmpStateSave(); - PicoStateLoadVDP(fname); + PicoStateLoadGfx(fname); /* do a frame and fetch menu bg */ pemu_forced_frame(POPT_EN_SOFTSCALE); menu_enter(1); - memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram)); - memcpy(Pico.cram, tmp_cram, sizeof(Pico.cram)); - memcpy(Pico.vsram, tmp_vsram, sizeof(Pico.vsram)); - memcpy(&Pico.video, &tmp_pv, sizeof(Pico.video)); - free(tmp_vram); + PicoTmpStateRestore(tmp_state); } static void draw_savestate_menu(int menu_sel, int is_loading) @@ -1105,6 +1093,7 @@ static int menu_loop_savestate(int is_loading) static int menu_sel = 10; int menu_sel_max = 10; unsigned long inp = 0; + int ret = 0; state_check_slots(); @@ -1134,15 +1123,18 @@ static int menu_loop_savestate(int is_loading) state_slot = menu_sel; if (emu_save_load_game(is_loading, 0)) { me_update_msg(is_loading ? "Load failed" : "Save failed"); - return 0; + break; } - return 1; + ret = 1; + break; } - return 0; + break; } if (inp & PBTN_MBACK) - return 0; + break; } + + return ret; } // -------------- key config --------------