-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Expansion of button controls for intent-based control modifications #638
base: main
Are you sure you want to change the base?
Conversation
…ent controls. Also adjusted the mappings to be defined externally in the apps using the library.
this is only true if the port doesn't define libultraship/include/libultraship/libultra/controller.h Lines 84 to 86 in 5849d3a
as long as whatever type the port defines as that being said the implementation in this PR would likely offer more flexibility - it just also introduces quite a bit of complexity i'm curious as to what other people think about the complexity/flexibility tradeoffs with this implementation |
That is a fair point. Although the |
Hmm I think I may have been mistaken about uint64_t being the maximum. In GCC there is is a __uint128_t type. If that can be used as |
Alright the __uint128_t type does not work because it isn't supported by things like This confirms that 64 bit button bitmasks would enable the maximum number of additional button mappings without a more complicated solution such as the one I have implemented. That should probably be enough for most use cases. |
…f the main control mapping window.
This PR contains code I have written for a controls mod for the 2ship2harkinian application, and I wanted to share it here in case it is useful to anyone else. Currently it is branched off of the commit used by 2ship.
This corresponding branch of 2ship uses these changes: https://github.com/cclark25/2ship2harkinian/tree/IntentControls
The primary goal of this branch is to allow the addition of an arbitrary number of button controls, for the sake of defining controls based on their intended usage rather than a set of limited global buttons.
For example, instead of a game using the
A
button for jump, roll, and talk, this will instead allow each of those controls to be optionally defined separately for more granular control mapping.This is currently very difficult in the libultraship library because all buttons are defined as a 16bit bitmask, only allowing 16 unique buttons. This PR addresses that by adding on special button mapping functionality, which utilizes a separate 16bit button ID value and 8bit "pressed" state to track whether a button is pressed or not. This effectively allows up to 2^16 - 1 (0 is reserved) additional buttons.
In addition, these control checks will be managed by a collection of function pointers, allowing the special control logic to be customized and swapped in/out per controller.
These code changes are currently functional.