The Settings dialogs now categorizes the machines to declutter the list.

This commit is contained in:
OBattler
2020-06-16 01:58:07 +02:00
parent c2dad63613
commit cfd10447e0
5 changed files with 319 additions and 202 deletions

View File

@@ -347,42 +347,45 @@ BEGIN
#endif
END
DLG_CFG_MACHINE DIALOG DISCARDABLE 97, 0, 286, 199
DLG_CFG_MACHINE DIALOG DISCARDABLE 97, 0, 305, 199
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
COMBOBOX IDC_COMBO_MACHINE,71,7,138,120,CBS_DROPDOWNLIST |
COMBOBOX IDC_COMBO_MACHINE_TYPE,71,7,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Machine:",IDT_1701,7,8,60,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MACHINE,214,7,46,12
COMBOBOX IDC_COMBO_CPU_TYPE,71,25,45,120,CBS_DROPDOWNLIST |
LTEXT "Machine type:",IDT_1708,7,8,60,10
COMBOBOX IDC_COMBO_MACHINE,71,26,138,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "CPU type:",IDT_1702,7,26,59,10
COMBOBOX IDC_COMBO_CPU,145,25,115,120,CBS_DROPDOWNLIST |
LTEXT "Machine:",IDT_1701,7,27,60,10
PUSHBUTTON "Configure",IDC_CONFIGURE_MACHINE,214,26,46,12
COMBOBOX IDC_COMBO_CPU_TYPE,71,44,45,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "CPU:",IDT_1704,124,26,18,10
COMBOBOX IDC_COMBO_FPU,71,44,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
LTEXT "CPU type:",IDT_1702,7,45,59,10
COMBOBOX IDC_COMBO_CPU,145,44,115,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "CPU:",IDT_1704,124,45,18,10
COMBOBOX IDC_COMBO_FPU,71,63,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "FPU:",IDT_1707,7,45,59,10
COMBOBOX IDC_COMBO_WS,71,63,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
LTEXT "FPU:",IDT_1707,7,63,59,10
COMBOBOX IDC_COMBO_WS,71,82,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Wait states:",IDT_1703,7,64,60,10
EDITTEXT IDC_MEMTEXT,70,82,45,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Wait states:",IDT_1703,7,83,60,10
EDITTEXT IDC_MEMTEXT,70,101,45,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MEMSPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,82,
UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,101,
12,12
LTEXT "MB",IDT_1705,123,83,10,10
LTEXT "Memory:",IDT_1706,7,83,30,10
GROUPBOX "Time synchronization",IDC_TIME_SYNC,7,115,100,56
LTEXT "MB",IDT_1705,123,102,10,10
LTEXT "Memory:",IDT_1706,7,102,30,10
GROUPBOX "Time synchronization",IDC_TIME_SYNC,7,134,100,56
CONTROL "Disabled",IDC_RADIO_TS_DISABLED,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,127,84,10
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,146,84,10
CONTROL "Enabled (local time)", IDC_RADIO_TS_LOCAL,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,14,141,84,10
BS_AUTORADIOBUTTON | WS_TABSTOP,14,160,84,10
CONTROL "Enabled (UTC)", IDC_RADIO_TS_UTC,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,14,155,84,10
BS_AUTORADIOBUTTON | WS_TABSTOP,14,174,84,10
#ifdef USE_DYNAREC
CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,100,94,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,119,94,10
#endif
END

View File

@@ -70,7 +70,7 @@
static int first_cat = 0;
/* Machine category */
static int temp_machine, temp_cpu_m, temp_cpu, temp_wait_states, temp_fpu, temp_sync;
static int temp_machine_type, temp_machine, temp_cpu_m, temp_cpu, temp_wait_states, temp_fpu, temp_sync;
static uint32_t temp_mem_size;
#ifdef USE_DYNAREC
static int temp_dynarec;
@@ -120,6 +120,7 @@ static HWND hwndParentDialog, hwndChildDialog;
static uint32_t displayed_category = 0;
extern int is486;
static int listtomachinetype[256], machinetypetolist[256];
static int listtomachine[256], machinetolist[256];
static int settings_device_to_list[2][20], settings_list_to_device[2][20];
static int settings_midi_to_list[20], settings_list_to_midi[20];
@@ -197,6 +198,7 @@ win_settings_init(void)
int i = 0;
/* Machine category */
temp_machine_type = machines[machine].type;
temp_machine = machine;
temp_cpu_m = cpu_manufacturer;
temp_wait_states = cpu_waitstates;
@@ -670,7 +672,8 @@ static BOOL CALLBACK
win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h, h2;
int c, d;
int c, d, e, f;
int old_machine_type;
LPTSTR lptsTemp;
char *stransi;
@@ -678,10 +681,35 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE_TYPE);
f = 0;
memset(machinetypetolist, 0x00, sizeof(machinetypetolist));
memset(listtomachinetype, 0x00, sizeof(listtomachinetype));
for (c = 1; c < MACHINE_TYPE_MAX; c++) {
d = e = 0;
while (machine_get_internal_name_ex(d) != NULL) {
if (machine_available(d) && (machines[d].type == c))
e++;
d++;
}
if (e > 0) {
stransi = (char *)machine_types[c].name;
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
machinetypetolist[c] = f;
listtomachinetype[f] = c;
f++;
}
}
SendMessage(h, CB_SETCURSEL, machinetypetolist[temp_machine_type], 0);
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
c = d = 0;
memset(machinetolist, 0x00, sizeof(machinetolist));
memset(listtomachine, 0x00, sizeof(listtomachine));
while (machine_get_internal_name_ex(c) != NULL) {
if (machine_available(c)) {
if (machine_available(c) && (machines[c].type == temp_machine_type)) {
stransi = (char *)machines[c].name;
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
@@ -739,6 +767,40 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_MACHINE_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE_TYPE);
old_machine_type = temp_machine_type;
temp_machine_type = listtomachinetype[SendMessage(h,CB_GETCURSEL,0,0)];
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = d = 0;
memset(machinetolist, 0x00, sizeof(machinetolist));
memset(listtomachine, 0x00, sizeof(listtomachine));
while (machine_get_internal_name_ex(c) != NULL) {
if (machine_available(c) && (machines[c].type == temp_machine_type)) {
stransi = (char *)machines[c].name;
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
machinetolist[c] = d;
listtomachine[d] = c;
d++;
}
c++;
}
if (old_machine_type == temp_machine_type)
SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0);
else {
SendMessage(h, CB_SETCURSEL, 0, 0);
temp_machine = listtomachine[0];
win_settings_machine_recalc_machine(hdlg);
}
}
break;
case IDC_COMBO_MACHINE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);