diff --git a/rpcs3/Emu/Io/PadHandler.cpp b/rpcs3/Emu/Io/PadHandler.cpp index 1667aa3b1d..cc8734b10c 100644 --- a/rpcs3/Emu/Io/PadHandler.cpp +++ b/rpcs3/Emu/Io/PadHandler.cpp @@ -350,7 +350,6 @@ void PadHandlerBase::get_motion_sensors(const std::string& pad_id, const motion_ // Get the current motion values std::shared_ptr pad = std::make_shared(m_type, 0, 0, 0, 0); - pad->m_sensors.resize(preview_values.size(), AnalogSensor(0, 0, 0, 0, 0)); pad_ensemble binding{pad, device, nullptr}; get_extended_info(binding); @@ -505,18 +504,18 @@ bool PadHandlerBase::bindPadToDevice(std::shared_ptr pad) pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_PRESS_PIGGYBACK, mapping[button::skateboard_tilt_right], CELL_PAD_CTRL_PRESS_R1); } - pad->m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X, mapping[button::ls_left], mapping[button::ls_right]); - pad->m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y, mapping[button::ls_down], mapping[button::ls_up]); - pad->m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X, mapping[button::rs_left], mapping[button::rs_right]); - pad->m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y, mapping[button::rs_down], mapping[button::rs_up]); + pad->m_sticks[0] = AnalogStick(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X, mapping[button::ls_left], mapping[button::ls_right]); + pad->m_sticks[1] = AnalogStick(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y, mapping[button::ls_down], mapping[button::ls_up]); + pad->m_sticks[2] = AnalogStick(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X, mapping[button::rs_left], mapping[button::rs_right]); + pad->m_sticks[3] = AnalogStick(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y, mapping[button::rs_down], mapping[button::rs_up]); - pad->m_sensors.emplace_back(CELL_PAD_BTN_OFFSET_SENSOR_X, 0, 0, 0, DEFAULT_MOTION_X); - pad->m_sensors.emplace_back(CELL_PAD_BTN_OFFSET_SENSOR_Y, 0, 0, 0, DEFAULT_MOTION_Y); - pad->m_sensors.emplace_back(CELL_PAD_BTN_OFFSET_SENSOR_Z, 0, 0, 0, DEFAULT_MOTION_Z); - pad->m_sensors.emplace_back(CELL_PAD_BTN_OFFSET_SENSOR_G, 0, 0, 0, DEFAULT_MOTION_G); + pad->m_sensors[0] = AnalogSensor(CELL_PAD_BTN_OFFSET_SENSOR_X, 0, 0, 0, DEFAULT_MOTION_X); + pad->m_sensors[1] = AnalogSensor(CELL_PAD_BTN_OFFSET_SENSOR_Y, 0, 0, 0, DEFAULT_MOTION_Y); + pad->m_sensors[2] = AnalogSensor(CELL_PAD_BTN_OFFSET_SENSOR_Z, 0, 0, 0, DEFAULT_MOTION_Z); + pad->m_sensors[3] = AnalogSensor(CELL_PAD_BTN_OFFSET_SENSOR_G, 0, 0, 0, DEFAULT_MOTION_G); - pad->m_vibrateMotors.emplace_back(true, 0); - pad->m_vibrateMotors.emplace_back(false, 0); + pad->m_vibrateMotors[0] = VibrateMotor(true, 0); + pad->m_vibrateMotors[1] = VibrateMotor(false, 0); m_bindings.emplace_back(pad, pad_device, nullptr); diff --git a/rpcs3/Emu/Io/pad_types.h b/rpcs3/Emu/Io/pad_types.h index 75b9122137..e99b2edda3 100644 --- a/rpcs3/Emu/Io/pad_types.h +++ b/rpcs3/Emu/Io/pad_types.h @@ -417,6 +417,7 @@ struct AnalogStick std::map m_pressed_keys_min{}; // only used in keyboard_pad_handler std::map m_pressed_keys_max{}; // only used in keyboard_pad_handler + AnalogStick() {} AnalogStick(u32 offset, std::set key_codes_min, std::set key_codes_max) : m_offset(offset) , m_key_codes_min(std::move(key_codes_min)) @@ -447,6 +448,7 @@ struct VibrateMotor bool m_is_large_motor = false; u8 m_value = 0; + VibrateMotor() {} VibrateMotor(bool is_large_motor, u8 value) : m_is_large_motor(is_large_motor) , m_value(value) @@ -489,9 +491,9 @@ struct Pad u8 m_battery_level{0}; std::vector