Support for up to 16bit stick axis values, and signed values (aroma) #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
I set out to add support for the Adaptoid N64-controller-to-USB-HID adapter made by Wish Technologies in around 1999, which was popular during the heyday of the UltraHLE N64 emulator on PC.
Changes
In order to add Adaptoid support I needed to extend controller_patcher to support the following:
Rationale
My aim was to introduce this support without making breaking changes to the schema for existing INI files, and with minimal impact to the existing code. I initially tried changing all the config value types from
uint8_t
touint16_t
but this seemed too disruptive.Instead, where I needed additional bytes of precision for existing variables, I added new parameters to capture their most significant bytes (MSB). I wrote additional logic to read in this additional data and to properly sign-extend and cast signed values. I then extended the inputs of the
convertAnalogValue
function fromuint8_t
toint32_t
type so that they could accommodate the full range of both signed and unsigned 16bit values. I also amended the deadzone and scaling logic to cope with negative values.Status
setProControllerDataFromHID
that doesn't apply insetControllerDataFromHID
. This behaviour only occurs after I exit hid_to_vpad and apply patches. While I remain in hid_to_vpad the debug logging confirms that all stick movement is polled correctly. I spent a long time reading the Gbatemp forum thread for hid_to_vpad and I did see some other mention of a device not working properly with one type of binding being ok using the other type, so I am inclined to think this is more of a long standing issue which I am unlikely to be able to solve.Build
I originally made these changes for the Tiramisu build of this library for hid_to_vpad here. I was able to build hid_to_vpad 0.1.1-alpha for aroma with these changes to the aroma branch of controller_patcher, using WUPS 0.7.1. Pacman package versions were as follows:
I needed to amend
logger.h
in hid_to_vpad to remove theextern "C" {
parts since that seems to be adequately handled in the current whb logger headers.Download
Testing
Misc
I have included my controller INI definition for the Adaptoid in the root folder, demonstrating the new configuration parameters. I realise it should go in the controller_patcher_configs repo but I figured that can wait while this PR is pending.