Updated controller code for SGDK

SGDK only sub forum

Moderator: Stef

Post Reply
Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Updated controller code for SGDK

Post by Chilly Willy » 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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Dec 16, 2014 9:50 am

Thanks Chilly Willy :) I will include the changes in the SGDK source tree asap !

nolddor
Very interested
Posts: 102
Joined: Sun Jun 02, 2013 1:35 pm
Location: Spain

Post by nolddor » Tue Dec 16, 2014 2:58 pm

Thanks a lot MASTER!

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Wed Dec 17, 2014 11:12 am

great work !


I doubt a double menacer is needed (it's so rare to even got one !) but it could be awesome !
2 phaser could be a great alternative to the blue + pink justifier since pink one is just hard to get at a good price.
Do you think 2 blue justifier, easier to find, is possible ?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Dec 17, 2014 5:54 pm

KanedaFr wrote:great work !

I doubt a double menacer is needed (it's so rare to even got one !) but it could be awesome !
2 phaser could be a great alternative to the blue + pink justifier since pink one is just hard to get at a good price.
Do you think 2 blue justifier, easier to find, is possible ?
Multiple light guns can be handled, you just need to keep track of how many are installed and cycle between them for reading the screen position. I already do that for the blue and red guns, I just need to add code to do that with any other guns, including more blue and red guns.

At least I don't need to worry about using light guns with the taps - only pads and mice work with the taps.

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Wed Dec 17, 2014 9:58 pm

I wonder if some games support 2 blue justifier
For me, they only support blue + pink ...

And do you know if the American Laser GameGun works the same as justifier ? or it uses its own code too ?

and the zillion gun is the same as the phaser classic, right ?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Dec 18, 2014 5:06 am

KanedaFr wrote:I wonder if some games support 2 blue justifier
For me, they only support blue + pink ...

And do you know if the American Laser GameGun works the same as justifier ? or it uses its own code too ?

and the zillion gun is the same as the phaser classic, right ?
No idea on any of that. I worked from that PDF put out on Genesis light guns, the SMS Hardware manual (which has a section on the Phaser), and a disassembly of a game that supports the Menacer to get the proper timing for reading the Menacer since the PDF on Genesis light guns doesn't actually discuss the timing at all. I have a Menacer, the Blue and Red Justifiers, and a Phaser. I can work out multiple light guns by doing something like using the Phaser in port 1 and the Menacer in port 2, or the Menacer in port 1 and the Justifiers in port 2, or any variation of those. At the moment, the code allows one light gun (or both the Red and Blue Justifiers) in either port.

Post Reply