Added emulation IDE PIO-only hard disks (affects hard disk bus type in the configuration files - make sure to correct it in Settings after loading a configuration file from previous 86Box builds);

The IDENTIFY PACKET DEVICE command of ATAPI PIO-only drives now behaves like that of mainline PCem ATAPI CD-ROM's;
Added two functions in win.c for waltje for updating the status bar text;
The configuration loader now does sanity checks on most loaded values.
This commit is contained in:
OBattler
2017-05-10 02:46:01 +02:00
parent 95d201d4fd
commit ff8186741a
10 changed files with 217 additions and 97 deletions

View File

@@ -514,12 +514,14 @@ END
163 ICON DISCARDABLE "ICONS/cdrom_atapi_dma_active.ico"
164 ICON DISCARDABLE "ICONS/cdrom_scsi.ico"
165 ICON DISCARDABLE "ICONS/cdrom_scsi_active.ico"
176 ICON DISCARDABLE "ICONS/hard_disk.ico"
177 ICON DISCARDABLE "ICONS/hard_disk_active.ico"
178 ICON DISCARDABLE "ICONS/hard_disk_ide.ico"
179 ICON DISCARDABLE "ICONS/hard_disk_ide_active.ico"
180 ICON DISCARDABLE "ICONS/hard_disk_scsi.ico"
181 ICON DISCARDABLE "ICONS/hard_disk_scsi_active.ico"
176 ICON DISCARDABLE "ICONS/hard_disk_mfm.ico"
177 ICON DISCARDABLE "ICONS/hard_disk_mfm_active.ico"
178 ICON DISCARDABLE "ICONS/hard_disk.ico"
179 ICON DISCARDABLE "ICONS/hard_disk_active.ico"
180 ICON DISCARDABLE "ICONS/hard_disk_ide.ico"
181 ICON DISCARDABLE "ICONS/hard_disk_ide_active.ico"
182 ICON DISCARDABLE "ICONS/hard_disk_scsi.ico"
183 ICON DISCARDABLE "ICONS/hard_disk_scsi_active.ico"
256 ICON DISCARDABLE "ICONS/machine.ico"
257 ICON DISCARDABLE "ICONS/video.ico"
258 ICON DISCARDABLE "ICONS/input_devices.ico"
@@ -660,7 +662,7 @@ BEGIN
2048 "86Box"
IDS_STRING2049 "86Box Error"
IDS_STRING2050 "86Box Fatal Error"
IDS_STRING2051 "This will reset 86Box.\nDo you want to save the settings?"
IDS_STRING2051 "This will reset 86Box.\nAre you sure you want to save the settings?"
IDS_STRING2052 "DirectDraw Screenshot Error"
IDS_STRING2053 "Invalid number of sectors (valid values are between 1 and 63)"
IDS_STRING2054 "Invalid number of heads (valid values are between 1 and 16)"
@@ -790,17 +792,17 @@ BEGIN
2154 "Internal IDE"
2155 "IRQ %i"
2156 "MFM (%01i:%01i)"
2157 "IDE (%01i:%01i)"
2157 "IDE (PIO+DMA) (%01i:%01i)"
2158 "SCSI (%02i:%02i)"
2159 "IDE (PIO-only)"
2159 "Invalid number of cylinders (valid values are between 1 and 1023)"
2160 "%" PRIu64
2161 "Genius Bus mouse"
2162 "Amstrad mouse"
2163 "Attempting to create a spuriously large hard disk image"
2164 "Invalid number of sectors (valid values are between 1 and 99)"
2165 "Invalid number of cylinders (valid values are between 1 and 1023)"
2166 "MFM"
2167 "IDE"
2165 "MFM"
2166 "IDE (PIO-only)"
2167 "IDE (PIO and DMA)"
2168 "SCSI"
2169 "%01i:%01i"
2170 "Custom..."
@@ -811,12 +813,12 @@ BEGIN
2175 "CD-ROM image (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0"
2176 "Use CTRL + ALT + PAGE DOWN to return to windowed mode"
2177 "Olivetti M24 mouse"
2178 "<Placeholder string>"
2178 "This image exists and will be overwritten.\nAre you sure you want to use it?"
2179 "Floppy %i (%s): %ws"
2180 "CD-ROM %i: %ws"
2181 "Removable disk %i: %s"
2182 "MFM hard disk"
2183 "IDE hard disk"
2181 "MFM hard disk"
2182 "IDE hard disk (PIO-only)"
2183 "IDE hard disk (PIO and DMA)"
2184 "SCSI hard disk"
2185 "(empty)"
2186 "(host drive %c:)"
@@ -828,7 +830,11 @@ BEGIN
2192 "ATAPI (PIO and DMA) (%01i:%01i)"
2193 "Use CTRL + ALT + PAGE DOWN to return to windowed mode"
2194 "Unable to create bitmap file: %s"
2195 "English (United States)"
2195 "IDE (PIO-only) (%01i:%01i)"
2196 "Add New Hard Disk"
2197 "Add Existing Hard Disk"
2198 "Removable disk %i: %s"
2199 "English (United States)"
END

BIN
src/ICONS/hard_disk_mfm.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -530,10 +530,10 @@ void loadconfig(wchar_t *fn)
else
config_load(fn);
GAMEBLASTER = config_get_int(NULL, "gameblaster", 0);
GUS = config_get_int(NULL, "gus", 0);
SSI2001 = config_get_int(NULL, "ssi2001", 0);
voodoo_enabled = config_get_int(NULL, "voodoo", 0);
GAMEBLASTER = !!config_get_int(NULL, "gameblaster", 0);
GUS = !!config_get_int(NULL, "gus", 0);
SSI2001 = !!config_get_int(NULL, "ssi2001", 0);
voodoo_enabled = !!config_get_int(NULL, "voodoo", 0);
/* SCSI */
p = (char *)config_get_string(NULL, "scsicard", "");
@@ -566,7 +566,7 @@ void loadconfig(wchar_t *fn)
romset = model_getromset();
cpu_manufacturer = config_get_int(NULL, "cpu_manufacturer", 0);
cpu = config_get_int(NULL, "cpu", 0);
cpu_use_dynarec = config_get_int(NULL, "cpu_use_dynarec", 0);
cpu_use_dynarec = !!config_get_int(NULL, "cpu_use_dynarec", 0);
cpu_waitstates = config_get_int(NULL, "cpu_waitstates", 0);
@@ -585,6 +585,10 @@ void loadconfig(wchar_t *fn)
mem_size = config_get_int(NULL, "mem_size", 4096);
if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram))
mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram);
if (mem_size > 1048576)
{
mem_size = 1048576;
}
for (c = 0; c < FDD_NUM; c++)
{
@@ -594,6 +598,10 @@ void loadconfig(wchar_t *fn)
fdd_set_type(c, fdd_get_from_internal_name(p));
else
fdd_set_type(c, (c < 2) ? 2 : 0);
if (fdd_get_type(c) > 13)
{
fdd_set_type(c, 13);
}
sprintf(temps, "fdd_%02i_fn", c + 1);
wp = (wchar_t *)config_get_wstring(NULL, temps, L"");
@@ -604,7 +612,7 @@ void loadconfig(wchar_t *fn)
}
printf("Floppy: %ws\n", discfns[c]);
sprintf(temps, "fdd_%02i_writeprot", c + 1);
ui_writeprot[c] = config_get_int(NULL, temps, 0);
ui_writeprot[c] = !!config_get_int(NULL, temps, 0);
}
p = (char *)config_get_string(NULL, "hdd_controller", "");
@@ -627,20 +635,52 @@ void loadconfig(wchar_t *fn)
{
sprintf(temps, "hdd_%02i_sectors", c + 1);
hdc[c].spt = config_get_int(NULL, temps, 0);
if (hdc[c].spt > 99)
{
hdc[c].spt = 99;
}
sprintf(temps, "hdd_%02i_heads", c + 1);
hdc[c].hpc = config_get_int(NULL, temps, 0);
if (hdc[c].hpc > 64)
{
hdc[c].hpc = 64;
}
sprintf(temps, "hdd_%02i_cylinders", c + 1);
hdc[c].tracks = config_get_int(NULL, temps, 0);
if (hdc[c].tracks > 266305)
{
hdc[c].tracks = 266305;
}
sprintf(temps, "hdd_%02i_bus_type", c + 1);
hdc[c].bus = config_get_int(NULL, temps, 0);
if (hdc[c].bus > 4)
{
hdc[c].bus = 4;
}
sprintf(temps, "hdd_%02i_mfm_channel", c + 1);
hdc[c].mfm_channel = config_get_int(NULL, temps, 0);
if (hdc[c].mfm_channel > 1)
{
hdc[c].mfm_channel = 1;
}
sprintf(temps, "hdd_%02i_ide_channel", c + 1);
hdc[c].ide_channel = config_get_int(NULL, temps, 0);
if (hdc[c].ide_channel > 7)
{
hdc[c].ide_channel = 7;
}
sprintf(temps, "hdd_%02i_scsi_device_id", c + 1);
hdc[c].scsi_id = config_get_int(NULL, temps, (c < 7) ? c : ((c < 15) ? (c + 1) : 15));
if (hdc[c].scsi_id > 15)
{
hdc[c].scsi_id = 15;
}
sprintf(temps, "hdd_%02i_scsi_device_lun", c + 1);
hdc[c].scsi_lun = config_get_int(NULL, temps, 0);
if (hdc[c].scsi_lun > 7)
{
hdc[c].scsi_lun = 7;
}
sprintf(temps, "hdd_%02i_fn", c + 1);
wp = (wchar_t *)config_get_wstring(NULL, temps, L"");
if (wp) memcpy(hdd_fn[c], wp, 512);
@@ -657,19 +697,35 @@ void loadconfig(wchar_t *fn)
cdrom_drives[c].host_drive = config_get_int(NULL, temps, 0);
cdrom_drives[c].prev_host_drive = cdrom_drives[c].host_drive;
sprintf(temps, "cdrom_%02i_enabled", c + 1);
cdrom_drives[c].enabled = config_get_int(NULL, temps, 0);
cdrom_drives[c].enabled = !!config_get_int(NULL, temps, 0);
sprintf(temps, "cdrom_%02i_sound_on", c + 1);
cdrom_drives[c].sound_on = config_get_int(NULL, temps, 1);
cdrom_drives[c].sound_on = !!config_get_int(NULL, temps, 1);
sprintf(temps, "cdrom_%02i_bus_type", c + 1);
cdrom_drives[c].bus_type = config_get_int(NULL, temps, 0);
if (cdrom_drives[c].bus_type > 1)
{
cdrom_drives[c].bus_type = 1;
}
sprintf(temps, "cdrom_%02i_atapi_dma", c + 1);
cdrom_drives[c].atapi_dma = config_get_int(NULL, temps, 0);
cdrom_drives[c].atapi_dma = !!config_get_int(NULL, temps, 0);
sprintf(temps, "cdrom_%02i_ide_channel", c + 1);
cdrom_drives[c].ide_channel = config_get_int(NULL, temps, 2);
if (cdrom_drives[c].ide_channel > 7)
{
cdrom_drives[c].ide_channel = 7;
}
sprintf(temps, "cdrom_%02i_scsi_device_id", c + 1);
cdrom_drives[c].scsi_device_id = config_get_int(NULL, temps, c + 2);
if (cdrom_drives[c].scsi_device_id > 15)
{
cdrom_drives[c].scsi_device_id = 15;
}
sprintf(temps, "cdrom_%02i_scsi_device_lun", c + 1);
cdrom_drives[c].scsi_device_lun = config_get_int(NULL, temps, 0);
if (cdrom_drives[c].scsi_device_lun > 7)
{
cdrom_drives[c].scsi_device_lun = 7;
}
sprintf(temps, "cdrom_%02i_image_path", c + 1);
wp = (wchar_t *)config_get_wstring(NULL, temps, L"");
@@ -680,17 +736,17 @@ void loadconfig(wchar_t *fn)
}
}
vid_resize = config_get_int(NULL, "vid_resize", 0);
vid_resize = !!config_get_int(NULL, "vid_resize", 0);
vid_api = config_get_int(NULL, "vid_api", 0);
video_fullscreen_scale = config_get_int(NULL, "video_fullscreen_scale", 0);
video_fullscreen_first = config_get_int(NULL, "video_fullscreen_first", 1);
force_43 = config_get_int(NULL, "force_43", 0);
scale = config_get_int(NULL, "scale", 1);
enable_overscan = config_get_int(NULL, "enable_overscan", 0);
force_43 = !!config_get_int(NULL, "force_43", 0);
scale = !!config_get_int(NULL, "scale", 1);
enable_overscan = !!config_get_int(NULL, "enable_overscan", 0);
enable_sync = config_get_int(NULL, "enable_sync", 1);
opl3_type = config_get_int(NULL, "opl3_type", 1);
enable_sync = !!config_get_int(NULL, "enable_sync", 1);
opl3_type = !!config_get_int(NULL, "opl3_type", 1);
window_w = config_get_int(NULL, "window_w", 0);
window_h = config_get_int(NULL, "window_h", 0);
@@ -705,8 +761,7 @@ void loadconfig(wchar_t *fn)
else
mouse_type = 0;
enable_xtide = config_get_int(NULL, "enable_xtide", 1);
enable_external_fpu = config_get_int(NULL, "enable_external_fpu", 0);
enable_external_fpu = !!config_get_int(NULL, "enable_external_fpu", 0);
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++)
{
@@ -757,10 +812,10 @@ void loadconfig(wchar_t *fn)
path_len = wcslen(nvr_path);
serial_enabled[0] = config_get_int(NULL, "serial1_enabled", 1);
serial_enabled[1] = config_get_int(NULL, "serial2_enabled", 1);
lpt_enabled = config_get_int(NULL, "lpt_enabled", 1);
bugger_enabled = config_get_int(NULL, "bugger_enabled", 0);
serial_enabled[0] = !!config_get_int(NULL, "serial1_enabled", 1);
serial_enabled[1] = !!config_get_int(NULL, "serial2_enabled", 1);
lpt_enabled = !!config_get_int(NULL, "lpt_enabled", 1);
bugger_enabled = !!config_get_int(NULL, "bugger_enabled", 0);
}
wchar_t temp_nvr_path[1024];
@@ -896,7 +951,6 @@ void saveconfig(void)
config_set_int(NULL, "joystick_type", joystick_type);
config_set_string(NULL, "mouse_type", mouse_get_internal_name(mouse_type));
config_set_int(NULL, "enable_xtide", enable_xtide);
config_set_int(NULL, "enable_external_fpu", enable_external_fpu);
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++)

View File

@@ -761,6 +761,8 @@ void runpc();
void saveconfig();
void softresetx86();
void speedchanged();
void status_settextw(wchar_t *wstr);
void status_settext(char *str);
void trc_reset(uint8_t val);
void update_status_bar_icon(int tag, int active);
void update_status_bar_icon_state(int tag, int state);

View File

@@ -382,7 +382,7 @@ static void ide_identify(IDE *ide)
ide->buffer[21] = 512; /*Buffer size*/
ide->buffer[47] = 16; /*Max sectors on multiple transfer command*/
ide->buffer[48] = 1; /*Dword transfers supported*/
if (PCI && (ide->board < 2))
if (PCI && (ide->board < 2) && (hdc[ide->hdc_num].bus == 3))
{
ide->buffer[49] = (1 << 8); /* LBA and DMA supported */
}
@@ -396,7 +396,6 @@ static void ide_identify(IDE *ide)
}
ide->buffer[50] = 0x4000; /* Capabilities */
ide->buffer[51] = 2 << 8; /*PIO timing mode*/
ide->buffer[52] = 2 << 8; /*DMA timing mode*/
#if 0
ide->buffer[53] = 1;
ide->buffer[55] = ide->hpc;
@@ -419,8 +418,9 @@ static void ide_identify(IDE *ide)
ide->buffer[60] = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) & 0xFFFF; /* Total addressable sectors (LBA) */
ide->buffer[61] = ((hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) >> 16) & 0x0FFF;
}
if (PCI && (ide->board < 2))
if (PCI && (ide->board < 2) && (hdc[ide->hdc_num].bus == 3))
{
ide->buffer[52] = 2 << 8; /*DMA timing mode*/
ide->buffer[63] = 7;
}
ide->buffer[80] = 0xe; /*ATA-1 to ATA-3 supported*/
@@ -444,16 +444,16 @@ static void ide_atapi_identify(IDE *ide)
ide_padstr((char *) (ide->buffer + 10), "", 20); /* Serial Number */
ide_padstr((char *) (ide->buffer + 23), emulator_version, 8); /* Firmware */
ide_padstr((char *) (ide->buffer + 27), device_identify, 40); /* Model */
ide->buffer[48] = 1; /*Dword transfers supported*/
ide->buffer[49] = 0x200; /* LBA supported */
ide->buffer[73] = 6;
ide->buffer[74] = 9;
ide->buffer[80] = 0x10; /*ATA/ATAPI-4 supported*/
if (PCI && (ide->board < 2) && (cdrom_drives[cdrom_id].bus_mode & 2))
{
ide->buffer[48] = 1; /*Dword transfers supported*/
ide->buffer[49] |= 0x100; /* DMA supported */
ide->buffer[63] = 7;
ide->buffer[73] = 6;
ide->buffer[74] = 9;
ide->buffer[80] = 0x10; /*ATA/ATAPI-4 supported*/
}
}
@@ -787,7 +787,7 @@ void resetide(void)
c = 0;
for (d = 0; d < HDC_NUM; d++)
{
if ((hdc[d].bus == 2) && (hdc[d].ide_channel < IDE_NUM))
if (((hdc[d].bus == 2) || (hdc[d].bus == 3)) && (hdc[d].ide_channel < IDE_NUM))
{
pclog("Found IDE hard disk on channel %i\n", hdc[d].ide_channel);
loadhd(&ide_drives[hdc[d].ide_channel], d, hdd_fn[d]);
@@ -1413,7 +1413,7 @@ uint32_t ide_read_data(int ide_board, int length)
}
else
{
update_status_bar_icon(0x21, 0);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 0);
}
}
}
@@ -1736,7 +1736,7 @@ void callbackide(int ide_board)
ide_irq_raise(ide);
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
return;
case WIN_READ_DMA:
@@ -1770,12 +1770,12 @@ void callbackide(int ide_board)
ide_next_sector(ide);
ide->atastat = BUSY_STAT;
idecallback[ide_board]=6*IDE_TIME;
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
}
else
{
ide_irq_raise(ide);
update_status_bar_icon(0x21, 0);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 0);
}
}
}
@@ -1813,7 +1813,7 @@ void callbackide(int ide_board)
ide->blockcount = 0;
}
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
return;
case WIN_WRITE:
@@ -1836,12 +1836,12 @@ void callbackide(int ide_board)
ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT;
ide->pos=0;
ide_next_sector(ide);
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
}
else
{
ide->atastat = READY_STAT | DSC_STAT;
update_status_bar_icon(0x21, 0);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 0);
}
return;
@@ -1877,12 +1877,12 @@ void callbackide(int ide_board)
ide_next_sector(ide);
ide->atastat = BUSY_STAT;
idecallback[ide_board]=6*IDE_TIME;
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
}
else
{
ide_irq_raise(ide);
update_status_bar_icon(0x21, 0);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 0);
}
}
}
@@ -1913,12 +1913,12 @@ void callbackide(int ide_board)
ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT;
ide->pos=0;
ide_next_sector(ide);
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
}
else
{
ide->atastat = READY_STAT | DSC_STAT;
update_status_bar_icon(0x21, 0);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 0);
}
return;
@@ -1935,7 +1935,7 @@ void callbackide(int ide_board)
ide->pos=0;
ide->atastat = READY_STAT | DSC_STAT;
ide_irq_raise(ide);
update_status_bar_icon(0x21, 1);
update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1);
return;
case WIN_FORMAT:
@@ -1957,7 +1957,7 @@ void callbackide(int ide_board)
ide->atastat = READY_STAT | DSC_STAT;
ide_irq_raise(ide);
/* update_status_bar_icon(0x21, 1); */
/* update_status_bar_icon((hdc[ide->hdc_num].bus == 3) ? 0x22 : 0x21, 1); */
return;
case WIN_DRIVE_DIAGNOSTICS:

View File

@@ -175,7 +175,7 @@ int find_hdc_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun)
for (i = 0; i < HDC_NUM; i++)
{
if ((hdc[i].bus == 3) && (hdc[i].scsi_id == scsi_id) && (hdc[i].scsi_lun == scsi_lun))
if ((hdc[i].bus == 4) && (hdc[i].scsi_id == scsi_id) && (hdc[i].scsi_lun == scsi_lun))
{
return i;
}
@@ -852,11 +852,11 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
shdc[id].all_blocks_total = shdc[id].block_total;
if (shdc[id].packet_status != CDROM_PHASE_COMPLETE)
{
update_status_bar_icon(0x22, 1);
update_status_bar_icon(0x23, 1);
}
else
{
update_status_bar_icon(0x22, 0);
update_status_bar_icon(0x23, 0);
}
return;
@@ -913,11 +913,11 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
shdc[id].all_blocks_total = shdc[id].block_total;
if (shdc[id].packet_status != CDROM_PHASE_COMPLETE)
{
update_status_bar_icon(0x22, 1);
update_status_bar_icon(0x23, 1);
}
else
{
update_status_bar_icon(0x22, 0);
update_status_bar_icon(0x23, 0);
}
return;
@@ -1129,7 +1129,7 @@ void scsi_hd_callback(uint8_t id)
shdc[id].status = READY_STAT;
shdc[id].phase = 3;
shdc[id].packet_status = 0xFF;
update_status_bar_icon(0x22, 0);
update_status_bar_icon(0x23, 0);
return;
case CDROM_PHASE_DATA_OUT:
scsi_hd_log("SCSI HD %i: PHASE_DATA_OUT\n", id);
@@ -1142,7 +1142,7 @@ void scsi_hd_callback(uint8_t id)
shdc[id].packet_status = CDROM_PHASE_COMPLETE;
shdc[id].status = READY_STAT;
shdc[id].phase = 3;
update_status_bar_icon(0x22, 0);
update_status_bar_icon(0x23, 0);
return;
case CDROM_PHASE_DATA_IN:
scsi_hd_log("SCSI HD %i: PHASE_DATA_IN\n", id);
@@ -1155,7 +1155,7 @@ void scsi_hd_callback(uint8_t id)
shdc[id].packet_status = CDROM_PHASE_COMPLETE;
shdc[id].status = READY_STAT;
shdc[id].phase = 3;
update_status_bar_icon(0x22, 0);
update_status_bar_icon(0x23, 0);
return;
case CDROM_PHASE_ERROR:
scsi_hd_log("SCSI HD %i: PHASE_ERROR\n", id);

View File

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

View File

@@ -1457,7 +1457,7 @@ static BOOL win_settings_hard_disks_image_list_init(HWND hwndList)
GetSystemMetrics(SM_CYSMICON),
ILC_MASK | ILC_COLOR32, 1, 1);
for (i = 0; i < 6; i += 2)
for (i = 0; i < 8; i += 2)
{
hiconItem = LoadIcon(hinstance, (LPCWSTR) (176 + i));
ImageList_AddIcon(hSmall, hiconItem);
@@ -1486,11 +1486,6 @@ static void normalize_hd_list()
}
for (i = 0; i < HDC_NUM; i++)
{
if ((temp_hdc[i].bus == 3) && (temp_hdc[i].scsi_id == 7))
{
/* SCSI ID 7 is the host adapter, so any hard disk set to SCSI bus and ID 7 is to be treated as disabled and marked as such. */
temp_hdc[i].bus = 0;
}
if (temp_hdc[i].bus > 0)
{
memcpy(&(ihdc[j]), &(temp_hdc[i]), sizeof(hard_disk_t));
@@ -1540,9 +1535,9 @@ static void add_locations(HWND hdlg)
lptsTemp = (LPTSTR) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS);
for (i = 0; i < 3; i++)
for (i = 0; i < 4; i++)
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2166 + i));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2165 + i));
}
h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL);
@@ -1623,7 +1618,8 @@ static void recalc_location_controls(HWND hdlg, int is_add_dlg)
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.mfm_channel : temp_hdc[hdlv_current_sel].mfm_channel, 0);
break;
case 1: /* IDE */
case 1: /* IDE (PIO-only) */
case 2: /* IDE (PIO and DMA) */
h = GetDlgItem(hdlg, 1802);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
@@ -1633,7 +1629,7 @@ static void recalc_location_controls(HWND hdlg, int is_add_dlg)
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, is_add_dlg ? new_hdc.ide_channel : temp_hdc[hdlv_current_sel].ide_channel, 0);
break;
case 2: /* SCSI */
case 3: /* SCSI */
h = GetDlgItem(hdlg, 1800);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
@@ -1661,8 +1657,7 @@ static void recalc_location_controls(HWND hdlg, int is_add_dlg)
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
EnableWindow(h, FALSE); ShowWindow(h, SW_HIDE);
}
else
{
@@ -1682,7 +1677,8 @@ static void recalc_next_free_id(HWND hdlg)
int i;
int c_mfm = 0;
int c_ide = 0;
int c_ide_pio = 0;
int c_ide_dma = 0;
int c_scsi = 0;
int enable_add = 0;
@@ -1696,9 +1692,13 @@ static void recalc_next_free_id(HWND hdlg)
}
else if (temp_hdc[i].bus == 2)
{
c_ide++;
c_ide_pio++;
}
else if (temp_hdc[i].bus == 3)
{
c_ide_dma++;
}
else if (temp_hdc[i].bus == 4)
{
c_scsi++;
}
@@ -1717,7 +1717,7 @@ static void recalc_next_free_id(HWND hdlg)
enable_add = enable_add || (next_free_id >= 0);
/* pclog("Enable add: %i\n", enable_add); */
enable_add = enable_add && ((c_mfm < MFM_NUM) || (c_ide < IDE_NUM) || (c_scsi < SCSI_NUM));
enable_add = enable_add && ((c_mfm < MFM_NUM) || (c_ide_pio < IDE_NUM) || (c_ide_dma < IDE_NUM) || (c_scsi < SCSI_NUM));
/* pclog("Enable add: %i\n", enable_add); */
h = GetDlgItem(hdlg, IDC_BUTTON_HDD_ADD_NEW);
@@ -1744,7 +1744,7 @@ static void recalc_next_free_id(HWND hdlg)
h = GetDlgItem(hdlg, IDC_BUTTON_HDD_REMOVE);
if ((c_mfm == 0) && (c_ide == 0) && (c_scsi == 0))
if ((c_mfm == 0) && (c_ide_pio == 0) && (c_ide_dma == 0) && (c_scsi == 0))
{
EnableWindow(h, FALSE);
}
@@ -1773,9 +1773,12 @@ static void win_settings_hard_disks_update_item(HWND hwndList, int i, int column
wsprintf(szText, win_language_get_string_from_id(2156), temp_hdc[i].mfm_channel >> 1, temp_hdc[i].mfm_channel & 1);
break;
case 2:
wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
wsprintf(szText, win_language_get_string_from_id(2195), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
break;
case 3:
wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
break;
case 4:
wsprintf(szText, win_language_get_string_from_id(2158), temp_hdc[i].scsi_id, temp_hdc[i].scsi_lun);
break;
}
@@ -1845,9 +1848,12 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList)
wsprintf(szText, win_language_get_string_from_id(2156), temp_hdc[i].mfm_channel >> 1, temp_hdc[i].mfm_channel & 1);
break;
case 2:
wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
wsprintf(szText, win_language_get_string_from_id(2195), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
break;
case 3:
wsprintf(szText, win_language_get_string_from_id(2157), temp_hdc[i].ide_channel >> 1, temp_hdc[i].ide_channel & 1);
break;
case 4:
wsprintf(szText, win_language_get_string_from_id(2158), temp_hdc[i].scsi_id, temp_hdc[i].scsi_lun);
break;
}
@@ -1946,11 +1952,11 @@ static BOOL win_settings_hard_disks_init_columns(HWND hwndList)
{
case 0: /* Bus */
lvc.cx = 85;
lvc.cx = 135;
lvc.fmt = LVCFMT_LEFT;
break;
case 2: /* Cylinders */
lvc.cx = 51;
lvc.cx = 41;
lvc.fmt = LVCFMT_RIGHT;
break;
case 3: /* Heads */
@@ -1959,11 +1965,11 @@ static BOOL win_settings_hard_disks_init_columns(HWND hwndList)
lvc.fmt = LVCFMT_RIGHT;
break;
case 1: /* File */
lvc.cx = 180;
lvc.cx = 150;
lvc.fmt = LVCFMT_LEFT;
break;
case 5: /* Size (MB) 8 */
lvc.cx = 51;
lvc.cx = 41;
lvc.fmt = LVCFMT_RIGHT;
break;
}
@@ -2086,6 +2092,8 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
case WM_INITDIALOG:
memset(hd_file_name, 0, 512);
SetWindowText(hdlg, win_language_get_string_from_id(existing ? 2197 : 2196));
no_update = 1;
spt = existing ? 0 : 17;
set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt);
@@ -2223,6 +2231,19 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
case IDC_CFILE:
if (!file_dlg_w(hdlg, win_language_get_string_from_id(2172), L"", !existing))
{
if (!existing)
{
f = _wfopen(wopenfilestring, L"rb");
if (f != NULL)
{
fclose(f);
if (msgbox_question(ghwnd, 2178) != IDYES)
{
return FALSE;
}
}
}
f = _wfopen(wopenfilestring, existing ? L"rb" : L"wb");
if (f == NULL)
{

View File

@@ -832,7 +832,7 @@ void create_hd_tip(int part)
WCHAR *szText;
int bus = sb_part_meanings[part] & 0xf;
szText = (WCHAR *) win_language_get_string_from_id(2182 + bus);
szText = (WCHAR *) win_language_get_string_from_id(2181 + bus);
memcpy(sbTips[part], szText, (wcslen(szText) << 1) + 2);
}
@@ -894,6 +894,34 @@ static int get_cd_state(int id)
}
}
void status_settextw(wchar_t *wstr)
{
int i = 0;
int part = -1;
for (i = 0; i < sb_parts; i++)
{
if (sb_part_meanings[i] == 0x30)
{
part = i;
}
}
if (part != -1)
{
SendMessage(hwndStatus, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM) wstr);
}
}
static wchar_t cwstr[512];
void status_settext(char *str)
{
memset(cwstr, 0, 1024);
mbstowcs(cwstr, str, strlen(str) + 1);
status_settextw(cwstr);
}
void update_status_bar_panes(HWND hwnds)
{
int i, j, id;
@@ -901,12 +929,14 @@ void update_status_bar_panes(HWND hwnds)
int c_rll = 0;
int c_mfm = 0;
int c_ide = 0;
int c_ide_pio = 0;
int c_ide_dma = 0;
int c_scsi = 0;
c_mfm = count_hard_disks(1);
c_ide = count_hard_disks(2);
c_scsi = count_hard_disks(3);
c_ide_pio = count_hard_disks(2);
c_ide_dma = count_hard_disks(3);
c_scsi = count_hard_disks(4);
sb_parts = 0;
memset(sb_part_meanings, 0, 40);
@@ -938,20 +968,27 @@ void update_status_bar_panes(HWND hwnds)
sb_part_meanings[sb_parts] = 0x20;
sb_parts++;
}
if (c_ide && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5))
if (c_ide_pio && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5))
{
edge += sb_icon_width;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = 0x21;
sb_parts++;
}
if (c_scsi)
if (c_ide_dma && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5))
{
edge += sb_icon_width;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = 0x22;
sb_parts++;
}
if (c_scsi)
{
edge += sb_icon_width;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = 0x23;
sb_parts++;
}
if (sb_parts)
{
iStatusWidths[sb_parts - 1] += (24 - sb_icon_width);