Skip to content

Commit

Permalink
Xbox One Support (Passthrough Dongle Required) (OpenStickCommunity#671)
Browse files Browse the repository at this point in the history
* [ImgBot] Optimize images

*Total -- 17,269.00kb -> 14,501.79kb (16.02%)

/site/docs/assets/images/gpc-add-ons-input-history.png -- 6.80kb -> 3.09kb (54.57%)
/configs/OpenCore0WASD/assets/Open_Core0_WASD_pinout.png -- 61.94kb -> 29.30kb (52.69%)
/configs/OpenCore0/assets/Open_Core0_WASD_pinout.png -- 61.94kb -> 29.30kb (52.69%)
/configs/RanaTadpole/assets/RanaTadpole_buttons.png -- 173.20kb -> 109.41kb (36.83%)
/configs/ReflexEncodeV2.0/assets/ReflexBoard_V2.png -- 3,498.35kb -> 2,412.30kb (31.04%)
/site/docs/assets/images/gpc-add-ons-keyboard-host-configuration.png -- 62.86kb -> 43.65kb (30.57%)
/site/docs/assets/images/gpc-macros-input-line.png -- 25.08kb -> 17.43kb (30.5%)
/site/docs/assets/images/gpc-keyboard-mapping.png -- 49.17kb -> 34.21kb (30.43%)
/site/docs/assets/images/gpc-backup-and-restore.png -- 13.17kb -> 9.25kb (29.75%)
/site/docs/assets/images/gpc-macros.png -- 88.21kb -> 62.03kb (29.68%)
/site/docs/assets/images/gpc-hotkey-settings.png -- 86.91kb -> 61.12kb (29.67%)
/site/docs/assets/images/gpc-add-ons-focus-mode.png -- 15.88kb -> 11.31kb (28.81%)
/site/docs/assets/images/gpc-restore.png -- 25.15kb -> 17.93kb (28.7%)
/site/docs/assets/images/gpc-home.png -- 58.23kb -> 41.75kb (28.3%)
/site/docs/assets/images/gpc-backup.png -- 24.80kb -> 17.79kb (28.26%)
/site/docs/assets/images/gpc-add-ons-tilt.png -- 49.57kb -> 35.71kb (27.96%)
/site/docs/assets/images/gpc-add-ons-snespad-input-pinout.svg -- 11.18kb -> 8.18kb (26.81%)
/site/docs/assets/images/gpc-profile-settings.png -- 64.89kb -> 47.94kb (26.12%)
/site/docs/assets/images/gpc-add-ons-dual-directional.png -- 16.54kb -> 12.26kb (25.89%)
/site/docs/assets/images/gpc-add-ons-player-number.png -- 22.67kb -> 16.83kb (25.77%)
/site/docs/assets/images/gpc-add-ons-ps4-mode.png -- 44.27kb -> 33.09kb (25.25%)
/site/docs/assets/images/gpc-add-ons-ps-passthrough.png -- 24.37kb -> 18.38kb (24.57%)
/configs/Liatris/assets/Liatris.png -- 759.92kb -> 581.83kb (23.44%)
/site/docs/assets/images/gpc-documentation-current-version.png -- 4.06kb -> 3.11kb (23.36%)
/site/docs/assets/images/gpc-add-ons-joystick-slider.png -- 20.35kb -> 15.63kb (23.23%)
/site/docs/assets/images/wii-extension-controllers/turntable.svg -- 19.46kb -> 15.65kb (19.59%)
/site/docs/assets/images/gpc-documentation-next-version.png -- 4.68kb -> 3.78kb (19.34%)
/site/docs/assets/gp2040-ce-placeholder.png -- 36.97kb -> 30.24kb (18.22%)
/site/docs/assets/images/wii-extension-controllers/taiko.svg -- 12.77kb -> 10.73kb (15.93%)
/site/docs/assets/boards/PicoW.jpg -- 71.43kb -> 60.90kb (14.74%)
/site/docs/assets/images/wii-extension-controllers/classic.svg -- 30.16kb -> 25.95kb (13.94%)
/site/static/img/gp2040-ce-logo.svg -- 1,228.80kb -> 1,059.02kb (13.82%)
/site/docs/assets/images/wii-extension-controllers/guitar.svg -- 25.92kb -> 22.51kb (13.15%)
/site/docs/assets/images/wii-extension-controllers/nunchuck.svg -- 25.25kb -> 22.32kb (11.64%)
/site/docs/assets/images/gpc-add-ons-wii-extensions.png -- 85.62kb -> 76.22kb (10.98%)
/configs/RP2040AdvancedBreakoutBoardUSBPassthrough/assets/RP2040 Advanced Breakout Board - Passthrough.jpg -- 3,150.54kb -> 2,827.79kb (10.24%)
/configs/OpenCore0/assets/Open_Core0_WASD.jpg -- 3,533.08kb -> 3,219.62kb (8.87%)
/configs/OpenCore0WASD/assets/Open_Core0_WASD.jpg -- 3,533.08kb -> 3,219.62kb (8.87%)
/site/docs/assets/boards/Liatris.jpg -- 10.05kb -> 9.22kb (8.31%)
/site/docs/assets/images/wii-extension-controllers/drums.svg -- 46.31kb -> 43.46kb (6.16%)
/site/docs/assets/boards/ReflexCtrlSNES.jpg -- 14.82kb -> 14.03kb (5.37%)
/site/docs/assets/boards/OpenCore0.jpg -- 22.83kb -> 21.86kb (4.25%)
/site/docs/assets/boards/FlatboxRev5Southpaw.jpg -- 20.13kb -> 19.39kb (3.71%)
/site/docs/assets/boards/KeyboardConverter.jpg -- 18.39kb -> 17.99kb (2.2%)
/site/docs/assets/boards/SGFDevices.jpg -- 14.18kb -> 13.87kb (2.2%)
/site/docs/assets/boards/OpenCore0WASD.jpg -- 11.63kb -> 11.45kb (1.59%)
/site/docs/assets/boards/ReflexEncode_v2.0.jpg -- 37.80kb -> 37.80kb (0.01%)
/site/docs/assets/boards/RP2040AdvancedBreakoutBoardUSBPassthrough.jpg -- 45.57kb -> 45.57kb (0.01%)

Signed-off-by: ImgBotApp <[email protected]>

* Initial Xbox One wip

* Fixing conflicts

* Lots of WIP, lots of not working code, do not use

* Got a lot of clean-up but this will cause Windows to attempt auth

* Removed a ton of print messages to narrow down the auth issues. Added a hack to give direct access to the xbox auth passthrough which will need to be cleaned. Some other hacks and what not, getting closer but VERY much a PoC do not use.

* Moved sends to a queue in-case we try to send too fast. This is still lots of hacks but we are auth'ing in Windows

* First steps of adding our XGIP transceiver protocol. Descriptor is working, auth is next

* Moved xbox pass through over to the XGIP protocol transceiver

* Blue light! checking in while its working

* Its delicate as this requires printfs to work for timing. But this should get us to reports

* Working without printfs!

* Xbox One auth working

* Randomize the serial based on time

* [ImgBot] Optimize images

*Total -- 7,719.41kb -> 5,978.77kb (22.55%)

/configs/Haute42/assets/Haute42_logo.png -- 11.96kb -> 3.55kb (70.33%)
/configs/Haute42/assets/Haute42_T16.png -- 50.72kb -> 19.89kb (60.78%)
/configs/SGFBridget/assets/SGF_Logo.png -- 14.39kb -> 6.05kb (57.92%)
/configs/SGFFaust/assets/SGF_Logo.png -- 14.39kb -> 6.05kb (57.92%)
/configs/SGFFaust/assets/SGF_Faust_Layout.png -- 154.32kb -> 70.79kb (54.13%)
/configs/Haute42/assets/Haute42_Mini.png -- 29.51kb -> 14.34kb (51.41%)
/configs/Haute42/assets/Haute42_G16.png -- 44.83kb -> 28.07kb (37.39%)
/configs/Haute42/assets/Haute42_G13.png -- 39.38kb -> 24.97kb (36.58%)
/configs/Haute42/assets/Haute42_G12.png -- 36.26kb -> 23.24kb (35.91%)
/configs/Haute42/assets/Haute42_T13.png -- 44.24kb -> 29.54kb (33.24%)
/configs/SGFBridget/assets/SGF_Bridget.png -- 2,455.65kb -> 1,787.95kb (27.19%)
/configs/SGFFaust/assets/SGF_Faust.png -- 3,513.55kb -> 2,742.10kb (21.96%)
/configs/Haute42/assets/Haute42_Mini_series.png -- 512.67kb -> 436.98kb (14.76%)
/configs/Haute42/assets/Haute42_G_series.png -- 356.78kb -> 350.79kb (1.68%)
/configs/Haute42/assets/Haute42_T_series.png -- 440.77kb -> 434.46kb (1.43%)

Signed-off-by: ImgBotApp <[email protected]>

* Fully working on non-test setups

* Updating MIT licenses before I do the merge

* Lots of code clean-ups, looking much closer to PR

* Add guide button support, working unique serial from pico ID, and code clean-ups

* Guide button is now fully working, fixed Left-Right analog (should be fixed)

* Cleaning up and getting ready

* More cleaning

* Revising tinyusb

* Changed tinyusb to point to hathach version

* Last bits of clean-up

* Fix for latest TinyUSB

* Thanks to Santroller and GIMX added to README.md

* Small code clean-ups

* Missed Xbox One pass through enabled in the webconfig save.

* Missed this when doing the migrate

* Capitalization gotchas

* Fix for Magic-X dongle (assume dongle is still ready on unmount/remount), fix for dev server

* Moving xbox one input mode USB/xbone passthrough from optional to required.

* Fix for guide button

* Fix to copyright on new Xbox One gamepad

* Quick fix for idle-comparison

---------

Signed-off-by: ImgBotApp <[email protected]>
Co-authored-by: ImgBotApp <[email protected]>
  • Loading branch information
arntsonl and ImgBotApp authored Dec 20, 2023
1 parent ee7f840 commit feae683
Show file tree
Hide file tree
Showing 48 changed files with 2,226 additions and 249 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/pico_pio_usb"]
path = lib/pico_pio_usb
url = https://github.com/sekigon-gonnoc/Pico-PIO-USB
[submodule "lib/tinyusb"]
path = lib/tinyusb
url = https://github.com/hathach/tinyusb/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ add_compile_options(-Wall
include(compile_proto.cmake)
compile_proto()

#pull in tinyUSB
set(PICO_TINYUSB_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb")

# initialize the Raspberry Pi Pico SDK
pico_sdk_init()

Expand Down Expand Up @@ -174,6 +177,7 @@ src/addons/inputhistory.cpp
src/gamepad/GamepadDebouncer.cpp
src/gamepad/GamepadDescriptors.cpp
src/addons/tilt.cpp
src/addons/xbonepassthrough.cpp
${PROTO_OUTPUT_DIR}/enums.pb.c
${PROTO_OUTPUT_DIR}/config.pb.c
)
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MIT License

Copyright (c) 2023 OpenStickCommunity (gp2040-ce.info)
Copyright (c) 2021 Jason Skuby (mytechtoybox.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ Please respect the coding style of the file(s) you are working in, and enforce t
* [TheTrain](https://github.com/TheTrainGoes/GP2040-Projects) and [Fortinbra](https://github.com/Fortinbra) for helping keep our community chugging along
* [PassingLink](https://github.com/passinglink/passinglink) for the technical details and code for PS4 implementation
* [Youssef Habchi](https://youssef-habchi.com/) for allowing us to purchase a license to use Road Rage font for the project
* [Santroller](https://github.com/Santroller/Santroller) and [GIMX](https://github.com/matlo/GIMX) for technical examples of Xbox One authentication using pass-through
2 changes: 2 additions & 0 deletions headers/addons/keyboard_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class KeyboardHostAddon : public USBAddon {
virtual std::string name() { return KeyboardHostName; }
// USB Add-on Features
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
virtual void xmount(uint8_t dev_addr, uint8_t instance, uint8_t controllerType, uint8_t subtype) {}
virtual void unmount(uint8_t dev_addr);
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
virtual void report_sent(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
private:
Expand Down
2 changes: 2 additions & 0 deletions headers/addons/pspassthrough.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ class PSPassthroughAddon : public USBAddon {
virtual std::string name() { return PSPassthroughName; }
// USB Add-on Features
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
virtual void xmount(uint8_t dev_addr, uint8_t instance, uint8_t controllerType, uint8_t subtype) {}
virtual void unmount(uint8_t dev_addr);
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len);
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len);
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
virtual void report_sent(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
private:
uint8_t ps_dev_addr;
uint8_t ps_instance;
Expand Down
42 changes: 42 additions & 0 deletions headers/addons/xbonepassthrough.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef _XBOnePassthrough_H
#define _XBOnePassthrough_H

#include "usbaddon.h"

#include "xgip_protocol.h"

#ifndef XBONEPASSTHROUGH_ENABLED
#define XBONEPASSTHROUGH_ENABLED 0
#endif

// KeyboardHost Module Name
#define XBOnePassthroughName "XBOnePassthrough"

class XBOnePassthroughAddon : public USBAddon {
public:
virtual bool available();
virtual void setup(); // XBOnePassthrough Setup
virtual void process(); // XBOnePassthrough Process
virtual void preprocess() {}
virtual std::string name() { return XBOnePassthroughName; }
// USB Add-on Features
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len) {}
virtual void xmount(uint8_t dev_addr, uint8_t instance, uint8_t controllerType, uint8_t subtype);
virtual void unmount(uint8_t dev_addr);
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
virtual void report_sent(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}

void queue_host_report(void* report, uint16_t len);
private:
uint8_t xbone_dev_addr;
uint8_t xbone_instance;

bool dongle_ready;

XGIPProtocol incomingXGIP;
XGIPProtocol outgoingXGIP;
};

#endif // _PSPassthrough_H_
8 changes: 8 additions & 0 deletions headers/gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "gamepad/descriptors/AstroDescriptors.h"
#include "gamepad/descriptors/PSClassicDescriptors.h"
#include "gamepad/descriptors/XboxOriginalDescriptors.h"
#include "gamepad/descriptors/XBOneDescriptors.h"

#include "pico/stdlib.h"

Expand Down Expand Up @@ -72,11 +73,13 @@ class Gamepad {
*/
bool hasRightAnalogStick {false};

void sendReportSuccess();
void *getReport();
uint16_t getReportSize();
HIDReport *getHIDReport();
SwitchReport *getSwitchReport();
XInputReport *getXInputReport();
XboxOneGamepad_Data_t *getXBOneReport();
KeyboardReport *getKeyboardReport();
PS4Report *getPS4Report();
NeogeoReport *getNeogeoReport();
Expand Down Expand Up @@ -193,6 +196,11 @@ class Gamepad {
const HotkeyOptions& hotkeyOptions;

GamepadHotkey lastAction = HOTKEY_NONE;

uint32_t keep_alive_timer;
uint8_t keep_alive_sequence;
uint8_t virtual_keycode_sequence;
bool xb1_guide_pressed;
};

#endif
219 changes: 12 additions & 207 deletions headers/gamepad/GamepadDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,211 +19,15 @@
#include "descriptors/AstroDescriptors.h"
#include "descriptors/PSClassicDescriptors.h"
#include "descriptors/XboxOriginalDescriptors.h"
#include "descriptors/XBOneDescriptors.h"

#include "enums.pb.h"

// Default value used for networking, override if necessary
static uint8_t macAddress[6] = { 0x02, 0x02, 0x84, 0x6A, 0x96, 0x00 };

static const uint8_t *getConfigurationDescriptor(uint16_t *size, InputMode mode)
{
switch (mode)
{
case INPUT_MODE_XINPUT:
*size = sizeof(xinput_configuration_descriptor);
return xinput_configuration_descriptor;

case INPUT_MODE_SWITCH:
*size = sizeof(switch_configuration_descriptor);
return switch_configuration_descriptor;

case INPUT_MODE_KEYBOARD:
*size = sizeof(keyboard_configuration_descriptor);
return keyboard_configuration_descriptor;

case INPUT_MODE_PS4:
*size = sizeof(ps4_configuration_descriptor);
return ps4_configuration_descriptor;

case INPUT_MODE_NEOGEO:
*size = sizeof(neogeo_configuration_descriptor);
return neogeo_configuration_descriptor;

case INPUT_MODE_MDMINI:
*size = sizeof(mdmini_configuration_descriptor);
return mdmini_configuration_descriptor;

case INPUT_MODE_PCEMINI:
*size = sizeof(pcengine_configuration_descriptor);
return pcengine_configuration_descriptor;

case INPUT_MODE_EGRET:
*size = sizeof(egret_configuration_descriptor);
return egret_configuration_descriptor;

case INPUT_MODE_ASTRO:
*size = sizeof(astro_configuration_descriptor);
return astro_configuration_descriptor;

case INPUT_MODE_PSCLASSIC:
*size = sizeof(psclassic_configuration_descriptor);
return psclassic_configuration_descriptor;

case INPUT_MODE_XBOXORIGINAL:
*size = sizeof(xboxoriginal_configuration_descriptor);
return xboxoriginal_configuration_descriptor;

default:
*size = sizeof(hid_configuration_descriptor);
return hid_configuration_descriptor;
}
}

static const uint8_t *getDeviceDescriptor(uint16_t *size, InputMode mode)
{
switch (mode)
{
case INPUT_MODE_XINPUT:
*size = sizeof(xinput_device_descriptor);
return xinput_device_descriptor;

case INPUT_MODE_SWITCH:
*size = sizeof(switch_device_descriptor);
return switch_device_descriptor;

case INPUT_MODE_KEYBOARD:
*size = sizeof(keyboard_device_descriptor);
return keyboard_device_descriptor;

case INPUT_MODE_PS4:
*size = sizeof(ps4_device_descriptor);
return ps4_device_descriptor;

case INPUT_MODE_NEOGEO:
*size = sizeof(neogeo_device_descriptor);
return neogeo_device_descriptor;

case INPUT_MODE_MDMINI:
*size = sizeof(mdmini_device_descriptor);
return mdmini_device_descriptor;

case INPUT_MODE_PCEMINI:
*size = sizeof(pcengine_device_descriptor);
return pcengine_device_descriptor;

case INPUT_MODE_EGRET:
*size = sizeof(egret_device_descriptor);
return egret_device_descriptor;

case INPUT_MODE_ASTRO:
*size = sizeof(astro_device_descriptor);
return astro_device_descriptor;

case INPUT_MODE_PSCLASSIC:
*size = sizeof(psclassic_device_descriptor);
return psclassic_device_descriptor;

case INPUT_MODE_XBOXORIGINAL:
*size = sizeof(xboxoriginal_device_descriptor);
return xboxoriginal_device_descriptor;

default:
*size = sizeof(hid_device_descriptor);
return hid_device_descriptor;
}
}

static const uint8_t *getHIDDescriptor(uint16_t *size, InputMode mode)
{
switch (mode)
{
case INPUT_MODE_SWITCH:
*size = sizeof(switch_hid_descriptor);
return switch_hid_descriptor;

case INPUT_MODE_KEYBOARD:
*size = sizeof(keyboard_hid_descriptor);
return keyboard_hid_descriptor;

case INPUT_MODE_PS4:
*size = sizeof(ps4_hid_descriptor);
return ps4_hid_descriptor;

case INPUT_MODE_NEOGEO:
*size = sizeof(neogeo_hid_descriptor);
return neogeo_hid_descriptor;

case INPUT_MODE_MDMINI:
*size = sizeof(mdmini_hid_descriptor);
return mdmini_hid_descriptor;

case INPUT_MODE_PCEMINI:
*size = sizeof(pcengine_hid_descriptor);
return pcengine_hid_descriptor;

case INPUT_MODE_EGRET:
*size = sizeof(egret_hid_descriptor);
return egret_hid_descriptor;

case INPUT_MODE_ASTRO:
*size = sizeof(astro_hid_descriptor);
return astro_hid_descriptor;

case INPUT_MODE_PSCLASSIC:
*size = sizeof(psclassic_hid_descriptor);
return psclassic_hid_descriptor;

default:
*size = sizeof(hid_hid_descriptor);
return hid_hid_descriptor;
}
}

static const uint8_t *getHIDReport(uint16_t *size, InputMode mode)
{
switch (mode)
{
case INPUT_MODE_SWITCH:
*size = sizeof(switch_report_descriptor);
return switch_report_descriptor;

case INPUT_MODE_KEYBOARD:
*size = sizeof(keyboard_report_descriptor);
return keyboard_report_descriptor;

case INPUT_MODE_PS4:
*size = sizeof(ps4_report_descriptor);
return ps4_report_descriptor;

case INPUT_MODE_NEOGEO:
*size = sizeof(neogeo_report_descriptor);
return neogeo_report_descriptor;

case INPUT_MODE_MDMINI:
*size = sizeof(mdmini_report_descriptor);
return mdmini_report_descriptor;

case INPUT_MODE_PCEMINI:
*size = sizeof(pcengine_report_descriptor);
return pcengine_report_descriptor;

case INPUT_MODE_EGRET:
*size = sizeof(egret_report_descriptor);
return egret_report_descriptor;

case INPUT_MODE_ASTRO:
*size = sizeof(astro_report_descriptor);
return astro_report_descriptor;

case INPUT_MODE_PSCLASSIC:
*size = sizeof(psclassic_report_descriptor);
return psclassic_report_descriptor;

default:
*size = sizeof(hid_report_descriptor);
return hid_report_descriptor;
}
}
static const uint8_t *getHIDDescriptor(uint16_t *size, InputMode mode);
static const uint8_t *getHIDReport(uint16_t *size, InputMode mode);

// Convert ASCII string into UTF-16
static const uint16_t *convertStringDescriptor(uint16_t *payloadSize, const char *str, int charCount)
Expand All @@ -248,12 +52,7 @@ static const uint16_t *getStringDescriptor(uint16_t *size, InputMode mode, uint8
uint8_t charCount = 0;
char *str = 0;

if (index == 0)
{
str = (char *)xinput_string_descriptors[0];
charCount = 1;
}
else if (index == 5)
if (index == 5)
{
// Convert MAC address into UTF-16
for (int i = 0; i < 6; i++)
Expand All @@ -270,6 +69,10 @@ static const uint16_t *getStringDescriptor(uint16_t *size, InputMode mode, uint8
str = (char *)xinput_string_descriptors[index];
break;

case INPUT_MODE_XBONE:
str = (char*)xbone_get_string_descriptor(index);
break;

case INPUT_MODE_SWITCH:
str = (char *)switch_string_descriptors[index];
break;
Expand Down Expand Up @@ -314,8 +117,10 @@ static const uint16_t *getStringDescriptor(uint16_t *size, InputMode mode, uint8
str = (char *)hid_string_descriptors[index];
break;
}

charCount = strlen(str);
if ( index == 0 ) // language always has a character count of 1
charCount = 1;
else
charCount = strlen(str);
}

return convertStringDescriptor(size, str, charCount);
Expand Down
Loading

0 comments on commit feae683

Please sign in to comment.