Machine can now be configured from selection dialogue.

This commit is contained in:
SarahW 2017-05-06 20:45:44 +01:00
commit beecfd8381
4 changed files with 70 additions and 5 deletions

View file

@ -325,6 +325,8 @@ BEGIN
DEFPUSHBUTTON "OK", IDOK, 200-54, 4, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "Cancel", IDCANCEL, 200-54,22, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "New...", IDC_NEW, 200-54,40, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "Configuration...", IDC_CONFIG, 200-54,58, 50, 14, WS_TABSTOP
DEFPUSHBUTTON "HDD...", IDC_HDCONF, 200-54,76, 50, 14, WS_TABSTOP
LISTBOX IDC_LIST, 4, 4,140,142, WS_TABSTOP
END

View file

@ -136,3 +136,5 @@
#define IDC_NEW 1200
#define IDC_LIST 1201
#define IDC_CONFIG 1202
#define IDC_HDCONF 1203

View file

@ -113,6 +113,58 @@ static BOOL CALLBACK config_selection_dlgproc(HWND hdlg, UINT message, WPARAM wP
return TRUE;
}
case IDC_CONFIG:
{
char s[512];
int ret = DlgDirSelectEx(hdlg, s, 512, IDC_LIST);
pclog("DlgDirSelectEx returned %i %s\n", ret, s);
if (s[0])
{
char cfg[512];
strcpy(cfg, pcempath);
put_backslash(cfg);
strcat(cfg, "configs\\");
strcat(cfg, s);
strcat(cfg, "cfg");
pclog("Config name %s\n", cfg);
loadconfig(cfg);
config_open(hdlg);
saveconfig(cfg);
}
return TRUE;
}
case IDC_HDCONF:
{
char s[512];
int ret = DlgDirSelectEx(hdlg, s, 512, IDC_LIST);
pclog("DlgDirSelectEx returned %i %s\n", ret, s);
if (s[0])
{
char cfg[512];
strcpy(cfg, pcempath);
put_backslash(cfg);
strcat(cfg, "configs\\");
strcat(cfg, s);
strcat(cfg, "cfg");
pclog("Config name %s\n", cfg);
loadconfig(cfg);
hdconf_open(hdlg);
saveconfig(cfg);
}
return TRUE;
}
}
break;
}
@ -121,7 +173,13 @@ static BOOL CALLBACK config_selection_dlgproc(HWND hdlg, UINT message, WPARAM wP
int config_selection_open(HWND hwnd, int inited)
{
int ret;
has_been_inited = inited;
return DialogBox(hinstance, TEXT("ConfigureSelectionDlg"), hwnd, (DLGPROC)config_selection_dlgproc);
ret = DialogBox(hinstance, TEXT("ConfigureSelectionDlg"), hwnd, (DLGPROC)config_selection_dlgproc);
has_been_inited = 1;
return ret;
}

View file

@ -458,7 +458,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
case IDOK:
if (hd_changed || cdrom_channel != new_cdrom_channel)
{
if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) == IDOK)
if (!has_been_inited || MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) == IDOK)
{
h = GetDlgItem(hdlg, IDC_EDIT_C_SPT);
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
@ -514,10 +514,13 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
hdc[3] = hd[3];
cdrom_channel = new_cdrom_channel;
saveconfig(NULL);
if (has_been_inited)
{
saveconfig(NULL);
resetpchard();
resetpchard();
}
}
}
case IDCANCEL: