ID:2245778
 
Resolved
The handling of default gamepad mappings was poor. Now, default mappings will not be applied if the game skin contains a macro or mapping for any of the directional gamepad buttons.
BYOND Version:511.1381
Operating System:Windows 10 Home 64-bit
Web Browser:Firefox 53.0
Applies to:Dream Seeker
Status: Resolved (511.1383)

This issue has been resolved.
Descriptive Problem Summary:
Gamepad left analog sticks and d-pads appear to be mapped to the North, West, East, and South keys by default. When using the Any macro and expecting arguments for d-pad directions it will fire twice -- once for the direction from the controller input and once for the normal direction string, as if the player were using the arrow keys.

Numbered Steps to Reproduce Problem:

1. Create a verb set up to accept string data with an Any macro.
2. Make it check if the string is equal to "GamepadUp" or "North"
3. It will fire twice, once for each.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
MenuNav(key as text)
set hidden = 1
if(key == "GamepadUp"||key == "North")
world << "This should run once"


Expected Results:
The verb should fire once.

Actual Results:
It fires twice, once with the string "GamepadUp" and once with the string "North."

Does the problem occur:
Every time? Or how often? Always
In other games? Probably
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
Never

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

I don't know.

Workarounds:

Check for "North" as a string instead of "GamepadUp," same for all the other directions. This is not at all ideal because it means that I cannot offer keyboard customization for local multiplayer.
This is avoidable if you include gamepad macros of any kind in your skin.
I didn't know that, thanks. This actually ties into something Ter13 and I were talking about -- it would be nice if we had a gamepad exclusive version of the Any macro so that it would only pick up input from the gamepad and not the keyboard.

Edit: This didn't work. I set a macro for GamepadFace1 in my macro list and it acts the same. I also switch between different macro lists at runtime, if that makes a difference. I really think there should be a way to disable this behavior altogether.
That would make co-op games a whole lot easier to make, for sure!
Oh, shoot, there's actually a bug in this behavior. I meant to check the skin for gamepad macros, not just the local macros. Plus I think there needs to be a flag not to save the ones that get auto-created with the other local macros. I'm on it.
Thanks Lummox! Awesome response time, as usual. :)
Okay, there will be a fix for that in 511.1383.

The new behavior is as follows:

1) Any gamepad macros with map-to in the default global macros.dmf will be stripped out; it was inappropriate of earlier versions to have put them there, really.

2) If a game skin includes macros OR mappings for any of the gamepad directional buttons (but other buttons, analog sticks, Dpad, and raw do not matter), the default gamepad mappings will not be applied.

Therefore in the next build you can map Gamepad4Left to a dummy key like PA1, and no other mappings will be applied.
Lummox JR resolved issue with message:
The handling of default gamepad mappings was poor. Now, default mappings will not be applied if the game skin contains a macro or mapping for any of the directional gamepad buttons.
This did not resolve the issue. Mapping a gamepad key to PA1 still does not unset the macros. Is there any way for you to please just make this a setting or remove it entirely?
I tested this in a game skin. Do you have an example project where it doesn't work?
I actually just tried to recreate it and couldn't, so I dunno. I don't know what could be causing it at this point. The only macro keys set for any of the macro lists (4 of them) are Any and Any+UP. All 4 lists have Gamepad4Left set to PA1.

I set up a demo to show you where I switch between macro lists and it doesn't work, but... well, it worked. I'm really stumped here.
Switching macro lists won't matter. If any macro in the skin, used or not, has a gamepad dir button mapped or macroed, then the default gamepad mappings will not be applied.
In response to Lummox JR
Lummox JR wrote:
Switching macro lists won't matter. If any macro in the skin, used or not, has a gamepad dir button mapped or macroed, then the default gamepad mappings will not be applied.

This is not true in my case though. The only thing I can think to do is send you the entire source, but there's a lot of irrelevant stuff in there and I'd really like to narrow it down for you but I don't even know where to start.