mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12:00
Qt/Input: enable XInput configs with disconnected devices
This commit is contained in:
parent
c5755b3633
commit
d6c4d8eec0
4 changed files with 32 additions and 6 deletions
|
@ -248,6 +248,11 @@ std::tuple<u16, u16> PadHandlerBase::ConvertToSquirclePoint(u16 inX, u16 inY, in
|
|||
return std::tuple<u16, u16>(newX, newY);
|
||||
}
|
||||
|
||||
int PadHandlerBase::max_devices()
|
||||
{
|
||||
return m_max_devices;
|
||||
}
|
||||
|
||||
bool PadHandlerBase::has_config()
|
||||
{
|
||||
return b_has_config;
|
||||
|
|
|
@ -363,6 +363,7 @@ protected:
|
|||
|
||||
std::array<bool, MAX_GAMEPADS> last_connection_status{{ false, false, false, false, false, false, false }};
|
||||
|
||||
int m_max_devices = 0;
|
||||
int m_trigger_threshold = 0;
|
||||
int m_thumb_threshold = 0;
|
||||
|
||||
|
@ -435,6 +436,7 @@ public:
|
|||
|
||||
pad_handler m_type = pad_handler::null;
|
||||
|
||||
int max_devices();
|
||||
bool has_config();
|
||||
bool has_rumble();
|
||||
bool has_deadzones();
|
||||
|
|
|
@ -324,16 +324,33 @@ void gamepads_settings_dialog::ChangeInputType(int player)
|
|||
|
||||
// Refill the device combobox with currently available devices
|
||||
co_deviceID[player]->clear();
|
||||
for (int i = 0; i < list_devices.size(); i++)
|
||||
|
||||
bool force_enable = true; // enable configs even with disconnected devices
|
||||
|
||||
switch (cur_pad_handler->m_type)
|
||||
{
|
||||
co_deviceID[player]->addItem(qstr(list_devices[i]), i);
|
||||
#ifdef _MSC_VER
|
||||
case pad_handler::xinput:
|
||||
for (int i = 0; i < cur_pad_handler->max_devices(); i++)
|
||||
{
|
||||
co_deviceID[player]->addItem(QString("XInput Pad #%1").arg(i), i);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
for (int i = 0; i < list_devices.size(); i++)
|
||||
{
|
||||
co_deviceID[player]->addItem(qstr(list_devices[i]), i);
|
||||
}
|
||||
force_enable = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Handle empty device list
|
||||
bool device_found = list_devices.size() > 0;
|
||||
co_deviceID[player]->setEnabled(device_found);
|
||||
co_deviceID[player]->setEnabled(force_enable || device_found);
|
||||
|
||||
if (device_found)
|
||||
if (force_enable || device_found)
|
||||
{
|
||||
co_deviceID[player]->setCurrentText(qstr(device));
|
||||
}
|
||||
|
@ -342,7 +359,7 @@ void gamepads_settings_dialog::ChangeInputType(int player)
|
|||
co_deviceID[player]->addItem(tr("No Device Detected"), -1);
|
||||
}
|
||||
|
||||
bool config_enabled = device_found && cur_pad_handler->has_config();
|
||||
bool config_enabled = force_enable || (device_found && cur_pad_handler->has_config());
|
||||
co_profile[player]->clear();
|
||||
|
||||
// update profile list if possible
|
||||
|
|
|
@ -19,6 +19,8 @@ xinput_pad_handler::xinput_pad_handler() : PadHandlerBase(pad_handler::xinput)
|
|||
b_has_rumble = true;
|
||||
b_has_deadzones = true;
|
||||
|
||||
m_max_devices = XUSER_MAX_COUNT;
|
||||
|
||||
m_trigger_threshold = trigger_max / 2;
|
||||
m_thumb_threshold = thumb_max / 2;
|
||||
}
|
||||
|
@ -451,7 +453,7 @@ std::vector<std::string> xinput_pad_handler::ListDevices()
|
|||
XINPUT_STATE state;
|
||||
DWORD result = (*xinputGetState)(i, &state);
|
||||
if (result == ERROR_SUCCESS)
|
||||
xinput_pads_list.push_back(fmt::format("Xinput Pad #%d", i));
|
||||
xinput_pads_list.push_back(fmt::format("XInput Pad #%d", i));
|
||||
}
|
||||
return xinput_pads_list;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue