- added OHCI options to win32 runtime dialog

- enable USB options for present devices only
- TODO: implement dynamic runtime dialog for the first external USB hub
This commit is contained in:
Volker Ruppert 2009-03-07 20:02:49 +00:00
parent db2302d13d
commit f3d3857ce3
3 changed files with 58 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.73 2009-02-24 08:08:20 vruppert Exp $
// $Id: win32dialog.cc,v 1.74 2009-03-07 20:02:49 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -568,14 +568,26 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
switch (msg) {
case WM_INITDIALOG:
if (SIM->get_param_string(BXPN_UHCI_PORT1)->get_enabled()) {
SetDlgItemText(hDlg, IDUSBDEV1, SIM->get_param_string(BXPN_UHCI_PORT1)->getptr());
SetDlgItemText(hDlg, IDUSBDEV2, SIM->get_param_string(BXPN_UHCI_PORT2)->getptr());
if (((bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB))->get_by_name("uhci")) {
SetDlgItemText(hDlg, IDUHCIDEV1, SIM->get_param_string(BXPN_UHCI_PORT1)->getptr());
SetDlgItemText(hDlg, IDUHCIDEV2, SIM->get_param_string(BXPN_UHCI_PORT2)->getptr());
} else {
EnableWindow(GetDlgItem(hDlg, IDUSBLBL1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBLBL2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBDEV1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBDEV2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUHCILBL1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUHCILBL2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUHCIDEV1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUHCIDEV2), FALSE);
}
if (((bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB))->get_by_name("ohci")) {
SetDlgItemText(hDlg, IDOHCIDEV1, SIM->get_param_string(BXPN_OHCI_PORT1)->getptr());
SetDlgItemText(hDlg, IDOHCIDEV2, SIM->get_param_string(BXPN_OHCI_PORT2)->getptr());
} else {
EnableWindow(GetDlgItem(hDlg, IDOHCILBL1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDOHCILBL2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDOHCIDEV1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDOHCIDEV2), FALSE);
}
if (!((bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB))->get_by_name("exthub1")) {
EnableWindow(GetDlgItem(hDlg, IDEXTHUB1), FALSE);
}
changed = FALSE;
return TRUE;
@ -584,10 +596,16 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
switch(psn->hdr.code) {
case PSN_APPLY:
if ((psn->lParam == FALSE) && changed) { // Apply pressed & change in this dialog
GetDlgItemText(hDlg, IDUSBDEV1, buffer, sizeof(buffer));
GetDlgItemText(hDlg, IDUHCIDEV1, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_UHCI_PORT1)->set(buffer);
GetDlgItemText(hDlg, IDUSBDEV2, buffer, sizeof(buffer));
GetDlgItemText(hDlg, IDUHCIDEV2, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_UHCI_PORT2)->set(buffer);
GetDlgItemText(hDlg, IDOHCIDEV1, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_OHCI_PORT1)->set(buffer);
GetDlgItemText(hDlg, IDOHCIDEV2, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_OHCI_PORT2)->set(buffer);
EnableWindow(GetDlgItem(hDlg, IDEXTHUB1),
(((bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB))->get_by_name("exthub1") != NULL));
}
return PSNRET_NOERROR;
case PSN_QUERYCANCEL:
@ -600,13 +618,21 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
switch(noticode) {
case EN_CHANGE:
switch (LOWORD(wParam)) {
case IDUSBDEV1:
case IDUSBDEV2:
case IDUHCIDEV1:
case IDUHCIDEV2:
case IDOHCIDEV1:
case IDOHCIDEV2:
changed = TRUE;
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
break;
}
break;
default:
switch (LOWORD(wParam)) {
case IDEXTHUB1:
MessageBox(hDlg, "Not implemented yet", "Error", MB_ICONERROR);
break;
}
}
break;
}

View File

@ -67,8 +67,13 @@
#define IDSB16TIMER 2660
#define IDSBLOGLEV 2670
#define RT_USBDEV_DLG 2700
#define IDUSBLBL1 2711
#define IDUSBLBL2 2712
#define IDUSBWARN 2715
#define IDUSBDEV1 2620
#define IDUSBDEV2 2640
#define IDUHCILBL1 2711
#define IDUHCILBL2 2712
#define IDOHCILBL1 2713
#define IDOHCILBL2 2714
#define IDUSBWARN 2715
#define IDUHCIDEV1 2620
#define IDUHCIDEV2 2630
#define IDOHCIDEV1 2640
#define IDOHCIDEV2 2650
#define IDEXTHUB1 2660

View File

@ -92,11 +92,16 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "USB Options"
FONT 8, "Helv"
BEGIN
LTEXT "USB port #1 device", IDUSBLBL1, 10, 27, 70, 14
EDITTEXT IDUSBDEV1, 85, 25, 100, 14, ES_AUTOHSCROLL
LTEXT "USB port #2 device", IDUSBLBL2, 10, 47, 70, 14
EDITTEXT IDUSBDEV2, 85, 45, 100, 14, ES_AUTOHSCROLL
LTEXT "USB device change support is still experimental !", IDUSBWARN, 10, 120, 155, 14
LTEXT "UHCI port #1 device", IDUHCILBL1, 10, 27, 70, 14
EDITTEXT IDUHCIDEV1, 85, 25, 100, 14, ES_AUTOHSCROLL
LTEXT "UHCI port #2 device", IDUHCILBL2, 10, 47, 70, 14
EDITTEXT IDUHCIDEV2, 85, 45, 100, 14, ES_AUTOHSCROLL
LTEXT "OHCI port #1 device", IDOHCILBL1, 10, 67, 70, 14
EDITTEXT IDOHCIDEV1, 85, 65, 100, 14, ES_AUTOHSCROLL
LTEXT "OHCI port #2 device", IDOHCILBL2, 10, 87, 70, 14
EDITTEXT IDOHCIDEV2, 85, 85, 100, 14, ES_AUTOHSCROLL
PUSHBUTTON "External hub", IDEXTHUB1, 85, 105, 50, 14
LTEXT "USB device change support is still experimental !", IDUSBWARN, 10, 130, 155, 14
END
RT_LOGOPT_DLG DIALOG 30, 30, 240, 180