Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SI: Be more careful with polling controllers #8282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions Source/Core/Core/HW/SI/SI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,34 @@ void UpdateDevices()
g_controller_interface.UpdateInput();

// Update channels and set the status bit if there's new data
s_status_reg.RDST0 =
!!s_channel[0].device->GetData(s_channel[0].in_hi.hex, s_channel[0].in_lo.hex);
s_status_reg.RDST1 =
!!s_channel[1].device->GetData(s_channel[1].in_hi.hex, s_channel[1].in_lo.hex);
s_status_reg.RDST2 =
!!s_channel[2].device->GetData(s_channel[2].in_hi.hex, s_channel[2].in_lo.hex);
s_status_reg.RDST3 =
!!s_channel[3].device->GetData(s_channel[3].in_hi.hex, s_channel[3].in_lo.hex);
std::array<u32, 4> port_enabled = {
s_poll.EN0,
s_poll.EN1,
s_poll.EN2,
s_poll.EN3,
};

for (size_t i = 0; i < port_enabled.size(); ++i)
{
if (port_enabled[i] == 0)
continue;
u32 in_hi, in_lo;
bool result = s_channel[i].device->GetData(in_hi, in_lo);
if (result)
{
// set RDST, update INBUFH/INBUFL, retain ERRLATCH
u32 error_latch = s_channel[i].in_hi.hex & 0x40000000;
s_channel[i].in_hi.hex = in_hi || error_latch;
s_channel[i].in_lo.hex = in_lo;
s_status_reg.hex |= (0x20000000 >> (i * 8));
}
else
{
// set NOREP, ERRSTAT, ERRLATCH
s_channel[i].in_hi.hex |= 0xc0000000;
s_status_reg.hex |= (0x08000000 >> (i * 8));
}
}
UpdateInterrupts();

// Polling finished
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/HW/SI/SI_DeviceGCAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ int CSIDevice_GCAdapter::RunBuffer(u8* buffer, int length)
bool CSIDevice_GCAdapter::GetData(u32& hi, u32& low)
{
CSIDevice_GCController::GetData(hi, low);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels a bit weird that this is called before the DeviceConnected check...should this be here?


if (!GCAdapter::DeviceConnected(m_device_number))
{
return false;
}
if (m_simulate_konga)
{
hi &= CSIDevice_TaruKonga::HI_BUTTON_MASK;
Expand Down