apple2: proper behavior when nothing is connected to gameio. Fixes Total Replay, Gauntlet IIgs, and many others from falsely detecting a joystick [R. Belmont, Peter Ferrie]

This commit is contained in:
arbee 2021-05-24 20:14:16 -04:00
parent 7d8874dec4
commit 8021d6be61
4 changed files with 15 additions and 0 deletions

View File

@ -67,6 +67,9 @@ public:
// utility strobe (active low)
DECLARE_WRITE_LINE_MEMBER(strobe_w);
// check if a device is connected
bool is_device_connected() { return (m_intf != nullptr); }
protected:
// device-level overrides
virtual void device_config_complete() override;

View File

@ -646,15 +646,19 @@ u8 apple2_state::flags_r(offs_t offset)
return (m_gameio->sw2_r() ? 0x80 : 0) | (read_floatingbus() & 0x7f);
case 4: // joy 1 X axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
case 5: // joy 1 Y axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
case 6: // joy 2 X axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
case 7: // joy 2 Y axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
}

View File

@ -1999,18 +1999,22 @@ u8 apple2e_state::c000_r(offs_t offset)
case 0x64: // joy 1 X axis
case 0x6c:
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
case 0x65: // joy 1 Y axis
case 0x6d:
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
case 0x66: // joy 2 X axis
case 0x6e:
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
case 0x67: // joy 2 Y axis
case 0x6f:
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
case 0x7e: // read IOUDIS

View File

@ -2567,15 +2567,19 @@ u8 apple2gs_state::c000_r(offs_t offset)
return ((m_gameio->sw2_r() || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7;
case 0x64: // joy 1 X axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
case 0x65: // joy 1 Y axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
case 0x66: // joy 2 X axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
case 0x67: // joy 2 Y axis
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
case 0x68: // STATEREG, synthesizes all the IIe state regs