Strange behaviour with buttons mapping

https://github.com/mist-devel/mist-board/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Moderator Team

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Strange behaviour with buttons mapping

Postby mambrino » Thu May 19, 2016 7:22 am

Hi,

I'm having problems to remap joysticks (last firmware, last core versions).

When change dpad or action buttons works perfectly, but when I try to assign spacebar key (as a START + B shortcut or as a keyboard scancode) to a button for use as a secondary in Commodore 64 or other cores, works but when i press (and release) this button the action repeats (like an autofire) until i press the same key in the keyboard.

I've try with all my gamepads (Buffalo Famicom, 8bitdo SFC30 & Fighter COmmander IV) and different mist.ini configs and always the same problem happens.

This is the two options i've try. I'm doing something wrong?

---------------------------------------------------------

[mist]
joystick_remap=0411,00C6,1,2,4,8,10,20,A0

---------------------------------------------------------

[mist]
joy_key_map=8,2C

------------------------------------------------------------

And these are VID,PID and buttons number of gamepads i've test:


Fighting Commander 4:
---------------------
VID 0F0D
PID 005F
1 - SQUARE
2 - CROSS
3 - CIRCLE
4 - TRIANGLE
5 - L1
6 - R1
7 - L2
8 - R2
9 - SHARE
10 - OPTIONS

Buffalo Famicom:
----------------
VID 0411
PID 00C6
1-A
2-B
3-X
4-Y
5-L
6-R
7-SELECT
8-START

8Bitdo SFC30:
------------
VID 1235
PID AB21
1 - A
2 - B
4 - X
5 - Y
7 - L
8 - R
11 - SEL
12 - START

Cheers and thanks in advice ;)

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Thu May 19, 2016 8:28 am

Can you try mapping to another key to check? I wonder if this is generic or just happens with the space bar...

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Thu May 19, 2016 11:09 am

This time i've tested 3 shortcuts (ESC, Enter, Space) and 2 scancodes (key A, key B) across 2 different cores (Amiga, CPC) with 2 gamepads (SFC30 and Buffalo) and the behaviour is similiar: repeats until any other button or key is pressed.

MIST.INI used
----------------
[mist]
joystick_remap=1235,AB21,1,2,4,8,10,A0,0,90,480,0,400,800
joystick_remap=0411,00C6,1,2,4,8,10,A0,90,480,400,800
joy_key_map=400,4
joy_key_map=800,5

Another thing I've noticed is that when mapping is active in mist.ini, sometimes the joystick doesn't respond and I have to disconnect and reconnect it (only after boot), and sometimes there are problems to show or hide the menu from the joystick.

Let me know if I can test something else to help find the problem.

Thanks ;)

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Thu May 19, 2016 3:00 pm

OK... I just upgraded to the latest firmware and I get the problem as well. It's probably a regression from a firmware change since January. I'll check when I get a chance.

Edit: I strongly suspect it's this change:

Code: Select all

//new code
kbd_timer = GetTimer(10);  // next key after 10ms earliest

//old
kbd_timer = GetTimer(50);  // next key after 50ms earliest


There must be a conflict with the mapping code. I don't have time to compile and test now (should have in the weekend), but if anybody want to try reverting, the above is worth a shot.

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Thu May 19, 2016 9:23 pm

Newsdee wrote:There must be a conflict with the mapping code. I don't have time to compile and test now (should have in the weekend), but if anybody want to try reverting, the above is worth a shot.


I've compiled the firmware with kbd_timer to 50ms at user_io.c, but no luck, still doing the same :? . Here are the files for testing:

Firmware - 160518

Wich is the last version working? I've tested down to 150825 (AGA v1.1 release) and all of them have the same problem.

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Thu May 19, 2016 11:51 pm

OK. The handling for this is in /usb/hid.c ; we had this problem before and it was supposed to be fixed in 29-Jun-2015, but looks like it's happening again. :( The way the MIST internal keyboard works is a function call to "user_io_kbd()" that passes the keys that are currently pressed; what must be happening is that it's never called with a "blank" state to reset it (but it is properly done with a keyboard when you release a key).

I tried once to refactor the whole thing to call user_io_kb only once, but it caused other issues. Time to revisit it perhaps...

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Sat May 21, 2016 11:46 am

Newsdee wrote:I tried once to refactor the whole thing to call user_io_kb only once, but it caused other issues. Time to revisit it perhaps...


Thanks, my knowledge right now is far from being able to do that :(

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Sun May 22, 2016 6:02 am

I think I've fixed it... can you try firmware_160522.upg ?

I've done a long overdue cleanup of the code - hopefully the mapping will be easier to maintain by others now. I also increased the max number of mapping in the INI file to 8, and fixed the bug that prevented the OSD to be driven by keyboard if a USB pad was connected.

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Sun May 22, 2016 8:41 am

Newsdee wrote:I think I've fixed it... can you try firmware_160522.upg ?

Tested and works perfectly! :D (all gamepads and all core mappings tested previously), but when mapping is active I can't open OSD menu with start + select, i've tried with "joy_key_map=c0,45" to assign F12 HID to start+select and doesn't work either.

Other shortcuts,keyboard F12 and OSD navigation (with keyboard or joystick) works well.

Thanks!

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Sun May 29, 2016 10:07 am

After testing in more detail, OSD at amiga core, stops working when it's opened at the same time a joystick action is pressed. This behaviour doesn't occur in other cores, but in spectrum one (last Sorgelig binary) and after some hours of gaming, the keyboard got stucked two or three times... and the OSD reacts as you keep the down button pressed.

¿Maybe this behaviour had to do with last firmware update?

Thanks ;)

javidoom
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 120
Joined: Thu Dec 15, 2011 3:16 pm

Re: Strange behaviour with buttons mapping

Postby javidoom » Sun May 29, 2016 10:44 am

mambrino wrote:After testing in more detail, OSD at amiga core, stops working when it's opened at the same time a joystick action is pressed. This behaviour doesn't occur in other cores, but in spectrum one (last Sorgelig binary) and after some hours of gaming, the keyboard got stucked two or three times... and the OSD reacts as you keep the down button pressed.

¿Maybe this behaviour had to do with last firmware update?

Thanks ;)


Hi!

Didn't notice the osd amiga bug, but yes, it's there, it gets stuck if you press F12 meanwhile anything on the joystick is pressed. (The core keeps running under the osd).

And the Spectrum core... mmm... TRUE... I've had two "down" stucks... but I didn't give it too much attention, as I thought it was and odd error...
I was playing a game, and the character got stuck in the down direction... pressed F12, and in the OSD Menu, it went down too... After a while (... mmm... 15 sec?) it unstucked and keep going ok. Odd...

Regards.

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Sun May 29, 2016 2:12 pm

Can you try this? It's my latest prototype:
firmware.zip

I did some cleanup to key bindings which I think fixed some problems (you'll also notice the stuff I've been up to :) )
You do not have the required permissions to view the files attached to this post.

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Sun May 29, 2016 3:54 pm

Newsdee wrote:I did some cleanup to key bindings which I think fixed some problems (you'll also notice the stuff I've been up to :) )

Tested and Amiga problem persists (Spectrum is difficult to replicate again), isn't important but if you forget to release joystick button before entering OSD, MiST freezes and reboot is needed to work again.

Thanks

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Mon May 30, 2016 12:24 am

mambrino wrote:Tested and Amiga problem persists (Spectrum is difficult to replicate again), isn't important but if you forget to release joystick button before entering OSD, MiST freezes and reboot is needed to work again.


Can you try disabling the joystick OSD control and (separately) disabling the joystick-to-keyboard mapping from MIST.INI?

That should tell us if the problem is with either piece, or if it's something more fundamental.

I use the select+start combo to enter the OSD and it works fine, even with Minimig. Unless it freezes when a direction is pushed?

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Mon May 30, 2016 10:04 am

Newsdee wrote:I use the select+start combo to enter the OSD and it works fine, even with Minimig. Unless it freezes when a direction is pushed?


This happens when using F12 to open OSD and joystick button is pressed at the same time, only with minimig and minimig-aga cores.

Newsdee wrote:Can you try disabling the joystick OSD control and (separately) disabling the joystick-to-keyboard mapping from MIST.INI?


With no joystick OSD control (joystick_ignore_osd=1) problem persists, with or without joystick mappings (even without mist.ini).

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Mon May 30, 2016 8:10 pm

tested last version (160530) with 2 different joysticks and problem persists. In addition, up/down buttons do nothing at OSD even without mist.ini, however 8-bit cores joystick test recognizes these buttons perfectly.

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Mon May 30, 2016 10:40 pm

The joystick test will check the joystick status but not the mapping. It looks like up/down isn't mapped to keys; which is weird because I've been using joystick to control the OSD in all my testing yesterday.

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Tue May 31, 2016 7:36 am

Newsdee wrote:It looks like up/down isn't mapped to keys; which is weird because I've been using joystick to control the OSD in all my testing yesterday.

You're right, is weird, but i've tested with 3 different joysticks and in previous firmware version all directions works ok. Maybe is a specific problem with certain joysticks due to last changes.

Thanks ;)

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Tue May 31, 2016 2:45 pm

Which joysticks are they? Also do you know which old firmware version works?

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Tue May 31, 2016 2:53 pm

Newsdee wrote:Which joysticks are they? Also do you know which old firmware version works?


Joysticks are these indicated in first post (viewtopic.php?f=101&t=29920#p295316).
Last firmware version working for me (all directions) is 160522.

javidoom
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 120
Joined: Thu Dec 15, 2011 3:16 pm

Re: Strange behaviour with buttons mapping

Postby javidoom » Tue May 31, 2016 4:16 pm

I've tested too the last firmware and cannot move UP / DOWN in the OSD. The A/B/SELECT/START buttons works, and left / right, but cannot move up/down.

I'm using the same joystick as ever, a PS2 to USB adaptor.

Regards.

User avatar
Newsdee
Atari God
Atari God
Posts: 1406
Joined: Fri Sep 19, 2014 8:40 am

Re: Strange behaviour with buttons mapping

Postby Newsdee » Tue May 31, 2016 4:59 pm

Ok somehow I got this behavior too now, after switching SD cards with a different mist.ini. I'll probably have more time to check in detail in the weekend,

User avatar
mambrino
Atari freak
Atari freak
Posts: 56
Joined: Mon May 09, 2016 4:59 pm

Re: Strange behaviour with buttons mapping

Postby mambrino » Wed Jun 01, 2016 4:18 pm

Tested and working all directions with new firmware (160601). Thanks!


Return to “MiST”

Who is online

Users browsing this forum: No registered users and 2 guests