summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author yz70s <yz70s@users.noreply.github.com>2020-01-11 20:49:04 +0100
committer yz70s <yz70s@users.noreply.github.com>2020-01-11 21:58:47 +0100
commitf5846116796eb6f26275b38be3bba71a7ebc463c (patch)
tree3c5135a14a2ff0c74f558788d70efdc0b6f9b348
parent595923c3d1c2c132de54f7d0185877a8eb549836 (diff)
gdrom.cpp: modifications to make it useable with the naomi dimm board (nw)
-rw-r--r--src/mame/machine/gdrom.cpp25
-rw-r--r--src/mame/machine/gdrom.h3
2 files changed, 27 insertions, 1 deletions
diff --git a/src/mame/machine/gdrom.cpp b/src/mame/machine/gdrom.cpp
index a25cc5d5373..d981bf68071 100644
--- a/src/mame/machine/gdrom.cpp
+++ b/src/mame/machine/gdrom.cpp
@@ -422,6 +422,8 @@ void gdrom_device::ReadData( uint8_t *data, int dataLength )
case 0x71:
memcpy(data, &GDROM_Cmd71_Reply[0], sizeof(GDROM_Cmd71_Reply));
+ if (is_real_gdrom_disc)
+ data[10] = 0x1f; // needed by dimm board firmware
break;
case 0x40: // Get Subchannel status
@@ -465,11 +467,23 @@ void gdrom_device::WriteData( uint8_t *data, int dataLength )
}
}
+void gdrom_device::SetDevice(void *device)
+{
+ t10mmc::SetDevice(device);
+
+ // try to find if the mounted chd is from an actual gd-rom disc
+ if (m_cdrom)
+ if (cdrom_get_last_track(m_cdrom) == 3)
+ if ((cdrom_get_track_type(m_cdrom, 0) == CD_TRACK_MODE1_RAW) && (cdrom_get_track_type(m_cdrom, 1) == CD_TRACK_AUDIO) && (cdrom_get_track_type(m_cdrom, 2) == CD_TRACK_MODE1_RAW))
+ is_real_gdrom_disc = true;
+}
+
// device type definition
DEFINE_DEVICE_TYPE(GDROM, gdrom_device, "gdrom", "GD-ROM")
gdrom_device::gdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- atapi_cdrom_device(mconfig, GDROM, tag, owner, clock)
+ atapi_cdrom_device(mconfig, GDROM, tag, owner, clock),
+ is_real_gdrom_disc(false)
{
}
@@ -523,3 +537,12 @@ void gdrom_device::process_buffer()
atapi_hle_device::process_buffer();
m_sector_number = 0x80 | GDROM_PAUSE_STATE; /// HACK: find out when this should be updated
}
+
+void gdrom_device::signature()
+{
+ atapi_hle_device::signature();
+
+ // naomi dimm board firmware needs the upper nibble to be 8 at the beginning
+ if (is_real_gdrom_disc)
+ m_sector_number = 0x81;
+}
diff --git a/src/mame/machine/gdrom.h b/src/mame/machine/gdrom.h
index 8fc87e95d2d..12014f62094 100644
--- a/src/mame/machine/gdrom.h
+++ b/src/mame/machine/gdrom.h
@@ -26,6 +26,8 @@ public:
protected:
virtual void process_buffer() override;
+ virtual void signature() override;
+ virtual void SetDevice(void *device) override;
// device-level overrides
virtual void device_start() override;
@@ -36,6 +38,7 @@ private:
uint32_t read_type; // for command 0x30 only
uint32_t data_select; // for command 0x30 only
uint32_t transferOffset;
+ bool is_real_gdrom_disc;
};
DECLARE_DEVICE_TYPE(GDROM, gdrom_device)