diff menu.c @ 1428:2540c05520f2

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
author Michael Pavone <pavone@retrodev.com>
date Wed, 09 Aug 2017 23:26:51 -0700
parents 4e5797b3935a
children c886c54d8cf1
line wrap: on
line diff
--- a/menu.c	Sun Aug 06 00:06:36 2017 -0700
+++ b/menu.c	Wed Aug 09 23:26:51 2017 -0700
@@ -429,11 +429,20 @@
 					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;
 				}