Does sms+ have full Light Phaser support?

This forum is for discussion pertaining to homebrew and indie software for the Dreamcast, such as homebrew games, emulators/interpreters, and other homebrew software/applications. Porting requests and developmental ideas are not to be made here; you can make those here. If you need any help burning discs for homebrew software, this is the place to ask as well.
Post Reply
alb3530
DCEmu Freak
DCEmu Freak
Posts: 99
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Nov 12, 2004 2:00 pm
Location: RS,Brazil
Has thanked: 0
Been thanked: 0
Contact:

Does sms+ have full Light Phaser support?

Post by alb3530 »

Some months ago i did tests to try making Light Phaser works with SMEG emu.
Light Phaser anatomy is something like this:
there are 4 ''connectors''(wires) used in the gun.
+ , - , sms 1 button,
and the fourth is the one that makes the button works as the trigger,and of course,the lens becomes functional-lets call this connector "trigger wire"
Analysing that,i went testing the thing out with SMEG.After i have opened my DC controller,i used 4 wires to connect the gun to Dreamcast controller.The problem is i didn't know where the trigger wire should be connected.Every combination i tried,the trigger simply activated the sms button.So i did some tests using a real Master System console,and i realised if only 3 connectors are plugged on the console,and the trigger wire is not plugged,when you hit the trigger,the screen becomes white and the game crashes(Operation Wolf,in my case).And this' not what happened to SMEG,so i begin thinking it doesn't have gun support.
Don't laugh now:
After destroying the gun in a test,i got the sms +(the previous release,not the latest) emu,and for my surprise,i tried to play Operation Wolf,and when hit the button,the screen became white,just like what happened in my tests with a real SMS,but not with SMEG.And now,does it mean sms + has full Light Phaser support?
Http_user_agent:
NokiaN80-1/3.0 (4.0623.0.41) Series60/3.0
Profile/MIDP-2.0
Configuration/CLDC-1.1
User avatar
semicolo
Mental DCEmu
Mental DCEmu
Posts: 328
Joined: Mon Apr 25, 2005 1:02 pm
Location: Three-rivers canada
Has thanked: 0
Been thanked: 0
Contact:

Post by semicolo »

does the white screen have a black square somewhere ? it could be the way de sms detects if you hit the target (when you shoot, display a white screen with a black square and read the gun status, if you aimed at the target there's no light going into the gun).

So it would just mean sms+ emulate the game better than smeg.
alb3530
DCEmu Freak
DCEmu Freak
Posts: 99
Joined: Fri Nov 12, 2004 2:00 pm
Location: RS,Brazil
Has thanked: 0
Been thanked: 0
Contact:

Post by alb3530 »

No,no black square appears.The screen becomes completely white,and the game crashes.So u have to reset the system,in Master System case,or use Reset emulation option,in sms+ case.
Http_user_agent:
NokiaN80-1/3.0 (4.0623.0.41) Series60/3.0
Profile/MIDP-2.0
Configuration/CLDC-1.1
Heliophobe
Smeg Creator
Smeg Creator
Posts: 246
Joined: Thu Mar 14, 2002 2:40 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by Heliophobe »

alb3530 wrote:No,no black square appears.The screen becomes completely white,and the game crashes.So u have to reset the system,in Master System case,or use Reset emulation option,in sms+ case.
Hi, alb3530.

Well, that's a clever idea but it won't pan out, unfortunately. I'll explain a little more about why that is and how the SMS light phaser works when I get a few extra minute (I just got to work) but for now I wouldn't recommend sacrificing any more light phasers for this project.
Heliophobe
Smeg Creator
Smeg Creator
Posts: 246
Joined: Thu Mar 14, 2002 2:40 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by Heliophobe »

Okay, a little more info:

The simple explanation is: Neither Smeg nor SMS Plus are written to check input from the controller port to determine whether the gun sees light or not, so no amount of controller rewiring will change that.

As for why SMS Plus can't just be patched to check the controller for the sensor status, that's a complicated topic but I will address it later today if nobody beats me to it. The Light Phaser works a bit differently than the NES Zapper, which made the Light Phaser more accurate but harder to emulate. I believe the Zapper could be adapted to work on a Dreamcast with an NES emulator that's been programmed to support it, but the Light Phaser could not -- nor could a zapper mod be used to play SMS Light Phaser games. Explanation to come...

As for the differences between SMS Plus, Smeg, and a real Master System crashing when playing Operation Wolf, it would just seem it's a case of SMSPlus correctly handling the controller related registers, even if the light gun is not specifically supported in earlier versions of SMSPlus. Operation Wolf is waiting for a certain condition of the bits from the controller port to tell it to give up checking the screen (or to start checking) (I am guessing) and as that condition is never met in Smeg or a modified Phaser, the game goes into an infinite loop. Other games will give up if they don't detect a hit after a certain amount of time so they don't lock up.

I dimly remember testing Operation Wolf on Smeg but, since I did not have light gun support anyway, I did not worry that it was locking up as it would be unplayable anyway. I don't believe any other light gun games locked up in that fashion.


SMSPlus's latest release does allow (somewhat glitchy) light phaser support by way of the analog stick and a crosshair. It's not exactly satisfying to play that way, however.
User avatar
Captain Skyhawk
DCEmu Respected
DCEmu Respected
Posts: 812
Joined: Fri Nov 09, 2001 6:48 am
Location: The Netherlands
Has thanked: 0
Been thanked: 0
Contact:

Post by Captain Skyhawk »

Interesting post!
Heliophobe wrote:I believe the Zapper could be adapted to work on a Dreamcast with an NES emulator that's been programmed to support it.
I do have an old NES Zapper lying around, does anybody can give me some more info on how to do this. Or does the method that alb3530 used for the SMS Phaser works for the NES Zapper?
Visit the DC Help for all the Dreamcast homebrew help you need!
Go to DC Evolution, for the best ready to burn images
.
Heliophobe
Smeg Creator
Smeg Creator
Posts: 246
Joined: Thu Mar 14, 2002 2:40 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by Heliophobe »

Well I'm just theorizing, but you might be able to patch a zapper in a similar fashion to the light phaser hack as above and map the light sensor to the input of another button. Then you'd need an emulator with a mode that lets you use that button as the indicator that the sensor has seen light.

The Zapper design is a little bit simpler in that the system only can tell if the controller sees light, not where it is. That's why you see white blocks around targets against black or dark screens when you pull the trigger on the NES. After the trigger is pulled, a block of white appears where the target is and the sensor will tell if it sees white light. If it does, that means the gun was aimed at the target and the game will treat it as a hit. If not, it's a miss. If there are multiple targets, then the NES game will alternate with different white blocks in different targets frame after frame.

So, you might be able to get a zapper to work by connecting the sensor to a button of the DC controller. If the button is 'pressed' that means the zapper saw light and that can be fed to the emulated game is it registers a hit. Now I don't know enough about zappers so say whether the light sensor stays on if it sees light (in which case you have to do something about bi-directional cummincation to clear its status between frames) or if it only registers when it sees light and clears its status when it no longer sees it (in which case you have to poll the controller fairly constantly to make sure not to miss a hit). There may also be some games that handle this differently (a more exact process might be possible with particular MMC's).

Problem here is I know next to nothing about electronics so I don't know if this idea actually makes sense. You could just as well use a light phaser for this, I believe, but you'd only be able to use it with NES games.

Some more information here:

http://www.nationmaster.com/encyclopedia/Light-gun

The SMS uses "method 2", and the NES method is the first method.
User avatar
Captain Skyhawk
DCEmu Respected
DCEmu Respected
Posts: 812
Joined: Fri Nov 09, 2001 6:48 am
Location: The Netherlands
Has thanked: 0
Been thanked: 0
Contact:

Post by Captain Skyhawk »

Thanks for the clear explanation Heliophobe. Facinating that the NES Zapper works so simple, yet on the outside looks very advanced. Especially when you realise they already used this technique in 1985. So the Master System had even a better lightgun system?

On the subject, I think the problem with the current NES DC Emulators that they only have software support for the DC Lightguns and not for a real one, altough the last might have been simpler to implent. Who knows I gonna give it a try someday.
Visit the DC Help for all the Dreamcast homebrew help you need!
Go to DC Evolution, for the best ready to burn images
.
Heliophobe
Smeg Creator
Smeg Creator
Posts: 246
Joined: Thu Mar 14, 2002 2:40 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by Heliophobe »

Ralph Baer invented the first light gun home video game in 1967, thought it did come to market until years later. In the early games you could cheat by aiming the gun at a light bulb so the photosensor would always see a bright light. The NES used some technqiues to reduce cheating like that but the technology was otherwise identical.

The SMS could actually pinpoint the spot on the screen that the gun was being aimed at, with reasonable accuracy, and did so with a full screen flash which was less ugly than the blocking on the NES. You'll notice in many SMS light gun games there is an impact spark where the gun hits even if the show did not hit a target, and in Shooting Gallery you could blow away bits of the background.

The actual hardware in the Light Phaser is very similar to the NES: the lens focuses light from the end of the gun to a photosensor. When the photosensor sees light, the gun registers this by way of input through the controller port. Where the SMS varied was its way of detecting a hit. When you pull the trigger, the game fill the screen with white and waits until the electron beam begins to draw the display.

As the beam sweeps across the display, the game program checks the light sensor status. When the electron beam sweeps across the area that the gun is aimed at (it's a circular are arather than a single point so it doesn't have to be focused), the phosphor will be at it's brightest. The photosensor will be set off and the game program will make note of the exact beam position that the electron beam was at when the sensor was triggered. Then when the sensor goes off again, the electron beam position is again recorded. The process is repeated line by line as the electron beam moves down the display. When it's done there should be enough readings to determine an approximately circular area that the gun was pointed at. By finding the midpoint, you can tell where the gun was pointed. The process is repeated for a frame or two and the results averaged for better accuracy.

This is the same principal that was used in all light guns released since the Light Phaser, including the Dreamcast Light Gun. Only recently has there been a new development, a "light gun" that uses a display-mounted sensor to tell where the gun is pointed. This is good for people with LCD or plasma displays, as they don't have bright electron beams to trigger light sensors in the same manner.

One difference is that the Dreamcast does not constantly read from the controller port ("polling") to tell when the gun sees the electron beam, the gun will send a signal to the Dreamcast (an "interrupt"). Beam position is recorded when the interrupt is sent through the controller port.

Here's why hacking a light phaser to work with SMS emulators on the DC is difficult:

The "polling" thing does not work well as there is a fair amount of protocol involved in checking the status of the controller port on the Dreamcast, whereas on the SMS you need only check the status of one pin directly on the control port. There is too much latency so you might miss a sensor change or just overload the bus with read requests. So you need to depend on the interrupt thing. However, I'm not aware if a hacked controller is capable of generating an interrupt - mapping buttons is easy as you're just attaching wires to contact pads, but you need the controller's circuitry to encode the message to send across the Dreamcast's "maple" controller bus. If the circuitry can't be triggered by a wire to generate an interrupt then it won't be of use.

You can always hack a genuine DC light gun, which of course does generate interrupts, but it sort of seems like if you have a light gun you should just use it.
alb3530
DCEmu Freak
DCEmu Freak
Posts: 99
Joined: Fri Nov 12, 2004 2:00 pm
Location: RS,Brazil
Has thanked: 0
Been thanked: 0
Contact:

Post by alb3530 »

Thanks,heliophobe!When i did that test,i didn't have internet access,so i couldn't know whether it was possible to make SMEG works with the gun.I'd only know if i tried.The interesting point is:
if you normally play Operation Wolf on SMEG, using a dreamcast controller,you press 1-button,and the screen flashes,just like you had using a controller instead the gun in a Master System console.Everything ok so far.But,as for both sms+(using the normal dc controller) and the real console(using the gun,but without connecting the ''trigger wire''),if the button/trigger is pressed,the screen becomes white forever,and u have to reset the system.This' why i thought the only thing missing for the gun to work with sms + was to find out where to connect the trigger wire in dc controller.And it seems impossible to know,once there's no connector in the dc controller that may act like a trigger activator.I tried to connect the trigger wire in all possible places but no combination worked.So i ended up destroying my Light Phaser,when trying to discover something in a real console,and my tests are stopped now.I forgot to tell a detail:
my test wasn't done in a Master System console,but in a Mega Drive 3 with Mega/Master Adaptor by Dynacom.I assume they're almost the same thing.Only some slight differences,like sonic 2 level select doesn't work,and in Operation Wolf it's possible to play in all levels after Village.Most things are just like Master System.
One more thing,Operation Wolf can be played without the gun,by using the second controller.A gunsight will appear at the screen.
Good luck if you're gonna try something,Captain Skyhawk.
Http_user_agent:
NokiaN80-1/3.0 (4.0623.0.41) Series60/3.0
Profile/MIDP-2.0
Configuration/CLDC-1.1
Post Reply