Merged all the latest and missed 86box commits.
Finally fixed the configuration UI of the FDC's.
This commit is contained in:
24
src/config.c
24
src/config.c
@@ -785,21 +785,10 @@ load_other_peripherals(void)
|
||||
scsi_card_current = 0;
|
||||
|
||||
p = config_get_string(cat, "fdc", NULL);
|
||||
if (p == NULL) {
|
||||
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
||||
strcpy(p, "internal");
|
||||
free_p = 1;
|
||||
}
|
||||
|
||||
if (!strcmp(p, "internal"))
|
||||
if (p != NULL)
|
||||
fdc_type = fdc_card_get_from_internal_name(p);
|
||||
else
|
||||
fdc_type = FDC_INTERNAL;
|
||||
else
|
||||
fdc_type = fdc_ext_get_from_internal_name(p);
|
||||
|
||||
if (free_p) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
p = config_get_string(cat, "hdc", NULL);
|
||||
if (p == NULL) {
|
||||
@@ -1762,8 +1751,11 @@ save_other_peripherals(void)
|
||||
config_set_string(cat, "scsicard",
|
||||
scsi_card_get_internal_name(scsi_card_current));
|
||||
|
||||
config_set_string(cat, "fdc",
|
||||
fdc_ext_get_internal_name(fdc_type));
|
||||
if (fdc_type == FDC_INTERNAL)
|
||||
config_delete_var(cat, "fdc");
|
||||
else
|
||||
config_set_string(cat, "fdc",
|
||||
fdc_card_get_internal_name(fdc_type));
|
||||
|
||||
config_set_string(cat, "hdc",
|
||||
hdc_get_internal_name(hdc_current));
|
||||
|
116
src/floppy/fdc.c
116
src/floppy/fdc.c
@@ -91,7 +91,7 @@ int floppymodified[4];
|
||||
int floppyrate[4];
|
||||
|
||||
|
||||
int fdc_type;
|
||||
int fdc_type = 0;
|
||||
|
||||
#ifdef ENABLE_FDC_LOG
|
||||
int fdc_do_log = ENABLE_FDC_LOG;
|
||||
@@ -114,73 +114,67 @@ fdc_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef const struct {
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
const device_t *device;
|
||||
} fdc_ext_t;
|
||||
} fdc_cards_t;
|
||||
|
||||
|
||||
static const device_t fdc_internal_device = {
|
||||
"Internal Floppy Drive Controller",
|
||||
0, 0,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
/* All emulated machines have at least one integrated FDC controller */
|
||||
static fdc_cards_t fdc_cards[] = {
|
||||
{ "Internal controller", "internal", NULL, },
|
||||
{ "DTK PII-151B", "dtk_pii151b", &fdc_pii151b_device, },
|
||||
{ "DTK PII-158B", "dtk_pii158b", &fdc_pii158b_device, },
|
||||
{ "", "", NULL, },
|
||||
};
|
||||
|
||||
|
||||
static fdc_ext_t fdc_devices[] = {
|
||||
{ "Internal controller", "internal", &fdc_internal_device },
|
||||
{ "DTK PII-151B", "dtk_pii151b", &fdc_pii151b_device },
|
||||
{ "DTK PII-158B", "dtk_pii158b", &fdc_pii158b_device },
|
||||
{ "", NULL, NULL }
|
||||
};
|
||||
|
||||
/* Reset the FDC, whichever one that is. */
|
||||
void
|
||||
fdc_ext_reset(void)
|
||||
int
|
||||
fdc_card_available(int card)
|
||||
{
|
||||
/* If we have a valid controller, add its device. */
|
||||
if (fdc_type > 0)
|
||||
device_add(fdc_devices[fdc_type].device);
|
||||
}
|
||||
if (fdc_cards[card].device)
|
||||
return(device_available(fdc_cards[card].device));
|
||||
|
||||
char *
|
||||
fdc_ext_get_name(int fdc_ext)
|
||||
{
|
||||
return((char *)fdc_devices[fdc_ext].name);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
fdc_ext_get_internal_name(int fdc_ext)
|
||||
fdc_card_getname(int card)
|
||||
{
|
||||
return((char *)fdc_devices[fdc_ext].internal_name);
|
||||
return((char *) fdc_cards[card].name);
|
||||
}
|
||||
|
||||
int
|
||||
fdc_ext_get_id(char *s)
|
||||
|
||||
const device_t *
|
||||
fdc_card_getdevice(int card)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (strlen((char *) fdc_devices[c].name))
|
||||
{
|
||||
if (!strcmp((char *) fdc_devices[c].name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return(fdc_cards[card].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fdc_ext_get_from_internal_name(char *s)
|
||||
fdc_card_has_config(int card)
|
||||
{
|
||||
if (! fdc_cards[card].device) return(0);
|
||||
|
||||
return(fdc_cards[card].device->config ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
fdc_card_get_internal_name(int card)
|
||||
{
|
||||
return((char *) fdc_cards[card].internal_name);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fdc_card_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (fdc_devices[c].internal_name != NULL) {
|
||||
if (! strcmp((char *)fdc_devices[c].internal_name, s))
|
||||
while (strlen((char *) fdc_cards[c].internal_name)) {
|
||||
if (!strcmp((char *) fdc_cards[c].internal_name, s))
|
||||
return(c);
|
||||
c++;
|
||||
}
|
||||
@@ -188,33 +182,17 @@ fdc_ext_get_from_internal_name(char *s)
|
||||
return(0);
|
||||
}
|
||||
|
||||
const device_t *
|
||||
fdc_ext_get_device(int fdc_ext)
|
||||
|
||||
void
|
||||
fdc_card_init(void)
|
||||
{
|
||||
return(fdc_devices[fdc_ext].device);
|
||||
if (!fdc_cards[fdc_type].device)
|
||||
return;
|
||||
|
||||
device_add(fdc_cards[fdc_type].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fdc_ext_has_config(int fdc_ext)
|
||||
{
|
||||
const device_t *dev = fdc_ext_get_device(fdc_ext);
|
||||
|
||||
if (dev == NULL) return(0);
|
||||
|
||||
if (dev->config == NULL) return(0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
fdc_ext_available(int fdc_ext)
|
||||
{
|
||||
return(device_available(fdc_devices[fdc_ext].device));
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t
|
||||
fdc_get_current_drive(void)
|
||||
{
|
||||
|
@@ -30,14 +30,13 @@ extern int fdc_type;
|
||||
extern const device_t fdc_pii151b_device;
|
||||
extern const device_t fdc_pii158b_device;
|
||||
|
||||
extern void fdc_ext_reset(void);
|
||||
extern void fdc_card_init(void);
|
||||
|
||||
extern char *fdc_ext_get_name(int fdc_ext);
|
||||
extern char *fdc_ext_get_internal_name(int fdc_ext);
|
||||
extern int fdc_ext_get_id(char *s);
|
||||
extern int fdc_ext_get_from_internal_name(char *s);
|
||||
extern const device_t *fdc_ext_get_device(int fdc_ext);
|
||||
extern int fdc_ext_has_config(int fdc_ext);
|
||||
extern int fdc_ext_available(int fdc_ext);
|
||||
extern char *fdc_card_getname(int card);
|
||||
extern char *fdc_card_get_internal_name(int card);
|
||||
extern int fdc_card_get_from_internal_name(char *s);
|
||||
extern const device_t *fdc_card_getdevice(int card);
|
||||
extern int fdc_card_has_config(int card);
|
||||
extern int fdc_card_available(int card);
|
||||
|
||||
#endif /*EMU_FDC_H*/
|
||||
|
@@ -91,6 +91,7 @@
|
||||
#define IDS_2115 2115 // "MO %i (%03i): %ls"
|
||||
#define IDS_2116 2116 // "MO images (*.IM?)\0*.IM..."
|
||||
#define IDS_2117 2117 // "Welcome to 86Box!"
|
||||
#define IDS_2118 2118 // "Internal controller"
|
||||
|
||||
#define IDS_4096 4096 // "Hard disk (%s)"
|
||||
#define IDS_4097 4097 // "%01i:%01i"
|
||||
@@ -169,7 +170,7 @@
|
||||
|
||||
#define IDS_LANG_ENUS IDS_7168
|
||||
|
||||
#define STR_NUM_2048 70
|
||||
#define STR_NUM_2048 71
|
||||
#define STR_NUM_3072 11
|
||||
#define STR_NUM_4096 18
|
||||
#define STR_NUM_4352 7
|
||||
|
@@ -181,8 +181,8 @@
|
||||
#define IDC_CHECK_POSTCARD 1130
|
||||
#define IDC_COMBO_ISARTC 1131
|
||||
#define IDC_CONFIGURE_ISARTC 1132
|
||||
#define IDC_COMBO_FDC_EXT 1133
|
||||
#define IDC_CONFIGURE_FDC_EXT 1134
|
||||
#define IDC_COMBO_FDC 1133
|
||||
#define IDC_CONFIGURE_FDC 1134
|
||||
#define IDC_GROUP_ISAMEM 1140
|
||||
#define IDC_COMBO_ISAMEM_1 1141
|
||||
#define IDC_COMBO_ISAMEM_2 1142
|
||||
|
@@ -267,6 +267,9 @@ machine_xt_hed919_init(const machine_t *model)
|
||||
|
||||
machine_xt_clone_init(model);
|
||||
|
||||
if (mem_size > 640)
|
||||
mem_remap_top(mem_size - 640);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -88,7 +88,7 @@ const machine_t machines[] = {
|
||||
/* 8088 Machines */
|
||||
{ "[8088] IBM PC (1981)", "ibmpc", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 16, 64, 16, 0, machine_pc_init, NULL },
|
||||
{ "[8088] IBM PC (1982)", "ibmpc82", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 256, 256, 256, 0, machine_pc82_init, NULL },
|
||||
{ "[8088] IBM PCjr", "ibmpcjr", MACHINE_TYPE_8088, {{"Intel", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_pcjr_init, pcjr_get_device },
|
||||
{ "[8088] IBM PCjr", "ibmpcjr", MACHINE_TYPE_8088, {{"Intel", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VIDEO | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_pcjr_init, pcjr_get_device },
|
||||
{ "[8088] IBM XT (1982)", "ibmxt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 256, 64, 0, machine_xt_init, NULL },
|
||||
{ "[8088] IBM XT (1986)", "ibmxt86", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 256, 640, 64, 0, machine_xt86_init, NULL },
|
||||
{ "[8088] AMI XT clone", "amixt", MACHINE_TYPE_8088, {{"Intel", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA, 64, 640, 64, 0, machine_xt_amixt_init, NULL },
|
||||
@@ -176,12 +176,11 @@ const machine_t machines[] = {
|
||||
{ "[MCA] IBM PS/2 model 55SX", "ibmps2_m55sx", MACHINE_TYPE_386SX, {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"IBM",cpus_IBM486SLC},{"", NULL}}, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL },
|
||||
|
||||
/* 386DX machines */
|
||||
{ "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 16384, 128, 127, machine_at_acc386_init, NULL },
|
||||
{ "[SiS Rabbit] ASUS 386DX ISA", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 16384, 128, 127, machine_at_asus386_init, NULL },
|
||||
{ "[ISA] Compaq Deskpro 386", "deskpro386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX_Compaq}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 14, 1, 127, machine_at_deskpro386_init, NULL },
|
||||
{ "[ACC 2168] AMI 386DX clone", "acc386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 16384, 128, 127, machine_at_acc386_init, NULL },
|
||||
{ "[SiS Rabbit] ASUS ISA-386C", "asus386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 16384, 128, 127, machine_at_asus386_init, NULL },
|
||||
{ "[ISA] Compaq Portable III (386)", "portableiii386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC | MACHINE_VIDEO, 1, 14, 1, 127, machine_at_portableiii386_init, at_cpqiii_get_device },
|
||||
{ "[ISA] Micronics 386 clone", "micronics386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512, 8192, 128, 127, machine_at_micronics386_init, NULL },
|
||||
{ "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL },
|
||||
{ "[C&T 386] ECS 386/32", "ecs386", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_AT, 1, 16, 1, 127, machine_at_ecs386_init, NULL },
|
||||
|
||||
/* 386DX machines which utilize the VLB bus */
|
||||
{ "[OPTi 495] Award 386DX clone", "award386dx", MACHINE_TYPE_386DX, {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 32, 1, 127, machine_at_opti495_init, NULL },
|
||||
|
4
src/pc.c
4
src/pc.c
@@ -749,6 +749,8 @@ pc_reset_hard_init(void)
|
||||
/* Reset any ISA RTC cards. */
|
||||
isartc_reset();
|
||||
|
||||
fdc_card_init();
|
||||
|
||||
fdd_reset();
|
||||
|
||||
/*
|
||||
@@ -770,8 +772,6 @@ pc_reset_hard_init(void)
|
||||
*/
|
||||
mouse_reset();
|
||||
|
||||
fdc_ext_reset();
|
||||
|
||||
/* Reset the Hard Disk Controller module. */
|
||||
hdc_reset();
|
||||
/* Reset and reconfigure the SCSI layer. */
|
||||
|
31
src/pic.c
31
src/pic.c
@@ -240,11 +240,37 @@ pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
pic.ocw3 = val;
|
||||
if (val & 2)
|
||||
pic.read=(val & 1);
|
||||
pic.read |= (val & 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pic_highest_req(PIC* target_pic, int pic2)
|
||||
{
|
||||
uint8_t pending = target_pic->pend & ~target_pic->mask;
|
||||
int i, highest = 0;
|
||||
int min = 0, max = 8;
|
||||
|
||||
if (AT && pic2) {
|
||||
min = 8;
|
||||
max = 16;
|
||||
}
|
||||
|
||||
for (i = min; i < max; i++) {
|
||||
if ((!AT || (i != 2)) && (pending & (1 << (i & 7)))) {
|
||||
highest = (i & 7) | 0x80;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
target_pic->read &= ~4;
|
||||
|
||||
return highest;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
pic_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -260,6 +286,8 @@ pic_read(uint16_t addr, void *priv)
|
||||
ret = ((pic.vector & 0xf8) >> 3) << 0;
|
||||
else if (addr & 1)
|
||||
ret = pic.mask;
|
||||
else if (pic.read & 5)
|
||||
ret = pic_highest_req(&pic, 0);
|
||||
else if (pic.read) {
|
||||
if (AT)
|
||||
ret = pic.ins | (pic2.ins ? 4 : 0);
|
||||
@@ -394,6 +422,7 @@ pic2_write(uint16_t addr, uint8_t val, void *priv)
|
||||
pic2.ocw3 = val;
|
||||
if (val & 2)
|
||||
pic2.read=(val & 1);
|
||||
pic2.read |= (val & 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,6 +443,8 @@ pic2_read(uint16_t addr, void *priv)
|
||||
ret = ((pic2.vector & 0xf8) >> 3) << 0;
|
||||
else if (addr & 1)
|
||||
ret = pic2.mask;
|
||||
else if (pic2.read & 5)
|
||||
ret = pic_highest_req(&pic2, 1);
|
||||
else if (pic2.read)
|
||||
ret = pic2.ins;
|
||||
else
|
||||
|
@@ -3392,7 +3392,7 @@ static const device_config_t gd5434_config[] =
|
||||
const device_t gd5401_isa_device =
|
||||
{
|
||||
"Cirrus Logic GD-5401 (ACUMOS AVGA1)",
|
||||
DEVICE_AT | DEVICE_ISA,
|
||||
DEVICE_ISA,
|
||||
CIRRUS_ID_CLGD5401,
|
||||
gd54xx_init, gd54xx_close,
|
||||
NULL,
|
||||
@@ -3405,7 +3405,7 @@ const device_t gd5401_isa_device =
|
||||
const device_t gd5402_isa_device =
|
||||
{
|
||||
"Cirrus Logic GD-5402 (ACUMOS AVGA2)",
|
||||
DEVICE_AT | DEVICE_ISA,
|
||||
DEVICE_ISA,
|
||||
CIRRUS_ID_CLGD5402,
|
||||
gd54xx_init, gd54xx_close,
|
||||
NULL,
|
||||
|
@@ -554,9 +554,9 @@ BEGIN
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,171,38,12
|
||||
|
||||
LTEXT "FDC Controller:",IDT_1768,7,190,48,10
|
||||
COMBOBOX IDC_COMBO_FDC_EXT,64,189,155,120,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_COMBO_FDC,64,189,155,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_FDC_EXT,217,189,38,12
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_FDC,217,189,38,12
|
||||
END
|
||||
|
||||
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154
|
||||
@@ -968,6 +968,7 @@ BEGIN
|
||||
IDS_2115 "MO %i (%03i): %ls"
|
||||
IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0"
|
||||
IDS_2117 "Welcome to 86Box!"
|
||||
IDS_2118 "Internal controller"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
|
@@ -97,7 +97,7 @@ static int temp_lpt_devices[3];
|
||||
static int temp_serial[2], temp_lpt[3];
|
||||
|
||||
/* Other peripherals category */
|
||||
static int temp_fdc_ext, temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
||||
static int temp_fdc_card, temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
||||
static int temp_bugger;
|
||||
static int temp_postcard;
|
||||
static int temp_isartc;
|
||||
@@ -125,6 +125,7 @@ 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_fdc_to_list[2][20], settings_list_to_fdc[2][20];
|
||||
static int settings_midi_to_list[20], settings_list_to_midi[20];
|
||||
static int settings_midi_in_to_list[20], settings_list_to_midi_in[20];
|
||||
|
||||
@@ -249,7 +250,7 @@ win_settings_init(void)
|
||||
|
||||
/* Other peripherals category */
|
||||
temp_scsi_card = scsi_card_current;
|
||||
temp_fdc_ext = fdc_type;
|
||||
temp_fdc_card = fdc_type;
|
||||
temp_hdc = hdc_current;
|
||||
temp_ide_ter = ide_ter_enabled;
|
||||
temp_ide_qua = ide_qua_enabled;
|
||||
@@ -359,7 +360,7 @@ win_settings_changed(void)
|
||||
|
||||
/* Peripherals category */
|
||||
i = i || (scsi_card_current != temp_scsi_card);
|
||||
i = i || (fdc_type != temp_fdc_ext);
|
||||
i = i || (fdc_type != temp_fdc_card);
|
||||
i = i || (hdc_current != temp_hdc);
|
||||
i = i || (temp_ide_ter != ide_ter_enabled);
|
||||
i = i || (temp_ide_qua != ide_qua_enabled);
|
||||
@@ -466,7 +467,7 @@ win_settings_save(void)
|
||||
/* Peripherals category */
|
||||
scsi_card_current = temp_scsi_card;
|
||||
hdc_current = temp_hdc;
|
||||
fdc_type = temp_fdc_ext;
|
||||
fdc_type = temp_fdc_card;
|
||||
ide_ter_enabled = temp_ide_ter;
|
||||
ide_qua_enabled = temp_ide_qua;
|
||||
bugger_enabled = temp_bugger;
|
||||
@@ -1589,42 +1590,6 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
recalc_fdc_list(HWND hdlg)
|
||||
{
|
||||
HWND h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
int c = 0, d = 0;
|
||||
int found_card = 0;
|
||||
WCHAR szText[512];
|
||||
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
|
||||
while (1) {
|
||||
char *s = fdc_ext_get_name(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
|
||||
if (fdc_ext_available(c) &&
|
||||
device_is_valid(fdc_ext_get_device(c), machines[temp_machine].flags)) {
|
||||
mbstowcs(szText, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
|
||||
if (c == temp_fdc_ext) {
|
||||
SendMessage(h, CB_SETCURSEL, d, 0);
|
||||
found_card = 1;
|
||||
}
|
||||
|
||||
d++;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
if (!found_card)
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
recalc_hdc_list(HWND hdlg)
|
||||
{
|
||||
@@ -1681,6 +1646,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
char *stransi;
|
||||
const device_t *scsi_dev;
|
||||
const device_t *dev;
|
||||
const device_t *fdc_dev;
|
||||
char *s;
|
||||
|
||||
switch (message) {
|
||||
@@ -1688,15 +1654,6 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
/*FD (Ext) controller config*/
|
||||
recalc_fdc_list(hdlg);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC_EXT);
|
||||
if (fdc_ext_has_config(temp_fdc_ext))
|
||||
EnableWindow(h, TRUE);
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
/*HD controller config*/
|
||||
recalc_hdc_list(hdlg);
|
||||
|
||||
@@ -1706,6 +1663,43 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
|
||||
/*FD controller config*/
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC);
|
||||
c = d = 0;
|
||||
while (1) {
|
||||
char *s = fdc_card_getname(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
|
||||
settings_fdc_to_list[0][c] = d;
|
||||
|
||||
if (fdc_card_available(c)) {
|
||||
fdc_dev = fdc_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(fdc_dev, machines[temp_machine].flags)) {
|
||||
if (c == 0)
|
||||
SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2118));
|
||||
else {
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
}
|
||||
settings_list_to_fdc[0][d] = c;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
SendMessage(h, CB_SETCURSEL, settings_fdc_to_list[0][temp_fdc_card], 0);
|
||||
|
||||
EnableWindow(h, d ? TRUE : FALSE);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC);
|
||||
EnableWindow(h, fdc_card_has_config(temp_fdc_card) ? TRUE : FALSE);
|
||||
|
||||
|
||||
/*SCSI config*/
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
|
||||
c = d = 0;
|
||||
@@ -1825,36 +1819,22 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_CONFIGURE_FDC_EXT:
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
case IDC_CONFIGURE_FDC:
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC);
|
||||
temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)fdc_ext_get_device(fdc_ext_get_id(stransi)));
|
||||
|
||||
free(stransi);
|
||||
free(lptsTemp);
|
||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)fdc_card_getdevice(temp_fdc_card));
|
||||
break;
|
||||
|
||||
case IDC_COMBO_FDC_EXT:
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
case IDC_COMBO_FDC:
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC);
|
||||
temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_fdc_ext = fdc_ext_get_id(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC_EXT);
|
||||
if (fdc_ext_has_config(temp_fdc_ext))
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC);
|
||||
if (fdc_card_has_config(temp_fdc_card))
|
||||
EnableWindow(h, TRUE);
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
free(stransi);
|
||||
free(lptsTemp);
|
||||
break;
|
||||
|
||||
case IDC_CONFIGURE_HDC:
|
||||
@@ -1979,16 +1959,14 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_fdc_ext = fdc_ext_get_id(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_hdc = hdc_get_id(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC);
|
||||
temp_fdc_card = settings_list_to_fdc[0][SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
|
||||
temp_scsi_card = settings_list_to_device[0][SendMessage(h, CB_GETCURSEL, 0, 0)];
|
||||
|
||||
|
Reference in New Issue
Block a user