mirror of
https://github.com/ndeadly/MissionControl
synced 2024-11-25 05:40:22 +00:00
mc.mitm: assign constants for maximum trigger values
This commit is contained in:
parent
d89e0ab1a7
commit
377c7b7caa
16 changed files with 76 additions and 61 deletions
|
@ -21,6 +21,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor16Bit = float(UINT12_MAX) / UINT16_MAX;
|
||||
constexpr float StickScaleFactor8Bit = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
|
@ -92,8 +93,8 @@ namespace ams::controller {
|
|||
m_buttons.L = src->input0x01_v2.buttons.L1;
|
||||
m_buttons.R = src->input0x01_v2.buttons.R1;
|
||||
|
||||
m_buttons.ZL = src->input0x01_v2.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01_v2.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01_v2.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZR = src->input0x01_v2.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
if (m_controller_type == EightBitDoControllerType_Sn30ProXboxCloud) {
|
||||
m_buttons.minus = src->input0x01_v2.buttons.v1.select;
|
||||
|
@ -182,8 +183,8 @@ namespace ams::controller {
|
|||
m_buttons.L = src->input0x03_v3.buttons.L1;
|
||||
m_buttons.R = src->input0x03_v3.buttons.R1;
|
||||
|
||||
m_buttons.ZL = src->input0x03_v3.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x03_v3.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x03_v3.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZR = src->input0x03_v3.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x03_v3.buttons.v2.select;
|
||||
m_buttons.plus = src->input0x03_v3.buttons.v2.start;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u16 TriggerMax = 0x3ff;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT16_MAX;
|
||||
|
||||
}
|
||||
|
@ -67,8 +68,8 @@ namespace ams::controller {
|
|||
|
||||
m_buttons.R = src->input0x01.buttons.RB;
|
||||
m_buttons.L = src->input0x01.buttons.LB;
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * 0x3ff);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * 0x3ff);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.lstick_press = src->input0x01.buttons.L3;
|
||||
m_buttons.rstick_press = src->input0x01.buttons.R3;
|
||||
|
|
|
@ -21,10 +21,10 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
constexpr float AccelScaleFactor = 65535 / 16000.0f * 1000;
|
||||
constexpr float GyroScaleFactor = 65535 / (13371 * 360.0f) * 1000;
|
||||
constexpr float AccelScaleFactor = UINT16_MAX / 16000.0f * 1000;
|
||||
constexpr float GyroScaleFactor = UINT16_MAX / (13371 * 360.0f) * 1000;
|
||||
|
||||
constexpr u16 TouchpadWidth = 1920;
|
||||
constexpr u16 TouchpadHeight = 1080;
|
||||
|
@ -156,8 +156,8 @@ namespace ams::controller {
|
|||
|
||||
this->MapButtons(&src->input0x01.buttons);
|
||||
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
}
|
||||
|
||||
void DualsenseController::MapInputReport0x31(const DualsenseReportData *src) {
|
||||
|
@ -190,8 +190,8 @@ namespace ams::controller {
|
|||
|
||||
this->MapButtons(&src->input0x31.buttons);
|
||||
|
||||
m_buttons.ZR = src->input0x31.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x31.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x31.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x31.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
if (src->input0x31.buttons.touchpad) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
|
|
|
@ -24,23 +24,24 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr const char Ds3DeviceName[] = "PLAYSTATION(R)3 Controller";
|
||||
constexpr u16 Ds3VendorId = 0x054c;
|
||||
constexpr u16 Ds3ProductId = 0x0268;
|
||||
|
||||
enum Dualshock3LedMode {
|
||||
Dualshock3LedMode_Switch = 0,
|
||||
Dualshock3LedMode_Ps3 = 1,
|
||||
Dualshock3LedMode_Hybrid = 2,
|
||||
};
|
||||
|
||||
constexpr const char Ds3DeviceName[] = "PLAYSTATION(R)3 Controller";
|
||||
constexpr u16 Ds3VendorId = 0x054c;
|
||||
constexpr u16 Ds3ProductId = 0x0268;
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
constexpr float AccelScaleFactor = UINT16_MAX / 16000.0f * 1000 / 113;
|
||||
|
||||
constinit const u8 EnablePayload[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
|
||||
constinit const u8 LedConfig[] = { 0xff, 0x27, 0x10, 0x00, 0x32 };
|
||||
constinit const u8 PlayerLedPatterns[] = { 0b1000, 0b1100, 0b1110, 0b1111, 0b1001, 0b0101, 0b1101, 0b0110 };
|
||||
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
constexpr float AccelScaleFactor = 65535 / 16000.0f * 1000 / 113;
|
||||
|
||||
alignas(os::MemoryPageSize) constinit u8 g_usb_buffer[0x1000];
|
||||
|
||||
constinit const UsbHsInterfaceFilter g_interface_filter = {
|
||||
|
@ -265,9 +266,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x01.buttons.square;
|
||||
|
||||
m_buttons.R = src->input0x01.buttons.R1;
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x01.buttons.L1;
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x01.buttons.select;
|
||||
m_buttons.plus = src->input0x01.buttons.start;
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
constexpr float AccelScaleFactor = 65535 / 16000.0f * 1000;
|
||||
constexpr float GyroScaleFactor = 65535 / (13371 * 360.0f) * 1000;
|
||||
constexpr float AccelScaleFactor = UINT16_MAX / 16000.0f * 1000;
|
||||
constexpr float GyroScaleFactor = UINT16_MAX / (13371 * 360.0f) * 1000;
|
||||
|
||||
constexpr u16 TouchpadWidth = 1920;
|
||||
constexpr u16 TouchpadHeight = 942;
|
||||
|
@ -119,8 +119,8 @@ namespace ams::controller {
|
|||
|
||||
this->MapButtons(&src->input0x01.buttons);
|
||||
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
}
|
||||
|
||||
void Dualshock4Controller::MapInputReport0x11(const Dualshock4ReportData *src) {
|
||||
|
@ -153,8 +153,8 @@ namespace ams::controller {
|
|||
|
||||
this->MapButtons(&src->input0x11.buttons);
|
||||
|
||||
m_buttons.ZR = src->input0x11.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x11.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x11.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x11.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
if (src->input0x11.buttons.touchpad) {
|
||||
for (int i = 0; i < src->input0x11.num_reports; ++i) {
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -68,9 +69,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x03.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x03.buttons.RB;
|
||||
m_buttons.ZR = src->input0x03.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x03.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x03.buttons.LB;
|
||||
m_buttons.ZL = src->input0x03.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x03.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x03.buttons.select;
|
||||
m_buttons.plus = src->input0x03.buttons.start;
|
||||
|
@ -114,9 +115,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0xc4.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0xc4.buttons.RB;
|
||||
m_buttons.ZR = src->input0xc4.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0xc4.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0xc4.buttons.LB;
|
||||
m_buttons.ZL = src->input0xc4.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0xc4.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0xc4.buttons.select;
|
||||
m_buttons.plus = src->input0xc4.buttons.start;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -71,9 +72,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x07.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x07.buttons.RB;
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x07.buttons.LB;
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.plus = src->input0x07.buttons.start;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -70,9 +71,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x07.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x07.buttons.RB;
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x07.buttons.LB;
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x07.buttons.view;
|
||||
m_buttons.plus = src->input0x07.buttons.menu;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
constexpr float MediaModeStickScaleFactor = float(UINT12_MAX) / 39;
|
||||
|
||||
|
@ -73,9 +74,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x01.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x01.buttons.R1;
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x01.buttons.L1;
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x01.buttons.select;
|
||||
m_buttons.plus = src->input0x01.buttons.start;
|
||||
|
@ -120,9 +121,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x81.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x81.buttons.R1;
|
||||
m_buttons.ZR = src->input0x81.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x81.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x81.buttons.L1;
|
||||
m_buttons.ZL = src->input0x81.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x81.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x81.buttons.select;
|
||||
m_buttons.plus = src->input0x81.buttons.start;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -60,16 +61,16 @@ namespace ams::controller {
|
|||
this->MapAnalogSticks(&src->input0x01.left_stick, &src->input0x01.right_stick);
|
||||
this->MapButtons(&src->input0x01.buttons, src->id == 0x01);
|
||||
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
}
|
||||
|
||||
void MocuteController::MapInputReport0x04(const MocuteReportData *src) {
|
||||
this->MapAnalogSticks(&src->input0x04.left_stick, &src->input0x04.right_stick);
|
||||
this->MapButtons(&src->input0x04.buttons, 1);
|
||||
|
||||
m_buttons.ZR = src->input0x04.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x04.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x04.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x04.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
}
|
||||
|
||||
void MocuteController::MapAnalogSticks(const MocuteStickData *left_stick, const MocuteStickData *right_stick) {
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u16 TriggerMax = UINT16_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT16_MAX;
|
||||
|
||||
}
|
||||
|
@ -66,9 +67,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x01.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x01.buttons.RB;
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT16_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x01.buttons.LB;
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT16_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x01.back;
|
||||
m_buttons.plus = src->input0x01.buttons.start;
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u16 TriggerMax = UINT16_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT16_MAX;
|
||||
|
||||
}
|
||||
|
@ -63,9 +64,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x07.buttons.U;
|
||||
|
||||
m_buttons.R = src->input0x07.buttons.RB;
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * UINT16_MAX);
|
||||
m_buttons.ZR = src->input0x07.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x07.buttons.LB;
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * UINT16_MAX);
|
||||
m_buttons.ZL = src->input0x07.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = 0;
|
||||
m_buttons.plus = 0;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -64,9 +65,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x01.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x01.buttons.R1;
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x01.buttons.L1;
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x01.buttons.select;
|
||||
m_buttons.plus = src->input0x01.buttons.start;
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr u16 FixedTriggerThreshold = 0x7ff;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
}
|
||||
|
@ -112,9 +114,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x01_v2.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x01_v2.buttons.R1;
|
||||
m_buttons.ZR = src->input0x01_v2.right_trigger > 0x7ff;
|
||||
m_buttons.ZR = src->input0x01_v2.right_trigger > FixedTriggerThreshold;
|
||||
m_buttons.L = src->input0x01_v2.buttons.L1;
|
||||
m_buttons.ZL = src->input0x01_v2.left_trigger > 0x7ff;
|
||||
m_buttons.ZL = src->input0x01_v2.left_trigger > FixedTriggerThreshold;
|
||||
|
||||
m_buttons.rstick_press = src->input0x01_v2.buttons.R3;
|
||||
m_buttons.lstick_press = src->input0x01_v2.buttons.L3;
|
||||
|
@ -160,9 +162,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0xc4.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0xc4.buttons.R1;
|
||||
m_buttons.ZR = src->input0xc4.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0xc4.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0xc4.buttons.L1;
|
||||
m_buttons.ZL = src->input0xc4.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0xc4.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.lstick_press = src->input0xc4.buttons.L3;
|
||||
m_buttons.rstick_press = src->input0xc4.buttons.R3;
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr u16 TriggerMax = 0x3ff;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT16_MAX;
|
||||
|
||||
}
|
||||
|
@ -63,8 +64,8 @@ namespace ams::controller {
|
|||
static_cast<u16>(StickScaleFactor * (UINT16_MAX - src->input0x01.right_stick.y)) & UINT12_MAX
|
||||
);
|
||||
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * 0x3ff);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * 0x3ff);
|
||||
m_buttons.ZR = src->input0x01.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.ZL = src->input0x01.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
if (new_format) {
|
||||
m_buttons.dpad_down = (src->input0x01.buttons.dpad == XboxOneDPad_S) ||
|
||||
|
|
|
@ -21,10 +21,11 @@ namespace ams::controller {
|
|||
|
||||
namespace {
|
||||
|
||||
constinit const u8 InitPacket[] = { 0x20, 0x00, 0x00 }; // packet to init vibration apparently
|
||||
|
||||
constexpr u8 TriggerMax = UINT8_MAX;
|
||||
constexpr float StickScaleFactor = float(UINT12_MAX) / UINT8_MAX;
|
||||
|
||||
constinit const u8 InitPacket[] = { 0x20, 0x00, 0x00 }; // packet to init vibration apparently
|
||||
|
||||
}
|
||||
|
||||
Result XiaomiController::Initialize() {
|
||||
|
@ -81,9 +82,9 @@ namespace ams::controller {
|
|||
m_buttons.Y = src->input0x04.buttons.X;
|
||||
|
||||
m_buttons.R = src->input0x04.buttons.R1;
|
||||
m_buttons.ZR = src->input0x04.right_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZR = src->input0x04.right_trigger > (m_trigger_threshold * TriggerMax);
|
||||
m_buttons.L = src->input0x04.buttons.L1;
|
||||
m_buttons.ZL = src->input0x04.left_trigger > (m_trigger_threshold * UINT8_MAX);
|
||||
m_buttons.ZL = src->input0x04.left_trigger > (m_trigger_threshold * TriggerMax);
|
||||
|
||||
m_buttons.minus = src->input0x04.buttons.back;
|
||||
m_buttons.plus = src->input0x04.buttons.menu;
|
||||
|
|
Loading…
Reference in a new issue