From 9ae91cdae64216c20c3faccdd0059e0fd52d36c2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Mar 2018 19:09:26 +0100 Subject: [PATCH] (D)word reads from IDE channels with no device attached now always return FFFF(FFFF), fixes the last IDE-related crashes. --- src/disk/hdc_ide.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index d07532abd..e80e287b0 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.35 2018/03/16 + * Version: @(#)hdc_ide.c 1.0.36 2018/03/16 * * Authors: Sarah Walker, * Miran Grca, @@ -1612,6 +1612,20 @@ uint32_t ide_read_data(int ide_board, int length) IDE *ide = &ide_drives[cur_ide[ide_board]]; uint32_t temp; + if (!ide->buffer) { + switch (length) + { + case 1: + return 0xff; + case 2: + return 0xffff; + case 4: + return 0xffffffff; + default: + return 0; + } + } + uint8_t *idebufferb = (uint8_t *) ide->buffer; uint16_t *idebufferw = ide->buffer; uint32_t *idebufferl = (uint32_t *) ide->buffer;