Adding a GameGun mode switch to the Mega Drive Justifier adaptor

Thursday, 30th June 2022

The light gun adaptor for the Mega Drive and Mega-CD that I'm working on now has a mode switch that allows you to choose between "Justifier" and "GameGun" modes. The circuit is starting to look a little messy:

Adaptor from a Light Phaser or Justifier to Justifier or GameGun
Light Phaser/Justifier to Justifier/GameGun

I have not fully tested the diagram or circuit in practice, but my initial tests are encouraging. The main change is an extra multiplexer that changes the source of four output pins on the adaptor:

Output Justifier GameGun
TH Latched light gun 1 or 2 sensor Raw light gun 1 sensor
DATA0 Light gun 1 or 2 trigger Light gun 1 trigger
DATA2 Raw light gun 1 or 2 sensor Logic high
DATA3 Logic low Light gun 1 start

The DATA1 pin continues to be connected to the Justifier start button output in this arrangement which is not correct but there aren't enough multiplexers available to also switch that, and in my testing it doesn't seem to affect the detection or handling of the adaptor as a GameGun.

At this point I think I need to build the circuit again on some prototyping board using the diagram as a reference (and not the breadboard prototype) to ensure that the diagram is correct. If that still works I can redesign the PCB and get some new boards manufactured to fully test the circuit's performance in all the Mega Drive and Mega-CD games once more.

The circuit constructed on a breadboard

Hopefully these PCBs will work a little better than the first batch now that I've made all of these improvements to the circuit!

The mysteries of the American Laser Games GameGun

Tuesday, 28th June 2022

When experimenting with the American Laser Games titles to try to get my Light Phaser-to-Justifier adaptor working properly I was surprised to see the circuit was initially detected as a GameGun. This was not a light gun I was familiar with so went to read about it on Sega Retro which turned up a photo of the gun:

The American Laser Games GameGun
The American Laser Games GameGun – photo from Sega Retro by user Black Squirrel

This gun is from American Laser Games themselves and is labelled "Sega CD Compatible" as it was apparently based on their similar gun for the 3DO. Sega Retro does also mention the following:

The GameGun [...] is also compatible with games designed for both the Sega Menacer and Konami Justifier. The GameGun is the only widely produced light gun to substitute the Menacer, and is therefore the only smaller alternative to an accessory often criticised for its cumbersome size.

This does sound like an intriguing device! It must pack some fairly sophisticated technology to be compatible with all three light gun protocols, considering how different they all are from each other. I'm not entirely sure how that would practically work, either, as there doesn't seem to be a mode switch or the additional buttons found on the Menacer. Maybe they're on the other side of the gun in the photo…

Fortunately, nesdev.org forum user nintendo2600 owns an ALG GameGun and posted some photos of the internals, which forum user TmEE used to derive a circuit diagram:

The American Laser Games GameGun
The American Laser Games GameGun circuit diagram reverse engineered by TmEE on nesdev.org

This circuit is very simple, only passing on the amplified light sensor signal to the TH output, the state of the trigger button to DATA0 (pin 1) and the state of the start button to DATA3 (pin 4). The GameGun appears to lack any sort of circuitry to generate a controller device ID, which on the Mega Drive is handled by setting the DATA0 to DATA3 pins to various "invalid" combinations depending on the state of TH as an input (the DATA pins are mapped to the d-pad in a standard controller, and an "invalid" combination would be for example reporting that up and down were held simultaneously – this is covered in somewhat more detail in this earlier journal post.

The Menacer and Justifier both contain the appropriate logic to generate a valid controller device ID, and so games supporting those guns check to see whether such a gun returns a valid device ID before allowing you to use the respective gun. Without that logic in place, the GameGun will not be detected as a Justifier or Menacer and so is unsupported in these games. I'm not sure where the source of the information that the GameGun is compatible with games that require a Menacer or Justifier originates, but the circuit doesn't back that up and it would also explain why people who own this gun have not been able to get it working in games that do not explicitly support the GameGun.

The inability to detect a GameGun is also why the American Laser Games default to assuming you have one plugged in, even if you don't have anything plugged into the controller port at all! Its simple design also makes a passive adaptor from the Master System Light Phaser to the GameGun possible:

Adaptor from a Light Phaser to GameGun
Light Phaser to GameGun adaptor

A passive Justifier-to-GameGun adaptor should also be possible, as well as a universal adaptor that could handle both guns. Interestingly the two games I was having compatibility difficulties with before – Mad Dog II and Crime Patrol – work with such a simple adaptor and a Light Phaser, even though the repeated triggering from the Light Phaser causes problems when it's converted to a Justifier using the circuit described in my previous post. Maybe a better solution to the compatibility issues would be to provide a Justifier/GameGun switch on the adaptor…

Even if I can get the Justifier adaptor working completely in Justifier mode in Mad Dog II and Crime Patrol a GameGun mode may still be handy as Corpse Killer on the Mega-CD supports the GameGun but not support the Justifier.

The above video shows the simple passive adaptor working in Mad Dog II: The Lost Gold. A big thank you to TmEE for reverse engineering the GameGun and to nintendo2600 for posting the photos of the insides of their controller!

Improving the Konami Justifier adaptor's compatibility by properly implementing the DATA2 output

Saturday, 25th June 2022

In the previous entry I mentioned how the Justifier light gun adaptor for the Mega Drive and Mega-CD had some compatibility issues, not working at all on one of my older Mega Drive consoles and not working in any of the games developed by American Laser Games. Fortunately, the former issue ended up being very easy to fix. After moving the circuit around a bit and checking various points with a logic probe I found that it did work sometimes, but not reliably. This made me think it was a floating input and adding a 10K pull-up resistor to TL on the Mega Drive side fixed the issue entirely. I have also added 10K pull-ups to TH and TR on the Mega Drive side, just to be sure. Unfortunately, this didn't help with the American Laser Games titles – they still weren't working.

A DE-9 breakout adaptor attached to the second controller port of a Mega Drive

To be able to diagnose the issue it would be very useful to actually see what's happening on the controller port's data lines. I can probe my own circuit, but not the Konami Justifier, so to help me out I built a crude DE-9 breakout adaptor that can sit between the console and the controller and provide pin headers to connect my logic analyser to.

One of the games that has issues, Mad Dog McCree, claims the adaptor is a "GameGun" and not a Justifier. This seems to indicate a problem with the device detection during startup, so I logged the activity to see what was going on:

Logic analyser trace showing activity on DATA2 line

This trace surprised me, as I had assumed all this time that DATA2 and DATA3 should be low at all times and were tied to ground on the adaptor. Indeed, inside the Justifier itself DATA3 seems to be soldered directly to ground; DATA2 is connected to a pin on the controller chip but I wasn't sure what it was supposed to be doing and tying it low didn't seem to cause any issues.

Zooming into the trace I could see that DATA2 was always the opposite logic level to TL, so I added a hex inverter chip to invert TL and connected its output to DATA2. Restarting the console made Mad Dog McCree detect the adaptor as a Justifier; pressing the Start button advanced through menus and pulling the trigger caused the screen to flash. Progress, of sorts, but the game would still not register any shots as being on-screen.

One detail about the Justifier's TH output, which goes low when the gun sees light on the screen, is that it is latched – once it goes low, it remains low, until the TL line goes high to reset the gun. This is not a feature I'd previously implemented as the Konami-developed games don't seem to rely on this behaviour. However, in the American Laser Games titles, once TH goes low, it remains low until the game resets back to the demo loop. How can the game tell where the gun is aimed if TH is pretty much permanently stuck low? This doesn't seem to bother the American Laser Games titles, so they must be using some other method for detecting when the gun can "see" light from the TV screen.

Logic analyser trace showing activity on DATA2 line at TV frame and line frequencies

Looking at a logic trace from real Justifier of the running game turned up some further information about the DATA2 signal; at points the signal would pulse low at around 60Hz, and sometimes those low pulses would themselves contain pulses at around 15.625kHz. These numbers are suspiciously close to the TV vertical (frame) and horizontal (line) refresh rates – are the games expecting the light sensor input from the gun to be on DATA2 instead of TH?

I replaced the simple DATA2=NOT(TL) circuit with DATA2=NOR(NOT(TH),TL) as this would pass TH to DATA2 when TL was low but output low when TH was high. Success, of sorts: Mad Dog McCree and Who Shot Johnny Rock? now work.

Unfortunately Mad Dog II and Crime Patrol still don't register shots. I compared a real Justifier to the adaptor and it mostly looks the same, with one possible exception: retriggering from the light sensor. Below is a capture of a successful shot from the Justifier; the top trace is the trigger pull, the lower trace is the signal on DATA2, showing a single burst of activity on the few lines where the gun can "see" the bright flash of the TV screen:

Trace of successful Justifier shot, showing a single burst of activity on DATA2
Single burst of activity after a shot from the Justifier

The Light Phaser doesn't produce a single set of pulses via the adaptor for the bright flash it sees, it produces four:

Trace of failed Light Phaser shot, showing four bursts of activity on DATA2 spaced 16ms apart
Four bursts of activity after a shot from the Light Phaser

The four bursts of activity repeat at around 60Hz; it's as if the Light Phaser continues to see the screen as being bright for a few more frames after the initial flash, but the Justifier only allows a single frame's worth of pulses to get through. The other control lines do not change to indicate this.

My best guess is that the two games that do not work with the adaptor detect the additional sets of pulses generated by the Light Phaser and rejects the shot if "too much light" (for lack of a clearer description at this point) is detected. One thing I have noticed is that the Justifier appears to have some sort of automatic gain control and adjusts its sensitivity based on recent light levels. If you point the gun at a reasonably bright spot on a TV screen it outputs a series of pulses every time the beam passes under where it's aimed. If you then pull the trigger to cause a bright screen flash the gun will output pulses during the flash but when the flash is over and the gun is left pointing at a less bright area of the screen it stops outputting pulses for a short while. The pulses then gradually return over the period of a few frames. Conversely, the Light Phaser outputs pulses consistently with no temporary loss of sensitivity after the screen's bright flash.

Trace of missing pulses from the light sensor in the Justifier after a trigger pull and flash

The captured traces above show this somewhat – after the trigger pull (when top trigger line goes low) the screen flashes brightly. The Justifier sends pulses initially but then there is a gap of around 200ms in the output from its light sensor after the bright screen flash. The Light Phaser, however, sends pulses continuously after the bright flash.
Some further testing also found the further related side effects that seem to confirm this:

  • When using a real Justifier gun directly connected to the console, if you turn the TV brightness and contrast up and shoot at a bright spot on the screen the game will sometimes reject your shots. This doesn't happen when shooting at dark areas.
  • When using a Justifier plugged into the adaptor, the adaptor works fine and shots are registered. In this mode the adaptor is not just a simple pass-through, it is replicating all the rest of the functionality of the Justifier gun and only relying on the connected gun for its light sensor.
  • When using the Light Phaser plugged into the adaptor, if the TV brightness is turned down and shoot at a dark spot on the screen the game will sometimes register your shots. This doesn't happen when shooting at light areas.

Unfortunately, as the issue appears to originate in the light sensor of the gun with no external way to control it, I'm not sure if I'll be able to find a good solution to this problem. Running the video signal through the adaptor to detect bright flashes and gate the light sensor output may work but is not a particularly clean solution!

Updated circuit for the Light Phaser to Justifier adaptor with improved Mega-CD support
Light Phaser/Justifier to Justifier adaptor

The above circuit diagram shows the new version of the adaptor. I believe it's correct but I have made mistakes drawing circuits before (the current prototype PCBs with pins 8 and 9 swapped on the controller port inputs spring to mind) so to summarise the changes:

  • TL, TR and TH inputs on the Mega Drive side of the adaptor are now pulled high with 10K resistors.
  • The DATA2 output is now driven with DATA2=NOR(NOT(TH),TL), allowing the adaptor to be properly identified as a Justifier in American Laser Games titles and have its light sensor signal sent to the console.
  • As the NOR gate chip required for DATA2 had two gates going spare on it the latching behaviour of TH has been implemented with an SR latch.
  • As the plain unlatched light sensor signal is available on a Justifier's DATA2 output a spare multiplexer on each input has been used to choose the light sensor signal between DATA2 (Justifier) and TH (Light Phaser).

The changes to improve compatibility only require one extra logic chip (and a handful of resistors). I tested all of my games again and found the following compatibility results:

  • Working
    • Lethal Enforcers (Cartridge and CD)
    • Lethal Enforcers II: Gun Fighters (Cartridge and CD)
    • Snatcher
    • Mad Dog McCree
    • Who Shot Johnny Rock?

  • Incompatible
    • Mad Dog II: The Lost Gold
    • Crime Patrol

Note that as the compatibility issue seems to be with the light sensor part of the individual guns, it is possible to play Mad Dog II: The Lost Gold and Crime Patrol via the adaptor if you plug in a Justifier instead of a Light Phaser. There is little point in doing so, however; for simultaneous two-player games this would allow you to play a game with two (slightly cheaper) blue Justifiers instead of sourcing the extremely expensive pink Justifier, but the American Laser Games titles with two-player support rely on taking it in turns with a single gun so you may as well just plug your Justifier in directly. Still, it feels like I'm getting somewhere.

Konami Justifier adaptor compatibility woes with the Mega-CD and older Mega Drive

Friday, 24th June 2022

Work has slowly continued in the background on the Mega Drive Justifier adaptor, as I'd love to be able to turn this into something I can build and sell to people who'd want one if they were unable to build one themselves. As the whole reason for the project is to save money, I'd need to be able to do this cheaply. The parts aren't expensive, but hand-wiring a board is very time consuming, so I thought I should design a PCB. The last time I designed a PCB was the best part of twenty years ago, so I'm pretty rusty (and I've never made a multi-layer board before), but I gave it my best shot in KiCad and sent off the designs to JLCPCB. Ten days later the boards turned up and I soldered the parts on:

The prototype circuit constructed on a PCB

I was pretty happy with the way the board turned out and was delighted to find it still worked just as well as the breadboard prototype described in the previous journal entry.

A couple of 10K resistors on the Mega Drive side of the circuit have been removed and a couple of 1K resistors have been added between ground and TR on the gun input side. The 10K resistors were connected to high-impedance logic inputs anyway so were unneccessary. TR is usually an output from the controller but here it's used to select which gun - blue or pink - is selected, so in case a Justifier is plugged into the adaptor TR is held low to select the blue gun (the pink gun uses a different physical connector so cannot be attached to this adaptor). Using a 1K resistor may prevent damage to other controllers that try to drive TR high. The updated circuit is shown below:

Updated circuit for the Light Phaser to Justifier adaptor with Justifier support
Light Phaser/Justifier to Justifier adaptor

In the process of updating that diagram I noticed a mistake in my PCB layout - pins 8 and 9 on the gun inputs are swapped, so in my case TR is connected directly to ground but the gun's GND is connected via a 1K resistor. This may be cause for concern and I've fixed it for the next PCB revision but I think I have more serious issues to contend with first!

A Mega-CD console underneath a Mega Drive

I need to be able to properly test these circuits, and the majority of games that support the Justifier light gun are not for the Mega Drive, they are for the Mega-CD. I didn't own one of these until recently, as they are ferociously expensive, but if I am to sell a product to others I have to make sure it's fit for purpose.

First, the good news: I tried the following Mega-CD games and they worked with the adaptor described above:

  • Lethal Enforcers
  • Lethal Enforcers II: Gun Fighters
  • Snatcher

The Lethal Enforcers games shouldn't be too surprising as they are not considerably different from their Mega Drive cartridge counterparts, chiefly upgraded with a CD audio soundtrack and many more sound effects. Snatcher was also developed by Konami, like the Lethal Enforcers games and the Justifier gun itself so that was not too surprising. However, the following games developed by American Laser Games do not work at all:

  • Mad Dog McCree
  • Mad Dog II: The Lost Gold
  • Crime Patrol
  • Who Shot Johnny Rock?

These games all support a number of different light guns but when started with the adaptor plugged in the best result I've got is to detect it as a "Gamegun" or "Other gun", not as a Justifier. If I plug in a real Justifier then that works, so there's definitely something up with how my circuit works. If I plug in a Justifier then swap to my adaptor I can sometimes get to the calibration screen, at which point the game either fails to respond to trigger pulls, hangs completely until the adaptor is unplugged or – if it does see the trigger pull - fail to register any shots on screen. Very disappointing, but this isn't even the worst of it…

The Mega-CD I bought came with a Mega Drive. I already have a Mega Drive (and Mega Drive II) and the adaptor works well with both of them whether playing cartridge or Mega-CD games. It doesn't work properly at all on the Mega Drive that was included with the Mega-CD. Most games don't recognise the adaptor as a Justifier at all, and if the game does happen to detect it (which it does intermittently) then it won't react to the Start button or trigger pulls in menus. I say in menus as weirdly if I get into a game of Lethal Enforcers II pulling the trigger does flash the screen (as if firing a shot) but no hits are registered and when game over occurs pulling the trigger does nothing (normally it advances the counter). Normally in the menus it advances to the next menu item, too, but not here – you can only fire blanks!

This is all rather strange. I've tried a few points around the circuit with a logic probe and it seems to be reacting as it should but the games are definitely not happy about the adaptor on that particular Mega Drive. The real Justifier works absolutely fine on it, though! I haven't yet had the opportunity to dig through activity logs with a logic analyser to see where the difference is creeping in, but thought I should mention this to save disappointment in anyone who was planning on building these projects.

This is unrelated to the pin 8/9 swap described above, incidentally – I get the exact same behaviour in my PCB prototype adaptor, the adaptor on a breadboard I used to design it and the adaptor I built in this earlier journal post. All three boards work fine on my other Mega Drive and Mega Drive II, just not the Mega Drive included with the Mega-CD.

The only difference I can see is that this new Mega Drive is actually an old Mega Drive – it's one of the earlier models with an EXT port and the "High Definition Graphics · Stereo Sound" label around the cartridge slot, whereas my previous Mega Drive is a slightly later revision without the port and text (but not so new that it suffers from poor sound quality).

I will continue probing, and update here when I've found the solution. On the plus side, the Menacer adaptor I'd developed works fine on the Mega-CD and its accompanying Mega Drive, so this weird behavior is mercifully not shared by that adaptor!

Adding input support for the Konami Justifier to the Light Phaser to Justifier Mega Drive light gun adaptor

Tuesday, 22nd March 2022

The Sega Light Phaser to Konami Justifier adaptor project that I've spoken about in the past (and the circuit of which can be found on the "product" page here) has had some interest from people who've asked me to sell them one. I've been somewhat hesitant to get into this as I am unable to test most Justifier games as I only have a Mega Drive (and can't afford a Mega CD, which most of the games require) and wouldn't want to sell people something that doesn't work! I own a Blaze "Guncon Adaptor" for the PlayStation which allows you to use a "normal" gun (e.g. Konami Hyper Blaster) to play Guncon/G-Con 45 light gun games, however it only works with some titles (e.g. Time Crisis) – I haven't been able to get it to work with any PlayStation 2 titles, for example, and it malfunctions with some non-Namco PlayStation games too. This was a bit disappointing to me, and I don't want to be a source of disappointment in others…

However, since originally developing the project I did manage to get a pretty good deal on one Konami Justifier so I thought it would be a good opportunity to at least compare my design to the real thing. In my experience the adaptor performs just as well in-game beyond the inconvenience of the Light Phasers not having a Start button on the gun, relying instead on a button on the adaptor itself. This did make me think about the opportunity to plug a Justifier into the adaptor and use it instead of a Light Phaser. This may sound like a daft idea – why do you need an adaptor to play Justifier games with a Justifier? – but this would allow you to use two player 1 (blue) Justifiers to play two-player games, as the pink player 2 Justifier is considerably more expensive than the blue player 1 Justifier.

Updated circuit for the Light Phaser to Justifier adaptor with Justifier support
Light Phaser/Justifier to Justifier adaptor

The updated circuit is shown above, though I must stress that at this point I haven't properly checked the diagram! I've built the circuit as a prototype and then drew the diagram based on the prototype, normally I'd then build another version of the circuit from the diagram to double check I'd drawn it correctly.

The type of gun is identified by DATA3 pin, which is soldered directly to GND in the Justifier gun but not connected to anything in the Light Phaser. This is pulled high with a 10K resistor and connected to the select pin of a pair of multiplexers that switches between 0 ("Justifier") and 1 ("Light Phaser") modes. The rightmost multiplexer selects the source of the "trigger" signal - in "0/Justifier" mode this comes from DATA0, in "1/Light Phaser" mode it comes from TL. The leftmost multiplexer is used to pass the TL signal back from the console to the light gun, as the Justifier requires this pin to be pulsed to reset the gun each frame. In "1/Light Phaser" mode the multiplexer's input is pulled high so it always outputs a high level and the reversed diode on the output prevents this from interfering with the input signal from the gun's trigger. In "0/Justifier" mode the signal comes from the console's TL output, with the reversed diode allowing the console to pull the gun's TL low if required.

The start button is a bit simpler, as the Light Phaser lacks a button of its own – this is just connected to DATA1 from the gun, with a reversed diode allowing the gun to pull the signal low but preventing the button built into the adaptor from shorting the output directly to ground if the gun was driving it high.

One difference between the adaptor circuit and the real Justifier is the need to reset the gun each frame. The real Justifier latches the state of TH – when the gun sees light from the CRT TV, TH goes low and will remain low until the gun is reset by pulsing TL. The Light Phaser does not do this, TH only goes low briefly whilst it can see light from the TV. This is why the circuit needed to be adapted to allow the console to reset the gun via TL. I am not sure if this difference in behaviour has any impact on real games but it doesn't affect Lethal Enforcers or Lethal Enforcers II, the two games I have to test with. If it did cause issues then a flip-flop could be added to the TH path through the adaptor to replicate this latching behaviour, but it seems like quite a lot of added complexity for something that may not be required.

The prototype circuit on breadboard

The photo above shows the current prototype of the updated circuit. I am currently using two additional 74HC157 multiplexer chips to handle the two guns but I think that I should be able to replace them with a single 74LS153 chip – some are currently in the post on their way over to me for further testing. A short video of the adaptor in action can be found on my Twitter account.

Page 1 of 50 1 2 3 4 550

Older posts RSSSearchBrowse by dateIndexTags