Merge pull request #2058 from RadWolfie/input-list-fix

Change listing to target specific type than default order
This commit is contained in:
PatrickvL 2020-12-03 08:30:07 +01:00 committed by GitHub
commit 471f3894cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -39,6 +39,17 @@
extern int dev_num_buttons[to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)];
typedef struct _input_controller {
XBOX_INPUT_DEVICE type;
const char* name;
} input_controller;
static input_controller input_support_list[] = {
{ XBOX_INPUT_DEVICE::DEVICE_INVALID, "None" },
{ XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE, "MS Controller Duke" },
{ XBOX_INPUT_DEVICE::MS_CONTROLLER_S, "MS Controller S" },
};
#pragma pack(1)
// xpad in/out buffers stripped of the first two bytes

View File

@ -114,11 +114,11 @@ INT_PTR CALLBACK DlgInputConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
for (int i = 0, j = 0; i != 4; i++) {
HWND hHandle = GetDlgItem(hWndDlg, IDC_DEVICE_PORT1 + i);
for (auto str : { "None", "MS Controller Duke", "MS Controller S" }) {
LRESULT index = SendMessage(hHandle, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str));
for (auto input : input_support_list) {
LRESULT index = SendMessage(hHandle, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(input.name));
SendMessage(hHandle, CB_SETITEMDATA, index,
to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID) + j);
if (g_Settings->m_input_port[i].Type == to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID) + j) {
to_underlying(input.type));
if (g_Settings->m_input_port[i].Type == to_underlying(input.type)) {
SendMessage(hHandle, CB_SETCURSEL, index, 0);
if (g_Settings->m_input_port[i].Type == to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID)) {
EnableWindow(GetDlgItem(hWndDlg, IDC_CONFIGURE_PORT1 + i), FALSE);