Wednesday, 16 January 2013

SDLMAME and a light gun working on a MacBook Pro

A few weeks ago, for one reason or another, I got thinking about an arcade game called CarnEvil. I remember playing it at a bowling alley in Stafford when I was about 11 or so, and it left quite an impression. The game is set in a haunted amusement park and features a variety of horror-themed enemies, and I thought the whole freaky carnival vibe was great. I've never seen another CarnEvil machine since then, but the other day I did a bit of research and realised you can run the game using MAME. However, there was little information on getting MAME and CarnEvil working on a Mac...

I downloaded the CarnEvil ROM and chd. file and installed SDLMAME for Mac using this tutorial. There wasn't a lot of information on how to correctly position the ROM and chd. file within the SDLMAME folder to get it to work, but this is the setup that worked for me:

As you can see, the '' ROM file is in the ROM folder, then I created another folder inside the ROM folder called 'carnevil'. Inside that I put the 'carnevil.chd' file. I loaded up SDLMAME and was surprised to see that CarnEvil ran pretty much perfectly on my MacBook Pro. I couldn't play it as you basically need a light gun, but I could watch the intro and even keep inserting credits to see the game levels.  That wasn't enough though - I wanted to actually play the game, which would require a light gun. 

I did some research and there weren't that many options, but the Arcade Guns PC Light Gun seemed to be getting a lot of praise. There were reviews of it on YouTube and it was apparently pretty easy to set up and use. However, nowhere did it say it would work on Mac, so I emailed Eric at Arcade Guns and asked if it was likely to work. He replied that the guns work on Linux, and Mac OS X is also a Unix-based OS so there shouldn't be any problems. He said I wouldn't be able to configure the gun, as the configuration software only runs on Windows, but that he'd set the gun to 'Joystick Mode' before sending it out to me so it should be OK.

The gun came in the post within about a week and I waited till I had a bit of time as I anticipated it wasn't going to be simple. First I plugged in the gun and the IR sensor into my two USB ports, but according to the manual I should have been able to control the cursor with the gun straight away; this doesn't seem to be possible on my MacBook Pro, probably something to do with the trackpad being part of the internal hardware. Anyway, I loaded up SDLMAME and pointed the gun at the screen and found that there was some kind of interaction - moving the gun did affect the crosshair on-screen - but it was jumping out all over the place and not following my movements. This was a good sign though, as now I just had to calibrate the gun properly.

You get two manuals with the gun - the Arcade Guns user manual and the AimTrak setup guide. Following the instructions on page 4 of the setup guide I tried holding the trigger for five seconds on my desktop screen, as this should start the calibration process. This didn't work, but after trying different combinations of buttons I figured out that you hold the large button at the back of the gun for around five seconds. Reading the user manual now it does actually say that, but in the setup guide it says to hold the trigger. 

So I could get into calibration mode, but this takes a long time to get right, and as I said, you can't control the cursor on my Mac using the gun, so even after you think you've calibrated the gun you can't tell until you load SDLMAME and check - basically the gun is only active in SDLMAME but can't control the cursor on your desktop. 

What works best for me is sitting about four or five feet away and turning off all the lights so the room is dark, but even then sometimes it doesn't work right - you end up with an erratic crosshair, or one that doesn't travel to certain parts of the screen. I got it calibrated pretty nice the other day and I haven't changed it since then. 

However, the first time I got it calibrated pretty good I noticed it still wasn't perfect. I realised the cursor was centring on the vertical and horizontal axes too easily. Basically it got stuck in the middle of the screen. I emailed Eric and he knew what was up - you just need to set 'deadzone' in MAME to '0'. As I open SDLMAME up from Terminal I just type './mame64 -jdz 0' every time now and that does the trick ('jdz' controls the 'deadzone' setting). 

So now the crosshair was responding well to my movement and most of the hard work was out of the way. Next was to configure the controls for CarnEvil

Above is how I've set up my controls. To assign the gun as an input you need to change 'Lightgun X Analog' to 'Joy 1 A0 Ultimarc'. You do this by moving the gun from left to right across the screen very steadily. You then set 'Lightgun Y Analog' to 'Joy 1 A0 Ultimarc' by moving the gun from the top of the screen to the bottom. 'P1 Button 1' is your trigger and 'P1 Button 2' is your reload, which I've set to the large button at the back of the gun (originally CarnEvil was off-screen reload).

As you can see, pressing 6 on my setup enters 'Service Mode', and you have to enter this menu to calibrate the gun once again in CarnEvil  I haven't got any keys assigned to for Player 2 anymore, but in CarnEvil's calibration mode you need to calibrate both guns to complete the process and save the settings. I only have one gun but you need to make CarnEvil think you're calibrating both guns. You can assign any buttons to Player 2 and complete the whole calibration process, but then just turn off Player 2 after you're done.

I can't think of any other problems I encountered. I was surprised that the whole thing works this well to be honest - the light gun is a great little piece of technology. There's so many variables, especially when this wasn't intended for Macs, but it works and it's a lot of fun. The only thing that would be better is two guns so that two people can play. Eric was really helpful so if you have any problems you can email him through the Arcade Guns website. 

Finally, I've put a couple of videos of me using the gun up on YouTube to show that it can be done. First a quick explanation, and then some footage of me playing Jurassic Park:

Labels: , , ,


Blogger Colby Fulton said...

Any other games you'd recommend for these guns? Just ordered two online as I love shooting games! I'm going to be using them on a mac, too.

17/01/2014, 23:48  
Blogger Jephso said...

That's cool. I use it for five games on MAME:

Alien3: The Gun, Jurassic Park, Duck Hunt, CarnEvil and Lucky & Wild. They all work, except (from what I remember) Lucky & Wild had a pedal on the arcade machine and so it's a little tricky to setup and play on a laptop or PC.

Let me know how you get on with the guns on your Mac.

18/01/2014, 10:21  
Anonymous Anonymous said...

Hi! I currently also have a mac, and was also trying to find a light gun for my birthday to play games like Terminator Salvation. The gun you used is sold out, and I was wondering what other guns might work?

Thank you!

22/01/2014, 01:06  
Anonymous Anonymous said...

I just wanted to thank you so much for this article. It was very helpful for getting my gun working with my mac. I have boot camp on here so I was able to go into windows and download the Ultimarc Aimtrak software so I could switch my gun to joystick mode and calibrate it to the sensor. Your MAME configuration stuff like the jdz 0 thing was the key. Thanks a ton!

06/03/2016, 05:27  
Blogger Jephso said...

No worries, that's why I wrote this. I haven't used mine in ages. Think I'll get it out and try it again soon!

And to the guy who asked about other guns (2 years ago) I think this is the best one from what I read.

06/03/2016, 11:49  
Blogger Paul guber said...

is there anyway to keep the deadzone at 0 and not always have to put it in? I use a front end (emulaunch) and I dont get a chance to type in the jdz 0 thing.

01/09/2017, 02:37  
Blogger Jephso said...

Did you figure this out? I'm not sure to be honest. This was the only thing that worked for me...

05/05/2018, 08:03  
Blogger Paul guber said...

I did figure this out, I honestly dont even remember writing what I wrote. But all is good now, no clue what I did ha ha, but all is good, thank you... oh I think I started using a different front end, made things a lot easier

12/05/2018, 04:17  

Post a Comment

<< Home