Split off the Network configuration from Other peripherals in the Settings dialog and made PCap device configurable;

Overhauled the configuration files so that the global variables are now subdivided into sections;
Fixed CD-ROM MODE SENSE page 0x2A which was being incorrectly reported as not implemented, fixes among other things Rayman 1 and Spellcross: The Last Battle (both now see the CD-ROM and play CD Audio fine).
This commit is contained in:
OBattler
2017-05-17 21:56:31 +02:00
parent 34c08faf46
commit 1a9a55c35e
25 changed files with 1523 additions and 899 deletions

View File

@@ -323,7 +323,7 @@ BEGIN
CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
CONTROL "Enable FPU",IDC_CHECK_FPU,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,147,81,113,10
WS_TABSTOP,147,80,113,10
EDITTEXT IDC_MEMTEXT,70,63,45,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_MEMSPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,63,
@@ -346,7 +346,7 @@ BEGIN
LTEXT "Video speed:",1800,7,26,58,10
CONTROL "Voodoo Graphics",IDC_CHECK_VOODOO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,45,199,10
PUSHBUTTON "Configure",IDC_CONFIGURE_VOODOO,215,44,45,12
PUSHBUTTON "Configure",IDC_CONFIGURE_VOODOO,214,44,46,12
PUSHBUTTON "Configure",IDC_CONFIGUREVID,214,7,46,12
END
@@ -366,53 +366,75 @@ BEGIN
PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14
END
CONFIGUREDLG_SOUND DIALOG DISCARDABLE 97, 0, 267, 60
CONFIGUREDLG_SOUND DIALOG DISCARDABLE 97, 0, 267, 78
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
COMBOBOX IDC_COMBOSND,71,7,141,120,CBS_DROPDOWNLIST | WS_VSCROLL |
COMBOBOX IDC_COMBOSND,71,7,140,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Sound card:",1800,7,8,59,10
PUSHBUTTON "Configure",IDC_CONFIGURESND,215,7,45,14
PUSHBUTTON "Configure",IDC_CONFIGURESND,214,7,46,12
COMBOBOX IDC_COMBO_MIDI,71,25,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "MIDI Out Device:",1801,7,26,59,10
CONTROL "CMS / Game Blaster",IDC_CHECKCMS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,87,25,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,87,43,80,10
CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,25,80,10
CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,174,25,80,10
CONTROL "Use Nuked OPL",IDC_CHECKNUKEDOPL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,43,80,10
CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,174,43,80,10
CONTROL "Use Nuked OPL",IDC_CHECKNUKEDOPL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,61,80,10
END
CONFIGUREDLG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 132
CONFIGUREDLG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,215,24,45,14
LTEXT "HD Controller:",1799,7,44,61,10
COMBOBOX IDC_COMBO_HDC,71,43,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Network adapter:",1801,7,8,59,10
COMBOBOX IDC_COMBONET,71,7,141,120,CBS_DROPDOWNLIST | WS_VSCROLL |
LTEXT "Network type:",1800,7,8,59,10
COMBOBOX IDC_COMBONETTYPE,71,7,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURENET,215,6,45,14
LTEXT "Tertiary IDE:",1802,7,62,61,10
COMBOBOX IDC_COMBO_IDE_TER,71,61,189,120,CBS_DROPDOWNLIST |
LTEXT "PCap device:",1801,7,26,59,10
COMBOBOX IDC_COMBOPCAP,71,25,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Network adapter:",1802,7,44,59,10
COMBOBOX IDC_COMBONET,71,43,140,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURENET,214,43,46,12
END
CONFIGUREDLG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 115
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "SCSI Controller:",1804,7,8,59,10
COMBOBOX IDC_COMBO_SCSI,71,7,140,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Quaternary IDE:",1803,7,81,61,10
COMBOBOX IDC_COMBO_IDE_QUA,71,79,189,120,CBS_DROPDOWNLIST |
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,214,7,46,12
LTEXT "HD Controller:",1799,7,26,61,10
COMBOBOX IDC_COMBO_HDC,71,25,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "SCSI Controller:",1804,7,26,59,10
COMBOBOX IDC_COMBO_SCSI,71,25,141,120,CBS_DROPDOWNLIST |
LTEXT "Tertiary IDE:",1802,7,44,61,10
COMBOBOX IDC_COMBO_IDE_TER,71,43,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Quaternary IDE:",1803,7,62,61,10
COMBOBOX IDC_COMBO_IDE_QUA,71,61,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Serial port 1",IDC_CHECKSERIAL1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,97,80,10
CONTROL "Parallel port",IDC_CHECKPARALLEL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,174,97,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
CONTROL "Serial port 2",IDC_CHECKSERIAL2,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,87,97,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,147,80,94,10
CONTROL "Parallel port",IDC_CHECKPARALLEL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,98,94,10
CONTROL "ISABugger device",IDC_CHECKBUGGER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,115,80,10
BS_AUTOCHECKBOX | WS_TABSTOP,147,98,94,10
END
CONFIGUREDLG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154
@@ -526,9 +548,10 @@ END
257 ICON DISCARDABLE "ICONS/video.ico"
258 ICON DISCARDABLE "ICONS/input_devices.ico"
259 ICON DISCARDABLE "ICONS/sound.ico"
260 ICON DISCARDABLE "ICONS/other_peripherals.ico"
261 ICON DISCARDABLE "ICONS/hard_disk.ico"
262 ICON DISCARDABLE "ICONS/removable_devices.ico"
260 ICON DISCARDABLE "ICONS/network.ico"
261 ICON DISCARDABLE "ICONS/other_peripherals.ico"
262 ICON DISCARDABLE "ICONS/hard_disk.ico"
263 ICON DISCARDABLE "ICONS/removable_devices.ico"
384 ICON DISCARDABLE "ICONS/floppy_525_1dd_empty.ico"
385 ICON DISCARDABLE "ICONS/floppy_525_1dd_empty_active.ico"
386 ICON DISCARDABLE "ICONS/floppy_525_2dd_empty.ico"
@@ -625,12 +648,28 @@ BEGIN
BOTTOMMARGIN, 58
END
CONFIGUREDLG_SOUND, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 71
END
CONFIGUREDLG_NETWORK, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 56
END
CONFIGUREDLG_PERIPHERALS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 125
BOTTOMMARGIN, 102
END
CONFIGUREDLG_HARD_DISKS, DIALOG
@@ -684,10 +723,10 @@ BEGIN
IDS_STRING2066 "Video"
IDS_STRING2067 "Input devices"
IDS_STRING2068 "Sound"
IDS_STRING2069 "Other peripherals"
IDS_STRING2070 "Hard disks"
IDS_STRING2071 "Removable devices"
IDS_STRING2072 "Disabled floppy drive"
IDS_STRING2069 "Network"
IDS_STRING2070 "Other peripherals"
IDS_STRING2071 "Hard disks"
IDS_STRING2072 "Removable devices"
IDS_STRING2073 "%i"" floppy drive: %s"
IDS_STRING2074 "Disabled CD-ROM drive"
IDS_STRING2075 "%s CD-ROM drive: %s"
@@ -714,7 +753,7 @@ BEGIN
2092 "Bus"
2093 "DMA"
2094 "KB"
2095 "Master"
2095 "MFM, RLL, or ESDI CD-ROM drives never existed"
END
STRINGTABLE DISCARDABLE
@@ -730,7 +769,7 @@ BEGIN
2104 "Network Type"
2105 "Surround Module"
2106 "MPU-401 Base Address"
2107 "MIDI Out Device"
2107 "No PCap devices found"
2108 "On-board RAM"
2109 "Memory Size"
2110 "Display Type"
@@ -834,7 +873,9 @@ BEGIN
2196 "Add New Hard Disk"
2197 "Add Existing Hard Disk"
2198 "Removable disk %i: %s"
2199 "English (United States)"
2199 "USB is not yet supported"
2200 "Invalid PCap device"
2201 "English (United States)"
END

View File

@@ -780,9 +780,6 @@ static device_config_t sb_config[] =
}
}
},
{
"midi", "MIDI out device", CONFIG_MIDI, "", 0
},
{
"", "", -1
}
@@ -821,9 +818,6 @@ static device_config_t sb_mcv_config[] =
}
}
},
{
"midi", "MIDI out device", CONFIG_MIDI, "", 0
},
{
"", "", -1
}
@@ -879,9 +873,6 @@ static device_config_t sb_pro_config[] =
}
}
},
{
"midi", "MIDI out device", CONFIG_MIDI, "", 0
},
{
"", "", -1
}
@@ -1003,9 +994,6 @@ static device_config_t sb_16_config[] =
}
}
},
{
"midi", "MIDI out device", CONFIG_MIDI, "", 0
},
{
"mode401", "MPU-401 mode", CONFIG_SELECTION, "", 1,
{
@@ -1141,9 +1129,6 @@ static device_config_t sb_awe32_config[] =
}
}
},
{
"midi", "MIDI out device", CONFIG_MIDI, "", 0
},
{
"mode401", "MPU-401 mode", CONFIG_SELECTION, "", 1,
{

View File

@@ -146,7 +146,7 @@ static void sound_cd_thread(void *param)
has_audio = 0;
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
if (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on)
{
has_audio++;
}
@@ -161,7 +161,7 @@ static void sound_cd_thread(void *param)
if (cdrom_drives[i].handler->audio_callback)
{
cdrom_drives[i].handler->audio_callback(i, cd_buffer[i], CD_BUFLEN*2);
has_audio = (cdrom_drives[i].enabled && cdrom_drives[i].sound_on);
has_audio = (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on);
}
if (soundon && has_audio)
{
@@ -240,7 +240,7 @@ void sound_init()
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
if (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on)
{
available_cdrom_drives++;
}
@@ -329,7 +329,7 @@ void sound_cd_thread_reset()
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].enabled && cdrom_drives[i].sound_on)
if (cdrom_drives[i].bus_type && cdrom_drives[i].sound_on)
{
available_cdrom_drives++;
}

View File

@@ -175,25 +175,10 @@ uint8_t cdrom_command_flags[0x100] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
uint8_t cdrom_mode_sense_page_flags[CDROM_NUM][0x40] =
{
{ 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED },
{ 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED },
{ 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED },
{ 0, IMPLEMENTED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, IMPLEMENTED, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IMPLEMENTED }
};
uint64_t cdrom_mode_sense_page_flags[CDROM_NUM] = { (1LL << GPMODE_R_W_ERROR_PAGE) | (1LL << GPMODE_CDROM_PAGE) | (1LL << GPMODE_CDROM_AUDIO_PAGE) | (1LL << GPMODE_CAPABILITIES_PAGE) | (1LL << GPMODE_ALL_PAGES),
(1LL << GPMODE_R_W_ERROR_PAGE) | (1LL << GPMODE_CDROM_PAGE) | (1LL << GPMODE_CDROM_AUDIO_PAGE) | (1LL << GPMODE_CAPABILITIES_PAGE) | (1LL << GPMODE_ALL_PAGES),
(1LL << GPMODE_R_W_ERROR_PAGE) | (1LL << GPMODE_CDROM_PAGE) | (1LL << GPMODE_CDROM_AUDIO_PAGE) | (1LL << GPMODE_CAPABILITIES_PAGE) | (1LL << GPMODE_ALL_PAGES),
(1LL << GPMODE_R_W_ERROR_PAGE) | (1LL << GPMODE_CDROM_PAGE) | (1LL << GPMODE_CDROM_AUDIO_PAGE) | (1LL << GPMODE_CAPABILITIES_PAGE) | (1LL << GPMODE_ALL_PAGES) };
const uint8_t cdrom_mode_sense_pages_default[CDROM_NUM][0x40][0x40] =
{
@@ -747,7 +732,7 @@ int find_cdrom_for_channel(uint8_t channel)
for (i = 0; i < CDROM_NUM; i++)
{
if (!cdrom_drives[i].bus_type && (cdrom_drives[i].ide_channel == channel))
if ((cdrom_drives[i].bus_type < 4) && (cdrom_drives[i].ide_channel == channel))
{
return i;
}
@@ -755,7 +740,7 @@ int find_cdrom_for_channel(uint8_t channel)
return 0xff;
}
void cdrom_init(int id, int cdb_len_setting, int bus_type);
void cdrom_init(int id, int cdb_len_setting);
void build_atapi_cdrom_map()
{
@@ -768,7 +753,7 @@ void build_atapi_cdrom_map()
atapi_cdrom_drives[i] = find_cdrom_for_channel(i);
if (atapi_cdrom_drives[i] != 0xff)
{
cdrom_init(atapi_cdrom_drives[i], 12, 0);
cdrom_init(atapi_cdrom_drives[i], 12);
}
}
}
@@ -779,7 +764,7 @@ int find_cdrom_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun)
for (i = 0; i < CDROM_NUM; i++)
{
if (cdrom_drives[i].bus_type && (cdrom_drives[i].scsi_device_id == scsi_id) && (cdrom_drives[i].scsi_device_lun == scsi_lun))
if ((cdrom_drives[i].bus_type == 4) && (cdrom_drives[i].scsi_device_id == scsi_id) && (cdrom_drives[i].scsi_device_lun == scsi_lun))
{
return i;
}
@@ -804,7 +789,7 @@ void build_scsi_cdrom_map()
scsi_cdrom_drives[i][j] = find_cdrom_for_scsi_id(i, j);
if (scsi_cdrom_drives[i][j] != 0xff)
{
cdrom_init(scsi_cdrom_drives[i][j], 12, 1);
cdrom_init(scsi_cdrom_drives[i][j], 12);
}
}
}
@@ -830,7 +815,7 @@ void cdrom_set_signature(int id)
cdrom[id].request_length = 0xEB14;
}
void cdrom_init(int id, int cdb_len_setting, int bus_type)
void cdrom_init(int id, int cdb_len_setting)
{
if (id >= CDROM_NUM)
{
@@ -847,9 +832,17 @@ void cdrom_init(int id, int cdb_len_setting, int bus_type)
cdrom[id].cd_status = CD_STATUS_EMPTY;
cdrom[id].sense[0] = 0xf0;
cdrom[id].sense[7] = 10;
cdrom_drives[id].bus_mode = cdrom_drives[id].bus_type ? 2 : (cdrom_drives[id].atapi_dma ? 3 : 1);
cdrom_drives[id].bus_mode = 0;
if (cdrom_drives[id].bus_type > 2)
{
cdrom_drives[id].bus_mode |= 2;
}
if (cdrom_drives[id].bus_type < 4)
{
cdrom_drives[id].bus_mode |= 1;
}
cdrom_log("CD-ROM %i: Bus type %i, bus mode %i\n", id, cdrom_drives[id].bus_type, cdrom_drives[id].bus_mode);
if (!cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type < 4)
{
cdrom_set_signature(id);
cdrom_drives[id].max_blocks_at_once = 1;
@@ -1083,7 +1076,7 @@ int cdrom_mode_select_header(uint8_t id, uint8_t val)
}
else if (cdrom[id].current_page_pos == (cdrom[id].current_page_len - 2))
{
if (cdrom_drives[id].bus_type && (cdrom[id].current_page_len == 8))
if ((cdrom_drives[id].bus_type == 4) && (cdrom[id].current_page_len == 8))
{
cdrom[id].block_descriptor_len |= ((uint16_t) val) << 8;
cdrom_log("CD-ROM %i: Position: %02X, value: %02X, block descriptor length: %02X\n", id, cdrom[id].current_page_pos, val, cdrom[id].block_descriptor_len);
@@ -1091,7 +1084,7 @@ int cdrom_mode_select_header(uint8_t id, uint8_t val)
}
else if (cdrom[id].current_page_pos == (cdrom[id].current_page_len - 1))
{
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
cdrom[id].block_descriptor_len |= (uint16_t) val;
cdrom_log("CD-ROM %i: Position: %02X, value: %02X, block descriptor length: %02X\n", id, cdrom[id].current_page_pos, val, cdrom[id].block_descriptor_len);
@@ -1134,7 +1127,7 @@ int cdrom_mode_select_page_header(uint8_t id, uint8_t val)
if (cdrom[id].current_page_pos == 0)
{
cdrom[id].current_page_code = val & 0x3f;
if (cdrom_mode_sense_page_flags[id][cdrom[id].current_page_code] != IMPLEMENTED)
if (!(cdrom_mode_sense_page_flags[id] & (1LL << cdrom[id].current_page_code)))
{
cdrom_log("CD-ROM %i: Trying to modify an unimplemented page: %02X\n", id, cdrom[id].current_page_code);
cdrom_mode_select_terminate(id, 1);
@@ -1342,7 +1335,7 @@ uint32_t cdrom_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type,
{
if ((type == GPMODE_ALL_PAGES) || (type == i))
{
if (cdrom_mode_sense_page_flags[id][i] == IMPLEMENTED)
if (cdrom_mode_sense_page_flags[id] & (1LL << cdrom[id].current_page_code))
{
buf[pos++] = cdrom_mode_sense_read(id, page_control, i, 0);
msplen = cdrom_mode_sense_read(id, page_control, i, 1);
@@ -1477,7 +1470,7 @@ static void cdrom_command_write_dma(uint8_t id)
static int cdrom_request_length_is_zero(uint8_t id)
{
if ((cdrom[id].request_length == 0) && !cdrom_drives[id].bus_type)
if ((cdrom[id].request_length == 0) && (cdrom_drives[id].bus_type < 4))
{
return 1;
}
@@ -1497,7 +1490,7 @@ static void cdrom_data_command_finish(uint8_t id, int len, int block_len, int al
}
if (cdrom_request_length_is_zero(id) || (len == 0) || (cdrom_current_mode(id) == 0))
{
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
SCSIDevices[cdrom_drives[id].scsi_device_id][cdrom_drives[id].scsi_device_lun].InitLength = 0;
}
@@ -1513,7 +1506,7 @@ static void cdrom_data_command_finish(uint8_t id, int len, int block_len, int al
{
if (direction == 0)
{
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
SCSIDevices[cdrom_drives[id].scsi_device_id][cdrom_drives[id].scsi_device_lun].InitLength = alloc_len;
}
@@ -2070,7 +2063,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb)
{
int ready = 0;
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
if (((cdrom[id].request_length >> 5) & 7) != cdrom_drives[id].scsi_device_lun)
{
@@ -2082,19 +2075,20 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb)
if (!(cdrom_command_flags[cdb[0]] & IMPLEMENTED))
{
cdrom_log("CD-ROM %i: Attempting to execute unknown command %02X over %s\n", id, cdb[0], cdrom_drives[id].bus_type ? "SCSI" : "ATAPI");
cdrom_log("CD-ROM %i: Attempting to execute unknown command %02X over %s\n", id, cdb[0], (cdrom_drives[id].bus_type == 4) ? "SCSI" : ((cdrom_drives[id].bus_type == 3) ? "ATAPI PIO/DMA" : "ATAPI PIO"));
cdrom_illegal_opcode(id);
return 0;
}
if (!cdrom_drives[id].bus_type && (cdrom_command_flags[cdb[0]] & SCSI_ONLY))
if ((cdrom_drives[id].bus_type < 4) && (cdrom_command_flags[cdb[0]] & SCSI_ONLY))
{
cdrom_log("CD-ROM %i: Attempting to execute SCSI-only command %02X over ATAPI\n", id, cdb[0]);
cdrom_illegal_opcode(id);
return 0;
}
if (cdrom_drives[id].bus_type && (cdrom_command_flags[cdb[0]] & ATAPI_ONLY))
if ((cdrom_drives[id].bus_type == 4) && (cdrom_command_flags[cdb[0]] & ATAPI_ONLY))
{
cdrom_log("CD-ROM %i: Attempting to execute ATAPI-only command %02X over SCSI\n", id, cdb[0]);
cdrom_illegal_opcode(id);
@@ -2155,7 +2149,7 @@ int cdrom_pre_execution_check(uint8_t id, uint8_t *cdb)
return 0;
}
cdrom_log("CD-ROM %i: Continuing with command\n", id);
cdrom_log("CD-ROM %i: Continuing with command %02X\n", id, cdb[0]);
return 1;
}
@@ -2309,7 +2303,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
#if 0
int CdbLength;
#endif
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
cdrom[id].status &= ~ERR_STAT;
}
@@ -2507,7 +2501,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
}
max_len = cdrom[id].sector_len;
/* if (cdrom_drives[id].bus_type) */
/* if (cdrom_drives[id].bus_type == 4) */
if (cdrom_current_mode(id) == 2)
{
cdrom[id].requested_blocks = max_len;
@@ -2579,7 +2573,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
case GPCMD_MODE_SENSE_6:
case GPCMD_MODE_SENSE_10:
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
block_desc = ((cdb[1] >> 3) & 1) ? 0 : 1;
}
@@ -2597,7 +2591,9 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
len = (cdb[8] | (cdb[7] << 8));
}
if (!(cdrom_mode_sense_page_flags[id][cdb[2] & 0x3F] & IMPLEMENTED))
cdrom[id].current_page_code = cdb[2] & 0x3F;
if (!(cdrom_mode_sense_page_flags[id] & (1LL << cdrom[id].current_page_code)))
{
cdrom_invalid_field(id);
return;
@@ -3201,8 +3197,8 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
memset(cdbufferb, 0, 8);
cdbufferb[0] = 5; /*CD-ROM*/
cdbufferb[1] = 0x80; /*Removable*/
cdbufferb[2] = cdrom_drives[id].bus_type ? 0x02 : 0x00; /*SCSI-2 compliant*/
cdbufferb[3] = cdrom_drives[id].bus_type ? 0x02 : 0x21;
cdbufferb[2] = (cdrom_drives[id].bus_type == 4) ? 0x02 : 0x00; /*SCSI-2 compliant*/
cdbufferb[3] = (cdrom_drives[id].bus_type == 4) ? 0x02 : 0x21;
cdbufferb[4] = 31;
ide_padstr8(cdbufferb + 8, 8, "86Box"); /* Vendor */
@@ -3356,7 +3352,7 @@ void cdrom_callback(uint8_t id) /* Callback for non-Read CD commands */
{
int old_pos = 0;
if (!cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type < 4)
{
cdrom_log("CD-ROM %i: Lowering IDE IRQ\n", id);
ide_irq_lower(&(ide_drives[cdrom_drives[id].ide_channel]));
@@ -3482,7 +3478,7 @@ int cdrom_read_from_dma(uint8_t id)
int in_data_length = 0;
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
ret = cdrom_read_from_scsi_dma(cdrom_drives[id].scsi_device_id, cdrom_drives[id].scsi_device_lun);
}
@@ -3496,7 +3492,7 @@ int cdrom_read_from_dma(uint8_t id)
return 0;
}
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
in_data_length = SCSIDevices[cdrom_drives[id].scsi_device_id][cdrom_drives[id].scsi_device_lun].InitLength;
cdrom_log("CD-ROM %i: SCSI Input data length: %i\n", id, in_data_length);
@@ -3602,7 +3598,7 @@ int cdrom_write_to_dma(uint8_t id)
{
int ret = 0;
if (cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type == 4)
{
ret = cdrom_write_to_scsi_dma(cdrom_drives[id].scsi_device_id, cdrom_drives[id].scsi_device_lun);
}
@@ -3621,7 +3617,7 @@ int cdrom_write_to_dma(uint8_t id)
void cdrom_irq_raise(uint8_t id)
{
if (!cdrom_drives[id].bus_type)
if (cdrom_drives[id].bus_type < 4)
{
ide_irq_raise(&(ide_drives[cdrom_drives[id].ide_channel]));
}

View File

@@ -59,7 +59,7 @@ typedef struct __attribute__((__packed__))
int requested_blocks; /* This will be set to something other than 1 when block reads are implemented. */
int current_page_code;
uint64_t current_page_code;
int current_page_len;
int current_page_pos;
@@ -132,8 +132,6 @@ typedef struct
typedef struct __attribute__((__packed__))
#endif
{
int enabled;
int max_blocks_at_once;
CDROM *handler;
@@ -141,17 +139,17 @@ typedef struct __attribute__((__packed__))
int host_drive;
int prev_host_drive;
uint8_t bus_type; /* 0 = ATAPI, 1 = SCSI */
unsigned int bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t ide_channel;
uint8_t scsi_device_id;
uint8_t scsi_device_lun;
unsigned int scsi_device_id;
unsigned int scsi_device_lun;
uint8_t sound_on;
uint8_t atapi_dma;
unsigned int sound_on;
unsigned int atapi_dma;
} cdrom_drive_t;
#ifdef __MSC__
# pragma pack(pop)

File diff suppressed because it is too large Load Diff

View File

@@ -131,6 +131,37 @@ int device_get_config_int(char *s)
return 0;
}
int device_get_config_int_ex(char *s, int default_int)
{
device_config_t *config = current_device->config;
while (config->type != -1)
{
if (!strcmp(s, config->name))
return config_get_int(current_device->name, s, default_int);
config++;
}
return default_int;
}
void device_set_config_int(char *s, int val)
{
device_config_t *config = current_device->config;
while (config->type != -1)
{
if (!strcmp(s, config->name))
{
config_set_int(current_device->name, s, val);
return;
}
config++;
}
return;
}
char *device_get_config_string(char *s)
{
device_config_t *config = current_device->config;

View File

@@ -2,7 +2,7 @@
#define CONFIG_INT 1
#define CONFIG_BINARY 2
#define CONFIG_SELECTION 3
#define CONFIG_MIDI 4
#define CONFIG_MAC 4
typedef struct device_config_selection_t
{
@@ -42,6 +42,8 @@ void device_force_redraw();
char *device_add_status_info(char *s, int max_len);
int device_get_config_int(char *name);
int device_get_config_int_ex(char *s, int default_int);
void device_set_config_int(char *s, int val);
char *device_get_config_string(char *name);
enum

View File

@@ -560,11 +560,11 @@ typedef struct {
int is_hdi;
uint32_t base;
uint64_t at_spt,at_hpc; /*[Translation] Sectors per track, heads per cylinder*/
int bus; /* 0 = none, 1 = MFM/RLL, 2 = IDE, 3 = SCSI */
uint8_t mfm_channel;
uint8_t ide_channel;
uint8_t scsi_id;
uint8_t scsi_lun;
unsigned int bus; /* 0 = none, 1 = MFM/RLL, 2 = IDE, 3 = SCSI */
unsigned int mfm_channel;
unsigned int ide_channel;
unsigned int scsi_id;
unsigned int scsi_lun;
} hard_disk_t;
#pragma pack(pop)

View File

@@ -132,7 +132,7 @@ int ide_drive_is_cdrom(IDE *ide)
}
else
{
if (cdrom_drives[atapi_cdrom_drives[ide->channel]].enabled && !cdrom_drives[atapi_cdrom_drives[ide->channel]].bus_type && (cdrom_drives[atapi_cdrom_drives[ide->channel]].bus_mode & 1))
if ((cdrom_drives[atapi_cdrom_drives[ide->channel]].bus_type > 0) && (cdrom_drives[atapi_cdrom_drives[ide->channel]].bus_type < 3))
{
return 1;
}

View File

@@ -1767,6 +1767,19 @@ nic_rom_init(nic_t *dev, wchar_t *s)
}
uint32_t
ne2000_get_maclocal(void)
{
uint32_t temp;
temp = (((int) maclocal[3]) << 16);
temp |= (((int) maclocal[4]) << 8);
temp |= ((int) maclocal[5]);
return(temp);
}
static void *
nic_init(int board)
{
@@ -1779,44 +1792,50 @@ nic_init(int board)
dev->board = board;
dev->is_rtl8029as = (PCI && (board == NE2K_RTL8029AS)) ? 1 : 0;
if (board == NE2K_RTL8029AS)
{
strcpy(dev->name, "RTL8029AS");
}
else if (board == NE2K_NE1000)
{
strcpy(dev->name, "NE1000");
}
else
{
strcpy(dev->name, "NE2000");
}
dev->base_irq = device_get_config_int("irq");
dev->disable_netbios = device_get_config_int("disable_netbios");
if (dev->is_rtl8029as) {
dev->base_address = 0x340;
mac = config_get_int(NULL, "maclocal_pci", -1);
} else {
dev->base_address = device_get_config_int("addr");
mac = config_get_int(NULL, "maclocal", -1);
}
mac = device_get_config_int_ex("mac", -1);
/* Set up our MAC address. */
if (dev->is_rtl8029as) {
maclocal_pci[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */
maclocal_pci[1] = 0x20;
maclocal_pci[2] = 0x18;
ptr = maclocal_pci;
maclocal[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */
maclocal[1] = 0x20;
maclocal[2] = 0x18;
} else {
maclocal[0] = 0x00; /* 00:00:D8 (NE2000 ISA vendor prefix). */
maclocal[1] = 0x00;
maclocal[2] = 0xD8;
ptr = maclocal;
}
ptr = maclocal;
pclog(1, "MAClocal: mac=%08lx\n", mac);
if (mac & 0xff000000) {
/* Generating new MAC. */
ptr[3] = disc_random_generate();
ptr[4] = disc_random_generate();
ptr[5] = disc_random_generate();
ptr[5] = disc_random_generate() | 1;
device_set_config_int("mac", ne2000_get_maclocal());
} else {
ptr[3] = (mac>>16) & 0xff;
ptr[4] = (mac>>8) & 0xff;
ptr[5] = mac & 0xff;
ptr[5] = (mac & 0xff) | 1;
}
memcpy(dev->physaddr, ptr, 6);
@@ -1906,32 +1925,6 @@ nic_close(void *priv)
}
uint32_t
ne2000_get_maclocal(void)
{
uint32_t temp;
temp = (((int) maclocal[3]) << 16);
temp |= (((int) maclocal[4]) << 8);
temp |= ((int) maclocal[5]);
return(temp);
}
uint32_t
ne2000_get_maclocal_pci(void)
{
uint32_t temp;
temp = (((int) maclocal_pci[3]) << 16);
temp |= (((int) maclocal_pci[4]) << 8);
temp |= ((int) maclocal_pci[5]);
return(temp);
}
static void *
ne1000_init(void)
{
@@ -2012,6 +2005,9 @@ static device_config_t ne1000_config[] =
}
},
},
{
"mac", "MAC Address", CONFIG_MAC, "", -1
},
{
"disable_netbios", "Disable network BIOS", CONFIG_BINARY, "", 0
},
@@ -2085,6 +2081,9 @@ static device_config_t ne2000_config[] =
}
},
},
{
"mac", "MAC Address", CONFIG_MAC, "", -1
},
{
"disable_netbios", "Disable network BIOS", CONFIG_BINARY, "", 0
},
@@ -2132,6 +2131,9 @@ static device_config_t rtl8029as_config[] =
}
},
},
{
"mac", "MAC Address", CONFIG_MAC, "", -1
},
{
"disable_netbios", "Disable network BIOS", CONFIG_BINARY, "", 0
},

View File

@@ -29,6 +29,34 @@ static thread_t *poll_tid;
static NETRXCB poll_rx; /* network RX function to call */
static void *poll_arg; /* network RX function arg */
int netdev_num;
netdev_t netdev_list[512];
#ifdef WALTJE
int pcap_do_log = 1;
# define ENABLE_PCAP_LOG
#else
int pcap_do_log = 0;
#endif
static void
pcap_log(const char *format, ...)
{
#ifdef ENABLE_PCAP_LOG
va_list ap;
if (pcap_do_log) {
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
fflush(stdout);
}
#endif
}
#define pclog pcap_log
/* Check if the interface has a packet for us. */
static void
@@ -80,6 +108,8 @@ poll_thread(void *arg)
}
char pcap_dev[512];
/* Initialize WinPcap for us. */
int
network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
@@ -105,12 +135,11 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
pclog("Initializing WinPcap, version %s\n", temp);
/* Get the value of our capture interface. */
dev = config_get_string(NULL, "pcap_device", NULL);
if (dev == NULL) {
if (pcap_dev == NULL) {
pclog(" No network device configured!\n");
return(-1);
}
pclog(" Network interface: '%s'\n", dev);
pclog(" Network interface: '%s'\n", pcap_dev);
pcap = pcap_open_live(dev, /* interface name */
1518, /* maximum packet size */
@@ -198,10 +227,16 @@ network_devlist(netdev_t *list)
pcap_if_t *devlist, *dev;
int i = 0;
/* Note by Kotori: Add the first (and guaranteed to be always present) device - "None". */
strcpy(list->device, "none");
strcpy(list->description, "None");
list++;
i++;
/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&devlist, errbuf) == -1) {
pclog("NETWORK: error in pcap_findalldevs_ex: %s\n", errbuf);
return(-1);
return(i); /* Note by Kotori: The list will always have at least one entry - "None". */
}
for (dev=devlist; dev!=NULL; dev=dev->next) {
@@ -219,3 +254,19 @@ network_devlist(netdev_t *list)
return(i);
}
int network_dev_to_id(char *dev)
{
int i = 0;
for (i = 0; i < netdev_num; i++)
{
if (!strcmp(netdev_list[i].device, dev))
{
return i;
}
}
/* If the device does not match the list, consider it as if it was set to "none". */
return 0;
}

View File

@@ -215,5 +215,5 @@ network_card_get_from_internal_name(char *s)
c++;
}
return(0);
return(-1);
}

View File

@@ -45,6 +45,11 @@ typedef struct {
extern int network_card;
extern int network_type;
extern char pcap_dev[512];
extern int netdev_num;
extern netdev_t netdev_list[512];
/* Function prototypes. */
extern void network_init(void);
@@ -70,5 +75,6 @@ extern char *network_card_get_internal_name(int);
extern int network_card_get_from_internal_name(char *);
extern struct device_t *network_card_getdevice(int);
int network_dev_to_id(char *dev);
#endif /*NETWORK_H*/

View File

@@ -288,6 +288,9 @@ void initpc(int argc, wchar_t *argv[])
*p=L'\0';
pclog("path = %ws\n", pcempath);
/* Initialize list of PCap devices. */
netdev_num = network_devlist(netdev_list);
for (c = 1; c < argc; c++)
{
if (!_wcsicmp(argv[c], L"--help"))

View File

@@ -6,3 +6,5 @@ void midi_close();
void midi_write(uint8_t val);
int midi_get_num_devs();
void midi_get_dev_name(int num, char *s);
extern int midi_id;

View File

@@ -11,11 +11,12 @@
#define CONFIGUREDLG_VIDEO 102
#define CONFIGUREDLG_INPUT 103
#define CONFIGUREDLG_SOUND 104
#define CONFIGUREDLG_PERIPHERALS 105
#define CONFIGUREDLG_HARD_DISKS 106
#define CONFIGUREDLG_REMOVABLE_DEVICES 107
#define ABOUTDLG 108
#define CONFIGUREDLG_HARD_DISKS_ADD 109
#define CONFIGUREDLG_NETWORK 105
#define CONFIGUREDLG_PERIPHERALS 106
#define CONFIGUREDLG_HARD_DISKS 107
#define CONFIGUREDLG_REMOVABLE_DEVICES 108
#define ABOUTDLG 109
#define CONFIGUREDLG_HARD_DISKS_ADD 110
#define CONFIGUREDLG_MAIN 117
#define IDC_SETTINGSCATLIST 1004
#define IDC_LIST_HARD_DISKS 1005
@@ -77,6 +78,7 @@
#define IDC_COMBO_CD_CHANNEL_IDE 1073
#define IDC_COMBO_CD_ID 1074
#define IDC_COMBO_CD_LUN 1075
#define IDC_COMBO_MIDI 1076
#define IDC_CHECK_CDROM_1_AUDIO_ENABLED 1584
#define IDC_CHECK_CDROM_2_AUDIO_ENABLED 1585
#define IDC_CHECK_CDROM_3_AUDIO_ENABLED 1586
@@ -228,7 +230,9 @@
#define IDC_COMBO386 1005
#define IDC_COMBO486 1006
#define IDC_COMBOSND 1007
#define IDC_COMBONET 1008
#define IDC_COMBONETTYPE 1008
#define IDC_COMBOPCAP 1009
#define IDC_COMBONET 1010
#define IDC_COMBOCPUM 1060
#define IDC_COMBOSPD 1061
#define IDC_COMBODR1 1062
@@ -361,8 +365,10 @@
#define IDC_CONFIGURESND 1201
#define IDC_CONFIGUREVOODOO 1202
#define IDC_CONFIGUREMOD 1203
#define IDC_CONFIGURENET 1204
#define IDC_CONFIGURENETTYPE 1204
#define IDC_CONFIGUREBUSLOGIC 1205
#define IDC_CONFIGUREPCAP 1206
#define IDC_CONFIGURENET 1207
#define IDC_JOY1 1210
#define IDC_JOY2 1211
#define IDC_JOY3 1212
@@ -418,7 +424,7 @@
#ifdef APSTUDIO_INVOKED
# ifndef APSTUDIO_READONLY_SYMBOLS
# define _APS_NO_MFC 1
# define _APS_NEXT_RESOURCE_VALUE 110
# define _APS_NEXT_RESOURCE_VALUE 111
# define _APS_NEXT_COMMAND_VALUE 40002
# define _APS_NEXT_CONTROL_VALUE 1055
# define _APS_NEXT_SYMED_VALUE 101

View File

@@ -1370,9 +1370,7 @@ aha_dev_present(uint8_t id, uint8_t lun)
if (scsi_cdrom_drives[id][lun] >= CDROM_NUM) return(0);
if (cdrom_drives[scsi_cdrom_drives[id][lun]].enabled &&
cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type &&
(cdrom_drives[scsi_cdrom_drives[id][lun]].bus_mode & 2)) return(1);
if ((cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type == 4)) return(1);
return(0);
}

View File

@@ -1006,9 +1006,7 @@ buslogic_dev_present(uint8_t id, uint8_t lun)
if (scsi_cdrom_drives[id][lun] >= CDROM_NUM) return(0);
if (cdrom_drives[scsi_cdrom_drives[id][lun]].enabled &&
cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type &&
(cdrom_drives[scsi_cdrom_drives[id][lun]].bus_mode & 2)) return(1);
if ((cdrom_drives[scsi_cdrom_drives[id][lun]].bus_type == 4)) return(1);
return(0);
}

View File

@@ -9,7 +9,6 @@
#include "ibm.h"
#include "config.h"
#include "device.h"
#include "plat-midi.h"
#include "resource.h"
#include "win.h"
@@ -60,21 +59,6 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
id += 2;
break;
case CONFIG_MIDI:
val_int = config_get_int(NULL, config->name, config->default_int);
num = midi_get_num_devs();
for (c = 0; c < num; c++)
{
midi_get_dev_name(c, s);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
if (val_int == c)
SendMessage(h, CB_SETCURSEL, c, 0);
}
id += 2;
break;
}
config++;
}
@@ -120,17 +104,6 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
id += 2;
break;
case CONFIG_MIDI:
val_int = config_get_int(NULL, config->name, config->default_int);
c = SendMessage(h, CB_GETCURSEL, 0, 0);
if (val_int != c)
changed = 1;
id += 2;
break;
}
config++;
}
@@ -171,13 +144,6 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
id += 2;
break;
case CONFIG_MIDI:
c = SendMessage(h, CB_GETCURSEL, 0, 0);
config_set_int(NULL, config->name, c);
id += 2;
break;
}
config++;
}
@@ -254,7 +220,6 @@ void deviceconfig_open(HWND hwnd, device_t *device)
break;
case CONFIG_SELECTION:
case CONFIG_MIDI:
/*Combo box*/
item = (DLGITEMTEMPLATE *)data;
item->x = 70;

View File

@@ -21,7 +21,7 @@ LCID dwLanguage;
uint32_t dwLangID, dwSubLangID;
#define STRINGS_NUM 152
#define STRINGS_NUM 154
WCHAR lpResourceString[STRINGS_NUM][512];

View File

@@ -2,6 +2,8 @@
extern "C" {
#endif
LCID dwLanguage;
int msgbox_reset(HWND hwndParent);
int msgbox_reset_yn(HWND hwndParent);
int msgbox_question(HWND hwndParent, int i);

View File

@@ -7,34 +7,65 @@
#include "config.h"
#include "plat-midi.h"
static int midi_id;
int midi_id;
static HMIDIOUT midi_out_device = NULL;
HANDLE m_event;
void midi_close();
static uint8_t midi_rt_buf[1024];
static uint8_t midi_cmd_buf[1024];
static int midi_cmd_pos = 0;
static int midi_cmd_len = 0;
static uint8_t midi_status = 0;
static unsigned int midi_sysex_start = 0;
static unsigned int midi_sysex_delay = 0;
uint8_t MIDI_evt_len[256] = {
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x00
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x10
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x20
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x30
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x40
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x50
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x60
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x70
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0x80
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0x90
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xa0
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xb0
2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2, // 0xc0
2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2, // 0xd0
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xe0
0,2,3,2, 0,0,1,0, 1,0,1,1, 1,0,1,0 // 0xf0
};
void midi_init()
{
MMRESULT hr = MMSYSERR_NOERROR;
memset(midi_rt_buf, 0, 1024);
memset(midi_cmd_buf, 0, 1024);
midi_cmd_pos = midi_cmd_len = 0;
midi_status = 0;
midi_sysex_start = midi_sysex_delay = 0;
midi_id = config_get_int(NULL, "midi", 0);
m_event = CreateEvent(NULL, TRUE, TRUE, NULL);
#if 0
hr = midiOutOpen(&midi_out_device, midi_id, 0,
0, CALLBACK_NULL);
#endif
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
0, CALLBACK_EVENT);
if (hr != MMSYSERR_NOERROR) {
printf("midiOutOpen error - %08X\n",hr);
midi_id = 0;
#if 0
hr = midiOutOpen(&midi_out_device, midi_id, 0,
0, CALLBACK_NULL);
#endif
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
0, CALLBACK_EVENT);
if (hr != MMSYSERR_NOERROR) {
@@ -83,81 +114,12 @@ static void midi_send_sysex()
hdr.dwBufferLength = midi_pos;
hdr.dwFlags = 0;
/* pclog("Sending sysex : ");
for (c = 0; c < midi_pos; c++)
pclog("%02x ", midi_sysex_data[c]);
pclog("\n");*/
midiOutPrepareHeader(midi_out_device, &hdr, sizeof(MIDIHDR));
midiOutLongMsg(midi_out_device, &hdr, sizeof(MIDIHDR));
midi_insysex = 0;
}
#if 0
void midi_write(uint8_t val)
{
if ((val & 0x80) && !(val == 0xf7 && midi_insysex))
{
midi_pos = 0;
midi_len = midi_lengths[(val >> 4) & 7];
midi_command = 0;
if (val == 0xf0)
midi_insysex = 1;
}
if (midi_insysex)
{
midi_sysex_data[midi_pos++] = val;
if (val == 0xf7 || midi_pos >= 1024+2)
midi_send_sysex();
return;
}
if (midi_len)
{
midi_command |= (val << (midi_pos * 8));
midi_pos++;
if (midi_pos == midi_len)
midiOutShortMsg(midi_out_device, midi_command);
}
}
#endif
static uint8_t midi_rt_buf[1024] = { 0, 0, 0, 0 };
static uint8_t midi_cmd_buf[1024] = { 0, 0, 0, 0 };
static int midi_cmd_pos = 0;
static int midi_cmd_len = 0;
static uint8_t midi_status = 0;
static int midi_sysex_start = 0;
static int midi_sysex_delay = 0;
uint8_t MIDI_evt_len[256] = {
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x00
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x10
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x20
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x30
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x40
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x50
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x60
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 0x70
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0x80
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0x90
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xa0
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xb0
2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2, // 0xc0
2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2, // 0xd0
3,3,3,3, 3,3,3,3, 3,3,3,3, 3,3,3,3, // 0xe0
0,2,3,2, 0,0,1,0, 1,0,1,1, 1,0,1,0 // 0xf0
};
void PlayMsg(uint8_t *msg)
{
midiOutShortMsg(midi_out_device, *(uint32_t *) msg);
@@ -197,12 +159,19 @@ void PlaySysex(uint8_t *sysex, unsigned int len)
#define SYSEX_SIZE 1024
#define RAWBUF 1024
int GetTicks()
{
}
void midi_write(uint8_t val)
{
uint32_t passed_ticks;
if (midi_sysex_start)
{
passed_ticks = GetTickCount() - midi_sysex_start;
if (passed_ticks < midi_sysex_delay)
{
Sleep(midi_sysex_delay - passed_ticks);
}
}
/* Test for a realtime MIDI message */
if (val >= 0xf8)
{
@@ -248,7 +217,7 @@ void midi_write(uint8_t val)
else
midi_sysex_delay = (unsigned int) (((float) (midi_pos) * 1.25f) * 1000.0f / 3125.0f) + 2;
midi_sysex_start = GetTicks();
midi_sysex_start = GetTickCount();
}
}
}

View File

@@ -23,6 +23,7 @@
#include "scsi.h"
#include "scsi_buslogic.h"
#include "network.h"
#include "plat-midi.h"
#include "sound/sound.h"
#include "sound/snd_dbopl.h"
#include "video/video.h"
@@ -47,10 +48,14 @@ int temp_gfxcard, temp_video_speed, temp_voodoo;
int temp_mouse, temp_joystick;
/* Sound category */
int temp_sound_card, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type;
int temp_sound_card, temp_midi_id, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type;
/* Network category */
int temp_net_type, temp_net_card;
char temp_pcap_dev[520];
/* Peripherals category */
int temp_scsi_card, temp_net_card, hdc_ignore, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq;
int temp_scsi_card, hdc_ignore, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq;
int temp_serial[2], temp_lpt, temp_bugger;
char temp_hdc_name[16];
@@ -102,14 +107,20 @@ static void win_settings_init()
/* Sound category */
temp_sound_card = sound_card_current;
temp_midi_id = midi_id;
temp_SSI2001 = SSI2001;
temp_GAMEBLASTER = GAMEBLASTER;
temp_GUS = GUS;
temp_opl3_type = opl3_type;
/* Network category */
temp_net_type = network_type;
memset(temp_pcap_dev, 0, 520);
strcpy(temp_pcap_dev, pcap_dev);
temp_net_card = network_card;
/* Peripherals category */
temp_scsi_card = scsi_card_current;
temp_net_card = network_card;
strncpy(temp_hdc_name, hdd_controller_name, sizeof(temp_hdc_name) - 1);
temp_ide_ter = ide_enable[2];
temp_ide_ter_irq = ide_irq[2];
@@ -161,14 +172,19 @@ static int win_settings_changed()
/* Sound category */
i = i || (sound_card_current != temp_sound_card);
i = i || (midi_id != temp_midi_id);
i = i || (SSI2001 != temp_SSI2001);
i = i || (GAMEBLASTER != temp_GAMEBLASTER);
i = i || (GUS != temp_GUS);
i = i || (opl3_type != temp_opl3_type);
/* Network category */
i = i || (network_type != temp_net_type);
i = i || strcmp(temp_pcap_dev, pcap_dev);
i = i || (network_card != temp_net_card);
/* Peripherals category */
i = i || (scsi_card_current != temp_scsi_card);
i = i || (network_card != temp_net_card);
i = i || strncmp(temp_hdc_name, hdd_controller_name, sizeof(temp_hdc_name) - 1);
i = i || (temp_ide_ter != ide_enable[2]);
i = i || (temp_ide_ter_irq != ide_irq[2]);
@@ -252,14 +268,20 @@ static void win_settings_save()
/* Sound category */
sound_card_current = temp_sound_card;
midi_id = temp_midi_id;
SSI2001 = temp_SSI2001;
GAMEBLASTER = temp_GAMEBLASTER;
GUS = temp_GUS;
opl3_type = temp_opl3_type;
/* Network category */
network_type = temp_net_type;
memset(pcap_dev, 0, 512);
strcpy(pcap_dev, temp_pcap_dev);
network_card = temp_net_card;
/* Peripherals category */
scsi_card_current = temp_scsi_card;
network_card = temp_net_card;
strncpy(hdd_controller_name, temp_hdc_name, sizeof(temp_hdc_name) - 1);
ide_enable[2] = temp_ide_ter;
ide_irq[2] = temp_ide_ter_irq;
@@ -1061,6 +1083,8 @@ int find_irq_in_array(int irq, int def)
return 7 + def;
}
static char midi_dev_name_buf[512];
static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
@@ -1068,6 +1092,7 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
int d = 0;
LPTSTR lptsTemp;
device_t *sound_dev;
int num = 0;
switch (message)
{
@@ -1121,6 +1146,18 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
num = midi_get_num_devs();
for (c = 0; c < num; c++)
{
memset(midi_dev_name_buf, 0, 512);
midi_get_dev_name(c, midi_dev_name_buf);
mbstowcs(lptsTemp, midi_dev_name_buf, strlen(midi_dev_name_buf) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
if (c == temp_midi_id)
SendMessage(h, CB_SETCURSEL, c, 0);
}
h=GetDlgItem(hdlg, IDC_CHECKCMS);
SendMessage(h, BM_SETCHECK, temp_GAMEBLASTER, 0);
@@ -1168,6 +1205,9 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
h = GetDlgItem(hdlg, IDC_COMBOSND);
temp_sound_card = settings_list_to_sound[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_MIDI);
temp_midi_id = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECKCMS);
temp_GAMEBLASTER = SendMessage(h, BM_GETCHECK, 0, 0);
@@ -1199,7 +1239,7 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
/*NIC config*/
/*SCSI config*/
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
c = d = 0;
while (1)
@@ -1249,49 +1289,6 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
recalc_hdd_list(hdlg, temp_model, 0);
/*NIC config*/
h = GetDlgItem(hdlg, IDC_COMBONET);
c = d = 0;
while (1)
{
char *s = network_card_getname(c);
if (!s[0])
{
break;
}
settings_network_to_list[c] = d;
if (network_card_available(c))
{
if (c == 0)
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152));
}
else
{
mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
settings_list_to_network[d] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_network_to_list[temp_net_card], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURENET);
if (network_card_has_config(temp_net_card))
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
h=GetDlgItem(hdlg, IDC_COMBO_IDE_TER);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2151));
@@ -1347,28 +1344,6 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_CONFIGURENET:
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card));
break;
case IDC_COMBONET:
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURENET);
if (network_card_has_config(temp_net_card))
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
break;
case IDC_CONFIGURE_SCSI:
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
@@ -1415,9 +1390,6 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
h = GetDlgItem(hdlg, IDC_COMBO_SCSI);
temp_scsi_card = settings_list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_COMBO_IDE_TER);
temp_ide_ter = SendMessage(h, CB_GETCURSEL, 0, 0);
if (temp_ide_ter > 1)
@@ -1452,6 +1424,203 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
return FALSE;
}
int net_ignore_message = 0;
static void network_recalc_combos(HWND hdlg)
{
HWND h;
net_ignore_message = 1;
h = GetDlgItem(hdlg, IDC_COMBOPCAP);
if (temp_net_type == 1)
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_COMBONET);
if (temp_net_type == 0)
{
EnableWindow(h, TRUE);
}
else if ((temp_net_type == 1) && (network_dev_to_id(temp_pcap_dev) > 0))
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_CONFIGURENET);
if (network_card_has_config(temp_net_card) && (temp_net_type == 0))
{
EnableWindow(h, TRUE);
}
else if (network_card_has_config(temp_net_card) && (temp_net_type == 1) && (network_dev_to_id(temp_pcap_dev) > 0))
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
net_ignore_message = 0;
}
static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
int d = 0;
LPTSTR lptsTemp;
device_t *scsi_dev;
switch (message)
{
case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBONETTYPE);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"None");
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"PCap");
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) L"SLiRP");
SendMessage(h, CB_SETCURSEL, temp_net_type + 1, 0);
h = GetDlgItem(hdlg, IDC_COMBOPCAP);
if (temp_net_type == 0)
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_COMBOPCAP);
for (c = 0; c < netdev_num; c++)
{
mbstowcs(lptsTemp, netdev_list[c].description, strlen(netdev_list[c].description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
SendMessage(h, CB_SETCURSEL, network_dev_to_id(temp_pcap_dev), 0);
/*NIC config*/
h = GetDlgItem(hdlg, IDC_COMBONET);
c = d = 0;
while (1)
{
char *s = network_card_getname(c);
if (!s[0])
{
break;
}
settings_network_to_list[c] = d;
if (network_card_available(c))
{
if (c == 0)
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152));
}
else
{
mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
settings_list_to_network[d] = c;
d++;
}
c++;
}
SendMessage(h, CB_SETCURSEL, settings_network_to_list[temp_net_card], 0);
network_recalc_combos(hdlg);
free(lptsTemp);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_COMBONETTYPE:
if (net_ignore_message)
{
return FALSE;
}
h = GetDlgItem(hdlg, IDC_COMBONETTYPE);
temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0) - 1;
network_recalc_combos(hdlg);
break;
case IDC_COMBOPCAP:
if (net_ignore_message)
{
return FALSE;
}
h = GetDlgItem(hdlg, IDC_COMBOPCAP);
memset(temp_pcap_dev, 0, 520);
strcpy(temp_pcap_dev, netdev_list[SendMessage(h, CB_GETCURSEL, 0, 0)].device);
network_recalc_combos(hdlg);
break;
case IDC_COMBONET:
if (net_ignore_message)
{
return FALSE;
}
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
network_recalc_combos(hdlg);
break;
case IDC_CONFIGURENET:
if (net_ignore_message)
{
return FALSE;
}
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
deviceconfig_open(hdlg, (void *)network_card_getdevice(temp_net_card));
break;
}
return FALSE;
case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBONETTYPE);
temp_net_type = SendMessage(h, CB_GETCURSEL, 0, 0) - 1;
h = GetDlgItem(hdlg, IDC_COMBOPCAP);
memset(temp_pcap_dev, 0, 520);
strcpy(temp_pcap_dev, netdev_list[SendMessage(h, CB_GETCURSEL, 0, 0)].device);
h = GetDlgItem(hdlg, IDC_COMBONET);
temp_net_card = settings_list_to_network[SendMessage(h, CB_GETCURSEL, 0, 0)];
default:
return FALSE;
}
return FALSE;
}
static BOOL win_settings_hard_disks_image_list_init(HWND hwndList)
{
HICON hiconItem;
@@ -2687,32 +2856,6 @@ static BOOL CALLBACK win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARA
int fdlv_current_sel;
int cdlv_current_sel;
static void combo_id_to_bus(int combo_id)
{
switch (combo_id)
{
case 0: /* Disabled */
default:
temp_cdrom_drives[cdlv_current_sel].enabled = 0;
break;
case 1: /* Atapi (PIO-only) */
temp_cdrom_drives[cdlv_current_sel].enabled = 1;
temp_cdrom_drives[cdlv_current_sel].bus_type = 0;
temp_cdrom_drives[cdlv_current_sel].atapi_dma = 0;
break;
case 2: /* Atapi (PIA and DMA) */
temp_cdrom_drives[cdlv_current_sel].enabled = 1;
temp_cdrom_drives[cdlv_current_sel].bus_type = 0;
temp_cdrom_drives[cdlv_current_sel].atapi_dma = 1;
break;
case 3: /* SCSI */
temp_cdrom_drives[cdlv_current_sel].enabled = 1;
temp_cdrom_drives[cdlv_current_sel].bus_type = 1;
temp_cdrom_drives[cdlv_current_sel].atapi_dma = 0;
break;
}
}
static int combo_id_to_string_id(int combo_id)
{
switch (combo_id)
@@ -2721,13 +2864,13 @@ static int combo_id_to_string_id(int combo_id)
default:
return 2151;
break;
case 1: /* Atapi (PIO-only) */
case 2: /* Atapi (PIO-only) */
return 2189;
break;
case 2: /* Atapi (PIA and DMA) */
case 3: /* Atapi (PIA and DMA) */
return 2190;
break;
case 3: /* SCSI */
case 4: /* SCSI */
return 2168;
break;
}
@@ -2741,46 +2884,18 @@ static int combo_id_to_format_string_id(int combo_id)
default:
return 2151;
break;
case 1: /* Atapi (PIO-only) */
case 2: /* Atapi (PIO-only) */
return 2191;
break;
case 2: /* Atapi (PIA and DMA) */
case 3: /* Atapi (PIA and DMA) */
return 2192;
break;
case 3: /* SCSI */
case 4: /* SCSI */
return 2158;
break;
}
}
static int bus_to_combo_id(int id)
{
if (temp_cdrom_drives[id].enabled)
{
if (temp_cdrom_drives[id].bus_type)
{
return 3;
}
else
{
if (temp_cdrom_drives[id].atapi_dma)
{
return 2;
}
else
{
return 1;
}
}
}
else
{
return 0;
}
return 0;
}
static BOOL win_settings_floppy_drives_image_list_init(HWND hwndList)
{
HICON hiconItem;
@@ -2883,28 +2998,35 @@ static BOOL win_settings_cdrom_drives_recalc_list(HWND hwndList)
for (i = 0; i < 4; i++)
{
bid = bus_to_combo_id(i);
fsid = combo_id_to_format_string_id(bid);
fsid = combo_id_to_format_string_id(temp_cdrom_drives[i].bus_type);
switch (bid)
switch (temp_cdrom_drives[i].bus_type)
{
case 0:
default:
lvI.pszText = win_language_get_string_from_id(fsid);
break;
case 1:
case 2:
case 3:
wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1);
lvI.pszText = szText;
break;
case 3:
case 4:
wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun);
lvI.pszText = szText;
break;
}
lvI.iItem = i;
lvI.iImage = bid;
if (temp_cdrom_drives[i].bus_type)
{
lvI.iImage = temp_cdrom_drives[i].bus_type - 1;
}
else
{
lvI.iImage = 0;
}
if (ListView_InsertItem(hwndList, &lvI) == -1)
return FALSE;
@@ -3035,27 +3157,33 @@ static void win_settings_cdrom_drives_update_item(HWND hwndList, int i)
lvI.iSubItem = 0;
lvI.iItem = i;
bid = bus_to_combo_id(i);
fsid = combo_id_to_format_string_id(bid);
fsid = combo_id_to_format_string_id(temp_cdrom_drives[i].bus_type);
switch (bid)
switch (temp_cdrom_drives[i].bus_type)
{
case 0:
default:
lvI.pszText = win_language_get_string_from_id(fsid);
break;
case 1:
case 2:
case 3:
wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1);
lvI.pszText = szText;
break;
case 3:
case 4:
wsprintf(szText, win_language_get_string_from_id(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun);
lvI.pszText = szText;
break;
}
lvI.iImage = bid;
if (temp_cdrom_drives[i].bus_type)
{
lvI.iImage = temp_cdrom_drives[i].bus_type - 1;
}
else
{
lvI.iImage = 0;
}
if (ListView_SetItem(hwndList, &lvI) == -1)
{
@@ -3072,7 +3200,7 @@ static void cdrom_add_locations(HWND hdlg)
lptsTemp = (LPTSTR) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
for (i = 0; i < 4; i++)
for (i = 1; i < 5; i++)
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(combo_id_to_string_id(i)));
}
@@ -3105,7 +3233,7 @@ static void cdrom_recalc_location_controls(HWND hdlg)
int i = 0;
HWND h;
int bus = bus_to_combo_id(cdlv_current_sel);
int bus = temp_cdrom_drives[cdlv_current_sel].bus_type;
for (i = 1800; i < 1803; i++)
{
@@ -3128,8 +3256,8 @@ static void cdrom_recalc_location_controls(HWND hdlg)
switch(bus)
{
case 1: /* ATAPI (PIO-only) */
case 2: /* ATAPI (PIO and DMA) */
case 2: /* ATAPI (PIO-only) */
case 3: /* ATAPI (PIO and DMA) */
h = GetDlgItem(hdlg, 1802);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
@@ -3139,7 +3267,7 @@ static void cdrom_recalc_location_controls(HWND hdlg)
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].ide_channel, 0);
break;
case 3: /* SCSI */
case 4: /* SCSI */
h = GetDlgItem(hdlg, 1800);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
@@ -3205,7 +3333,14 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
cdrom_add_locations(hdlg);
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
SendMessage(h, CB_SETCURSEL, bus_to_combo_id(cdlv_current_sel), 0);
if (temp_cdrom_drives[cdlv_current_sel].bus_type > 1)
{
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type, 0);
}
else
{
SendMessage(h, CB_SETCURSEL, 0, 0);
}
cdrom_recalc_location_controls(hdlg);
rd_ignore_change = 0;
@@ -3256,7 +3391,14 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message
}
rd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
SendMessage(h, CB_SETCURSEL, bus_to_combo_id(cdlv_current_sel), 0);
if (temp_cdrom_drives[cdlv_current_sel].bus_type > 1)
{
SendMessage(h, CB_SETCURSEL, temp_cdrom_drives[cdlv_current_sel].bus_type, 0);
}
else
{
SendMessage(h, CB_SETCURSEL, 0, 0);
}
cdrom_recalc_location_controls(hdlg);
rd_ignore_change = 0;
}
@@ -3287,8 +3429,11 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message
rd_ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
cid = SendMessage(h, CB_GETCURSEL, 0, 0);
combo_id_to_bus(cid);
temp_cdrom_drives[cdlv_current_sel].bus_type = SendMessage(h, CB_GETCURSEL, 0, 0) + 1;
if (temp_cdrom_drives[cdlv_current_sel].bus_type == 1)
{
temp_cdrom_drives[cdlv_current_sel].bus_type = 0;
}
cdrom_recalc_location_controls(hdlg);
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
win_settings_cdrom_drives_update_item(h, cdlv_current_sel);
@@ -3375,12 +3520,15 @@ void win_settings_show_child(HWND hwndParent, DWORD child_id)
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_SOUND, hwndParent, win_settings_sound_proc);
break;
case 4:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_PERIPHERALS, hwndParent, win_settings_peripherals_proc);
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_NETWORK, hwndParent, win_settings_network_proc);
break;
case 5:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_HARD_DISKS, hwndParent, win_settings_hard_disks_proc);
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_PERIPHERALS, hwndParent, win_settings_peripherals_proc);
break;
case 6:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_HARD_DISKS, hwndParent, win_settings_hard_disks_proc);
break;
case 7:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR) CONFIGUREDLG_REMOVABLE_DEVICES, hwndParent, win_settings_removable_devices_proc);
break;
default:
@@ -3402,7 +3550,7 @@ static BOOL win_settings_main_image_list_init(HWND hwndList)
GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32, 1, 1);
for (i = 0; i < 7; i++)
for (i = 0; i < 8; i++)
{
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + i));
ImageList_AddIcon(hSmall, hiconItem);
@@ -3422,7 +3570,7 @@ static BOOL win_settings_main_insert_categories(HWND hwndList)
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < 7; i++)
for (i = 0; i < 8; i++)
{
lvI.pszText = win_language_get_settings_category(i);
lvI.iItem = i;
@@ -3465,7 +3613,7 @@ static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wPar
if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST))
{
category = -1;
for (i = 0; i < 7; i++)
for (i = 0; i < 8; i++)
{
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
j = ListView_GetItemState(h, i, LVIS_SELECTED);

View File

@@ -941,7 +941,7 @@ void update_status_bar_panes(HWND hwnds)
}
for (i = 0; i < 4; i++)
{
if (cdrom_drives[i].enabled != 0)
if (cdrom_drives[i].bus_type != 0)
{
edge += sb_icon_width;
iStatusWidths[sb_parts] = edge;
@@ -1015,13 +1015,17 @@ void update_status_bar_panes(HWND hwnds)
sb_icon_flags[i] = 0;
}
}
if (cdrom_drives[id].bus_type == 1)
if (cdrom_drives[id].bus_type == 4)
{
j = 164;
}
else if (cdrom_drives[id].bus_type == 3)
{
j = 162;
}
else
{
j = (cdrom_drives[id].atapi_dma) ? 162 : 160;
j = 160;
}
sb_part_icons[i] = j | sb_icon_flags[i];
create_cdrom_tip(i);
@@ -1606,7 +1610,7 @@ void win_cdrom_eject(uint8_t id)
cdrom_drives[id].handler->exit(id);
cdrom_close(id);
cdrom_null_open(id, 0);
if (cdrom_drives[id].enabled)
if (cdrom_drives[id].bus_type)
{
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
@@ -1638,7 +1642,7 @@ void win_cdrom_reload(uint8_t id)
if (cdrom_drives[id].prev_host_drive == 200)
{
image_open(id, cdrom_image[id].image_path);
if (cdrom_drives[id].enabled)
if (cdrom_drives[id].bus_type)
{
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
@@ -1651,7 +1655,7 @@ void win_cdrom_reload(uint8_t id)
{
new_cdrom_drive = cdrom_drives[id].prev_host_drive;
ioctl_open(id, new_cdrom_drive);
if (cdrom_drives[id].enabled)
if (cdrom_drives[id].bus_type)
{
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
@@ -2347,7 +2351,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
cdrom_drives[cdrom_id].handler->exit(cdrom_id);
cdrom_close(cdrom_id);
image_open(cdrom_id, temp_image_path);
if (cdrom_drives[cdrom_id].enabled)
if (cdrom_drives[cdrom_id].bus_type)
{
/* Signal disc change to the emulated machine. */
cdrom_insert(cdrom_id);
@@ -2381,7 +2385,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
cdrom_drives[cdrom_id].handler->exit(cdrom_id);
cdrom_close(cdrom_id);
ioctl_open(cdrom_id, new_cdrom_drive);
if (cdrom_drives[cdrom_id].enabled)
if (cdrom_drives[cdrom_id].bus_type)
{
/* Signal disc change to the emulated machine. */
cdrom_insert(cdrom_id);