libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.17k stars 1.82k forks source link

Analog inputs as digital does not function properly #6644

Closed prataczak closed 6 years ago

prataczak commented 6 years ago

Description

Had a chance to test out the new remap options in the quick menu today. Tested with Castlevania and Mega Man 4 for Nintendo Entertainment System with the Mesen core. In Castlevania, I tried unassigning all D-Pad inputs, and mapping them to the right analog stick instead. Character on screen would keep walking even when analog is released - it seems that on/off switches are not working properly.

For Mega Man 4, I tried unassigning the B button, and remapping it to Right Analog X-. Normally when held, the B Button acts as a 'charge' shot in this game - but currently does not work properly. Pressing the right analog stick left makes him fire a single quick shot (unexpected behavior), then charge a shot as expected, but when released, the character keeps charging the shot, instead of releasing it.

Expected behavior

Expected behavior is for the analog to function as a digital input, but it seems there's a few issues to work out.

Version/Commit

Environment information

andres-asm commented 6 years ago

Can't test right now but try this Set this in your config input_axis_threshold = "1000"

And apply this diff:

diff --git a/input/input_mapper.c b/input/input_mapper.c
index 253ffcf112..6794fb85cb 100644
--- a/input/input_mapper.c
+++ b/input/input_mapper.c
@@ -191,7 +191,7 @@ void input_mapper_poll(input_mapper_t *handle)
                   settings->uints.input_remap_ids[i][k];

                if (
-                     (current_axis_value != 0) &&
+                     (abs(current_axis_value) > *input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD)) &&
                      (k != remap_axis)         &&
                      (remap_axis != RARCH_UNMAPPED)
RobLoach commented 6 years ago

Also, what input and joypad drivers are you using?

prataczak commented 6 years ago

X Input.

Forgive my ignorance @fr500 but I do not know how to apply the diff, if you can point me in the right direction I will try it.

andres-asm commented 6 years ago

@RobLoach he's talking about remaps tho, it's completely independent of the driver @prataczak find the line with the minus sign in input_mapper.c, replace it with the line with the plus

andres-asm commented 6 years ago

I tested this and it works, feel free to integrate it tho I don't have my git key on this laptop

andres-asm commented 6 years ago

You don't need to make input_axis_threshold 1000 anymore, I didn't understand it was a porcentual value, I changed it so the default 0.5 should work fine