diff --git a/src/pc.rc b/src/pc.rc index d581364..d2d5d11 100644 --- a/src/pc.rc +++ b/src/pc.rc @@ -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 diff --git a/src/resources.h b/src/resources.h index bc4184b..a4acd50 100644 --- a/src/resources.h +++ b/src/resources.h @@ -136,3 +136,5 @@ #define IDC_NEW 1200 #define IDC_LIST 1201 +#define IDC_CONFIG 1202 +#define IDC_HDCONF 1203 diff --git a/src/win-config_sel.c b/src/win-config_sel.c index 5b4711e..9e3ef03 100644 --- a/src/win-config_sel.c +++ b/src/win-config_sel.c @@ -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; } diff --git a/src/win-hdconf.c b/src/win-hdconf.c index edcc586..184b370 100644 --- a/src/win-hdconf.c +++ b/src/win-hdconf.c @@ -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: