diff blastem.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 9a3e003bdcb3
children e2bd03ed3190
line wrap: on
line diff
--- a/blastem.c	Sun Aug 06 00:06:36 2017 -0700
+++ b/blastem.c	Wed Aug 09 23:26:51 2017 -0700
@@ -37,6 +37,7 @@
 int exit_after = 0;
 int z80_enabled = 1;
 int frame_limit = 0;
+uint8_t use_native_states = 1;
 
 tern_node * config;
 
@@ -169,8 +170,11 @@
 		free(save_dir);
 		save_dir = get_save_dir(media);
 	}
-	//TODO: make quick save filename dependent on system type
-	parts[2] = "quicksave.gst";
+	if (use_native_states || context->type != SYSTEM_GENESIS) {
+		parts[2] = "quicksave.state";
+	} else {
+		parts[2] = "quicksave.gst";
+	}
 	free(save_state_path);
 	save_state_path = alloc_concat_m(3, parts);
 	context->save_dir = save_dir;
@@ -417,6 +421,12 @@
 	if (!current_system) {
 		fatal_error("Failed to configure emulated machine for %s\n", romfname);
 	}
+	char *state_format = tern_find_path(config, "ui\0state_format\0", TVAL_PTR).ptrval;
+	if (state_format && !strcmp(state_format, "gst")) {
+		use_native_states = 0;
+	} else if (state_format && strcmp(state_format, "native")) {
+		warning("%s is not a valid value for the ui.state_format setting. Valid values are gst and native\n", state_format);
+	}
 	setup_saves(&cart, &info, current_system);
 	update_title(info.name);
 	if (menu) {