- new function win32SaveState now called after pressing the "suspend" button

- save state handling removed from runtime dialog
- textconfig save state prompt improved
- textconfig: save state item removed from runtime menu
This commit is contained in:
Volker Ruppert 2006-06-08 17:02:52 +00:00
parent 21b1f8ce58
commit 1be86095ab
5 changed files with 57 additions and 43 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.58 2006-06-07 19:40:15 vruppert Exp $
// $Id: textconfig.cc,v 1.59 2006-06-08 17:02:51 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// This is code for a text-mode configuration interface. Note that this file
@ -278,17 +278,18 @@ static char *runtime_menu_prompt =
"9. Log options for individual devices\n"
"10. Instruction tracing: off (doesn't exist yet)\n"
"11. Misc runtime options\n"
#if BX_SUPPORT_SAVE_RESTORE
"12. Save the Bochs state to directory and quit...\n"
"13. Continue simulation\n"
"14. Quit now\n"
"\n"
"Please choose one: [13] ";
#else
"12. Continue simulation\n"
"13. Quit now\n"
"\n"
"Please choose one: [12] ";
#if BX_SUPPORT_SAVE_RESTORE
static char *save_state_prompt =
"----------------\n"
"Save Bochs State\n"
"----------------\n\n"
"What is the path to save the Bochs state to?\n"
"To cancel, type 'none'. [%s] ";
#endif
#endif
@ -516,23 +517,31 @@ int bx_config_interface(int menu)
}
break;
case BX_CI_SAVE_RESTORE:
if (ask_string("\nWhat is the path to save the Bochs state to?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
if (strcmp(sr_path, "none")) {
if (SIM->save_state(sr_path)) {
Bit32u cont = 0;
ask_yn("\nThe save function currently doesn't handle the state of hard drive images,\n"
"so we don't recommend to continue, unless you are running a read-only\n"
"guest system (e.g. Live-CD).\n\n"
"Do you want to continue? [no]", 0, &cont);
if (!cont) {
bx_user_quit = 1;
SIM->quit_sim(1);
return -1;
{
Bit32u cont = 1;
#ifdef WIN32
cont = win32SaveState();
#else
if (ask_string(save_state_prompt, "none", sr_path) >= 0) {
if (strcmp(sr_path, "none")) {
if (SIM->save_state(sr_path)) {
cont = 0;
ask_yn("\nThe save function currently doesn't handle the state of hard drive images,\n"
"so we don't recommend to continue, unless you are running a read-only\n"
"guest system (e.g. Live-CD).\n\n"
"Do you want to continue? [no]", 0, &cont);
}
}
}
#endif
if (!cont) {
bx_user_quit = 1;
SIM->quit_sim(1);
return -1;
} else {
return 0;
}
}
return 0;
default:
fprintf (stderr, "Unknown config interface menu type.\n");
assert (menu >=0 && menu < BX_CI_N_MENUS);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.47 2006-05-31 20:12:43 vruppert Exp $
// $Id: win32dialog.cc,v 1.48 2006-06-08 17:02:51 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#include "config.h"
@ -708,10 +708,6 @@ static BOOL CALLBACK RTMiscDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
long noticode;
char buffer[32];
PSHNOTIFY *psn;
#if BX_SUPPORT_SAVE_RESTORE
char sr_path[MAX_PATH];
int ret;
#endif
switch (msg) {
case WM_INITDIALOG:
@ -723,7 +719,6 @@ static BOOL CALLBACK RTMiscDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
SetDlgItemText(hDlg, IDUSERBTN, SIM->get_param_string(BXPN_USER_SHORTCUT)->getptr());
SetDlgItemInt(hDlg, IDSB16TIMER, SIM->get_param_num(BXPN_SB16_DMATIMER)->get(), FALSE);
SetDlgItemInt(hDlg, IDSBLOGLEV, SIM->get_param_num(BXPN_SB16_LOGLEVEL)->get(), FALSE);
EnableWindow(GetDlgItem(hDlg, IDSAVESTATE), BX_SUPPORT_SAVE_RESTORE);
changed = FALSE;
return TRUE;
case WM_NOTIFY:
@ -772,19 +767,6 @@ static BOOL CALLBACK RTMiscDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
changed = TRUE;
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
break;
case IDSAVESTATE:
#if BX_SUPPORT_SAVE_RESTORE
sr_path[0] = 0;
if (BrowseDir("Select folder for save/restore data", sr_path)) {
if (SIM->save_state(sr_path)) {
ret = MessageBox(hDlg, "The save function currently doesn't handle the state of hard drive images,\nso we don't recommend to continue, unless you are running a read-only\nguest system (e.g. Live-CD).\n\nDo you want to continue?", "WARNING", MB_YESNO | MB_ICONEXCLAMATION);
if (ret == IDNO) {
SendMessage(GetParent(hDlg), PSM_PRESSBUTTON, (WPARAM)PSBTN_CANCEL, 0);
}
}
}
#endif
break;
}
}
break;
@ -909,6 +891,28 @@ int RuntimeOptionsDialog()
return retcode;
}
#if BX_SUPPORT_SAVE_RESTORE
bx_bool win32SaveState()
{
char sr_path[MAX_PATH];
int ret;
sr_path[0] = 0;
if (BrowseDir("Select folder for save/restore data", sr_path)) {
if (SIM->save_state(sr_path)) {
ret = MessageBox(GetBochsWindow(), "The save function currently doesn't handle the state of hard drive images,\n"
"so we don't recommend to continue, unless you are running a read-only\n"
"guest system (e.g. Live-CD).\n\nDo you want to continue?",
"WARNING", MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
if (ret == IDNO) {
return 0;
}
}
}
return 1;
}
#endif
BxEvent* win32_notify_callback(void *unused, BxEvent *event)
{
int opts;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.h,v 1.8 2005-10-22 11:00:00 vruppert Exp $
// $Id: win32dialog.h,v 1.9 2006-06-08 17:02:51 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#include "config.h"
@ -7,6 +7,9 @@
#if BX_USE_TEXTCONFIG && defined(WIN32)
int RuntimeOptionsDialog();
#if BX_SUPPORT_SAVE_RESTORE
bx_bool win32SaveState();
#endif
void win32_init_notify_callback();
#endif

View File

@ -66,7 +66,6 @@
#define IDUSERBTN 2650
#define IDSB16TIMER 2660
#define IDSBLOGLEV 2670
#define IDSAVESTATE 2680
#define RT_USBDEV_DLG 2700
#define IDUSBLBL1 2711
#define IDUSBLBL2 2712

View File

@ -143,6 +143,5 @@ BEGIN
EDITTEXT IDSB16TIMER, 85, 105, 70, 14, ES_NUMBER
LTEXT "SB16 loglevel", IDMISCLBL5, 10, 127, 70, 14
EDITTEXT IDSBLOGLEV, 85, 125, 70, 14, ES_NUMBER
PUSHBUTTON "Save state and quit...", IDSAVESTATE, 85, 145, 70, 14
END