mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-09 08:25:16 +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
|
|
@ -113,8 +113,6 @@ ds4_pad_handler::ds4_pad_handler()
|
|||
thumb_max = 255;
|
||||
trigger_min = 0;
|
||||
trigger_max = 255;
|
||||
vibration_min = 0;
|
||||
vibration_max = 255;
|
||||
|
||||
// set capabilities
|
||||
b_has_config = true;
|
||||
|
|
@ -197,15 +195,15 @@ u32 ds4_pad_handler::get_battery_level(const std::string& padId)
|
|||
return std::min<u32>(device->battery_level * 10, 100);
|
||||
}
|
||||
|
||||
void ds4_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 ds4_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<DS4Device> device = get_hid_device(padId);
|
||||
if (!device || !device->hidDevice || !device->config)
|
||||
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;
|
||||
|
|
@ -888,8 +886,8 @@ void ds4_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 = ds4_dev->cable_state == 0;
|
||||
const bool low_battery = ds4_dev->battery_level < 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue