|
|
@ -65,9 +65,35 @@ private: |
|
|
if (is_device_reload_pending.exchange(false)) |
|
|
if (is_device_reload_pending.exchange(false)) |
|
|
LoadInputDevices(); |
|
|
LoadInputDevices(); |
|
|
|
|
|
|
|
|
// TODO(shinyquagsire23): This is a hack!
|
|
|
|
|
|
ControllerPadState& state = |
|
|
|
|
|
mem->controllers[Controller_Handheld].layouts[Layout_Default].entries[0].buttons; |
|
|
|
|
|
|
|
|
// Set up controllers as neon red+blue Joy-Con attached to console
|
|
|
|
|
|
ControllerHeader& controllerHeader = mem->controllers[Controller_Handheld].header; |
|
|
|
|
|
controllerHeader.type = ControllerType_Handheld | ControllerType_JoyconPair; |
|
|
|
|
|
controllerHeader.singleColorsDescriptor = ColorDesc_ColorsNonexistent; |
|
|
|
|
|
controllerHeader.rightColorBody = 0xFF3C28; |
|
|
|
|
|
controllerHeader.rightColorButtons = 0x1E0A0A; |
|
|
|
|
|
controllerHeader.leftColorBody = 0x0AB9E6; |
|
|
|
|
|
controllerHeader.leftColorButtons = 0x001E1E; |
|
|
|
|
|
|
|
|
|
|
|
for (int layoutIdx = 0; layoutIdx < HID_NUM_LAYOUTS; layoutIdx++) |
|
|
|
|
|
{ |
|
|
|
|
|
ControllerLayout& layout = mem->controllers[Controller_Handheld].layouts[layoutIdx]; |
|
|
|
|
|
layout.header.numEntries = HID_NUM_ENTRIES; |
|
|
|
|
|
layout.header.maxEntryIndex = HID_NUM_ENTRIES - 1; |
|
|
|
|
|
|
|
|
|
|
|
// HID shared memory stores the state of the past 17 samples in a circlular buffer,
|
|
|
|
|
|
// each with a timestamp in number of samples since boot.
|
|
|
|
|
|
layout.header.timestampTicks = CoreTiming::GetTicks(); |
|
|
|
|
|
layout.header.latestEntry = (layout.header.latestEntry + 1) % HID_NUM_ENTRIES; |
|
|
|
|
|
|
|
|
|
|
|
ControllerInputEntry& entry = layout.entries[layout.header.latestEntry]; |
|
|
|
|
|
entry.connectionState = ConnectionState_Connected | ConnectionState_Wired; |
|
|
|
|
|
entry.timestamp++; |
|
|
|
|
|
entry.timestamp_2++; // TODO(shinyquagsire23): Is this always identical to timestamp?
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(shinyquagsire23): Set up some LUTs for each layout mapping in the future?
|
|
|
|
|
|
// For now everything is just the default handheld layout, but split Joy-Con will
|
|
|
|
|
|
// rotate the face buttons and directions for certain layouts.
|
|
|
|
|
|
ControllerPadState& state = entry.buttons; |
|
|
using namespace Settings::NativeButton; |
|
|
using namespace Settings::NativeButton; |
|
|
state.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); |
|
|
state.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); |
|
|
state.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); |
|
|
state.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); |
|
|
@ -103,6 +129,7 @@ private: |
|
|
// TODO(shinyquagsire23): Analog stick vals
|
|
|
// TODO(shinyquagsire23): Analog stick vals
|
|
|
|
|
|
|
|
|
// TODO(shinyquagsire23): Update pad info proper, (circular buffers, timestamps, layouts)
|
|
|
// TODO(shinyquagsire23): Update pad info proper, (circular buffers, timestamps, layouts)
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// TODO(shinyquagsire23): Update touch info
|
|
|
// TODO(shinyquagsire23): Update touch info
|
|
|
|
|
|
|
|
|
|