| 1 | // tControllerDefinitions.cpp  |
| 2 | //  |
| 3 | // This file contains a table specifying the properties of various controller models. In particular the controller  |
| 4 | // properties may be looked up if you supply the vendor ID and the product ID. The suspected polling period, a  |
| 5 | // descriptive name, component technology used, plus latency and jitter information are all included. The data is based  |
| 6 | // on https://gist.github.com/nondebug/aec93dff7f0f1969f4cc2291b24a3171 and https://gamepadla.com/  |
| 7 | //  |
| 8 | // Copyright (c) 2025 Tristan Grimmer.  |
| 9 | // Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby  |
| 10 | // granted, provided that the above copyright notice and this permission notice appear in all copies.  |
| 11 | //  |
| 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL  |
| 13 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,  |
| 14 | // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  |
| 15 | // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR  |
| 16 | // PERFORMANCE OF THIS SOFTWARE.  |
| 17 |   |
| 18 | #include <Foundation/tMap.h>  |
| 19 | #include "Input/tControllerDefinitions.h"  |
| 20 |   |
| 21 |   |
| 22 | namespace tInput  |
| 23 | {  |
| 24 | // The controller dictionary. Lookup by vidpid and contains the controller definitions.  |
| 25 | tMap<tVidPid, tContDefn> ContDict;  |
| 26 |   |
| 27 | bool ContDictPopulated = false;  |
| 28 | void tPopulateContDict();  |
| 29 | }  |
| 30 |   |
| 31 |   |
| 32 | const tInput::tContDefn* tInput::tLookupContDefn(const tVidPid& vidpid)  |
| 33 | {  |
| 34 | if (!ContDictPopulated)  |
| 35 | {  |
| 36 | tPopulateContDict();  |
| 37 | ContDictPopulated = true;  |
| 38 | }  |
| 39 |   |
| 40 | return ContDict.GetValue(key: vidpid);  |
| 41 | }  |
| 42 |   |
| 43 |   |
| 44 | void tInput::tPopulateContDict()  |
| 45 | {  |
| 46 | ContDict[ {0x2DC8, 0x310B} ] =  |
| 47 | {  |
| 48 | // Vendor Product  |
| 49 | .Vendor: "8BitDo" , .Product: "Ultimate 2 Wireless Controller" ,  |
| 50 |   |
| 51 | // Poll StickTech TriggerTech JoyDead TrgDead AxesLat ButnLat AxesJit ButnJit  |
| 52 | // (Hz) (%) (%) (ms) (ms) (ms) (ms)  |
| 53 | .MaxPollingFreq: 956, .DispTechSticks: tDispTech::TMR, .DispTechTriggers: tDispTech::HAL, .StickDeadZone: 0.05f, .TriggerDeadZone: 0.00f, .LatencyAxes: 7.02f, .LatencyButtons: 2.81f, .JitterAxes: 0.45f, .JitterButtons: 0.35f // No dead zone.  |
| 54 | };  |
| 55 |   |
| 56 | ContDict[ {0x2DC8, 0x3106} ] =  |
| 57 | {  |
| 58 | .Vendor: "8BitDo" , .Product: "Ultimate Bluetooth Controller" ,  |
| 59 | .MaxPollingFreq: 100, .DispTechSticks: tDispTech::HAL, .DispTechTriggers: tDispTech::HAL, .StickDeadZone: 0.05f, .TriggerDeadZone: 0.00f, .LatencyAxes: 16.22f, .LatencyButtons: 10.11f, .JitterAxes: 2.68f, .JitterButtons: 2.56f // No dead zone.  |
| 60 | };  |
| 61 |   |
| 62 | ContDict[ {0x045E, 0x02FF} ] =  |
| 63 | {  |
| 64 | .Vendor: "Microsoft" , .Product: "XBox One Controller" ,  |
| 65 | .MaxPollingFreq: 125, .DispTechSticks: tDispTech::POT, .DispTechTriggers: tDispTech::POT, .StickDeadZone: 0.05f, .TriggerDeadZone: 0.00f, .LatencyAxes: 5.54f, .LatencyButtons: 5.54f, .JitterAxes: 2.24f, .JitterButtons: 2.24f // No dead zone. Latencies and jitter not measures separately so they match.  |
| 66 | };  |
| 67 | }  |
| 68 | |