diff options
| author | JMC47 <JMC4789@gmail.com> | 2025-05-09 18:55:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 18:55:18 -0400 |
| commit | b18bca11e8a358cec3218b44f72ab968c87ef970 (patch) | |
| tree | 20acf16cffc829102554a4d908230a460d425505 /Source/Core | |
| parent | 7f44509a704c40a80cc3967a8747ff0ef292b7bb (diff) | |
| parent | 6e22e145a0aa06a49741ff55b4bcd85e69c210a6 (diff) | |
Merge pull request #13440 from jordan-woyak/si-dev-change-tweak
HW/SI: Don't require waiting a second before disconnecting an SIDevice.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/SI/SI.cpp | 22 | ||||
| -rw-r--r-- | Source/Core/Core/HW/SI/SI.h | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/Source/Core/Core/HW/SI/SI.cpp b/Source/Core/Core/HW/SI/SI.cpp index 5968b904ba..c869ed0e3d 100644 --- a/Source/Core/Core/HW/SI/SI.cpp +++ b/Source/Core/Core/HW/SI/SI.cpp @@ -90,7 +90,7 @@ void SerialInterfaceManager::ChangeDeviceCallback(Core::System& system, u64 user { // The purpose of this callback is to simply re-enable device changes. auto& si = system.GetSerialInterface(); - si.m_channel[user_data].has_recent_device_change = false; + si.m_channel[user_data].has_recent_device_unplug = false; } void SerialInterfaceManager::UpdateInterrupts() @@ -201,7 +201,7 @@ void SerialInterfaceManager::DoState(PointerWrap& p) p.Do(m_channel[i].in_hi.hex); p.Do(m_channel[i].in_lo.hex); p.Do(m_channel[i].out.hex); - p.Do(m_channel[i].has_recent_device_change); + p.Do(m_channel[i].has_recent_device_unplug); const std::unique_ptr<ISIDevice>& device = m_channel[i].device; SIDevices type = device->GetDeviceType(); @@ -269,7 +269,7 @@ void SerialInterfaceManager::Init() m_channel[i].out.hex = 0; m_channel[i].in_hi.hex = 0; m_channel[i].in_lo.hex = 0; - m_channel[i].has_recent_device_change = false; + m_channel[i].has_recent_device_unplug = false; auto& movie = m_system.GetMovie(); if (movie.IsMovieActive()) @@ -511,7 +511,7 @@ void SerialInterfaceManager::ChangeDeviceDeterministic(SIDevices device, int cha { if (channel < 0 || channel >= MAX_SI_CHANNELS) return; - if (m_channel[channel].has_recent_device_change) + if (m_channel[channel].has_recent_device_unplug) return; if (GetDeviceType(channel) != SIDEVICE_NONE) @@ -520,18 +520,20 @@ void SerialInterfaceManager::ChangeDeviceDeterministic(SIDevices device, int cha device = SIDEVICE_NONE; } + // TODO: Resetting this state may not be necessary or accurate. m_channel[channel].out.hex = 0; m_channel[channel].in_hi.hex = 0; m_channel[channel].in_lo.hex = 0; - SetNoResponse(channel); - AddDevice(device, channel); - // Prevent additional device changes on this channel for one second. - m_channel[channel].has_recent_device_change = true; - m_system.GetCoreTiming().ScheduleEvent(m_system.GetSystemTimers().GetTicksPerSecond(), - m_event_type_change_device, channel); + if (device == SIDEVICE_NONE) + { + // Prevent additional device changes on this channel for one second. + m_channel[channel].has_recent_device_unplug = true; + m_system.GetCoreTiming().ScheduleEvent(m_system.GetSystemTimers().GetTicksPerSecond(), + m_event_type_change_device, channel); + } } void SerialInterfaceManager::UpdateDevices() diff --git a/Source/Core/Core/HW/SI/SI.h b/Source/Core/Core/HW/SI/SI.h index 9bd9f707a2..731b9b5c19 100644 --- a/Source/Core/Core/HW/SI/SI.h +++ b/Source/Core/Core/HW/SI/SI.h @@ -131,7 +131,7 @@ private: USIChannelIn_Lo in_lo{}; std::unique_ptr<ISIDevice> device; - bool has_recent_device_change = false; + bool has_recent_device_unplug = false; }; // SI Poll: Controls how often a device is polled |
