# HG changeset patch # User nkeynes # Date 1168596962 0 # Node ID fcc1274776cbd09dedb1452bd4ef0f94d8288139 # Parent 1e594c2804f81a8af1b5abce5f1af51bd9b1da0c Add ability to save flash --- a/src/dreamcast.c Fri Jan 12 10:15:06 2007 +0000 +++ b/src/dreamcast.c Fri Jan 12 10:16:02 2007 +0000 @@ -1,5 +1,5 @@ /** - * $Id: dreamcast.c,v 1.19 2007-01-06 04:06:36 nkeynes Exp $ + * $Id: dreamcast.c,v 1.20 2007-01-12 10:16:02 nkeynes Exp $ * Central switchboard for the system. This pulls all the individual modules * together into some kind of coherent structure. This is also where you'd * add Naomi support, if I ever get a board to play with... @@ -85,6 +85,12 @@ dreamcast_register_module( &ide_module ); } +void dreamcast_save_flash() +{ + char *file = dreamcast_get_config_value(CONFIG_FLASH_PATH); + mem_save_block( file, 0x00200000, 0x00020000 ); +} + /** * Constructs a system configuration for the AICA in standalone mode, * ie sound chip only. @@ -154,6 +160,13 @@ dreamcast_state = STATE_STOPPING; } +void dreamcast_shutdown() +{ + dreamcast_stop(); + sh4_stop(); + dreamcast_save_flash(); +} + gboolean dreamcast_is_running( void ) { return dreamcast_state == STATE_RUNNING; --- a/src/gui/callbacks.c Fri Jan 12 10:15:06 2007 +0000 +++ b/src/gui/callbacks.c Fri Jan 12 10:16:02 2007 +0000 @@ -1,5 +1,5 @@ /** - * $Id: callbacks.c,v 1.17 2006-12-15 10:17:08 nkeynes Exp $ + * $Id: callbacks.c,v 1.18 2007-01-12 10:16:02 nkeynes Exp $ * * All GTK callbacks go here (stubs are autogenerated by Glade) * @@ -172,6 +172,7 @@ GdkEvent *event, gpointer user_data) { + dreamcast_shutdown(); gtk_main_quit(); return FALSE; }