]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
statefile_quit
authorToni Wilen <twilen@winuae.net>
Fri, 21 May 2010 18:56:13 +0000 (21:56 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 21 May 2010 18:56:13 +0000 (21:56 +0300)
cfgfile.cpp
drawing.cpp
include/options.h
main.cpp

index c99f63fd7ef0ace7d19e9f9b12e0a154a349b167..5d978d502d7d1f595b3f5cccfc87c484c6c7e8a0 100644 (file)
@@ -556,6 +556,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        if (p->cdimagefile[0])
                cfgfile_write_str (f, L"cdimage0", p->cdimagefile);
 
+       if (p->quitstatefile[0])
+               cfgfile_write_str (f, L"statefile_quit", p->quitstatefile);
+
        cfgfile_write (f, L"nr_floppies", L"%d", p->nr_floppies);
        cfgfile_write (f, L"floppy_speed", L"%d", p->floppy_speed);
        cfgfile_write (f, L"floppy_volume", L"%d", p->dfxclickvolume);
@@ -1393,7 +1396,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
        if (cfgfile_strval (option, value, L"joyport3autofire", &p->jports[3].autofire, joyaf, 0))
                return 1;
 
-       if (cfgfile_path (option, value, L"statefile", tmpbuf, sizeof (tmpbuf) / sizeof (TCHAR))) {
+       if (cfgfile_path (option, value, L"statefile_quit", p->quitstatefile, sizeof p->quitstatefile / sizeof (TCHAR)))
+               return 1;
+
+       if (cfgfile_path (option, value, L"statefile", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
                _tcscpy (savestate_fname, tmpbuf);
                if (zfile_exists (savestate_fname)) {
                        savestate_state = STATE_DORESTORE;
index 0016a171a97eb0315e64b687c86ed32e1a7a15e8..46947f5409c5425a45e185ef9d25548b99abef96 100644 (file)
@@ -2865,6 +2865,12 @@ void vsync_handle_redraw (int long_frame, int lof_changed)
 #endif
 
                if (quit_program < 0) {
+                       if (!savestate_state) {
+                               if (currprefs.quitstatefile[0]) {
+                                       savestate_initsave (currprefs.quitstatefile, 1, 1); 
+                                       save_state (currprefs.quitstatefile, L"");
+                               }
+                       }
                        quit_program = -quit_program;
                        set_inhibit_frame (IHF_QUIT_PROGRAM);
                        set_special (SPCFLAG_BRK);
index 6686ce49cee1adefa7732aacdd8061ca83947a3d..bb162fa4c55953b6e8eb92637beeabaf45784029 100644 (file)
@@ -273,6 +273,7 @@ struct uae_prefs {
        TCHAR amaxromfile[MAX_DPATH];
        TCHAR a2065name[MAX_DPATH];
        TCHAR cdimagefile[MAX_DPATH];
+       TCHAR quitstatefile[MAX_DPATH];
 
        TCHAR path_floppy[256];
        TCHAR path_hardfile[256];
@@ -362,7 +363,6 @@ struct uae_prefs {
 
        /* input */
 
-       TCHAR inputname[256];
        struct jport jports[MAX_JPORTS];
        int input_selected_setting;
        int input_joymouse_multiplier;
index 537665b5aa96687bd59b06306164fe462742c974..c14e1f9d3b93e666ba5400cdee65447130738ae3 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -390,6 +390,8 @@ static int default_config;
 
 void uae_reset (int hardreset)
 {
+       currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0;
+
        if (quit_program == 0) {
                quit_program = -2;
                if (hardreset)