JoyWIP v0.0

Announce (tech) demos or games releases

Moderator: Mask of Destiny

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

Post by Chilly Willy » Wed May 16, 2012 6:59 pm

KanedaFr wrote:when you say trackball, do you mean the mouse with reverted Y ?
I know the Y is different from US/EUR & JAP.....
No, not a mouse. Technically, it's called the Sega Sports Pad and it looks like this:

http://www.atariage.com/forums/uploads/ ... _thumb.jpg

It's a trackball, pure and simple. :lol:

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

Post by KanedaFr » Fri May 18, 2012 9:30 am

oh...yes, sorry..I didn't notice we were talking about SMS pad

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

Post by Chilly Willy » Fri May 18, 2012 8:56 pm

No problem. If you notice anything else worth working on, let me know. I'm keeping an eye on Menacer prices so I can get one of those, too.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri May 18, 2012 9:17 pm

SF87 sold some brand new Menacers on Sega-16, but he is in Finland so it may be expensive to ship it to USA... I got mine from him, but aim is very juggly on it.. however my friend's Menacer has rock solid aim. Got to look into it and see what might be wrong...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Chilly Willy » Fri May 18, 2012 11:30 pm

TmEE co.(TM) wrote:SF87 sold some brand new Menacers on Sega-16, but he is in Finland so it may be expensive to ship it to USA... I got mine from him, but aim is very juggly on it.. however my friend's Menacer has rock solid aim. Got to look into it and see what might be wrong...
I checked ebay the other day... people sell JUST the Menacer, or JUST the IR receiver; buying both separately made it too expensive for me right now. And everyone selling both together treated it like some kind of solid gold rare item - used with a box Menacers were going for more than $100 easily.

I got Lethal Enforcers I and II, and both Justifier guns for $32 plus shipping. There were plenty of people selling one Justifier gun or the other separate, so buying both would cost about $40 shipped... and these were a bargain compared to Menacer prices. :cry:

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

Post by KanedaFr » Sat May 19, 2012 1:24 pm

Chilly Willy wrote:No problem. If you notice anything else worth working on, let me know.
I planned to check if American Laser orange guns (used in MadDog games) are the same as justifier
I also planned to add analog support : only used in japanese game , it costs a lot... so if you're able to understand how it works, it should be possible to hack a PS pad

Justifier are not that in expensive...in US!
The pink one is just too expensive here in France :(
I took me almost 1 year to buy one... in Yahoo Japan !

For menacer, I'm trying to find one for a low price for so long ....
The cheap one are almost always incomplete
Good luck ;)

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

Post by Chilly Willy » Sat May 19, 2012 5:08 pm

Hmm - the only pictures of the "AX-1E" I've found are all actually of the Dempa Micomsoft XE-1 AP:

http://segaretro.org/XE-1_AP

Is that what you were talking about? I can't find ANYTHING on "AX-1E" besides that wikipedia page you linked, and there certainly aren't any "AX-1E"s for sale on ebay.

Of course, the last XE-1 AP to sell on ebay went for $105 + $35 shipping, so I don't think I'll be getting one. :lol:

I can add support for things as long as it is known how they work, I just won't be able to test the ones I don't have.

Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Sat May 19, 2012 5:15 pm

about XE-1AP: i added support for it some time ago

see here: http://code.google.com/p/genplus-gx/sou ... w/xe_a1p.c

and some notes here:

http://code.google.com/p/genplus-gx/iss ... ail?id=156

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

Post by Chilly Willy » Sat May 19, 2012 7:48 pm

Eke wrote:about XE-1AP: i added support for it some time ago

see here: http://code.google.com/p/genplus-gx/sou ... w/xe_a1p.c

and some notes here:

http://code.google.com/p/genplus-gx/iss ... ail?id=156
Thanks! That's really helpful. :D

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

Post by KanedaFr » Mon May 21, 2012 8:10 am

do you know if the XE 1AP has a sega ID ?
is there a way to detect it ?

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

Post by Chilly Willy » Thu May 24, 2012 1:06 am

Well, I got Justifier support working... here's a few notes:

If you want continuous tracking of the gun coords, the average brightness of the screen needs to be BGR=88x or better. The sensor is apparently sensitive to light in the blue-green spectrum. Note that BGR=800 or 008 or 088 or 808 won't work; it needs to be 880 or better. Your value may vary by the brightness of your TV.

The gun lens has a focal length longer than a yard... any closer to the TV and you have to point directly at something white to activate the sensor. It seems to work about the same for greater than a yard (meter for you metric folk!).

There doesn't seem to be any way to auto-detect the second gun. I get the same inputs regardless of whether the second gun is attached or not. Because of this, I have a suggestion.

The way I currently handle Justifier support is to auto-detect the Justifier during JOY_init() with the pads and mouses and taps. That works well. However, the Justifier is a fairly resource heavy input device, needing you to setup an interrupt handler and all, so I don't enable the Justifier by default.

Instead, I added a new function: JOY_getPortType(). This allows you to see if one of the ports has a Justifier plugged in or not. If there is and if you wish to use it, THEN you enable the Justifier support.

Code: Select all

    /* one or the other, not both */
    value = JOY_getPortType(PORT_1);
    if (value == PORT_TYPE_JUSTIFIER)
    {
        JOY_setSupport(PORT_1, JOY_SUPPORT_JUSTIFIER);
    }
    else
    {
        value = JOY_getPortType(PORT_2);
        if (value == PORT_TYPE_JUSTIFIER)
            JOY_setSupport(PORT_2, JOY_SUPPORT_JUSTIFIER);
    }
The JOY_setSupport() function actually sets up all the junk needed to handle the Justifier at that point. From that point on, you merely do JOY_readJoypad()/JOY_readJoypadX()/JOY_readJoypadY() to get the Justifier input just like a mouse.

The X/Y values are -1 if the gun is not pointed at the screen. They are the raw HV counters if the gun IS pointed at the screen (and it's bright enough to pick up). I don't process the values in any way other than to separate them - JOY_readJoypadX() returns H and JOY_readJoypadY() returns V.

Currently, since I can't auto-detect the red gun, both guns show as JOY_1 and JOY_3 for port 1, or JOY_2 and JOY_6 for port 2. The buttons are read every vertical blank, with START mapped to BUTTON_START and TRIGGER mapped to BUTTON_A. The coords are read every other frame since you can only handle one light sensor input at a time.

While I support Justifiers in either port 1 or port 2, I don't yet support BOTH (four guns). I don't really see the need for that, but if someone thinks it worth it, I can add support for that.

Which brings up my suggestion: since I can't auto-detect the red gun, I was wondering if I should make two different Justifier support defines - one for just the blue gun, and one for both guns. That way if a game only supports one gun, they just enable support for one gun. If the game can handle both guns, then it can enable support for both guns. There's a MINOR speedup for just handling the blue gun (can't measure it), and the coords would update at 60 Hz instead of 30. With both guns enabled, there is a very minor slowdown associated with reading two guns instead of one, and you update the coords every other frame, i.e., 30 Hz.

Anywho, my current sample for reading the joypads now also shows both ports in addition to all eight pads. So I can see what the port type value is for different controllers: the Sega Sport Pad (trackball) has an ID of 0, the two button pad (SMS) has an ID of 15 (same as nothing), and the SMS light gun also has an ID of 15.

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

Post by Stef » Thu May 24, 2012 10:04 am

Great work ! That sounds really good so far, the JOY_getPortType() method is really welcome :D

I didn't know that justifiers were connected on a single port, i though you needed a port by gun.
I think that having 2 defines for justifiers (SINGLE_JUSTIFIER and BOTH_JUSTIFIERS maybe) could be nice, that save a bit of time and bring 60 Hz update.

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

Post by KanedaFr » Thu May 24, 2012 11:40 am

yep...
Actually it seems possible to mod a blue like a pink and vice versa...
just need to test it....

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

Post by Chilly Willy » Thu May 24, 2012 7:08 pm

Stef wrote:Great work ! That sounds really good so far, the JOY_getPortType() method is really welcome :D

I didn't know that justifiers were connected on a single port, i though you needed a port by gun.
I think that having 2 defines for justifiers (SINGLE_JUSTIFIER and BOTH_JUSTIFIERS maybe) could be nice, that save a bit of time and bring 60 Hz update.
That's what I thought... JOY_SUPPORT_JUSTIFIER_BLUE and JOY_SUPPORT_JUSTIFIER_BOTH was my thought on it.

The red gun has a phone connector that plugs into the bottom of the grip of the blue gun. The blue gun has the proper DB9 connector to hook to the MD. The red gun has a spot in the grip were a gun would be connected, just like the blue. I think they made the guns the same other than the color, then the blue ones get the DB9 cable while the red get the phone cable.

The overhead is actually better than I was expecting... I think it's probably not nearly as bad as a TeamPlayer. :) Which is another reason for JOY_getPortType() - if you don't NEED the TeamPlayer, you may want to look for it and TURN IT OFF for better speed. Same for a mouse. Most folks won't bother, but someone trying to get every bit of speed possible would want to disable everything not needed.

I added an external int to the base and rom header, and a callback for it. The init code for the Justifier adds a callback for when the external int occurs that disables the gun (to prevent any other "spurious" ints) and reads the HV counters. When you enable the gun, the sr is set to $2100 instead of the more normal $2300. You need that or external ints (at level 2) won't be dispatched. When you disable the Justifier, it sets the int level back to $2300.

You may wish to add official sr handling instructions to the SDK, or at least give some examples of how people should save the sr, then restore it to avoid trouble - if someone merely set the sr to $2300 since that's what they saw in sega.s, that would kill the external int handling.

I'll make the changes for enabling one gun or both and then post my code and the examples. As mentioned, I had to change more than just joy.c and joy.h because of the int handler needed for the light gun, but the changes were all pretty straightforward - I just patterned the external int off the h and v ints. I added code to the reset as well to clear the external callback.

EDIT: Just won an auction on a Menacer! I should have it by the 30th, so when that comes in, I'll add support for that as well. 8)

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

Post by Stef » Fri May 25, 2012 9:56 am

Yep i already added SR control in the wip SGDK as we need it at some point.
Indeed the teamplayer and mouse eats sometime and it's preferable to disable them when not needed :) I am also trying to keep the library overhead as low as possible as we don't have many CPU resource to waste on that type of system ;)

All the changes you made looks good, thanks again for that !

Post Reply