mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 07:25:26 +00:00
input: add analog limiter
This commit is contained in:
parent
2806348f73
commit
f2ef0966eb
25 changed files with 327 additions and 76 deletions
|
|
@ -83,6 +83,7 @@ void evdev_joystick_handler::init_config(cfg_pad* cfg)
|
|||
cfg->motion_sensor_g.axis.def = ::at32(motion_axis_list, ABS_RY); // DS3 uses the yaw axis for gyros
|
||||
|
||||
cfg->pressure_intensity_button.def = ::at32(button_list, NO_BUTTON);
|
||||
cfg->analog_limiter_button.def = ::at32(button_list, NO_BUTTON);
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstick_anti_deadzone.def = static_cast<u32>(0.13 * thumb_max); // 13%
|
||||
|
|
@ -1087,13 +1088,14 @@ void evdev_joystick_handler::apply_input_events(const std::shared_ptr<Pad>& pad)
|
|||
|
||||
// Find out if special buttons are pressed (introduced by RPCS3).
|
||||
// These buttons will have a delay of one cycle, but whatever.
|
||||
const bool analog_limiter_enabled = pad->get_analog_limiter_button_active(cfg->analog_limiter_toggle_mode.get(), pad->m_player_id);
|
||||
const bool adjust_pressure = pad->get_pressure_intensity_button_active(cfg->pressure_intensity_toggle_mode.get(), pad->m_player_id);
|
||||
const u32 pressure_intensity_deadzone = cfg->pressure_intensity_deadzone.get();
|
||||
|
||||
const auto update_values = [&](bool& pressed, u16& final_value, bool is_stick_value, u32 code, u16 val)
|
||||
{
|
||||
bool press{};
|
||||
TranslateButtonPress(m_dev, code, press, val, is_stick_value);
|
||||
TranslateButtonPress(m_dev, code, press, val, analog_limiter_enabled, is_stick_value);
|
||||
|
||||
if (press)
|
||||
{
|
||||
|
|
@ -1341,8 +1343,17 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad)
|
|||
cfg->pressure_intensity
|
||||
);
|
||||
|
||||
pad->m_buttons.emplace_back(special_button_offset, find_buttons(cfg->pressure_intensity_button), special_button_value::pressure_intensity);
|
||||
pad->m_pressure_intensity_button_index = static_cast<s32>(pad->m_buttons.size()) - 1;
|
||||
if (b_has_pressure_intensity_button)
|
||||
{
|
||||
pad->m_buttons.emplace_back(special_button_offset, find_buttons(cfg->pressure_intensity_button), special_button_value::pressure_intensity);
|
||||
pad->m_pressure_intensity_button_index = static_cast<s32>(pad->m_buttons.size()) - 1;
|
||||
}
|
||||
|
||||
if (b_has_analog_limiter_button)
|
||||
{
|
||||
pad->m_buttons.emplace_back(special_button_offset, find_buttons(cfg->analog_limiter_button), special_button_value::analog_limiter);
|
||||
pad->m_analog_limiter_button_index = static_cast<s32>(pad->m_buttons.size()) - 1;
|
||||
}
|
||||
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2,find_buttons(cfg->triangle), CELL_PAD_CTRL_TRIANGLE);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2,find_buttons(cfg->circle), CELL_PAD_CTRL_CIRCLE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue