Support for up to 16bit stick axis values, and signed values#42
Open
patters-match wants to merge 1 commit intoMaschell:masterfrom
Open
Support for up to 16bit stick axis values, and signed values#42patters-match wants to merge 1 commit intoMaschell:masterfrom
patters-match wants to merge 1 commit intoMaschell:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 do this 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 u8 to u16 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
convertAnalogValuefunction from u8 to s32 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
setProControllerDataFromHIDthat doesn't apply insetControllerDataFromHID. This behaviour only occurs after I exit HidtoVpad and apply patches. While I remain in HidtoVpad the debug logging confirms that all stick movement is polled correctly. I spent a long time reading the Gbatemp forum thread for HidtoVpad 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.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.