System: Implement runahead

This commit is contained in:
Connor McLaughlin
2021-01-24 02:52:52 +10:00
parent 689b62e065
commit e01d66d18e
15 changed files with 278 additions and 35 deletions

View File

@ -117,6 +117,9 @@ void AnalogController::SetAxisState(s32 axis_code, float value)
void AnalogController::SetAxisState(Axis axis, u8 value)
{
if (value != m_axis_state[static_cast<u8>(axis)])
System::SetRunaheadReplayFlag();
m_axis_state[static_cast<u8>(axis)] = value;
}
@ -131,10 +134,22 @@ void AnalogController::SetButtonState(Button button, bool pressed)
return;
}
const u16 bit = u16(1) << static_cast<u8>(button);
if (pressed)
m_button_state &= ~(u16(1) << static_cast<u8>(button));
{
if (m_button_state & bit)
System::SetRunaheadReplayFlag();
m_button_state &= ~(bit);
}
else
m_button_state |= u16(1) << static_cast<u8>(button);
{
if (!(m_button_state & bit))
System::SetRunaheadReplayFlag();
m_button_state |= bit;
}
}
void AnalogController::SetButtonState(s32 button_code, bool pressed)