From 215b3253a5f2ae247bbe7b3d6dbb929cf663c570 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Mon, 8 Jul 2024 00:40:52 -0400 Subject: [PATCH] Deal with some magic numbers re hdc_current --- src/disk/hdc.c | 2 +- src/include/86box/config.h | 1 + src/machine/m_at_compaq.c | 4 ++-- src/machine/m_europc.c | 2 +- src/machine/m_ps1.c | 2 +- src/machine/m_ps2_isa.c | 2 +- src/machine/m_v86p.c | 2 +- src/machine/m_xt_t1000.c | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/disk/hdc.c b/src/disk/hdc.c index 034b8890e..bb7adcd67 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -132,7 +132,7 @@ hdc_reset(void) hdc_current, (machines[machine].flags & MACHINE_HDC) ? 1 : 0); /* If we have a valid controller, add its device. */ - if (hdc_current > 1) + if (hdc_current > HDC_INTERNAL) device_add(controllers[hdc_current].device); /* Now, add the tertiary and/or quaternary IDE controllers. */ diff --git a/src/include/86box/config.h b/src/include/86box/config.h index 80c987162..8ce6f4cfe 100644 --- a/src/include/86box/config.h +++ b/src/include/86box/config.h @@ -114,6 +114,7 @@ typedef struct config_t { /* Other peripherals category */ int fdc_type; /* Floppy disk controller type */ + int hdc_current; /* Hard disk controller type */ int hdc; /* Hard disk controller */ int scsi_card; /* SCSI controller */ int ide_ter_enabled; /* Tertiary IDE controller enabled */ diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index 7f31d4ecd..b628ea095 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -798,7 +798,7 @@ machine_at_compaq_init(const machine_t *model, int type) break; case COMPAQ_PORTABLEIII: - if (hdc_current == 1) + if (hdc_current == HDC_INTERNAL) device_add(&ide_isa_device); if (gfxcard[0] == VID_INTERNAL) device_add(&compaq_plasma_device); @@ -806,7 +806,7 @@ machine_at_compaq_init(const machine_t *model, int type) break; case COMPAQ_PORTABLEIII386: - if (hdc_current == 1) + if (hdc_current == HDC_INTERNAL) device_add(&ide_isa_device); if (gfxcard[0] == VID_INTERNAL) device_add(&compaq_plasma_device); diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index e541cf718..c53061c4e 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -660,7 +660,7 @@ europc_boot(UNUSED(const device_t *info)) * * We only do this if we have not configured another one. */ - if (hdc_current == 1) + if (hdc_current == HDC_INTERNAL) (void) device_add(&xta_hd20_device); return sys; diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index 34691773f..25d21cfb9 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -353,7 +353,7 @@ ps1_setup(int model) device_add(&fdc_at_ps1_device); /* Enable the builtin HDC. */ - if (hdc_current == 1) { + if (hdc_current == HDC_INTERNAL) { priv = device_add(&ps1_hdc_device); ps1_hdc_inform(priv, &ps->ps1_91); diff --git a/src/machine/m_ps2_isa.c b/src/machine/m_ps2_isa.c index fa9c5acc2..4f6d9bc2b 100644 --- a/src/machine/m_ps2_isa.c +++ b/src/machine/m_ps2_isa.c @@ -179,7 +179,7 @@ ps2_isa_setup(int model, int cpu_type) device_add(&fdc_at_ps1_device); /* Enable the builtin HDC. */ - if (hdc_current == 1) { + if (hdc_current == HDC_INTERNAL) { priv = device_add(&ps1_hdc_device); ps1_hdc_inform(priv, &ps2->ps2_91); } diff --git a/src/machine/m_v86p.c b/src/machine/m_v86p.c index 54af9b053..5d132a839 100644 --- a/src/machine/m_v86p.c +++ b/src/machine/m_v86p.c @@ -94,7 +94,7 @@ machine_v86p_init(const machine_t *model) if (gfxcard[0] == VID_INTERNAL) device_add(&f82c425_video_device); - if (hdc_current <= 1) + if (hdc_current <= HDC_INTERNAL) device_add(&st506_xt_victor_v86p_device); return ret; diff --git a/src/machine/m_xt_t1000.c b/src/machine/m_xt_t1000.c index a12fa4e96..88fc6ada2 100644 --- a/src/machine/m_xt_t1000.c +++ b/src/machine/m_xt_t1000.c @@ -969,7 +969,7 @@ machine_xt_t1200_init(const machine_t *model) if (gfxcard[0] == VID_INTERNAL) device_add(&t1200_video_device); - if (hdc_current <= 1) + if (hdc_current <= HDC_INTERNAL) device_add(&st506_xt_toshiba_t1200_device); return ret;