ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
672 stars 193 forks source link

Mouse does not work with SGDK homebrew #526

Closed lucaspcamargo closed 9 months ago

lucaspcamargo commented 9 months ago

So, I'm writing a game using SGDK and the mouse works in Blastem, but not on GPGX. I though it could be an issue with my game, but the mouse also won't work with the joy_test SGDK sample. I've also ruled out a RetroArch misconfiguration, because I can play commercial titles with the mouse just fine (e.g Lemmings).

Looking into what data is returned by the emulator, the header bytes shows up fine (0x0, 0xB, 0xF, 0xF), but the data itself comes out as just all zeroes. I wonder, is there some rom database or header check that prevents the mouse from working properly on homebrew? Or some other timing or delay that should be respected by the game? Anything else I could check?

Thanks for the help :)

ekeeke commented 9 months ago

There is no ROM database for mouse support, you only need to configure the input ports to sega mouse (can be set to either port but only one port at a time).

If the first mouse data specific nibbles are returned, this means emulated mouse is configured as input controller in the i/o port you read. The fact that mouse data returns 0x0 means two possible things: either input.analog and input.data are not updated with physical mouse state (this is done by frontend code i.e libretro.c once per frame) or your mouse handling code accidentally resets the internal counter (by setting TH output from 0 to 1).

Have you test your code with real hardware (or have someone test it for you) ?

lucaspcamargo commented 9 months ago

Unfortunately I don't have real hardware yet. Sorry, it was indeed a configuration issue. Mouse works from RetroArch port 1 just fine, and can be mapped to either core port. Mouse cannot work in RetroArch port 2 no matter what configuration is done. I'm sure I tested both configurations before, in multiple ways, but alas, everything is working fine now, and is unrelated to GPGX. Thanks for your suggestions.