Hooked up the new FPU type selection to the UI.
This commit is contained in:
14
src/config.c
14
src/config.c
@@ -528,9 +528,9 @@ load_machine(void)
|
|||||||
cpu = config_get_int(cat, "cpu", 0);
|
cpu = config_get_int(cat, "cpu", 0);
|
||||||
cpu_waitstates = config_get_int(cat, "cpu_waitstates", 0);
|
cpu_waitstates = config_get_int(cat, "cpu_waitstates", 0);
|
||||||
|
|
||||||
p = (char *)config_get_string(cat, "fpu", "none");
|
p = (char *)config_get_string(cat, "fpu_type", "none");
|
||||||
fpu_type = fpu_get_type(machine, cpu_manufacturer, cpu, p);
|
fpu_type = fpu_get_type(machine, cpu_manufacturer, cpu, p);
|
||||||
|
|
||||||
mem_size = config_get_int(cat, "mem_size", 4096);
|
mem_size = config_get_int(cat, "mem_size", 4096);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1510,6 +1510,11 @@ save_machine(void)
|
|||||||
else
|
else
|
||||||
config_set_int(cat, "cpu_waitstates", cpu_waitstates);
|
config_set_int(cat, "cpu_waitstates", cpu_waitstates);
|
||||||
|
|
||||||
|
if (fpu_type == 0)
|
||||||
|
config_delete_var(cat, "fpu_type");
|
||||||
|
else
|
||||||
|
config_set_string(cat, "fpu_type", fpu_get_internal_name(machine, cpu_manufacturer, cpu, fpu_type));
|
||||||
|
|
||||||
if (mem_size == 4096)
|
if (mem_size == 4096)
|
||||||
config_delete_var(cat, "mem_size");
|
config_delete_var(cat, "mem_size");
|
||||||
else
|
else
|
||||||
@@ -1517,11 +1522,6 @@ save_machine(void)
|
|||||||
|
|
||||||
config_set_int(cat, "cpu_use_dynarec", cpu_use_dynarec);
|
config_set_int(cat, "cpu_use_dynarec", cpu_use_dynarec);
|
||||||
|
|
||||||
if (enable_external_fpu == 0)
|
|
||||||
config_delete_var(cat, "cpu_enable_fpu");
|
|
||||||
else
|
|
||||||
config_set_int(cat, "cpu_enable_fpu", enable_external_fpu);
|
|
||||||
|
|
||||||
if (time_sync & TIME_SYNC_ENABLED)
|
if (time_sync & TIME_SYNC_ENABLED)
|
||||||
if (time_sync & TIME_SYNC_UTC)
|
if (time_sync & TIME_SYNC_UTC)
|
||||||
config_set_string(cat, "time_sync", "utc");
|
config_set_string(cat, "time_sync", "utc");
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ int is286,
|
|||||||
is_am486, is_pentium, is_k5, is_k6, is_p6;
|
is_am486, is_pentium, is_k5, is_k6, is_p6;
|
||||||
|
|
||||||
int hasfpu;
|
int hasfpu;
|
||||||
int fpu_type;
|
|
||||||
|
|
||||||
uint64_t tsc = 0;
|
uint64_t tsc = 0;
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
#ifndef EMU_CPU_H
|
#ifndef EMU_CPU_H
|
||||||
# define EMU_CPU_H
|
# define EMU_CPU_H
|
||||||
|
|
||||||
extern int fpu_type;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FPU_NONE,
|
FPU_NONE,
|
||||||
FPU_8087,
|
FPU_8087,
|
||||||
@@ -592,9 +590,9 @@ extern int sysexit(uint32_t fetchdat);
|
|||||||
extern int syscall(uint32_t fetchdat);
|
extern int syscall(uint32_t fetchdat);
|
||||||
extern int sysret(uint32_t fetchdat);
|
extern int sysret(uint32_t fetchdat);
|
||||||
|
|
||||||
int fpu_get_type(int machine, int cpu_manufacturer, int cpu, const char *internal_name);
|
extern int fpu_get_type(int machine, int cpu_manufacturer, int cpu, const char *internal_name);
|
||||||
const char *fpu_get_internal_name(int machine, int cpu_manufacturer, int cpu, int type);
|
extern const char *fpu_get_internal_name(int machine, int cpu_manufacturer, int cpu, int type);
|
||||||
const char *fpu_get_name_from_index(int machine, int cpu_manufacturer, int cpu, int c);
|
extern const char *fpu_get_name_from_index(int machine, int cpu_manufacturer, int cpu, int c);
|
||||||
int fpu_get_type_from_index(int machine, int cpu_manufacturer, int cpu, int c);
|
extern int fpu_get_type_from_index(int machine, int cpu_manufacturer, int cpu, int c);
|
||||||
|
|
||||||
#endif /*EMU_CPU_H*/
|
#endif /*EMU_CPU_H*/
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ static __inline uint16_t x87_compare(double a, double b)
|
|||||||
if (!memcmp(&ea, &ia, 8) && !memcmp(&eb, &ib, 8))
|
if (!memcmp(&ea, &ia, 8) && !memcmp(&eb, &ib, 8))
|
||||||
return C3;
|
return C3;
|
||||||
|
|
||||||
if (!is386 && !(cpu_state.npxc & 0x1000) &&
|
if ((fpu_type != FPU_287XL) && (fpu_type != FPU_387) && !(cpu_state.npxc & 0x1000) &&
|
||||||
((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY)))
|
((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY)))
|
||||||
eb = ea;
|
eb = ea;
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ static __inline uint16_t x87_compare(double a, double b)
|
|||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
double ea = a, eb = b;
|
double ea = a, eb = b;
|
||||||
|
|
||||||
if (!is386 && !(cpu_state.npxc & 0x1000) &&
|
if ((fpu_type != FPU_287XL) && (fpu_type != FPU_387) && !(cpu_state.npxc & 0x1000) &&
|
||||||
((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY)))
|
((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY)))
|
||||||
eb = ea;
|
eb = ea;
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ static int opFCOMPP(uint32_t fetchdat)
|
|||||||
cpu_state.npxs &= ~(C0|C2|C3);
|
cpu_state.npxs &= ~(C0|C2|C3);
|
||||||
p = (uint64_t *)&ST(0);
|
p = (uint64_t *)&ST(0);
|
||||||
q = (uint64_t *)&ST(1);
|
q = (uint64_t *)&ST(1);
|
||||||
if ((*p == ((uint64_t)1 << 63) && *q == 0) && is386)
|
if ((*p == ((uint64_t)1 << 63) && *q == 0) && ((fpu_type == FPU_287XL) || (fpu_type == FPU_387)))
|
||||||
cpu_state.npxs |= C0; /*Nasty hack to fix 80387 detection*/
|
cpu_state.npxs |= C0; /*Nasty hack to fix 80387 detection*/
|
||||||
else
|
else
|
||||||
cpu_state.npxs |= x87_compare(ST(0), ST(1));
|
cpu_state.npxs |= x87_compare(ST(0), ST(1));
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ extern uint32_t mem_size; /* (C) memory size */
|
|||||||
extern int cpu_manufacturer, /* (C) cpu manufacturer */
|
extern int cpu_manufacturer, /* (C) cpu manufacturer */
|
||||||
cpu, /* (C) cpu type */
|
cpu, /* (C) cpu type */
|
||||||
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
|
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
|
||||||
enable_external_fpu; /* (C) enable external FPU */
|
fpu_type; /* (C) fpu type */
|
||||||
extern int time_sync; /* (C) enable time sync */
|
extern int time_sync; /* (C) enable time sync */
|
||||||
extern int network_type; /* (C) net provider type */
|
extern int network_type; /* (C) net provider type */
|
||||||
extern int network_card; /* (C) net interface num */
|
extern int network_card; /* (C) net interface num */
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
#define IDC_CONFIGURE_MACHINE 1011
|
#define IDC_CONFIGURE_MACHINE 1011
|
||||||
#define IDC_COMBO_CPU_TYPE 1012
|
#define IDC_COMBO_CPU_TYPE 1012
|
||||||
#define IDC_COMBO_CPU 1013
|
#define IDC_COMBO_CPU 1013
|
||||||
#define IDC_CHECK_FPU 1014
|
#define IDC_COMBO_FPU 1014
|
||||||
#define IDC_COMBO_WS 1015
|
#define IDC_COMBO_WS 1015
|
||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
#define IDC_CHECK_DYNAREC 1016
|
#define IDC_CHECK_DYNAREC 1016
|
||||||
|
|||||||
2
src/pc.c
2
src/pc.c
@@ -135,7 +135,7 @@ uint32_t mem_size = 0; /* (C) memory size */
|
|||||||
int cpu_manufacturer = 0, /* (C) cpu manufacturer */
|
int cpu_manufacturer = 0, /* (C) cpu manufacturer */
|
||||||
cpu_use_dynarec = 0, /* (C) cpu uses/needs Dyna */
|
cpu_use_dynarec = 0, /* (C) cpu uses/needs Dyna */
|
||||||
cpu = 3, /* (C) cpu type */
|
cpu = 3, /* (C) cpu type */
|
||||||
enable_external_fpu = 0; /* (C) enable external FPU */
|
fpu_type = 0; /* (C) fpu type */
|
||||||
int time_sync = 0; /* (C) enable time sync */
|
int time_sync = 0; /* (C) enable time sync */
|
||||||
#ifdef USE_DISCORD
|
#ifdef USE_DISCORD
|
||||||
int enable_discord = 0; /* (C) enable Discord integration */
|
int enable_discord = 0; /* (C) enable Discord integration */
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ BEGIN
|
|||||||
#endif
|
#endif
|
||||||
END
|
END
|
||||||
|
|
||||||
DLG_CFG_MACHINE DIALOG DISCARDABLE 97, 0, 267, 199
|
DLG_CFG_MACHINE DIALOG DISCARDABLE 97, 0, 286, 199
|
||||||
STYLE DS_CONTROL | WS_CHILD
|
STYLE DS_CONTROL | WS_CHILD
|
||||||
FONT 9, "Segoe UI"
|
FONT 9, "Segoe UI"
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -361,25 +361,28 @@ BEGIN
|
|||||||
COMBOBOX IDC_COMBO_CPU,145,25,115,120,CBS_DROPDOWNLIST |
|
COMBOBOX IDC_COMBO_CPU,145,25,115,120,CBS_DROPDOWNLIST |
|
||||||
WS_VSCROLL | WS_TABSTOP
|
WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "CPU:",IDT_1704,124,26,18,10
|
LTEXT "CPU:",IDT_1704,124,26,18,10
|
||||||
COMBOBOX IDC_COMBO_WS,71,44,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
|
COMBOBOX IDC_COMBO_FPU,71,44,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
|
||||||
WS_TABSTOP
|
WS_TABSTOP
|
||||||
LTEXT "Wait states:",IDT_1703,7,45,60,10
|
LTEXT "FPU:",IDT_1707,7,45,59,10
|
||||||
EDITTEXT IDC_MEMTEXT,70,63,45,12,ES_AUTOHSCROLL | ES_NUMBER
|
COMBOBOX IDC_COMBO_WS,71,63,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
|
||||||
CONTROL "",IDC_MEMSPIN,"msctls_updown32",UDS_SETBUDDYINT |
|
CONTROL "",IDC_MEMSPIN,"msctls_updown32",UDS_SETBUDDYINT |
|
||||||
UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,63,
|
UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,82,
|
||||||
12,12
|
12,12
|
||||||
LTEXT "MB",IDT_1705,123,64,10,10
|
LTEXT "MB",IDT_1705,123,83,10,10
|
||||||
LTEXT "Memory:",IDT_1706,7,64,30,10
|
LTEXT "Memory:",IDT_1706,7,83,30,10
|
||||||
GROUPBOX "Time synchronization",IDC_TIME_SYNC,7,96,100,56
|
GROUPBOX "Time synchronization",IDC_TIME_SYNC,7,115,100,56
|
||||||
CONTROL "Disabled",IDC_RADIO_TS_DISABLED,"Button",
|
CONTROL "Disabled",IDC_RADIO_TS_DISABLED,"Button",
|
||||||
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,108,84,10
|
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,127,84,10
|
||||||
CONTROL "Enabled (local time)", IDC_RADIO_TS_LOCAL,"Button",
|
CONTROL "Enabled (local time)", IDC_RADIO_TS_LOCAL,"Button",
|
||||||
BS_AUTORADIOBUTTON | WS_TABSTOP,14,122,84,10
|
BS_AUTORADIOBUTTON | WS_TABSTOP,14,141,84,10
|
||||||
CONTROL "Enabled (UTC)", IDC_RADIO_TS_UTC,"Button",
|
CONTROL "Enabled (UTC)", IDC_RADIO_TS_UTC,"Button",
|
||||||
BS_AUTORADIOBUTTON | WS_TABSTOP,14,136,84,10
|
BS_AUTORADIOBUTTON | WS_TABSTOP,14,155,84,10
|
||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button",
|
CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,147,81,94,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,7,100,94,10
|
||||||
#endif
|
#endif
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ win_settings_init(void)
|
|||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
temp_dynarec = cpu_use_dynarec;
|
temp_dynarec = cpu_use_dynarec;
|
||||||
#endif
|
#endif
|
||||||
temp_fpu = enable_external_fpu;
|
temp_fpu = fpu_type;
|
||||||
temp_sync = time_sync;
|
temp_sync = time_sync;
|
||||||
|
|
||||||
/* Video category */
|
/* Video category */
|
||||||
@@ -318,7 +318,7 @@ win_settings_changed(void)
|
|||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
i = i || (temp_dynarec != cpu_use_dynarec);
|
i = i || (temp_dynarec != cpu_use_dynarec);
|
||||||
#endif
|
#endif
|
||||||
i = i || (temp_fpu != enable_external_fpu);
|
i = i || (temp_fpu != fpu_type);
|
||||||
i = i || (temp_sync != time_sync);
|
i = i || (temp_sync != time_sync);
|
||||||
|
|
||||||
/* Video category */
|
/* Video category */
|
||||||
@@ -422,7 +422,7 @@ win_settings_save(void)
|
|||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
cpu_use_dynarec = temp_dynarec;
|
cpu_use_dynarec = temp_dynarec;
|
||||||
#endif
|
#endif
|
||||||
enable_external_fpu = temp_fpu;
|
fpu_type = temp_fpu;
|
||||||
time_sync = temp_sync;
|
time_sync = temp_sync;
|
||||||
|
|
||||||
/* Video category */
|
/* Video category */
|
||||||
@@ -507,6 +507,40 @@ win_settings_save(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
win_settings_machine_recalc_fpu(HWND hdlg)
|
||||||
|
{
|
||||||
|
HWND h;
|
||||||
|
int c, type;
|
||||||
|
LPTSTR lptsTemp;
|
||||||
|
const char *stransi;
|
||||||
|
|
||||||
|
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||||
|
|
||||||
|
h = GetDlgItem(hdlg, IDC_COMBO_FPU);
|
||||||
|
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||||
|
c = 0;
|
||||||
|
while (1) {
|
||||||
|
stransi = (char *) fpu_get_name_from_index(temp_machine, temp_cpu_m, temp_cpu, c);
|
||||||
|
type = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, c);
|
||||||
|
if (!stransi)
|
||||||
|
break;
|
||||||
|
|
||||||
|
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||||
|
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||||
|
if (!c || (type == temp_fpu))
|
||||||
|
SendMessage(h, CB_SETCURSEL, c, 0);
|
||||||
|
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c > 1)
|
||||||
|
EnableWindow(h, TRUE);
|
||||||
|
else
|
||||||
|
EnableWindow(h, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
win_settings_machine_recalc_cpu(HWND hdlg)
|
win_settings_machine_recalc_cpu(HWND hdlg)
|
||||||
{
|
{
|
||||||
@@ -539,15 +573,7 @@ win_settings_machine_recalc_cpu(HWND hdlg)
|
|||||||
EnableWindow(h, TRUE);
|
EnableWindow(h, TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
h = GetDlgItem(hdlg, IDC_CHECK_FPU);
|
win_settings_machine_recalc_fpu(hdlg);
|
||||||
cpu_type = machines[temp_machine].cpu[temp_cpu_m].cpus[temp_cpu].cpu_type;
|
|
||||||
if (cpu_type < CPU_i486DX)
|
|
||||||
EnableWindow(h, TRUE);
|
|
||||||
else {
|
|
||||||
temp_fpu = 1;
|
|
||||||
EnableWindow(h, FALSE);
|
|
||||||
}
|
|
||||||
SendMessage(h, BM_SETCHECK, temp_fpu, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -738,6 +764,12 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
win_settings_machine_recalc_cpu(hdlg);
|
win_settings_machine_recalc_cpu(hdlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_COMBO_FPU:
|
||||||
|
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||||
|
h = GetDlgItem(hdlg, IDC_COMBO_FPU);
|
||||||
|
temp_fpu = fpu_get_type_from_index(temp_machine, temp_cpu_m, temp_cpu, SendMessage(h, CB_GETCURSEL, 0, 0));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDC_CONFIGURE_MACHINE:
|
case IDC_CONFIGURE_MACHINE:
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
|
h = GetDlgItem(hdlg, IDC_COMBO_MACHINE);
|
||||||
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
temp_machine = listtomachine[SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||||
@@ -769,9 +801,6 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if(SendMessage(h, BM_GETCHECK, 0, 0))
|
if(SendMessage(h, BM_GETCHECK, 0, 0))
|
||||||
temp_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC;
|
temp_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC;
|
||||||
|
|
||||||
h=GetDlgItem(hdlg, IDC_CHECK_FPU);
|
|
||||||
temp_fpu = SendMessage(h, BM_GETCHECK, 0, 0);
|
|
||||||
|
|
||||||
h = GetDlgItem(hdlg, IDC_COMBO_WS);
|
h = GetDlgItem(hdlg, IDC_COMBO_WS);
|
||||||
temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0);
|
temp_wait_states = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user