gdrom.cpp: modifications to make it useable with the naomi dimm board (nw)

This commit is contained in:
yz70s 2020-01-11 20:49:04 +01:00
parent 595923c3d1
commit f584611679
2 changed files with 27 additions and 1 deletions

View File

@ -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;
}

View File

@ -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)