diff --git a/src/common/Settings.cpp b/src/common/Settings.cpp index dd47a9b5f..2da72ba25 100644 --- a/src/common/Settings.cpp +++ b/src/common/Settings.cpp @@ -490,6 +490,7 @@ bool Settings::LoadConfig() { case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE): case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): lambda(dev_num_buttons[device], button_xbox_ctrl_names); break; @@ -650,6 +651,7 @@ bool Settings::Save(std::string file_path) { case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE): case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): lambda(dev_num_buttons[device], button_xbox_ctrl_names); break; diff --git a/src/common/input/EmuDevice.cpp b/src/common/input/EmuDevice.cpp index b92411d91..3b4caf5ce 100644 --- a/src/common/input/EmuDevice.cpp +++ b/src/common/input/EmuDevice.cpp @@ -41,7 +41,8 @@ EmuDevice::EmuDevice(int type, HWND hwnd, void *wnd) switch (type) { case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE): - case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): { + case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): { for (size_t i = 0; i < ARRAY_SIZE(button_xbox_ctrl_id); i++) { m_buttons.push_back(new Button(button_xbox_ctrl_id[i], i, hwnd, wnd)); m_buttons.back()->AddTooltip(m_hwnd, m_tooltip_hwnd, tooltip_text); diff --git a/src/common/input/InputDevice.cpp b/src/common/input/InputDevice.cpp index 05223789b..f00ec285d 100644 --- a/src/common/input/InputDevice.cpp +++ b/src/common/input/InputDevice.cpp @@ -71,6 +71,10 @@ std::string GetInputDeviceName(int dev_type) str = "Steel battalion controller"; break; + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): + str = "Arcade joystick"; + break; + case to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID): str = "None"; break; diff --git a/src/common/input/InputDevice.h b/src/common/input/InputDevice.h index 93c4e70c2..c0c8cbcef 100644 --- a/src/common/input/InputDevice.h +++ b/src/common/input/InputDevice.h @@ -63,6 +63,7 @@ typedef enum class _XBOX_INPUT_DEVICE : int { MEMORY_UNIT, IR_DONGLE, STEEL_BATTALION_CONTROLLER, + ARCADE_STICK, DEVICE_MAX, } XBOX_INPUT_DEVICE; diff --git a/src/common/input/InputManager.cpp b/src/common/input/InputManager.cpp index e60305e0f..c213153ce 100644 --- a/src/common/input/InputManager.cpp +++ b/src/common/input/InputManager.cpp @@ -64,6 +64,7 @@ int dev_num_buttons[to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)] = { 0, 0, SBC_NUM_BUTTONS, // STEEL_BATTALION_CONTROLLER + XBOX_CTRL_NUM_BUTTONS, // ARCADE_STICK }; extern CXBX_CONTROLLER_HOST_BRIDGE g_XboxControllerHostBridge[4]; // hle xinput @@ -360,7 +361,8 @@ bool InputDeviceManager::UpdateXboxPortInput(int usb_port, void* Buffer, int Dir switch (xid_type) { case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE): - case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): { + case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): { has_changed = UpdateInputXpad(dev_ptr, Buffer, Direction); } break; diff --git a/src/common/input/InputManager.h b/src/common/input/InputManager.h index cc4f3dc31..bf4ea777e 100644 --- a/src/common/input/InputManager.h +++ b/src/common/input/InputManager.h @@ -44,6 +44,7 @@ inline XBOX_INPUT_DEVICE input_support_list[] = { XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE, XBOX_INPUT_DEVICE::MS_CONTROLLER_S, XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER, + XBOX_INPUT_DEVICE::ARCADE_STICK, }; #pragma pack(1) diff --git a/src/core/hle/XAPI/Xapi.cpp b/src/core/hle/XAPI/Xapi.cpp index 90f2ac10b..6bf460cfd 100644 --- a/src/core/hle/XAPI/Xapi.cpp +++ b/src/core/hle/XAPI/Xapi.cpp @@ -67,7 +67,8 @@ bool operator==(xbox::PXPP_DEVICE_TYPE XppType, XBOX_INPUT_DEVICE XidType) switch (XidType) { case XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE: - case XBOX_INPUT_DEVICE::MS_CONTROLLER_S: { + case XBOX_INPUT_DEVICE::MS_CONTROLLER_S: + case XBOX_INPUT_DEVICE::ARCADE_STICK: { if (XppType == g_DeviceType_Gamepad) { return true; } @@ -149,6 +150,20 @@ bool ConstructHleInputDevice(int Type, int Port) } break; + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): { + g_XboxControllerHostBridge[Port].XboxPort = Port; + g_XboxControllerHostBridge[Port].XboxType = XBOX_INPUT_DEVICE::ARCADE_STICK; + g_XboxControllerHostBridge[Port].bPendingRemoval = false; + g_XboxControllerHostBridge[Port].bSignaled = false; + g_XboxControllerHostBridge[Port].bIoInProgress = false; + g_XboxControllerHostBridge[Port].XboxDeviceInfo.ucType = XINPUT_DEVTYPE_GAMEPAD; + g_XboxControllerHostBridge[Port].XboxDeviceInfo.ucSubType = XINPUT_DEVSUBTYPE_GC_ARCADE_STICK; + g_XboxControllerHostBridge[Port].XboxDeviceInfo.ucInputStateSize = sizeof(XpadInput); + g_XboxControllerHostBridge[Port].XboxDeviceInfo.ucFeedbackSize = sizeof(XpadOutput); + g_XboxControllerHostBridge[Port].XboxDeviceInfo.dwPacketNumber = 0; + } + break; + case to_underlying(XBOX_INPUT_DEVICE::LIGHT_GUN): case to_underlying(XBOX_INPUT_DEVICE::STEERING_WHEEL): case to_underlying(XBOX_INPUT_DEVICE::MEMORY_UNIT): diff --git a/src/gui/DlgInputConfig.cpp b/src/gui/DlgInputConfig.cpp index 47bb085e8..a1efc5720 100644 --- a/src/gui/DlgInputConfig.cpp +++ b/src/gui/DlgInputConfig.cpp @@ -195,7 +195,8 @@ INT_PTR CALLBACK DlgInputConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR switch (DeviceType) { case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE): - case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): { + case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S): + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): { DialogBoxParam(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_XID_DUKE_CFG), hWndDlg, DlgXidControllerConfigProc, (DeviceType << 8) | port); } diff --git a/src/gui/controllers/DlgDukeControllerConfig.cpp b/src/gui/controllers/DlgDukeControllerConfig.cpp index 4fffef0b7..0eca3788e 100644 --- a/src/gui/controllers/DlgDukeControllerConfig.cpp +++ b/src/gui/controllers/DlgDukeControllerConfig.cpp @@ -72,6 +72,11 @@ void DukeInputWindow::Initialize(HWND hwnd, int port_num, int dev_type) } break; + case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK): { + title += "Arcade joystick at port "; + } + break; + } SendMessage(m_hwnd_window, WM_SETTEXT, 0, reinterpret_cast((title + std::to_string(PORT_INC(m_port_num))).c_str())); @@ -250,7 +255,8 @@ INT_PTR CALLBACK DlgXidControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wPar // Ensure that the controller type is valid assert(dev_type == to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE) || - dev_type == to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S)); + dev_type == to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S) || + dev_type == to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK)); g_InputWindow = new DukeInputWindow; g_InputWindow->Initialize(hWndDlg, port_num, dev_type);