From: Toni Wilen Date: Fri, 21 May 2010 18:56:13 +0000 (+0300) Subject: statefile_quit X-Git-Tag: 2200~27 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6e1279d2b386b5717e8697656816e95b2122ae41;p=francis%2Fwinuae.git statefile_quit --- diff --git a/cfgfile.cpp b/cfgfile.cpp index c99f63fd..5d978d50 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -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; diff --git a/drawing.cpp b/drawing.cpp index 0016a171..46947f54 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -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); diff --git a/include/options.h b/include/options.h index 6686ce49..bb162fa4 100644 --- a/include/options.h +++ b/include/options.h @@ -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; diff --git a/main.cpp b/main.cpp index 537665b5..c14e1f9d 100644 --- 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)