Making Light gun for LCD TV
Making Light gun for LCD TV
Hi,
From what I understood (thanks Eke for the docs), Justifier won't work on LCD TV because they don't "see" the lightbeam ...correct ?
My question is 'how could we fix that on the hardware way' (ie not patching the original ROM of a game) ?
Since light gun position is mainly related to int2 and HV counter, which is triggered by the HL, the goal is the change HL state at the right moment.
For this, I'll need to read the HVCounter, compare it to the wanted XY and change HL state when I want.
I wonder if this could be done adding a 'special' card on the CD port.
For this, it mean a program could run at the time of Lethal Enforcers, look at HVcounter (on HInt) and change HL state through DB9 cable itself.
I don't KNOW if hardware allow that, I'm only starting to work on this CD port :
I know a cart could access CD port...but not if the "CD cart" could work by itself, even on a limited way
I also know a CD cart could access the cart so perhaps a "CD cart" could launch the game cart and still run, reacting to HInt.
Unfortunaly, it will lock the CD port...and so now way to use a light gun on MegaCD game
I'm only looking this as a possible way to do that.
I know how to make a new lightgun (Wiimote power!) but not how to control the int2/HVCounter from 'elsewhere'.
If you have any other ideas, i'm here!
EDIT : bad understanding of the int2/hvc/HL
From what I understood (thanks Eke for the docs), Justifier won't work on LCD TV because they don't "see" the lightbeam ...correct ?
My question is 'how could we fix that on the hardware way' (ie not patching the original ROM of a game) ?
Since light gun position is mainly related to int2 and HV counter, which is triggered by the HL, the goal is the change HL state at the right moment.
For this, I'll need to read the HVCounter, compare it to the wanted XY and change HL state when I want.
I wonder if this could be done adding a 'special' card on the CD port.
For this, it mean a program could run at the time of Lethal Enforcers, look at HVcounter (on HInt) and change HL state through DB9 cable itself.
I don't KNOW if hardware allow that, I'm only starting to work on this CD port :
I know a cart could access CD port...but not if the "CD cart" could work by itself, even on a limited way
I also know a CD cart could access the cart so perhaps a "CD cart" could launch the game cart and still run, reacting to HInt.
Unfortunaly, it will lock the CD port...and so now way to use a light gun on MegaCD game
I'm only looking this as a possible way to do that.
I know how to make a new lightgun (Wiimote power!) but not how to control the int2/HVCounter from 'elsewhere'.
If you have any other ideas, i'm here!
EDIT : bad understanding of the int2/hvc/HL
Maybe you could intercept the video signal and use a sync separator to extract hsync and vsync. If you synchronize an internal counter to the TV's beam, you would know where the HV counter was. Then, when you get the trigger signal from the light gun, you would wait until the HV counter reaches the right position before asserting HL. The gadget would plug in to the controller port and to the video output.
I think it's the main idea...I don't see how it could be possible another way.Graz wrote:Then, when you get the trigger signal from the light gun, you would wait until the HV counter reaches the right position before asserting HL.
The main problem is how
Thanks for the input, it's another idea....
I also thought about a game genie clone with hardware dedicated to light gun (like Codemaster's JCart but for lightgun) linked to joy2 port.
so a mix between hardware and (patch) software solution....
-
- Very interested
- Posts: 746
- Joined: Sat Dec 15, 2007 7:49 am
- Location: Kazakhstan, Pavlodar
No. You both wrong. Lightgun works only with CRT (100Hz/120Hz TV's draws image at twice speed, LCD TV's draws all image at once, and those TV's use own image memory, so "input lag" is present) TV's. Becouse, CRT beam draw every frame from top-left corner to bottom-right corner. Ofcourse, old image get blanked before new trace done by beam. So, optical element just "see" this different of brightness. And change logical 0 (black) to logical 1 (white). And becouse raster deliver from VDP to TV line by line, VDP always known, where beam is. And it's own H/W counter stores correct X/Y value of beam position.
So, you must trigger "HL" in right raster line and right position in line. That's not difficult. Just as said Graz. But, how did you will know, where position on TV screen lightgun pointed? That's difficult. Becouse lightgun holds by man and not necessarily in front of screen. So, the whole problem is the development of tracking device, wich will be return correct X/Y coordinates of "beam" pointed from lightgun barrel to TV's srcreen (or whatever, you know, you can use screen of light projector for bigger picture size :3). And then, those coordinates easy to convert to right "HL" change timings.
I hope you are understand me, with my terrible english. :3
So, you must trigger "HL" in right raster line and right position in line. That's not difficult. Just as said Graz. But, how did you will know, where position on TV screen lightgun pointed? That's difficult. Becouse lightgun holds by man and not necessarily in front of screen. So, the whole problem is the development of tracking device, wich will be return correct X/Y coordinates of "beam" pointed from lightgun barrel to TV's srcreen (or whatever, you know, you can use screen of light projector for bigger picture size :3). And then, those coordinates easy to convert to right "HL" change timings.
I hope you are understand me, with my terrible english. :3
Last edited by HardWareMan on Thu Jul 08, 2010 12:42 pm, edited 1 time in total.
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
for LCD you'd need some 3 sensors that triangulate the position of your gun and to simulate the beams position.
I once experimented with lightguns on MD... I made a motion sensor from a clone NES zapper, lol
I once experimented with lightguns on MD... I made a motion sensor from a clone NES zapper, lol
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
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
err....it's why I want to make a lightgun not dependent on beam...HardWareMan wrote:No. You both wrong. Lightgun works only with CRT (non 100/120Hz!) TV's. Becouse, CRT beam draw every frame from top-left corner to bottom-right corner. Ofcourse, old image get blanked before new trace done by beam. So, optical element just "see" this different of brightness. And change logical 0 (black) to logical 1 (white). And becouse raster deliver from VDP to TV line by line, VDP always known, where beam is. And it's own H/W counter stores correct X/Y value of beam position.
hoo...So, you must trigger "HL" in right raster line and right position in line. That's not difficult. Just as said Graz.
About video signal, I'm lost
I think it's not difficult. I'm almost finish my experiment with a wiimote.But, how did you will know, where position on TV screen lightgun pointed? That's difficult.
Let say I could define X/Y
My problem is really WHEN trigger HL...
You seem to say it would be possible using video signal...
I have to dig into it so....
Wow...so, it seems it's doable....projector for bigger picture size :3). And then, those coordinates easy to convert to right "HL" change timings.
Don't forget I'm french, so no problem with any kind of english LOLI hope you are understand me, with my terrible english. :3
-
- Very interested
- Posts: 746
- Joined: Sat Dec 15, 2007 7:49 am
- Location: Kazakhstan, Pavlodar
So, you want to use wiimote to get right X/Y coordinates on screen? This will work.KanedaFr wrote:I think it's not difficult. I'm almost finish my experiment with a wiimote.But, how did you will know, where position on TV screen lightgun pointed? That's difficult.
Let say I could define X/Y
My problem is really WHEN trigger HL...
You seem to say it would be possible using video signal...
I have to dig into it so....
OK. Now, you must make device, wich will take those X/Y coordinates, HSync/VSync from MD (we have TTL signals in system: separate on slot B14 and B13 and as mixed from PAL/NTSC coder), count scanlines from VSync as Y coordinate and then calculate offset of changing "HL" in right video scanline as X coordinate.
And one more thing: in interleave mode there can be a problem.
I'll keep this in mind.KanedaFr wrote:Don't forget I'm french, so no problem with any kind of english LOLI hope you are understand me, with my terrible english. :3
CoolHardWareMan wrote: So, you want to use wiimote to get right X/Y coordinates on screen? This will work.
Ok, some question on this:OK. Now, you must make device, wich will take those X/Y coordinates, HSync/VSync from MD (we have TTL signals in system: separate on slot B14 and B13 and as mixed from PAL/NTSC coder), count scanlines from VSync as Y coordinate and then calculate offset of changing "HL" in right video scanline as X coordinate.
1/ I see how to get the Y, but what about the X ? you have to know how much 'time' is take to draw a pixel to calculte the time to get to the correct X ? This 'time' is different from NTSC and PAL, no ?
2/ if I borrow the vsync & hsync from the cart bus (which is cool since it will work on MCD too!) using an adapter, it won't alterate the signal ?
something like :
B14--------->B14 original card
|----zener-->my device
need to check if light gun games use interleave mode or not....And one more thing: in interleave mode there can be a problem.
I don't think so, Eke doesn't talk about it on his doc
Don't forget about EDCLK
We know that out of /HSYNC, it's exactly running at twice the pixel clock (in 40-cell mode at least) so I imagine you could use that to count the number of pixels once you are on the right line and /HSYNC is high again. With some adjustements (you have to account front porch + border area, all of this have been measured by Jorge Nuno on this forum), it could be used to trigger the /TH line on the I/O port at the right moment (forget about triggering IRQ or /HL, all of this is already handled by software & original hardware).
PS: there are only 2 games using interlaced mode on the Mega Drive, and none of them support the lightgun ; I think I verified that all lightgun games use 40-cell mode but don't quote me on that
Also, don't forget that most likely, original lightguns would see a number of lines around the aimed position, at least games do some averaging with the HCounte rvalue being read and expect the interrupt to be triggered on multiple successive lines to average Y position.
DOing this with hardware is neat but as last solution (the easiest one), since you have a Wii, I strongly suggest you try these games in Genesis Plus GX , lightgun emulation via wiimote should be quite accurate, it even ouputs the original non-interlaced video signal
We know that out of /HSYNC, it's exactly running at twice the pixel clock (in 40-cell mode at least) so I imagine you could use that to count the number of pixels once you are on the right line and /HSYNC is high again. With some adjustements (you have to account front porch + border area, all of this have been measured by Jorge Nuno on this forum), it could be used to trigger the /TH line on the I/O port at the right moment (forget about triggering IRQ or /HL, all of this is already handled by software & original hardware).
PS: there are only 2 games using interlaced mode on the Mega Drive, and none of them support the lightgun ; I think I verified that all lightgun games use 40-cell mode but don't quote me on that
Also, don't forget that most likely, original lightguns would see a number of lines around the aimed position, at least games do some averaging with the HCounte rvalue being read and expect the interrupt to be triggered on multiple successive lines to average Y position.
DOing this with hardware is neat but as last solution (the easiest one), since you have a Wii, I strongly suggest you try these games in Genesis Plus GX , lightgun emulation via wiimote should be quite accurate, it even ouputs the original non-interlaced video signal
Last edited by Eke on Thu Jul 08, 2010 1:53 pm, edited 1 time in total.
shhhhut, it's what i first wrote but it was a misundertstandingEke wrote: (forget about triggering IRQ or /HL, all of this is already handled by software & original hardware).
so....no problem..at least on this pointPS: there are only 2 games using interlaced mode on the Mega Drive, and none of them support the lightgun
yeah, I read about it on your menacer doc (not on justifier part)Also, don't forget that most likely, original lightguns would see a number of lines around the aimed position, at least games do some averaging with the HCounte rvalue being read and expect the interrupt to be triggered on multiple successive lines to average Y position.
so it's needed to trigger HL from Y-4 to Y+4 ?
-
- Very interested
- Posts: 746
- Joined: Sat Dec 15, 2007 7:49 am
- Location: Kazakhstan, Pavlodar
MD cartriges don't use B13 and B14 (not sure about cartriges with DSP chips). About 32x I don't know, but it's doesn't matter: B13 and B13 (wich is HSync and VSync) are TTL output from VDP. So, you can just connect input of TTL logic.
About X coordinate. Yes, it's can be a problem. For example, we know, PAL whole scanline (with synchro and flyback) take 64 microseconds, and active raster 48 microseconds with offset 8 microseconds from end of synchronization impulse. And those 48 microseconds we must divide by horizontal resolution (256 or 320 pixels).
But, not so bad! We can use "percentage" term for operate as X coordinate, right? 0% for left border and 100% for rigth border. And of course, we can (and I think must) use calibration procedure for both X and Y coordinates.
About X coordinate. Yes, it's can be a problem. For example, we know, PAL whole scanline (with synchro and flyback) take 64 microseconds, and active raster 48 microseconds with offset 8 microseconds from end of synchronization impulse. And those 48 microseconds we must divide by horizontal resolution (256 or 320 pixels).
But, not so bad! We can use "percentage" term for operate as X coordinate, right? 0% for left border and 100% for rigth border. And of course, we can (and I think must) use calibration procedure for both X and Y coordinates.
We can use EDCLK. Or measure scanline time and calculate position of /TH triggering.Eke wrote:Don't forget about EDCLK
Yeah. By "HL" in my post I mean "/TH" line on port. :3Eke wrote:We know that out of /HSYNC, it's exactly running at twice the pixel clock (in 40-cell mode at least) so I imagine you could use that to count the number of pixels once you are on the right line and /HSYNC is high again. With some adjustements (you have to account front porch + border area, all of this have been measured by Jorge Nuno on this forum), it could be used to trigger the /TH line on the I/O port at the right moment (forget about triggering IRQ or /HL, all of this is already handled by software & original hardware).
Last edited by HardWareMan on Thu Jul 08, 2010 2:05 pm, edited 1 time in total.
a passthrough device on the cartridge port that intercepts HSYNC, VSYNC and EDCLK signal and is also connected to the controller port would indeed be the best solution
But I still have trouble figuring how you think you can send wiimote position to that device ? Are you thinking about some kind of bluetooth receiver ? It woudl need to operate in real-time, very fast, seems hard to me at first glance
But I still have trouble figuring how you think you can send wiimote position to that device ? Are you thinking about some kind of bluetooth receiver ? It woudl need to operate in real-time, very fast, seems hard to me at first glance
should be adjustable in my opinion, just like X positionningso it's needed to trigger HL from Y-4 to Y+4 ?
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
32X uses both H and Vsync, and it is extremely picky about Hsync... if the signal is slightly lower or deformed then you'll get scrolling or deformation and/or dislocation in the 32X image :/
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
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
sure, calibration is a must need!HardWareMan wrote:About X coordinate. Yes, it's can be a problem. For example, we know, PAL whole scanline (with synchro and flyback) take 64 microseconds, and active raster 48 microseconds with offset 8 microseconds from end of synchronization impulse. And those 48 microseconds we must divide by horizontal resolution (256 or 320 pixels).
But, not so bad! We can use "percentage" term for operate as X coordinate, right? 0% for left border and 100% for rigth border. And of course, we can (and I think must) use calibration procedure for both X and Y coordinates.
you made a perfect (technical) resume of what I thought about "calculate" x coordinate
I now think so tooa passthrough device on the cartridge port that intercepts HSYNC, VSYNC and EDCLK signal and is also connected to the controller port would indeed be the best solution
Yeah, I knew it has to be fast but now I realize how MUCH (since related to video sync!)But I still have trouble figuring how you think you can send wiimote position to that device ? Are you thinking about some kind of bluetooth receiver ? It woudl need to operate in real-time, very fast, seems hard to me at first glance
My first proto was about
Wiimote-(BT)->PC-(USB)->Teensy-(wire)->Joyport
because a BT enabled hardware is expensive...
the cheapest solution is serial so low(?) speed
It will be 'stupid' to make something which cost 100$ !!!
I wish to be able to hack somethink like this :
http://www.hkems.com/product/xbox/EMSTopGun2.htm