input: add battery LED flag and some getters

This commit is contained in:
Megamouse 2024-07-06 17:46:37 +02:00
parent 1a61a7a39f
commit 20f906bf9b
9 changed files with 22 additions and 66 deletions

View File

@ -192,61 +192,6 @@ std::tuple<u16, u16> PadHandlerBase::ConvertToSquirclePoint(u16 inX, u16 inY, u3
return std::tuple<u16, u16>(newX, newY);
}
std::string PadHandlerBase::name_string() const
{
return m_name_string;
}
usz PadHandlerBase::max_devices() const
{
return m_max_devices;
}
bool PadHandlerBase::has_config() const
{
return b_has_config;
}
bool PadHandlerBase::has_rumble() const
{
return b_has_rumble;
}
bool PadHandlerBase::has_motion() const
{
return b_has_motion;
}
bool PadHandlerBase::has_deadzones() const
{
return b_has_deadzones;
}
bool PadHandlerBase::has_led() const
{
return b_has_led;
}
bool PadHandlerBase::has_rgb() const
{
return b_has_rgb;
}
bool PadHandlerBase::has_player_led() const
{
return b_has_player_led;
}
bool PadHandlerBase::has_battery() const
{
return b_has_battery;
}
bool PadHandlerBase::has_pressure_intensity_button() const
{
return b_has_pressure_intensity_button;
}
void PadHandlerBase::init_configs()
{
for (u32 i = 0; i < MAX_GAMEPADS; i++)

View File

@ -123,6 +123,7 @@ protected:
bool b_has_rgb = false;
bool b_has_player_led = false;
bool b_has_battery = false;
bool b_has_battery_led = false;
bool b_has_deadzones = false;
bool b_has_rumble = false;
bool b_has_motion = false;
@ -249,17 +250,19 @@ public:
pad_handler m_type;
bool m_is_init = false;
std::string name_string() const;
usz max_devices() const;
bool has_config() const;
bool has_rumble() const;
bool has_motion() const;
bool has_deadzones() const;
bool has_led() const;
bool has_rgb() const;
bool has_player_led() const;
bool has_battery() const;
bool has_pressure_intensity_button() const;
std::vector<pad_ensemble>& bindings() { return m_bindings; }
std::string name_string() const { return m_name_string; }
usz max_devices() const { return m_max_devices; }
bool has_config() const { return b_has_config; }
bool has_rumble() const { return b_has_rumble; }
bool has_motion() const { return b_has_motion; }
bool has_deadzones() const { return b_has_deadzones; }
bool has_led() const { return b_has_led; }
bool has_rgb() const { return b_has_rgb; }
bool has_player_led() const { return b_has_player_led; }
bool has_battery() const { return b_has_battery; }
bool has_battery_led() const { return b_has_battery_led; }
bool has_pressure_intensity_button() const { return b_has_pressure_intensity_button; }
u16 NormalizeStickInput(u16 raw_value, s32 threshold, s32 multiplier, bool ignore_threshold = false) const;
void convert_stick_values(u16& x_out, u16& y_out, s32 x_in, s32 y_in, u32 deadzone, u32 anti_deadzone, u32 padsquircling) const;

View File

@ -53,6 +53,7 @@ ds3_pad_handler::ds3_pad_handler()
b_has_motion = true;
b_has_deadzones = true;
b_has_battery = true;
b_has_battery_led = true;
b_has_led = true;
b_has_rgb = false;
b_has_player_led = true;

View File

@ -113,6 +113,7 @@ ds4_pad_handler::ds4_pad_handler()
b_has_led = true;
b_has_rgb = true;
b_has_battery = true;
b_has_battery_led = true;
m_name_string = "DS4 Pad #";
m_max_devices = CELL_PAD_MAX_PORT_NUM;

View File

@ -85,6 +85,7 @@ dualsense_pad_handler::dualsense_pad_handler()
b_has_rgb = true;
b_has_player_led = true;
b_has_battery = true;
b_has_battery_led = true;
m_name_string = "DualSense Pad #";
m_max_devices = CELL_PAD_MAX_PORT_NUM;

View File

@ -34,6 +34,8 @@ public:
void open_home_menu();
std::map<pad_handler, std::shared_ptr<PadHandlerBase>>& get_handlers() { return m_handlers; }
static std::shared_ptr<PadHandlerBase> GetHandler(pad_handler type);
static void InitPadConfig(cfg_pad& cfg, pad_handler type, std::shared_ptr<PadHandlerBase>& handler);

View File

@ -170,6 +170,7 @@ sdl_pad_handler::sdl_pad_handler() : PadHandlerBase(pad_handler::sdl)
b_has_led = true;
b_has_rgb = true;
b_has_battery = true;
b_has_battery_led = true;
m_trigger_threshold = trigger_max / 2;
m_thumb_threshold = thumb_max / 2;

View File

@ -81,6 +81,7 @@ skateboard_pad_handler::skateboard_pad_handler()
b_has_rgb = false;
b_has_player_led = false;
b_has_battery = false;
b_has_battery_led = false;
b_has_pressure_intensity_button = false;
m_name_string = "Skateboard #";

View File

@ -59,6 +59,7 @@ xinput_pad_handler::xinput_pad_handler() : PadHandlerBase(pad_handler::xinput)
b_has_rumble = true;
b_has_deadzones = true;
b_has_battery = true;
b_has_battery_led = false;
m_name_string = "XInput Pad #";
m_max_devices = XUSER_MAX_COUNT;