From 5457531753e1d89d1071e7abd14cfb9e6631485d Mon Sep 17 00:00:00 2001 From: SarahW Date: Tue, 13 Dec 2016 20:44:43 +0000 Subject: [PATCH] Only enable waitstate selection on CPUs where it has any practical effect (286/386). --- src/cpu.c | 2 +- src/win-config.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/cpu.c b/src/cpu.c index d659849..aa6c289 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1553,7 +1553,7 @@ void cpu_update_waitstates() /* Disable prefetch emulation */ cpu_prefetch_cycles = 0; } - else if (cpu_waitstates) + else if (cpu_waitstates && (cpu_s->cpu_type >= CPU_286 && cpu_s->cpu_type <= CPU_386DX)) { /* Waitstates override */ cpu_prefetch_cycles = cpu_waitstates+1; diff --git a/src/win-config.c b/src/win-config.c index 7aa4ac3..90d610c 100644 --- a/src/win-config.c +++ b/src/win-config.c @@ -34,6 +34,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR int cpu_flags; int temp_fda_type, temp_fdb_type; int temp_joystick_type; + int cpu_type; UDACCEL accel; // pclog("Dialog msg %i %08X\n",message,message); @@ -251,6 +252,11 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"6 W/S"); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"7 W/S"); SendMessage(h, CB_SETCURSEL, cpu_waitstates, 0); + cpu_type = models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].cpu_type; + if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); return TRUE; case WM_COMMAND: @@ -463,6 +469,13 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR accel.nSec = 0; accel.nInc = models[temp_model].ram_granularity; SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel); + + h = GetDlgItem(hdlg, IDC_COMBOWS); + cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; + if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); } break; case IDC_COMBOCPUM: @@ -496,6 +509,14 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR else EnableWindow(h, TRUE); SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && temp_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); + + h = GetDlgItem(hdlg, IDC_COMBOWS); + cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; + if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); + } break; case IDC_COMBO3: @@ -518,6 +539,13 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR else EnableWindow(h, TRUE); SendMessage(h, BM_SETCHECK, ((cpu_flags & CPU_SUPPORTS_DYNAREC) && temp_dynarec) || (cpu_flags & CPU_REQUIRES_DYNAREC), 0); + + h = GetDlgItem(hdlg, IDC_COMBOWS); + cpu_type = models[temp_model].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type; + if (cpu_type >= CPU_286 && cpu_type <= CPU_386DX) + EnableWindow(h, TRUE); + else + EnableWindow(h, FALSE); } break;