From ab401809a76e8b54526006c307ceb02804da4261 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 6 Sep 2018 17:02:49 +0200 Subject: [PATCH] Reaplied the changes to device_add() that were needed to allow one device to correctly add another, fixes IDE hard disks after reset. --- src/device.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index 865ebf42b..86ac96336 100644 --- a/src/device.c +++ b/src/device.c @@ -9,7 +9,7 @@ * Implementation of the generic device interface to handle * all devices attached to the emulator. * - * Version: @(#)device.c 1.0.15 2018/09/06 + * Version: @(#)device.c 1.0.16 2018/09/06 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -168,18 +168,22 @@ device_add(const device_t *d) device_current = (device_t *)d; + devices[c] = (device_t *)d; + if (d->init != NULL) { priv = d->init(d); if (priv == NULL) { if (d->name) device_log("DEVICE: device '%s' init failed\n", d->name); - else + else device_log("DEVICE: device init failed\n"); + + device_priv[c] = NULL; + return(NULL); } } - devices[c] = (device_t *)d; device_priv[c] = priv; return(priv);