Updated controller code for SGDK
Posted: Tue Dec 16, 2014 7:05 am
I promised an update to handle the SMS Light Phaser, and here it is. There are two archives: the first is the changed joy.c and joy.h for SGDK; the second is an update of my controller test code - it now works with the 1.0 SGDK and supports testing the Phaser.
http://www.mediafire.com/download/t42u3 ... 141215.zip
http://www.mediafire.com/download/67az8 ... 141215.zip
The test code has three binaries included.
autojoy.bin - auto-detects both ports
phaser.bin - auto-detects port 1, forces port 2 to phaser mode
trackball.bin - auto-detects port 1, forces port 2 to trackball mode
Note: Only Genesis controllers auto-detect correctly. SMS controllers have to be forced by using JOY_setSupport(port, whatever). You can force port 1 just the same as port 2 - my tests only force port 2 for convenience. So you COULD have a game that used two phasers in both ports, you just need to force both ports to phaser mode. They can't be detected, so you either need to have a menu control for forcing the port or not, or you just simply need to force the port like the test code here.
Note: All light guns set BUTTON_A for the main (or only) trigger. That is the only button the phaser has. The justifier also has a START button. The menacer has A, B, C, and START. My menacer sets A in addition to START when you press the start button. I'd like to know what other folks menacers do (do they all do this?).
Note: I changed the mouse reading code the tiniest bit to handle negative zero, so the Japanese and European mice should work properly now. That was the only difference someone with a Japanese mouse reported when I was working with gasega68k on mouse support in his game.
EDIT: Actually, you can only use one phaser or menacer in either port. The code isn't yet setup to handle TWO of them in both ports. I'd need to toggle between the two guns every other screen to get a position from both... which is what I do for the blue and red justifier guns. So it's just one phaser or one menacer, and a blue and red justifier. I'll eventually work that in. Let me know if you think that should be bumped up the todo list.
http://www.mediafire.com/download/t42u3 ... 141215.zip
http://www.mediafire.com/download/67az8 ... 141215.zip
The test code has three binaries included.
autojoy.bin - auto-detects both ports
phaser.bin - auto-detects port 1, forces port 2 to phaser mode
trackball.bin - auto-detects port 1, forces port 2 to trackball mode
Note: Only Genesis controllers auto-detect correctly. SMS controllers have to be forced by using JOY_setSupport(port, whatever). You can force port 1 just the same as port 2 - my tests only force port 2 for convenience. So you COULD have a game that used two phasers in both ports, you just need to force both ports to phaser mode. They can't be detected, so you either need to have a menu control for forcing the port or not, or you just simply need to force the port like the test code here.
Note: All light guns set BUTTON_A for the main (or only) trigger. That is the only button the phaser has. The justifier also has a START button. The menacer has A, B, C, and START. My menacer sets A in addition to START when you press the start button. I'd like to know what other folks menacers do (do they all do this?).
Note: I changed the mouse reading code the tiniest bit to handle negative zero, so the Japanese and European mice should work properly now. That was the only difference someone with a Japanese mouse reported when I was working with gasega68k on mouse support in his game.
EDIT: Actually, you can only use one phaser or menacer in either port. The code isn't yet setup to handle TWO of them in both ports. I'd need to toggle between the two guns every other screen to get a position from both... which is what I do for the blue and red justifier guns. So it's just one phaser or one menacer, and a blue and red justifier. I'll eventually work that in. Let me know if you think that should be bumped up the todo list.