32x and sms savestates. Core-independent z80 state. SS bugfixing/refactoring.
authornotaz <notasas@gmail.com>
Wed, 27 Jan 2010 16:30:41 +0000 (16:30 +0000)
committernotaz <notasas@gmail.com>
Wed, 27 Jan 2010 16:30:41 +0000 (16:30 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@868 be3aeb3a-fb24-0410-a615-afba39da0efa

common/common.mak
common/menu.c

index 061771e..2a240b0 100644 (file)
@@ -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
index 34d5b49..5b0474a 100644 (file)
@@ -19,7 +19,7 @@
 #include <version.h>\r
 #include <revision.h>\r
 \r
-#include <pico/pico_int.h>\r
+#include <pico/pico.h>\r
 #include <pico/patch.h>\r
 \r
 static char static_buff[64];\r
@@ -1039,34 +1039,22 @@ static void state_check_slots(void)
 \r
 static void draw_savestate_bg(int slot)\r
 {\r
-       struct PicoVideo tmp_pv;\r
-       unsigned short tmp_cram[0x40];\r
-       unsigned short tmp_vsram[0x40];\r
-       void *tmp_vram;\r
        const char *fname;\r
+       void *tmp_state;\r
 \r
        fname = emu_get_save_fname(1, 0, slot);\r
-       if (!fname) return;\r
-\r
-       tmp_vram = malloc(sizeof(Pico.vram));\r
-       if (tmp_vram == NULL) return;\r
+       if (!fname)\r
+               return;\r
 \r
-       memcpy(tmp_vram, Pico.vram, sizeof(Pico.vram));\r
-       memcpy(tmp_cram, Pico.cram, sizeof(Pico.cram));\r
-       memcpy(tmp_vsram, Pico.vsram, sizeof(Pico.vsram));\r
-       memcpy(&tmp_pv, &Pico.video, sizeof(Pico.video));\r
+       tmp_state = PicoTmpStateSave();\r
 \r
-       PicoStateLoadVDP(fname);\r
+       PicoStateLoadGfx(fname);\r
 \r
        /* do a frame and fetch menu bg */\r
        pemu_forced_frame(POPT_EN_SOFTSCALE);\r
        menu_enter(1);\r
 \r
-       memcpy(Pico.vram, tmp_vram, sizeof(Pico.vram));\r
-       memcpy(Pico.cram, tmp_cram, sizeof(Pico.cram));\r
-       memcpy(Pico.vsram, tmp_vsram, sizeof(Pico.vsram));\r
-       memcpy(&Pico.video, &tmp_pv,  sizeof(Pico.video));\r
-       free(tmp_vram);\r
+       PicoTmpStateRestore(tmp_state);\r
 }\r
 \r
 static void draw_savestate_menu(int menu_sel, int is_loading)\r
@@ -1105,6 +1093,7 @@ static int menu_loop_savestate(int is_loading)
        static int menu_sel = 10;\r
        int menu_sel_max = 10;\r
        unsigned long inp = 0;\r
+       int ret = 0;\r
 \r
        state_check_slots();\r
 \r
@@ -1134,15 +1123,18 @@ static int menu_loop_savestate(int is_loading)
                                state_slot = menu_sel;\r
                                if (emu_save_load_game(is_loading, 0)) {\r
                                        me_update_msg(is_loading ? "Load failed" : "Save failed");\r
-                                       return 0;\r
+                                       break;\r
                                }\r
-                               return 1;\r
+                               ret = 1;\r
+                               break;\r
                        }\r
-                       return 0;\r
+                       break;\r
                }\r
                if (inp & PBTN_MBACK)\r
-                       return 0;\r
+                       break;\r
        }\r
+\r
+       return ret;\r
 }\r
 \r
 // -------------- key config --------------\r