Added support for IBM AT Fixed Disk Adapter (MFM).

Added ability to configure hard drive controller.
Changed XTIDE to be generic device.
This commit is contained in:
SarahW 2017-03-14 21:15:28 +00:00
commit 9ddd1fc679
20 changed files with 1206 additions and 133 deletions

View file

@ -10,6 +10,7 @@
#include "device.h"
#include "fdd.h"
#include "gameport.h"
#include "hdd.h"
#include "model.h"
#include "mouse.h"
#include "nvr.h"
@ -23,6 +24,7 @@ extern int is486;
static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX];
static int settings_sound_to_list[20], settings_list_to_sound[20];
static int settings_mouse_to_list[20], settings_list_to_mouse[20];
static char *hdd_names[16];
static int mouse_valid(int type, int model)
{
@ -35,6 +37,71 @@ static int mouse_valid(int type, int model)
return 1;
}
static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd)
{
HWND h;
h = GetDlgItem(hdlg, IDC_COMBOHDD);
if (models[model].flags & MODEL_HAS_IDE)
{
SendMessage(h, CB_RESETCONTENT, 0, 0);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Internal IDE");
EnableWindow(h, FALSE);
SendMessage(h, CB_SETCURSEL, 0, 0);
}
else
{
char *s;
int valid = 0;
char old_name[16];
int c, d;
if (use_selected_hdd)
{
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (c != -1 && hdd_names[c])
strncpy(old_name, hdd_names[c], sizeof(old_name)-1);
else
strcpy(old_name, "none");
}
else
strncpy(old_name, hdd_controller_name, sizeof(old_name)-1);
SendMessage(h, CB_RESETCONTENT, 0, 0);
c = d = 0;
while (1)
{
s = hdd_controller_get_name(c);
if (s[0] == 0)
break;
if ((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT))
{
c++;
continue;
}
if (!hdd_controller_available(c))
{
c++;
continue;
}
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
hdd_names[d] = hdd_controller_get_internal_name(c);
if (!strcmp(old_name, hdd_names[d]))
{
SendMessage(h, CB_SETCURSEL, d, 0);
valid = 1;
}
c++;
d++;
}
if (!valid)
SendMessage(h, CB_SETCURSEL, 0, 0);
}
}
static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
char temp_str[256];
@ -290,6 +357,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
c++;
}
SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[mouse_type], 0);
recalc_hdd_list(hdlg, romstomodel[romset], 0);
return TRUE;
case WM_COMMAND:
@ -350,13 +420,17 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
temp_joystick_type = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBOMOUSE);
temp_mouse_type = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBOHDD);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (temp_model != model || gfx != gfxcard || mem != mem_size ||
fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS ||
temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current ||
temp_voodoo != voodoo_enabled || temp_dynarec != cpu_use_dynarec ||
temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) ||
temp_mouse_type != mouse_type)
temp_mouse_type != mouse_type ||
strncmp(hdd_names[c], hdd_controller_name, sizeof(hdd_controller_name)-1))
{
if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK)
{
@ -377,6 +451,12 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
fdd_set_type(0, temp_fda_type);
fdd_set_type(1, temp_fdb_type);
if (hdd_names[c])
strncpy(hdd_controller_name, hdd_names[c], sizeof(hdd_controller_name)-1);
else
strcpy(hdd_controller_name, "none");
mem_resize();
loadbios();
@ -542,6 +622,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse_type], 0);
else
SendMessage(h, CB_SETCURSEL, 0, 0);
recalc_hdd_list(hdlg, temp_model, 1);
}
break;
case IDC_COMBOCPUM: