From 60284e9c017bc28ab0ca30d3eb061097c350a6dc Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Mon, 7 Sep 2020 10:09:00 +0200 Subject: [PATCH] btdrv-mitm: handle home button according to reported data format --- btdrv-mitm/source/controllers/gembox_controller.cpp | 3 +++ btdrv-mitm/source/controllers/gembox_controller.hpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/btdrv-mitm/source/controllers/gembox_controller.cpp b/btdrv-mitm/source/controllers/gembox_controller.cpp index 7cfc081..a67c8fc 100644 --- a/btdrv-mitm/source/controllers/gembox_controller.cpp +++ b/btdrv-mitm/source/controllers/gembox_controller.cpp @@ -51,6 +51,9 @@ namespace ams::controller { void GemboxController::HandleInputReport0x02(const GemboxReportData *src, SwitchReportData *dst) { dst->input0x30.buttons.minus = src->input0x02.back; + dst->input0x30.buttons.home = src->input0x02.buttons == 0; + + this->PackStickData(&dst->input0x30.left_stick, STICK_ZERO, STICK_ZERO); this->PackStickData(&dst->input0x30.right_stick, STICK_ZERO, STICK_ZERO); } diff --git a/btdrv-mitm/source/controllers/gembox_controller.hpp b/btdrv-mitm/source/controllers/gembox_controller.hpp index 827f31c..4257421 100644 --- a/btdrv-mitm/source/controllers/gembox_controller.hpp +++ b/btdrv-mitm/source/controllers/gembox_controller.hpp @@ -55,9 +55,15 @@ namespace ams::controller { } __attribute__ ((__packed__)); struct GemboxInputReport0x02 { - uint8_t : 2; - uint8_t back : 1; - uint8_t : 0; + union { + struct { + uint8_t : 6; + uint8_t back : 1; + uint8_t : 0; + }; + + uint8_t buttons; + }; } __attribute__((packed)); struct GemboxInputReport0x07 {