Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong JOY_getJoypadType(JOY_2) result #326

Open
D0NM opened this issue Apr 18, 2024 · 5 comments
Open

Wrong JOY_getJoypadType(JOY_2) result #326

D0NM opened this issue Apr 18, 2024 · 5 comments

Comments

@D0NM
Copy link
Contributor

D0NM commented Apr 18, 2024

What I have (in BlastEm)

PORT1: PAD6
PORT2: TEAMPLAYER
in TEAMPLAYER's PORT1: PAD6
(ofc, I enable TEAMPLAYER support on PORT2 manually)

The data reading for JOY_2 DOES NOT WORK ,
so JOY_readJoypad(JOY_2) never returns anything.
The data reading for JOY_ALL reacts on JOY_2 activity and returns its state.
The callbacks WORK FINE for both JOY_1 and JOY_2.

ERROR:
JOY_getJoypadType(JOY_2) returns JOY_TYPE_UNKNOWN when it should return JOY_TYPE_PAD6

I suppose it might be a bug for all gamepads connected via TEAMPLAYER or EA 4-WAY PLAYER.

Peace!

UPD:
even the sample\joy-test doesn't show the type correctly.
i think its .bin file is outdated and uses old SGDK...
It shows type "PHASER" for JOY_2

@D0NM
Copy link
Contributor Author

D0NM commented Apr 18, 2024

i checked your code.... maybe it is all hw limitation...
or bad emulation.

i just want to count the number of connected gamepads.. and i cannot do it

@Stephane-D
Copy link
Owner

It would be nice to confirm the issue on real hardware. The code was wrote a long time ago by Chilly Willy and as far i remember he validated against real hardware. Still maybe some devices has not been fully tested.

@RealMalachi
Copy link

If it worked before, it could be a regression. If I had to guess, maybe ram isn't being properly allocated, making it bleed into other controller ram data?
I own a multitap I can test this with; team player with "ExtrA" mode. Might test SGDKs implementation later, have other controllers I need to test anyway

@D0NM
Copy link
Contributor Author

D0NM commented May 9, 2024

Would be cool ti SGDK release had updated sample joy-test rom.bin
It shows current gamepad activity and the detected names of the devices on the screen.

At my side... I added a hacky solution - i listen to all JOY inputs and mark those gamepads which use MODE, X, Y or Z buttons at least once. This hacky solution let me use at least 4 inputs

@loki666
Copy link

loki666 commented Aug 2, 2024

Mmmmh that issue does rings a bell to me.

see my joy -> player mapping in my code

    if (JOY_getPortType(PORT_1) == PORT_TYPE_EA4WAYPLAY || JOY_getPortType(PORT_1) == PORT_TYPE_TEAMPLAYER) {
        portMapping[0] = JOY_1;
        portMapping[1] = JOY_3;
        portMapping[2] = JOY_4;
        portMapping[3] = JOY_5;        
    } else if (JOY_getPortType(PORT_2) == PORT_TYPE_TEAMPLAYER) {
        portMapping[0] = JOY_2;
        portMapping[1] = JOY_6;
        portMapping[2] = JOY_7;
        portMapping[3] = JOY_8;        
    } else {
        portMapping[0] = JOY_1;
        portMapping[1] = JOY_2;
        portMapping[2] = JOY_7;
        portMapping[3] = JOY_8;
    }

this code assumes, that all players (4 max in my game) joypad are connected to same the teamplayer,
one player in first PORT and other player on TEAMPLAYER is not supported

fallback else if for two player game,
actually I should set portMapping[2] and portMapping[3] to -1 (or something) and don't try to read from these joy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants