diff --git a/rpcs3/Emu/Io/PadHandler.cpp b/rpcs3/Emu/Io/PadHandler.cpp index d71a59f311..eabb55ff3e 100644 --- a/rpcs3/Emu/Io/PadHandler.cpp +++ b/rpcs3/Emu/Io/PadHandler.cpp @@ -248,6 +248,11 @@ std::tuple PadHandlerBase::ConvertToSquirclePoint(u16 inX, u16 inY, in return std::tuple(newX, newY); } +int PadHandlerBase::max_devices() +{ + return m_max_devices; +} + bool PadHandlerBase::has_config() { return b_has_config; diff --git a/rpcs3/Emu/Io/PadHandler.h b/rpcs3/Emu/Io/PadHandler.h index 9d850dcee2..db410b1810 100644 --- a/rpcs3/Emu/Io/PadHandler.h +++ b/rpcs3/Emu/Io/PadHandler.h @@ -363,6 +363,7 @@ protected: std::array 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(); diff --git a/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp b/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp index 1f3fa53938..ce6096f255 100644 --- a/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp @@ -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 diff --git a/rpcs3/xinput_pad_handler.cpp b/rpcs3/xinput_pad_handler.cpp index 08267c2cdb..acbe50b876 100644 --- a/rpcs3/xinput_pad_handler.cpp +++ b/rpcs3/xinput_pad_handler.cpp @@ -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 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; }