HandHeldLegend / HOJA-LIB-ESP32

An API project to emulate various retro and modern controllers on ESP32.
Other
56 stars 12 forks source link

Added support for Side Buttons on NS Long input #9

Closed JPZV closed 1 year ago

JPZV commented 1 year ago

This is useful for the Nintendo Switch N64 Control, as they use the SB_Left for the ZR (yeah, their map sucks actually, as they use the original ZR for C-Down)

mitchellcairns commented 1 year ago

Hello, please give me some time to look at this request. I will want a clean way to have this situation resolved. I do understand the predicament and I will try to provide a solution that works well for this use case.

Let me know what you think about this mapping Right button -> A button Upper button -> C Up Lower button -> B button Left button -> C Down ZL trigger -> Z button ZR trigger -> R button L trigger -> C left R button -> C right Minus button -> L button

In this way, every N64 game can be played with a standard controller (4 trigger buttons) without odd mapping. Also, I will need to add the proper translation code that will act conditionally only if N64 mode is enabled on the NS core.

I think this will work well but let me know what you think.

JPZV commented 1 year ago

Wouldn't a standard controller have two analog stick on it? Because in that case we could use rs_x/rs_y from analog_data as C "buttons". It may need a little overworked solution from us the developers ir order to determine when two "buttons" are pressed at the same time, but I used to use a DualShock 4 to play on Project64/RetroArch with that kind of mapping without any issue.

mitchellcairns commented 1 year ago

Wouldn't a standard controller have two analog stick on it? Because in that case we could use rs_x/rs_y from analog_data as C "buttons". It may need a little overworked solution from us the developers ir order to determine when two "buttons" are pressed at the same time, but I used to use a DualShock 4 to play on Project64/RetroArch with that kind of mapping without any issue.

Yes it could, however many games utilize the mapping of real face buttons as inputs. For example, Super Smash Bros uses C buttons for jump.

Having a standardized button input format will be the way we go. Handling analog to button inputs would be something that can be done in the users code. There will be some examples of this provided further in development :)

mitchellcairns commented 1 year ago

New conditional logic added specifically for N64's weird mapping. See the commit notes and the linked line of code for full details and mapping info: Commit info