summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-08-09 23:26:51 -0700
committerMichael Pavone <pavone@retrodev.com>2017-08-09 23:26:51 -0700
commit5b2b37e775d719fc055ef5e8e59cf965a8049e11 (patch)
tree4662dab8115571aaced5ee6e2d1c80cc7839f3be /menu.c
parent581601741c3b94bc66a03eece1774618312b260a (diff)
New savestates are working. New config file option for selecting format states will be saved in. Mostly complete, needs a little more work before release
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/menu.c b/menu.c
index 751d8f3..c8ccc43 100644
--- a/menu.c
+++ b/menu.c
@@ -429,11 +429,20 @@ void * menu_write_w(uint32_t address, void * context, uint16_t value)
slotname = numslotname;
}
char const *parts[] = {gen->header.next_context->save_dir, PATH_SEP, slotname};
- char *gstpath = alloc_concat_m(3, parts);
+ char *statepath = alloc_concat_m(3, parts);
genesis_context *next = (genesis_context *)gen->header.next_context;
-
- uint32_t pc = load_gst(next, gstpath);
- free(gstpath);
+ deserialize_buffer state;
+ uint32_t pc = 0;
+ if (load_from_file(&state, statepath)) {
+ genesis_deserialize(&state, next);
+ free(state.data);
+ //HACK
+ pc = next->m68k->last_prefetch_address;
+ } else {
+ strcpy(statepath + strlen(statepath)-strlen("state"), "gst");
+ pc = load_gst(next, statepath);
+ }
+ free(statepath);
if (!pc) {
break;
}