From 5b2b37e775d719fc055ef5e8e59cf965a8049e11 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 9 Aug 2017 23:26:51 -0700 Subject: 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 --- menu.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'menu.c') 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; } -- cgit v1.2.3