diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp index 61745e870c2c..714698a5e29b 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp @@ -39,17 +39,59 @@ void CEXIBaseboard::TransferByte(u8& byte) byte = ID[(m_position - 2) & 3]; break; } + case 0x01: + byte = 0x01; + break; + case 0x02: + byte = 0x01; + break; + case 0x03: + byte = 0x01; + break; + case 0xFF: + { + if ((m_subcommand[1] == 0) && (m_subcommand[2] == 0)) + { + m_have_irq = true; + m_irq_timer = 0; + m_irq_status = 0x02; + } + if ((m_subcommand[1] == 2) && (m_subcommand[2] == 1)) + { + m_irq_status = 0; + } + byte = 0x04; + break; + } default: ERROR_LOG_FMT(EXPANSIONINTERFACE, "EXI BASEBOARD: Unhandled command {:#x} {:#x}", m_command, m_position); + byte = 0x04; + break; } } m_position++; } +bool CEXIBaseboard::IsInterruptSet() +{ + if (m_have_irq) + { + if (++m_irq_timer > 4) + m_have_irq = false; + return 1; + } + else + { + return 0; + } +} + void CEXIBaseboard::DoState(PointerWrap& p) { p.Do(m_position); p.Do(m_command); + p.Do(m_subcommand); + p.Do(m_have_irq); } } // namespace ExpansionInterface diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h index c4c6641c1fae..687ff110cc5a 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h @@ -15,12 +15,17 @@ class CEXIBaseboard : public IEXIDevice CEXIBaseboard(); void SetCS(int CS) override; bool IsPresent() const override; + bool IsInterruptSet(); void DoState(PointerWrap& p) override; private: // STATE_TO_SAVE + bool m_have_irq; u32 m_position = 0; u32 m_command = 0; + u8* m_subcommand = (u8*)&m_command; + u32 m_irq_timer; + u32 m_irq_status; void TransferByte(u8& byte) override; };