2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 17:37:03 +00:00

Add initial rumble support, use modified SDL branch to support all GC controller rumble modes

This commit is contained in:
2022-02-22 01:12:15 -08:00
parent c679c2e0f8
commit 40669f4dc9
8 changed files with 99 additions and 58 deletions

View File

@@ -45,7 +45,8 @@ void CInputGenerator::controllerAdded(uint32_t which) noexcept {
aurora::set_controller_player_index(which, 0);
}
m_state[player] = SAuroraControllerState(which, aurora::is_controller_gamecube(which));
m_state[player] =
SAuroraControllerState(which, aurora::is_controller_gamecube(which), aurora::controller_has_rumble(which));
}
void CInputGenerator::controllerRemoved(uint32_t which) noexcept {
@@ -93,6 +94,18 @@ void CInputGenerator::controllerAxis(uint32_t which, aurora::ControllerAxis axis
m_state[player].m_axes[size_t(axis)] = value;
}
void CInputGenerator::SetMotorState(EIOPort port, EMotorState state) {
if (m_state[size_t(port)].m_hasRumble && m_state[size_t(port)].m_isGamecube) {
if (state == EMotorState::Rumble) {
aurora::controller_rumble(m_state[size_t(port)].m_which, 1, 1);
} else if (state == EMotorState::Stop) {
aurora::controller_rumble(m_state[size_t(port)].m_which, 0, 1);
} else if (state == EMotorState::StopHard) {
aurora::controller_rumble(m_state[size_t(port)].m_which, 0, 0);
}
} // TODO: Figure out good intensity values for generic controllers with rumble, support HAPTIC?
}
const CFinalInput& CInputGenerator::getFinalInput(unsigned int idx, float dt) {
auto input = CFinalInput(idx, dt, m_data, m_lastUpdate);
// Merge controller input with kb/m input