mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Input: refactor vibration
There's no need to deal with vibration levels outside of the handlers. All we need to know is the 0-255 DS3 range which is given by the u8 type.
This commit is contained in:
parent
a1f9ff0aaa
commit
ddd261c943
18 changed files with 59 additions and 76 deletions
|
|
@ -120,15 +120,15 @@ u32 ds3_pad_handler::get_battery_level(const std::string& padId)
|
|||
return std::clamp<u32>(device->battery_level, 0, 100);
|
||||
}
|
||||
|
||||
void ds3_pad_handler::SetPadData(const std::string& padId, u8 player_id, u32 largeMotor, u32 smallMotor, s32/* r*/, s32/* g*/, s32 /* b*/, bool player_led, bool /*battery_led*/, u32 /*battery_led_brightness*/)
|
||||
void ds3_pad_handler::SetPadData(const std::string& padId, u8 player_id, u8 large_motor, u8 small_motor, s32/* r*/, s32/* g*/, s32 /* b*/, bool player_led, bool /*battery_led*/, u32 /*battery_led_brightness*/)
|
||||
{
|
||||
std::shared_ptr<ds3_device> device = get_hid_device(padId);
|
||||
if (device == nullptr || device->hidDevice == nullptr)
|
||||
return;
|
||||
|
||||
// Set the device's motor speeds to our requested values 0-255
|
||||
device->large_motor = largeMotor;
|
||||
device->small_motor = smallMotor;
|
||||
device->large_motor = large_motor;
|
||||
device->small_motor = small_motor;
|
||||
device->player_id = player_id;
|
||||
|
||||
int index = 0;
|
||||
|
|
@ -585,8 +585,8 @@ void ds3_pad_handler::apply_pad_data(const pad_ensemble& binding)
|
|||
const int idx_l = config->switch_vibration_motors ? 1 : 0;
|
||||
const int idx_s = config->switch_vibration_motors ? 0 : 1;
|
||||
|
||||
const int speed_large = config->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : vibration_min;
|
||||
const int speed_small = config->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : vibration_min;
|
||||
const u8 speed_large = config->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : 0;
|
||||
const u8 speed_small = config->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : 0;
|
||||
|
||||
const bool wireless = dev->cable_state == 0;
|
||||
const bool low_battery = dev->battery_level < 25;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue