diff io.c @ 451:b7c3b2d22858

Added support for saving savestates. Added gst savestate format test harness
author Mike Pavone <pavone@retrodev.com>
date Fri, 26 Jul 2013 19:55:04 -0700
parents cc754a309ead
children 140af5509ce7
line wrap: on
line diff
--- a/io.c	Sat Jul 20 23:49:31 2013 -0700
+++ b/io.c	Fri Jul 26 19:55:04 2013 -0700
@@ -13,6 +13,7 @@
 	UI_DEBUG_MODE_INC,
 	UI_DEBUG_PAL_INC,
 	UI_ENTER_DEBUGGER,
+  UI_SAVE_STATE,
 	UI_EXIT
 } ui_action;
 
@@ -107,7 +108,7 @@
 
 void bind_gamepad(int keycode, int gamepadnum, int button)
 {
-	
+
 	if (gamepadnum < 1 || gamepadnum > 2) {
 		return;
 	}
@@ -210,6 +211,9 @@
 		case UI_ENTER_DEBUGGER:
 			break_on_sync = 1;
 			break;
+		case UI_SAVE_STATE:
+			save_state = 1;
+			break;
 		case UI_EXIT:
 			exit(0);
 		}
@@ -283,6 +287,8 @@
 			*ui_out = UI_DEBUG_PAL_INC;
 		} else if(!strcmp(target + 3, "enter_debugger")) {
 			*ui_out = UI_ENTER_DEBUGGER;
+		} else if(!strcmp(target + 3, "save_state")) {
+			*ui_out = UI_SAVE_STATE;
 		} else if(!strcmp(target + 3, "exit")) {
 			*ui_out = UI_EXIT;
 		} else {
@@ -345,7 +351,7 @@
 	special = tern_insert_int(special, "right", RENDERKEY_RIGHT);
 	special = tern_insert_int(special, "enter", '\r');
 		special = tern_insert_int(special, "esc", RENDERKEY_ESC);
-	
+
 	tern_node * padbuttons = tern_insert_int(NULL, ".up", DPAD_UP);
 	padbuttons = tern_insert_int(padbuttons, ".down", DPAD_DOWN);
 	padbuttons = tern_insert_int(padbuttons, ".left", DPAD_LEFT);
@@ -358,7 +364,7 @@
 	padbuttons = tern_insert_int(padbuttons, ".z", BUTTON_Z);
 	padbuttons = tern_insert_int(padbuttons, ".start", BUTTON_START);
 	padbuttons = tern_insert_int(padbuttons, ".mode", BUTTON_MODE);
-	
+
 	tern_node * keys = tern_find_prefix(config, "bindingskeys");
 	process_keys(keys, special, padbuttons, NULL);
 	char prefix[] = "bindingspads00";