mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
input: disable pad vibration after no new data was sent for 3 seconds
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
This is supposedly how the lib does it.
This commit is contained in:
parent
1e6a4dc5c8
commit
781da9dc59
3 changed files with 19 additions and 0 deletions
|
@ -752,6 +752,22 @@ void PadHandlerBase::process()
|
||||||
|
|
||||||
pad->move_data.orientation_enabled = b_has_orientation && device->config && device->config->orientation_enabled.get();
|
pad->move_data.orientation_enabled = b_has_orientation && device->config && device->config->orientation_enabled.get();
|
||||||
|
|
||||||
|
// Disable pad vibration if no new data was sent for 3 seconds
|
||||||
|
if (pad->m_last_rumble_time_us > 0)
|
||||||
|
{
|
||||||
|
std::lock_guard lock(pad::g_pad_mutex);
|
||||||
|
|
||||||
|
if ((get_system_time() - pad->m_last_rumble_time_us) > 3'000'000)
|
||||||
|
{
|
||||||
|
for (VibrateMotor& motor : pad->m_vibrateMotors)
|
||||||
|
{
|
||||||
|
motor.m_value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pad->m_last_rumble_time_us = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const connection status = update_connection(device);
|
const connection status = update_connection(device);
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
|
|
|
@ -522,6 +522,8 @@ struct Pad
|
||||||
s32 m_orientation_reset_button_index{-1}; // Special button index. -1 if not set.
|
s32 m_orientation_reset_button_index{-1}; // Special button index. -1 if not set.
|
||||||
bool get_orientation_reset_button_active();
|
bool get_orientation_reset_button_active();
|
||||||
|
|
||||||
|
u64 m_last_rumble_time_us{0};
|
||||||
|
|
||||||
// Cable State: 0 - 1 plugged in ?
|
// Cable State: 0 - 1 plugged in ?
|
||||||
u8 m_cable_state{0};
|
u8 m_cable_state{0};
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,7 @@ void pad_thread::SetRumble(const u32 pad, u8 large_motor, bool small_motor)
|
||||||
if (pad >= m_pads.size())
|
if (pad >= m_pads.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_pads[pad]->m_last_rumble_time_us = get_system_time();
|
||||||
m_pads[pad]->m_vibrateMotors[0].m_value = large_motor;
|
m_pads[pad]->m_vibrateMotors[0].m_value = large_motor;
|
||||||
m_pads[pad]->m_vibrateMotors[1].m_value = small_motor ? 255 : 0;
|
m_pads[pad]->m_vibrateMotors[1].m_value = small_motor ? 255 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue