sorgelig / ZX_Spectrum-128K_MIST

ZX Spectrum 128K for MIST Board
GNU General Public License v2.0
30 stars 18 forks source link

Joysticks weird behavior #42

Closed Dark-Schneider-666 closed 1 year ago

Dark-Schneider-666 commented 1 year ago

Version 221024, but checked some older and seems to be the same.

The joysticks seems to not map correctly to its corresponding Spectrum controls.

In all the cases is the same, the up and down directions are not mapped to its corresponding ones and makes random behaviors depending the game, some move to left when pressing down, others pauses the game, etc.

The only combo that makes joystick to map correctly is when attaching an USB controller and a DB9 to the "natural" second DB9 port (the one that core assigns to joystick 2 if no USB is attached). Then only the DB9 one is mapped correctly to Spectrum controls.

We can easily check this selecting Sinclair I and II, the first is mapped to keys 6-0 and the second to 1-5, so launching i.e. +3 BASIC and moving the stick should write the numbers. And as I say it only does from the DB9 one when connecting a USB. By this way all the issues mentioned like characters doing weird things or pausing go off and the control work nicely.

If we connect 2 USB so they are joystick 1 and 2 can check that both are not mapped correctly, no one writes when pressing up or down.

gyurco commented 1 year ago

If you plug in an USB controller, then the DB9 ones are shifted, so one less remain usable with every new USB controller. If you want to preserve the DB9 controllers, then joystick_db9_fixed_index can be used. Note that if you set this, then no USB controller can be used.

Dark-Schneider-666 commented 1 year ago

That’s right.

But what I mean is that up and down directions don’t work correctly on controllers but when connecting one USB and one DB9, being the DB9 the only one that respond right to up and down directions. Can be checked as mentioned using the +3 BASIC and setting the joysticks to Sinclair type. If we press up and down they don’t write numbers as they should, and if we use the previous mentioned config (one USB + one DB9) we notice that the DB9 writes numbers when pressing up and down directions.

In games this is translated in the way that many games do not respond right to the controller input. I.e. can be tested with After The War, or Nightshade.

gyurco commented 1 year ago

I cannot reproduce this. I plug in an USB controller - all directions are working. Is your controller works correctly on the input test OSD screen?

Dark-Schneider-666 commented 1 year ago

Hi, I recorded a video showing it: https://vimeo.com/775017758

The 1st one is the USB, the 2nd is the DB9 while the USB is still plugged, as mentioned is the only way it gets the input correctly, with that DB9 shifted by one USB, using the DB9 one. In any other case (like USB or the DB9 alone with no USB plugged) it has the 1st behavior.

Have tested the same controllers in other cores and seem to work fine, also the firmware input test and config get all the directions and buttons. In the Amstrad CPC BASIC pressing directions writes arrows, and it writes all them including up and down using the USB, or the single DB9 without any USB plugged.

But, is not like it does nothing, as said what it does is send some another signal, because in games it responds, but in a wrong way, i.e. in After the War part 2 if press down the character moves to left instead duck, in other games it freezes and unfreezes while pressing the directions.

As note, I use the Mistica FPGA variant. Talked to another Misitca user about the issue, and also has it, with other controllers. I don't know anyone with a base MIST board, so cannot test on it.

gyurco commented 1 year ago

So even DB9 or the USB doesn't work well, if you don't plug in both? It's weird. Do you have something in mist.ini? Can you try with a different power supply? Maybe some noise or whatever...

Dark-Schneider-666 commented 1 year ago

Do you have something in mist.ini?

That did the trick! Had some old data from previous versions that probably interfered in some way. Cleaned the mist.ini file and now works fine.

But it was so rare that only interfered with ZX that I had never though it could be that.

Issue solved, thanks!