mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 18:28:35 +12:00
input: move config getters to base class
This commit is contained in:
parent
35c92723c7
commit
b3a9c8d83f
6 changed files with 26 additions and 59 deletions
|
@ -323,6 +323,26 @@ void PadHandlerBase::init_configs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg_pad* PadHandlerBase::get_config(const std::string& pad_id)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (uint i = 0; i < MAX_GAMEPADS; i++)
|
||||||
|
{
|
||||||
|
if (g_cfg_input.player[i]->handler == m_type)
|
||||||
|
{
|
||||||
|
if (g_cfg_input.player[i]->device.to_string() == pad_id)
|
||||||
|
{
|
||||||
|
m_pad_configs[index].from_string(g_cfg_input.player[i]->config.to_string());
|
||||||
|
return &m_pad_configs[index];
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::string& pad_id, const pad_callback& callback, const pad_fail_callback& fail_callback, bool get_blacklist, const std::vector<std::string>& /*buttons*/)
|
PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::string& pad_id, const pad_callback& callback, const pad_fail_callback& fail_callback, bool get_blacklist, const std::vector<std::string>& /*buttons*/)
|
||||||
{
|
{
|
||||||
if (get_blacklist)
|
if (get_blacklist)
|
||||||
|
|
|
@ -229,4 +229,5 @@ protected:
|
||||||
virtual void get_mapping(const pad_ensemble& binding);
|
virtual void get_mapping(const pad_ensemble& binding);
|
||||||
void TranslateButtonPress(const std::shared_ptr<PadDevice>& device, u64 keyCode, bool& pressed, u16& val, bool ignore_stick_threshold = false, bool ignore_trigger_threshold = false);
|
void TranslateButtonPress(const std::shared_ptr<PadDevice>& device, u64 keyCode, bool& pressed, u16& val, bool ignore_stick_threshold = false, bool ignore_trigger_threshold = false);
|
||||||
void init_configs();
|
void init_configs();
|
||||||
|
cfg_pad* get_config(const std::string& pad_id);
|
||||||
};
|
};
|
||||||
|
|
|
@ -130,21 +130,7 @@ void ds3_pad_handler::SetPadData(const std::string& padId, u8 player_id, u8 larg
|
||||||
device->large_motor = large_motor;
|
device->large_motor = large_motor;
|
||||||
device->small_motor = small_motor;
|
device->small_motor = small_motor;
|
||||||
device->player_id = player_id;
|
device->player_id = player_id;
|
||||||
|
device->config = get_config(padId);
|
||||||
int index = 0;
|
|
||||||
for (uint i = 0; i < MAX_GAMEPADS; i++)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->handler == m_type)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->device.to_string() == padId)
|
|
||||||
{
|
|
||||||
m_pad_configs[index].from_string(g_cfg_input.player[i]->config.to_string());
|
|
||||||
device->config = &m_pad_configs[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ensure(device->config);
|
ensure(device->config);
|
||||||
device->config->player_led_enabled.set(player_led);
|
device->config->player_led_enabled.set(player_led);
|
||||||
|
|
|
@ -205,21 +205,7 @@ void ds4_pad_handler::SetPadData(const std::string& padId, u8 player_id, u8 larg
|
||||||
device->large_motor = large_motor;
|
device->large_motor = large_motor;
|
||||||
device->small_motor = small_motor;
|
device->small_motor = small_motor;
|
||||||
device->player_id = player_id;
|
device->player_id = player_id;
|
||||||
|
device->config = get_config(padId);
|
||||||
int index = 0;
|
|
||||||
for (uint i = 0; i < MAX_GAMEPADS; i++)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->handler == m_type)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->device.to_string() == padId)
|
|
||||||
{
|
|
||||||
m_pad_configs[index].from_string(g_cfg_input.player[i]->config.to_string());
|
|
||||||
device->config = &m_pad_configs[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ensure(device->config);
|
ensure(device->config);
|
||||||
|
|
||||||
|
|
|
@ -1143,21 +1143,7 @@ void dualsense_pad_handler::SetPadData(const std::string& padId, u8 player_id, u
|
||||||
device->large_motor = large_motor;
|
device->large_motor = large_motor;
|
||||||
device->small_motor = small_motor;
|
device->small_motor = small_motor;
|
||||||
device->player_id = player_id;
|
device->player_id = player_id;
|
||||||
|
device->config = get_config(padId);
|
||||||
int index = 0;
|
|
||||||
for (uint i = 0; i < MAX_GAMEPADS; i++)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->handler == m_type)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->device.to_string() == padId)
|
|
||||||
{
|
|
||||||
m_pad_configs[index].from_string(g_cfg_input.player[i]->config.to_string());
|
|
||||||
device->config = &m_pad_configs[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ensure(device->config);
|
ensure(device->config);
|
||||||
device->update_lightbar = true;
|
device->update_lightbar = true;
|
||||||
|
|
|
@ -443,21 +443,9 @@ void sdl_pad_handler::SetPadData(const std::string& padId, u8 player_id, u8 larg
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dev->player_id = player_id;
|
dev->player_id = player_id;
|
||||||
|
dev->config = get_config(padId);
|
||||||
|
|
||||||
int index = 0;
|
ensure(dev->config);
|
||||||
for (uint i = 0; i < MAX_GAMEPADS; i++)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->handler == m_type)
|
|
||||||
{
|
|
||||||
if (g_cfg_input.player[i]->device.to_string() == padId)
|
|
||||||
{
|
|
||||||
m_pad_configs[index].from_string(g_cfg_input.player[i]->config.to_string());
|
|
||||||
device->config = &m_pad_configs[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set_rumble(dev, large_motor, small_motor);
|
set_rumble(dev, large_motor, small_motor);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue