- save state function now supported on win32 in the runtime dialog

- for the BrowseDir() function Bochs for win32 needs to be linked with SHELL32.DLL
  (currently used for the save/restore support only)
- save/restore support symbol name changed
This commit is contained in:
Volker Ruppert 2006-04-09 13:55:55 +00:00
parent 841c802e6b
commit 0396a9d86f
11 changed files with 73 additions and 30 deletions

View File

@ -107,9 +107,9 @@ GUI_LINK_OPTS_SVGA = -lvga -lvgagl
GUI_LINK_OPTS_BEOS = -lbe
GUI_LINK_OPTS_RFB = @RFB_LIBS@
GUI_LINK_OPTS_AMIGAOS =
GUI_LINK_OPTS_WIN32 = -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lwsock32
GUI_LINK_OPTS_WIN32 = -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lwsock32 -lshell32
GUI_LINK_OPTS_WIN32_VCPP = user32.lib gdi32.lib winmm.lib \
comdlg32.lib comctl32.lib wsock32.lib advapi32.lib
comdlg32.lib comctl32.lib wsock32.lib advapi32.lib shell32.lib
GUI_LINK_OPTS_MACOS =
GUI_LINK_OPTS_CARBON = -framework Carbon
GUI_LINK_OPTS_NOGUI =
@ -249,7 +249,7 @@ $(BX_OBJS): $(BX_INCLUDES)
bxversion.h:
$(RM) -f bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h
echo '// $$Id: Makefile.in,v 1.178 2006-03-06 22:32:01 sshwarts Exp $$' >> bxversion.h
echo '// $$Id: Makefile.in,v 1.179 2006-04-09 13:55:53 vruppert Exp $$' >> bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h
echo '// This file is generated by "make bxversion.h"' >> bxversion.h
echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.101 2006-04-06 20:42:50 vruppert Exp $
// $Id: config.cc,v 1.102 2006-04-09 13:55:53 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -343,7 +343,7 @@ void bx_init_options()
BX_RUN_START,
BX_QUICK_START);
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
new bx_param_bool_c(menu,
"restore",
"Restore Bochs session",

View File

@ -739,8 +739,8 @@ typedef
#define BX_SUPPORT_ICACHE 0
// save/restore (under construction)
#define BX_SAVE_RESTORE 0
// save/restore support (under construction)
#define BX_SUPPORT_SAVE_RESTORE 0
// if 1, don't do gpf on MSRs that we don't implement
#define BX_IGNORE_BAD_MSR 0

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.138 2006-04-09 09:05:30 vruppert Exp $
// $Id: siminterface.cc,v 1.139 2006-04-09 13:55:54 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// See siminterface.h for description of the siminterface concept.
@ -138,7 +138,7 @@ public:
virtual int find_user_option(const char *keyword);
virtual bx_bool register_user_option(const char *keyword, user_option_handler_t handler);
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []);
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
// save/restore support
virtual bx_bool save_state(const char *checkpoint_path);
virtual bx_bool restore_config();
@ -834,7 +834,7 @@ Bit32s bx_real_sim_c::parse_user_option(int idx, const char *context, int num_pa
return (*user_option_handler[idx])(context, num_params, params);
}
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
bx_bool bx_real_sim_c::save_state(const char *checkpoint_path)
{
char config[BX_PATHNAME_LEN];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.183 2006-04-07 12:49:50 vruppert Exp $
// $Id: siminterface.h,v 1.184 2006-04-09 13:55:54 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Intro to siminterface by Bryce Denney:
@ -1179,7 +1179,7 @@ public:
virtual int find_user_option(const char *keyword) {return -1;}
virtual bx_bool register_user_option(const char *keyword, user_option_handler_t handler) {return 0;}
virtual Bit32s parse_user_option(int idx, const char *context, int num_params, char *params []) {return -1;}
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
// save/restore support
virtual bx_bool save_state(const char *checkpoint_path) {return 0;}
virtual bx_bool restore_config() {return 0;}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.51 2006-04-09 09:05:30 vruppert Exp $
// $Id: textconfig.cc,v 1.52 2006-04-09 13:55:55 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// This is code for a text-mode configuration interface. Note that this file
@ -229,7 +229,7 @@ static char *startup_menu_prompt =
"2. Read options from...\n"
"3. Edit options\n"
"4. Save options to...\n"
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
"5. Restore Bochs config and log options from...\n"
"6. Begin simulation\n"
"7. Quit now\n"
@ -278,7 +278,7 @@ 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_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
"12. Save Bochs config and log options to...\n"
"13. Continue simulation\n"
"14. Quit now\n"
@ -372,7 +372,7 @@ void askparam(char *pname)
int bx_config_interface(int menu)
{
Bit32u choice;
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
char sr_path[CI_PATH_LENGTH];
#endif
while (1) {
@ -394,13 +394,13 @@ int bx_config_interface(int menu)
case BX_EDIT_START:
default_choice = 3; break;
default:
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
default_choice = 6; break;
#else
default_choice = 5; break;
#endif
}
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
if (ask_uint(startup_menu_prompt, 1, 7, default_choice, &choice, 10) < 0) return -1;
#else
if (ask_uint(startup_menu_prompt, 1, 6, default_choice, &choice, 10) < 0) return -1;
@ -423,7 +423,7 @@ int bx_config_interface(int menu)
SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_RUN_START);
break;
case 4: bx_write_rc(NULL); break;
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
case 5:
if (ask_string("\nWhat is the path to restore Bochs config and log options from?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
if (strcmp (sr_path, "none")) {
@ -511,7 +511,7 @@ int bx_config_interface(int menu)
bx_user_quit = 1;
SIM->quit_sim(1);
return -1;
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
case BX_CI_RT_SAVE:
if (ask_string("\nWhat is the path to save the Bochs config and log options to?\nTo cancel, type 'none'. [%s] ", "none", sr_path) >= 0) {
if (strcmp (sr_path, "none")) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.h,v 1.4 2006-04-06 20:42:51 vruppert Exp $
// $Id: textconfig.h,v 1.5 2006-04-09 13:55:55 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
@ -33,7 +33,7 @@ enum {
BX_CI_RT_LOGOPTS2,
BX_CI_RT_INST_TR,
BX_CI_RT_MISC,
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
BX_CI_RT_SAVE,
#endif
BX_CI_RT_CONT,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.41 2006-03-08 18:10:41 vruppert Exp $
// $Id: win32dialog.cc,v 1.42 2006-04-09 13:55:55 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#include "config.h"
@ -11,6 +11,7 @@ extern "C" {
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <ctype.h>
}
#include "win32res.h"
@ -62,6 +63,33 @@ BOOL CreateImage(HWND hDlg, int sectors, const char *filename)
return TRUE;
}
int BrowseDir(const char *Title, char *result)
{
BROWSEINFO browseInfo;
LPITEMIDLIST ItemIDList;
int r = 0;
memset(&browseInfo,0,sizeof(BROWSEINFO));
browseInfo.hwndOwner = GetActiveWindow();
browseInfo.pszDisplayName = result;
browseInfo.lpszTitle = (LPCSTR)Title;
browseInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS;
ItemIDList = SHBrowseForFolder(&browseInfo);
if (ItemIDList != NULL) {
*result = 0;
if (SHGetPathFromIDList(ItemIDList, result)) {
if (result[0]) r = 1;
}
// free memory used
IMalloc * imalloc = 0;
if (SUCCEEDED(SHGetMalloc(&imalloc))) {
imalloc->Free(ItemIDList);
imalloc->Release();
}
}
return r;
}
static BOOL CALLBACK LogAskProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BxEvent *event;
@ -667,6 +695,9 @@ 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];
#endif
switch (msg) {
case WM_INITDIALOG:
@ -678,6 +709,7 @@ 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:
@ -726,6 +758,15 @@ 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
MessageBox(hDlg, "The save/restore function currently handles config and log options only", "WARNING", MB_ICONEXCLAMATION);
sr_path[0] = 0;
if (BrowseDir("Select folder for save/restore data", sr_path)) {
SIM->save_state(sr_path);
}
#endif
break;
}
}
break;

View File

@ -66,6 +66,7 @@
#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

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.329 2006-04-09 09:05:29 vruppert Exp $
// $Id: main.cc,v 1.330 2006-04-09 13:55:53 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -466,7 +466,7 @@ void print_usage()
" -n no configuration file\n"
" -f configfile specify configuration file\n"
" -q quick start (skip configuration interface)\n"
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
" -r path restore Bochs config and log options from path\n"
#endif
" --help display this help and exit\n\n"
@ -527,7 +527,7 @@ int bx_init_main (int argc, char *argv[])
if (++arg >= argc) BX_PANIC(("-qf must be followed by a filename"));
else bochsrc_filename = argv[arg];
}
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
else if (!strcmp ("-r", argv[arg])) {
if (++arg >= argc) BX_PANIC(("-r must be followed by a path"));
else {
@ -655,7 +655,7 @@ int bx_init_main (int argc, char *argv[])
int norcfile = 1;
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
load_rcfile = 0;
norcfile = 0;
@ -795,7 +795,7 @@ bx_bool load_and_init_display_lib ()
int bx_begin_simulation (int argc, char *argv[])
{
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
SIM->restore_config();
}
@ -1002,14 +1002,14 @@ int bx_init_hardware()
#endif
DEV_init_devices();
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
SIM->restore_logopts();
}
#endif
// will enable A20 line and reset CPU and devices
bx_pc_system.Reset(BX_RESET_HARDWARE);
#if BX_SAVE_RESTORE
#if BX_SUPPORT_SAVE_RESTORE
if (SIM->get_param_bool(BXPN_RESTORE_FLAG)->get()) {
// SIM->restore_hardware();
}

View File

@ -143,5 +143,6 @@ 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...", IDSAVESTATE, 85, 145, 50, 14
END