mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
input: Add pressure sensitivity button
This commit is contained in:
parent
0031c41630
commit
d4802cc766
@ -5,7 +5,10 @@
|
||||
class NullPadHandler final : public PadHandlerBase
|
||||
{
|
||||
public:
|
||||
NullPadHandler() : PadHandlerBase(pad_handler::null) {}
|
||||
NullPadHandler() : PadHandlerBase(pad_handler::null)
|
||||
{
|
||||
b_has_pressure_intensity_button = false;
|
||||
}
|
||||
|
||||
bool Init() override
|
||||
{
|
||||
@ -46,6 +49,8 @@ public:
|
||||
cfg->l2.def = "";
|
||||
cfg->l3.def = "";
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Apply defaults
|
||||
cfg->from_default();
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ int PadHandlerBase::FindKeyCode(const std::unordered_map<u32, std::string>& map,
|
||||
|
||||
if (fallback)
|
||||
{
|
||||
input_log.error("int FindKeyCode for [name = %s] returned with [def_code = %d] for [def = %s]", nam, def_code, def);
|
||||
if (!nam.empty())
|
||||
input_log.error("int FindKeyCode for [name = %s] returned with [def_code = %d] for [def = %s]", nam, def_code, def);
|
||||
|
||||
if (def_code < 0)
|
||||
def_code = 0;
|
||||
}
|
||||
@ -55,7 +57,9 @@ long PadHandlerBase::FindKeyCode(const std::unordered_map<u64, std::string>& map
|
||||
|
||||
if (fallback)
|
||||
{
|
||||
input_log.error("long FindKeyCode for [name = %s] returned with [def_code = %d] for [def = %s]", nam, def_code, def);
|
||||
if (!nam.empty())
|
||||
input_log.error("long FindKeyCode for [name = %s] returned with [def_code = %d] for [def = %s]", nam, def_code, def);
|
||||
|
||||
if (def_code < 0)
|
||||
def_code = 0;
|
||||
}
|
||||
@ -74,7 +78,8 @@ int PadHandlerBase::FindKeyCodeByString(const std::unordered_map<u32, std::strin
|
||||
|
||||
if (fallback)
|
||||
{
|
||||
input_log.error("long FindKeyCodeByString for [name = %s] returned with 0", name);
|
||||
if (!name.empty())
|
||||
input_log.error("long FindKeyCodeByString for [name = %s] returned with 0", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,7 +97,8 @@ long PadHandlerBase::FindKeyCodeByString(const std::unordered_map<u64, std::stri
|
||||
|
||||
if (fallback)
|
||||
{
|
||||
input_log.error("long FindKeyCodeByString for [name = %s] returned with 0", name);
|
||||
if (!name.empty())
|
||||
input_log.error("long FindKeyCodeByString for [name = %s] returned with 0", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -288,6 +294,11 @@ bool PadHandlerBase::has_battery() const
|
||||
return b_has_battery;
|
||||
}
|
||||
|
||||
bool PadHandlerBase::has_pressure_intensity_button() const
|
||||
{
|
||||
return b_has_pressure_intensity_button;
|
||||
}
|
||||
|
||||
std::string PadHandlerBase::get_config_dir(pad_handler type, const std::string& title_id)
|
||||
{
|
||||
if (!title_id.empty())
|
||||
@ -479,9 +490,13 @@ bool PadHandlerBase::bindPadToDevice(std::shared_ptr<Pad> pad, const std::string
|
||||
profile->device_class_type,
|
||||
pclass_profile,
|
||||
profile->vendor_id,
|
||||
profile->product_id
|
||||
profile->product_id,
|
||||
profile->pressure_intensity
|
||||
);
|
||||
|
||||
pad->m_buttons.emplace_back(special_button_offset, mapping[button::pressure_intensity_button], special_button_value::pressure_intensity);
|
||||
pad->m_pressure_intensity_button_index = pad->m_buttons.size() - 1;
|
||||
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, mapping[button::up], CELL_PAD_CTRL_UP);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, mapping[button::down], CELL_PAD_CTRL_DOWN);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, mapping[button::left], CELL_PAD_CTRL_LEFT);
|
||||
@ -549,6 +564,8 @@ std::array<u32, PadHandlerBase::button::button_count> PadHandlerBase::get_mapped
|
||||
mapping[button::rs_up] = FindKeyCode(button_list, profile->rs_up);
|
||||
mapping[button::ps] = FindKeyCode(button_list, profile->ps);
|
||||
|
||||
mapping[button::pressure_intensity_button] = FindKeyCode(button_list, profile->pressure_intensity_button);
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,8 @@ protected:
|
||||
rs_down,
|
||||
rs_up,
|
||||
|
||||
pressure_intensity_button,
|
||||
|
||||
button_count
|
||||
};
|
||||
|
||||
@ -80,6 +82,7 @@ protected:
|
||||
bool b_has_deadzones = false;
|
||||
bool b_has_rumble = false;
|
||||
bool b_has_config = false;
|
||||
bool b_has_pressure_intensity_button = true;
|
||||
std::array<pad_config, MAX_GAMEPADS> m_pad_configs;
|
||||
std::vector<std::pair<std::shared_ptr<PadDevice>, std::shared_ptr<Pad>>> bindings;
|
||||
std::unordered_map<u32, std::string> button_list;
|
||||
@ -148,6 +151,7 @@ public:
|
||||
bool has_led() const;
|
||||
bool has_rgb() const;
|
||||
bool has_battery() const;
|
||||
bool has_pressure_intensity_button() const;
|
||||
|
||||
void set_player(u32 player_id) { m_player_id = player_id; }
|
||||
|
||||
|
@ -35,7 +35,7 @@ void usb_device_turntable::control_transfer(u8 bmRequestType, u8 bRequest, u16 w
|
||||
// Do nothing here - not sure what it should do.
|
||||
break;
|
||||
default:
|
||||
turntable_log.error("Unhandled Query Type: 0x%02X", buf[0]);
|
||||
turntable_log.error("Unhandled Query Type: 0x%02X", buf[0]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -248,19 +248,19 @@ void usb_device_turntable::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endpo
|
||||
{
|
||||
case CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y:
|
||||
buf[6] = ~(stick.m_value) + 0x01; // Right Turntable
|
||||
// Some pad handlers like MMJoystick are centered at 0x81 instead of 0x80
|
||||
// Some pad handlers like MMJoystick are centered at 0x81 instead of 0x80
|
||||
// which leaves the turntable stuck at 0x7F instead of 0x80, causing auto-scrolling menus
|
||||
// so force 0x7F to 0x80.
|
||||
if (buf[6] == 0x7F)
|
||||
buf[6] = 0x80;
|
||||
if (buf[6] == 0x7F)
|
||||
buf[6] = 0x80;
|
||||
break;
|
||||
case CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y:
|
||||
buf[21] = (stick.m_value & 0x3F) << 2; // Crossfader, lower 6 bits
|
||||
buf[22] = (stick.m_value & 0xC0) >> 6; // Crossfader, upper 2 bits
|
||||
buf[21] = (stick.m_value & 0x3F) << 2; // Crossfader, lower 6 bits
|
||||
buf[22] = (stick.m_value & 0xC0) >> 6; // Crossfader, upper 2 bits
|
||||
break;
|
||||
case CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X:
|
||||
buf[19] = (stick.m_value & 0x3F) << 2; // Effects Dial, lower 6 bits
|
||||
buf[20] = (stick.m_value & 0xC0) >> 6; // Effects Dial, upper 2 bits
|
||||
buf[19] = (stick.m_value & 0x3F) << 2; // Effects Dial, lower 6 bits
|
||||
buf[20] = (stick.m_value & 0xC0) >> 6; // Effects Dial, upper 2 bits
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -69,6 +69,9 @@ struct pad_config final : cfg::node
|
||||
cfg::string l2{ this, "L2", "" };
|
||||
cfg::string l3{ this, "L3", "" };
|
||||
|
||||
cfg::string pressure_intensity_button{ this, "Pressure Intensity Button", "" };
|
||||
cfg::uint<0, 100> pressure_intensity{ this, "Pressure Intensity Percent", 50 };
|
||||
|
||||
cfg::uint<0, 200> lstickmultiplier{ this, "Left Stick Multiplier", 100 };
|
||||
cfg::uint<0, 200> rstickmultiplier{ this, "Right Stick Multiplier", 100 };
|
||||
cfg::uint<0, 1000000> lstickdeadzone{ this, "Left Stick Deadzone", 0 };
|
||||
|
@ -163,6 +163,14 @@ enum
|
||||
CELL_MAX_PADS = 127,
|
||||
};
|
||||
|
||||
|
||||
constexpr u32 special_button_offset = 666; // Must not conflict with other CELL offsets like ButtonDataOffset
|
||||
|
||||
enum special_button_value
|
||||
{
|
||||
pressure_intensity
|
||||
};
|
||||
|
||||
struct Button
|
||||
{
|
||||
u32 m_offset;
|
||||
@ -241,22 +249,25 @@ struct VibrateMotor
|
||||
|
||||
struct Pad
|
||||
{
|
||||
bool m_buffer_cleared;
|
||||
u32 m_port_status;
|
||||
u32 m_device_capability;
|
||||
u32 m_device_type;
|
||||
u32 m_class_type;
|
||||
u32 m_class_profile;
|
||||
bool m_buffer_cleared{true};
|
||||
u32 m_port_status{0};
|
||||
u32 m_device_capability{0};
|
||||
u32 m_device_type{0};
|
||||
u32 m_class_type{0};
|
||||
u32 m_class_profile{0};
|
||||
|
||||
u16 m_vendor_id;
|
||||
u16 m_product_id;
|
||||
u16 m_vendor_id{0};
|
||||
u16 m_product_id{0};
|
||||
|
||||
s32 m_pressure_intensity_button_index{-1}; // Special button index. -1 if not set.
|
||||
u8 m_pressure_intensity{127}; // 0-255
|
||||
|
||||
// Cable State: 0 - 1 plugged in ?
|
||||
u8 m_cable_state;
|
||||
u8 m_cable_state{0};
|
||||
|
||||
// DS4: 0 - 9 while unplugged, 0 - 10 while plugged in, 11 charge complete
|
||||
// XInput: 0 = Empty, 1 = Low, 2 = Medium, 3 = Full
|
||||
u8 m_battery_level;
|
||||
u8 m_battery_level{0};
|
||||
|
||||
std::vector<Button> m_buttons;
|
||||
std::vector<AnalogStick> m_sticks;
|
||||
@ -264,39 +275,46 @@ struct Pad
|
||||
std::vector<VibrateMotor> m_vibrateMotors;
|
||||
|
||||
// These hold bits for their respective buttons
|
||||
u16 m_digital_1;
|
||||
u16 m_digital_2;
|
||||
u16 m_digital_1{0};
|
||||
u16 m_digital_2{0};
|
||||
|
||||
// All sensors go from 0-255
|
||||
u16 m_analog_left_x;
|
||||
u16 m_analog_left_y;
|
||||
u16 m_analog_right_x;
|
||||
u16 m_analog_right_y;
|
||||
u16 m_analog_left_x{128};
|
||||
u16 m_analog_left_y{128};
|
||||
u16 m_analog_right_x{128};
|
||||
u16 m_analog_right_y{128};
|
||||
|
||||
u16 m_press_right;
|
||||
u16 m_press_left;
|
||||
u16 m_press_up;
|
||||
u16 m_press_down;
|
||||
u16 m_press_triangle;
|
||||
u16 m_press_circle;
|
||||
u16 m_press_cross;
|
||||
u16 m_press_square;
|
||||
u16 m_press_L1;
|
||||
u16 m_press_L2;
|
||||
u16 m_press_R1;
|
||||
u16 m_press_R2;
|
||||
u16 m_press_right{0};
|
||||
u16 m_press_left{0};
|
||||
u16 m_press_up{0};
|
||||
u16 m_press_down{0};
|
||||
u16 m_press_triangle{0};
|
||||
u16 m_press_circle{0};
|
||||
u16 m_press_cross{0};
|
||||
u16 m_press_square{0};
|
||||
u16 m_press_L1{0};
|
||||
u16 m_press_L2{0};
|
||||
u16 m_press_R1{0};
|
||||
u16 m_press_R2{0};
|
||||
|
||||
// Except for these...0-1023
|
||||
// ~399 on sensor y is a level non moving controller
|
||||
u16 m_sensor_x;
|
||||
u16 m_sensor_y;
|
||||
u16 m_sensor_z;
|
||||
u16 m_sensor_g;
|
||||
u16 m_sensor_x{512};
|
||||
u16 m_sensor_y{399};
|
||||
u16 m_sensor_z{512};
|
||||
u16 m_sensor_g{512};
|
||||
|
||||
bool ldd = false;
|
||||
bool ldd{false};
|
||||
u8 ldd_data[132] = {};
|
||||
|
||||
void Init(u32 port_status, u32 device_capability, u32 device_type, u32 class_type, u32 class_profile, u16 vendor_id, u16 product_id)
|
||||
explicit Pad(u32 port_status, u32 device_capability, u32 device_type)
|
||||
: m_port_status(port_status)
|
||||
, m_device_capability(device_capability)
|
||||
, m_device_type(device_type)
|
||||
{
|
||||
}
|
||||
|
||||
void Init(u32 port_status, u32 device_capability, u32 device_type, u32 class_type, u32 class_profile, u16 vendor_id, u16 product_id, u8 pressure_intensity_percent)
|
||||
{
|
||||
m_port_status = port_status;
|
||||
m_device_capability = device_capability;
|
||||
@ -305,45 +323,6 @@ struct Pad
|
||||
m_class_profile = class_profile;
|
||||
m_vendor_id = vendor_id;
|
||||
m_product_id = product_id;
|
||||
}
|
||||
|
||||
Pad(u32 port_status, u32 device_capability, u32 device_type)
|
||||
: m_buffer_cleared(true)
|
||||
, m_port_status(port_status)
|
||||
, m_device_capability(device_capability)
|
||||
, m_device_type(device_type)
|
||||
, m_class_type(0)
|
||||
, m_class_profile(0)
|
||||
, m_vendor_id(0)
|
||||
, m_product_id(0)
|
||||
, m_cable_state(0)
|
||||
, m_battery_level(0)
|
||||
|
||||
, m_digital_1(0)
|
||||
, m_digital_2(0)
|
||||
|
||||
, m_analog_left_x(128)
|
||||
, m_analog_left_y(128)
|
||||
, m_analog_right_x(128)
|
||||
, m_analog_right_y(128)
|
||||
|
||||
, m_press_right(0)
|
||||
, m_press_left(0)
|
||||
, m_press_up(0)
|
||||
, m_press_down(0)
|
||||
, m_press_triangle(0)
|
||||
, m_press_circle(0)
|
||||
, m_press_cross(0)
|
||||
, m_press_square(0)
|
||||
, m_press_L1(0)
|
||||
, m_press_L2(0)
|
||||
, m_press_R1(0)
|
||||
, m_press_R2(0)
|
||||
|
||||
, m_sensor_x(512)
|
||||
, m_sensor_y(399)
|
||||
, m_sensor_z(512)
|
||||
, m_sensor_g(512)
|
||||
{
|
||||
m_pressure_intensity = (255 * pressure_intensity_percent) / 100;
|
||||
}
|
||||
};
|
||||
|
@ -85,6 +85,7 @@ ds3_pad_handler::ds3_pad_handler()
|
||||
b_has_battery = true;
|
||||
b_has_led = true;
|
||||
b_has_rgb = false;
|
||||
b_has_pressure_intensity_button = false; // The DS3 obviously already has this feature natively.
|
||||
|
||||
m_name_string = "DS3 Pad #";
|
||||
m_max_devices = CELL_PAD_MAX_PORT_NUM;
|
||||
@ -228,6 +229,8 @@ void ds3_pad_handler::init_config(pad_config* cfg, const std::string& name)
|
||||
cfg->l2.def = button_list.at(DS3KeyCodes::L2);
|
||||
cfg->l3.def = button_list.at(DS3KeyCodes::L3);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstickdeadzone.def = 40; // between 0 and 255
|
||||
cfg->rstickdeadzone.def = 40; // between 0 and 255
|
||||
|
@ -162,6 +162,8 @@ void ds4_pad_handler::init_config(pad_config* cfg, const std::string& name)
|
||||
cfg->l2.def = button_list.at(DS4KeyCodes::L2);
|
||||
cfg->l3.def = button_list.at(DS4KeyCodes::L3);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstickdeadzone.def = 40; // between 0 and 255
|
||||
cfg->rstickdeadzone.def = 40; // between 0 and 255
|
||||
|
@ -273,6 +273,8 @@ void dualsense_pad_handler::init_config(pad_config* cfg, const std::string& name
|
||||
cfg->l2.def = button_list.at(DualSenseKeyCodes::L2);
|
||||
cfg->l3.def = button_list.at(DualSenseKeyCodes::L3);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstickdeadzone.def = 40; // between 0 and 255
|
||||
cfg->rstickdeadzone.def = 40; // between 0 and 255
|
||||
|
@ -81,6 +81,8 @@ void evdev_joystick_handler::init_config(pad_config* cfg, const std::string& nam
|
||||
cfg->l2.def = axis_list.at(ABS_Z);
|
||||
cfg->l3.def = button_list.at(BTN_THUMBL);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstickdeadzone.def = 30; // between 0 and 255
|
||||
cfg->rstickdeadzone.def = 30; // between 0 and 255
|
||||
@ -951,9 +953,13 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std
|
||||
p_profile->device_class_type,
|
||||
pclass_profile,
|
||||
p_profile->vendor_id,
|
||||
p_profile->product_id
|
||||
p_profile->product_id,
|
||||
p_profile->pressure_intensity
|
||||
);
|
||||
|
||||
pad->m_buttons.emplace_back(special_button_offset, evdevbutton(p_profile->pressure_intensity_button).code, special_button_value::pressure_intensity);
|
||||
pad->m_pressure_intensity_button_index = pad->m_buttons.size() - 1;
|
||||
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, evdevbutton(p_profile->triangle).code, CELL_PAD_CTRL_TRIANGLE);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, evdevbutton(p_profile->circle).code, CELL_PAD_CTRL_CIRCLE);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, evdevbutton(p_profile->cross).code, CELL_PAD_CTRL_CROSS);
|
||||
|
@ -65,6 +65,8 @@ void keyboard_pad_handler::init_config(pad_config* cfg, const std::string& name)
|
||||
cfg->l2.def = GetKeyName(Qt::Key_R);
|
||||
cfg->l3.def = GetKeyName(Qt::Key_F);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// apply defaults
|
||||
cfg->from_default();
|
||||
}
|
||||
@ -743,9 +745,13 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
|
||||
p_profile->device_class_type,
|
||||
pclass_profile,
|
||||
p_profile->vendor_id,
|
||||
p_profile->product_id
|
||||
p_profile->product_id,
|
||||
p_profile->pressure_intensity
|
||||
);
|
||||
|
||||
pad->m_buttons.emplace_back(special_button_offset, find_key(p_profile->pressure_intensity_button), special_button_value::pressure_intensity);
|
||||
pad->m_pressure_intensity_button_index = pad->m_buttons.size() - 1;
|
||||
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, find_key(p_profile->left), CELL_PAD_CTRL_LEFT);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, find_key(p_profile->down), CELL_PAD_CTRL_DOWN);
|
||||
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, find_key(p_profile->right), CELL_PAD_CTRL_RIGHT);
|
||||
|
@ -60,6 +60,8 @@ void mm_joystick_handler::init_config(pad_config* cfg, const std::string& name)
|
||||
cfg->l2.def = button_list.at(JOY_BUTTON5);
|
||||
cfg->l3.def = button_list.at(JOY_BUTTON11);
|
||||
|
||||
cfg->pressure_intensity_button.def = "";
|
||||
|
||||
// Set default misc variables
|
||||
cfg->lstickdeadzone.def = 0; // between 0 and 255
|
||||
cfg->rstickdeadzone.def = 0; // between 0 and 255
|
||||
|
@ -253,6 +253,22 @@ void pad_thread::ThreadFunc()
|
||||
}
|
||||
}
|
||||
|
||||
// I guess this is the best place to add pressure sensitivity without too much code duplication.
|
||||
for (const auto& pad : m_pads)
|
||||
{
|
||||
if ((pad->m_port_status & CELL_PAD_STATUS_CONNECTED) &&
|
||||
pad->m_pressure_intensity_button_index >= 0 && pad->m_buttons[pad->m_pressure_intensity_button_index].m_pressed)
|
||||
{
|
||||
for (auto& button : pad->m_buttons)
|
||||
{
|
||||
if (button.m_pressed)
|
||||
{
|
||||
button.m_value = pad->m_pressure_intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
}
|
||||
@ -275,7 +291,8 @@ void pad_thread::InitLddPad(u32 handle)
|
||||
0, // CELL_PAD_PCLASS_TYPE_STANDARD
|
||||
product.pclass_profile,
|
||||
product.vendor_id,
|
||||
product.product_id
|
||||
product.product_id,
|
||||
50
|
||||
);
|
||||
|
||||
num_ldd_pad++;
|
||||
|
@ -298,6 +298,8 @@ void pad_settings_dialog::InitButtons()
|
||||
insert_button(button_ids::id_pad_rstick_right, ui->b_rstick_right);
|
||||
insert_button(button_ids::id_pad_rstick_up, ui->b_rstick_up);
|
||||
|
||||
insert_button(button_ids::id_pressure_intensity, ui->b_pressure_intensity);
|
||||
|
||||
m_pad_buttons->addButton(ui->b_refresh, button_ids::id_refresh);
|
||||
m_pad_buttons->addButton(ui->b_addProfile, button_ids::id_add_profile);
|
||||
|
||||
@ -578,6 +580,8 @@ void pad_settings_dialog::ReloadButtons()
|
||||
updateButton(button_ids::id_pad_rstick_right, ui->b_rstick_right, &m_handler_cfg.rs_right);
|
||||
updateButton(button_ids::id_pad_rstick_up, ui->b_rstick_up, &m_handler_cfg.rs_up);
|
||||
|
||||
updateButton(button_ids::id_pressure_intensity, ui->b_pressure_intensity, &m_handler_cfg.pressure_intensity_button);
|
||||
|
||||
m_min_force = m_handler->vibration_min;
|
||||
m_max_force = m_handler->vibration_max;
|
||||
|
||||
@ -587,6 +591,9 @@ void pad_settings_dialog::ReloadButtons()
|
||||
// Enable Deadzone Settings
|
||||
m_enable_deadzones = m_handler->has_deadzones();
|
||||
|
||||
// Enable Pressure Sensitivity Settings
|
||||
m_enable_pressure_intensity_button = m_handler->has_pressure_intensity_button();
|
||||
|
||||
UpdateLabels(true);
|
||||
}
|
||||
|
||||
@ -969,54 +976,61 @@ void pad_settings_dialog::UpdateLabels(bool is_reset)
|
||||
ui->slider_stick_right->setRange(0, m_handler->thumb_max);
|
||||
ui->slider_stick_right->setValue(m_handler_cfg.rstickdeadzone);
|
||||
|
||||
std::vector<std::string> range;
|
||||
|
||||
// Update Mouse Deadzones
|
||||
std::vector<std::string> mouse_dz_range_x = m_handler_cfg.mouse_deadzone_x.to_list();
|
||||
ui->mouse_dz_x->setRange(std::stoi(mouse_dz_range_x.front()), std::stoi(mouse_dz_range_x.back()));
|
||||
range = m_handler_cfg.mouse_deadzone_x.to_list();
|
||||
ui->mouse_dz_x->setRange(std::stoi(range.front()), std::stoi(range.back()));
|
||||
ui->mouse_dz_x->setValue(m_handler_cfg.mouse_deadzone_x);
|
||||
|
||||
std::vector<std::string> mouse_dz_range_y = m_handler_cfg.mouse_deadzone_y.to_list();
|
||||
ui->mouse_dz_y->setRange(std::stoi(mouse_dz_range_y.front()), std::stoi(mouse_dz_range_y.back()));
|
||||
range = m_handler_cfg.mouse_deadzone_y.to_list();
|
||||
ui->mouse_dz_y->setRange(std::stoi(range.front()), std::stoi(range.back()));
|
||||
ui->mouse_dz_y->setValue(m_handler_cfg.mouse_deadzone_y);
|
||||
|
||||
// Update Mouse Acceleration
|
||||
std::vector<std::string> mouse_accel_range_x = m_handler_cfg.mouse_acceleration_x.to_list();
|
||||
ui->mouse_accel_x->setRange(std::stod(mouse_accel_range_x.front()) / 100.0, std::stod(mouse_accel_range_x.back()) / 100.0);
|
||||
range = m_handler_cfg.mouse_acceleration_x.to_list();
|
||||
ui->mouse_accel_x->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->mouse_accel_x->setValue(m_handler_cfg.mouse_acceleration_x / 100.0);
|
||||
|
||||
std::vector<std::string> mouse_accel_range_y = m_handler_cfg.mouse_acceleration_y.to_list();
|
||||
ui->mouse_accel_y->setRange(std::stod(mouse_accel_range_y.front()) / 100.0, std::stod(mouse_accel_range_y.back()) / 100.0);
|
||||
range = m_handler_cfg.mouse_acceleration_y.to_list();
|
||||
ui->mouse_accel_y->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->mouse_accel_y->setValue(m_handler_cfg.mouse_acceleration_y / 100.0);
|
||||
|
||||
// Update Stick Lerp Factors
|
||||
std::vector<std::string> left_stick_lerp_range = m_handler_cfg.l_stick_lerp_factor.to_list();
|
||||
ui->left_stick_lerp->setRange(std::stod(left_stick_lerp_range.front()) / 100.0, std::stod(left_stick_lerp_range.back()) / 100.0);
|
||||
range = m_handler_cfg.l_stick_lerp_factor.to_list();
|
||||
ui->left_stick_lerp->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->left_stick_lerp->setValue(m_handler_cfg.l_stick_lerp_factor / 100.0);
|
||||
|
||||
std::vector<std::string> right_stick_lerp_range = m_handler_cfg.r_stick_lerp_factor.to_list();
|
||||
ui->right_stick_lerp->setRange(std::stod(right_stick_lerp_range.front()) / 100.0, std::stod(right_stick_lerp_range.back()) / 100.0);
|
||||
range = m_handler_cfg.r_stick_lerp_factor.to_list();
|
||||
ui->right_stick_lerp->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->right_stick_lerp->setValue(m_handler_cfg.r_stick_lerp_factor / 100.0);
|
||||
|
||||
// Update Stick Multipliers
|
||||
std::vector<std::string> stick_multi_range_left = m_handler_cfg.lstickmultiplier.to_list();
|
||||
ui->stick_multi_left->setRange(std::stod(stick_multi_range_left.front()) / 100.0, std::stod(stick_multi_range_left.back()) / 100.0);
|
||||
range = m_handler_cfg.lstickmultiplier.to_list();
|
||||
ui->stick_multi_left->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->stick_multi_left->setValue(m_handler_cfg.lstickmultiplier / 100.0);
|
||||
|
||||
std::vector<std::string> stick_multi_range_right = m_handler_cfg.rstickmultiplier.to_list();
|
||||
ui->stick_multi_right->setRange(std::stod(stick_multi_range_right.front()) / 100.0, std::stod(stick_multi_range_right.back()) / 100.0);
|
||||
range = m_handler_cfg.rstickmultiplier.to_list();
|
||||
ui->stick_multi_right->setRange(std::stod(range.front()) / 100.0, std::stod(range.back()) / 100.0);
|
||||
ui->stick_multi_right->setValue(m_handler_cfg.rstickmultiplier / 100.0);
|
||||
|
||||
// Update Squircle Factors
|
||||
std::vector<std::string> squircle_range_left = m_handler_cfg.lpadsquircling.to_list();
|
||||
ui->squircle_left->setRange(std::stoi(squircle_range_left.front()), std::stoi(squircle_range_left.back()));
|
||||
range = m_handler_cfg.lpadsquircling.to_list();
|
||||
ui->squircle_left->setRange(std::stoi(range.front()), std::stoi(range.back()));
|
||||
ui->squircle_left->setValue(m_handler_cfg.lpadsquircling);
|
||||
|
||||
std::vector<std::string> squircle_range_right = m_handler_cfg.rpadsquircling.to_list();
|
||||
ui->squircle_right->setRange(std::stoi(squircle_range_right.front()), std::stoi(squircle_range_right.back()));
|
||||
range = m_handler_cfg.rpadsquircling.to_list();
|
||||
ui->squircle_right->setRange(std::stoi(range.front()), std::stoi(range.back()));
|
||||
ui->squircle_right->setValue(m_handler_cfg.rpadsquircling);
|
||||
|
||||
RepaintPreviewLabel(ui->preview_stick_left, ui->slider_stick_left->value(), ui->slider_stick_left->size().width(), m_lx, m_ly, m_handler_cfg.lpadsquircling, m_handler_cfg.lstickmultiplier / 100.0);
|
||||
RepaintPreviewLabel(ui->preview_stick_right, ui->slider_stick_right->value(), ui->slider_stick_right->size().width(), m_rx, m_ry, m_handler_cfg.rpadsquircling, m_handler_cfg.rstickmultiplier / 100.0);
|
||||
|
||||
// Update pressure sensitivity factors
|
||||
range = m_handler_cfg.pressure_intensity.to_list();
|
||||
ui->sb_pressure_intensity->setRange(std::stoi(range.front()), std::stoi(range.back()));
|
||||
ui->sb_pressure_intensity->setValue(m_handler_cfg.pressure_intensity);
|
||||
|
||||
// Apply stored/default LED settings to the device
|
||||
m_enable_led = m_handler->has_led();
|
||||
m_handler->SetPadData(m_device_name, 0, 0, m_handler_cfg.colorR, m_handler_cfg.colorG, m_handler_cfg.colorB, false, m_handler_cfg.led_battery_indicator_brightness);
|
||||
@ -1043,6 +1057,7 @@ void pad_settings_dialog::SwitchButtons(bool is_enabled)
|
||||
{
|
||||
m_enable_buttons = is_enabled;
|
||||
|
||||
ui->gb_pressure_intensity->setEnabled(is_enabled && m_enable_pressure_intensity_button);
|
||||
ui->gb_vibration->setEnabled(is_enabled && m_enable_rumble);
|
||||
ui->gb_sticks->setEnabled(is_enabled && m_enable_deadzones);
|
||||
ui->gb_triggers->setEnabled(is_enabled && m_enable_deadzones);
|
||||
@ -1244,6 +1259,7 @@ void pad_settings_dialog::ChangeInputType()
|
||||
// change our contextual widgets
|
||||
ui->left_stack->setCurrentIndex((m_handler->m_type == pad_handler::keyboard) ? 1 : 0);
|
||||
ui->right_stack->setCurrentIndex((m_handler->m_type == pad_handler::keyboard) ? 1 : 0);
|
||||
ui->gb_pressure_intensity->setVisible(m_handler->has_pressure_intensity_button());
|
||||
|
||||
// Refill the device combobox with currently available devices
|
||||
switch (m_handler->m_type)
|
||||
@ -1552,6 +1568,11 @@ void pad_settings_dialog::SaveProfile()
|
||||
m_handler_cfg.rstickdeadzone.set(ui->slider_stick_right->value());
|
||||
}
|
||||
|
||||
if (m_handler->has_pressure_intensity_button())
|
||||
{
|
||||
m_handler_cfg.pressure_intensity.set(ui->sb_pressure_intensity->value());
|
||||
}
|
||||
|
||||
if (m_handler->m_type == pad_handler::keyboard)
|
||||
{
|
||||
m_handler_cfg.mouse_acceleration_x.set(ui->mouse_accel_x->value() * 100);
|
||||
@ -1665,6 +1686,7 @@ void pad_settings_dialog::SubscribeTooltips()
|
||||
// Localized tooltips
|
||||
const Tooltips tooltips;
|
||||
|
||||
SubscribeTooltip(ui->gb_pressure_intensity, tooltips.gamepad_settings.pressure_intensity);
|
||||
SubscribeTooltip(ui->gb_squircle, tooltips.gamepad_settings.squircle_factor);
|
||||
SubscribeTooltip(ui->gb_stick_multi, tooltips.gamepad_settings.stick_multiplier);
|
||||
SubscribeTooltip(ui->gb_vibration, tooltips.gamepad_settings.vibration);
|
||||
|
@ -66,6 +66,8 @@ class pad_settings_dialog : public QDialog
|
||||
id_pad_rstick_right,
|
||||
id_pad_rstick_up,
|
||||
|
||||
id_pressure_intensity, // Special button for pressure intensity
|
||||
|
||||
id_pad_end, // end
|
||||
|
||||
id_led,
|
||||
@ -117,6 +119,7 @@ private:
|
||||
bool m_enable_deadzones{ false };
|
||||
bool m_enable_led{ false };
|
||||
bool m_enable_battery{ false };
|
||||
bool m_enable_pressure_intensity_button{ true };
|
||||
|
||||
// Button Mapping
|
||||
QButtonGroup* m_pad_buttons = nullptr;
|
||||
|
@ -641,6 +641,47 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_pressure_intensity">
|
||||
<property name="title">
|
||||
<string>Pressure Sensitivity Mode</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="pressure_intensity_layout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="b_pressure_intensity">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sb_pressure_intensity">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="left_stack">
|
||||
<property name="lineWidth">
|
||||
|
@ -233,6 +233,7 @@ public:
|
||||
const QString evdev = tr("The evdev handler should work with any controller that has linux support.<br>If your joystick is not being centered properly, read the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.");
|
||||
const QString mmjoy = tr("The MMJoystick handler should work with almost any controller recognized by Windows. However, it is recommended that you use the more specific handlers if you have a controller that supports them.");
|
||||
|
||||
const QString pressure_intensity = tr("Controls the intensity of pressure sensitive buttons while this special button is pressed.<br>Use the percentage to change how hard you want to press a button.");
|
||||
const QString squircle_factor = tr("The actual DualShock 3's stick range is not circular but formed like a rounded square (or squircle) which represents the maximum range of the emulated sticks. You can use the squircle values to modify the stick input if your sticks can't reach the corners of that range. A value of 0 does not apply any so called squircling. A value of 8000 is usually recommended.");
|
||||
const QString stick_multiplier = tr("The stick multipliers can be used to change the sensitivity of your stick movements.<br>The default setting is 1 and represents normal input.");
|
||||
const QString stick_deadzones = tr("A stick's deadzone determines how far the stick has to be moved until it is fully recognized by the game. The resulting range will be projected onto the full input range in order to give you a smooth experience. Movement inside the deadzone is actually simulated as a real DualShock 3's deadzone of ~13%, so don't worry if there is still movement shown in the emulated stick preview.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user