NOTE: This page is covers the updated method where Johnny5 is only launched when MAME is paused, not any time MAME is running. Thanks to Allister Fiend for researching this. The previous version of this page is no longer recommended, but is documented here.
NOTE: In
order to view the ToolTips in the coding sections (aqua background),
you must have javascript enabled. This page assumes you
already have MAME, Johnny5 and your frontend of choice configured and
just wish
to add support for launching Johnny5 from a hotkey while MAME is active
(paused).
INTRODUCTION
This page explains how to add support for launching the Johnny5 Viewer from a HotKey when MAME is paused. This is my preferred method of using Howard Casto's great idea of using an AutoHotKey (AHK) script to launch Johnny5 when MAME is paused, as it avoids much of the quirkiness of Method 4 - Launch AutoHotKey Script Along With MAME - Johnny5 Launches When MAME is Paused. However, the linked method is more conventional, and you may prefer it if it works with no problems on your system.
Major thanks to AllisterFiend and Papaschtroumpf of BYOAC and Thalon of the AHK Forum for making this possible as it is much improved over my previous effort.
The script is based
off one of the early Beta versions of the AHK script, but works fine,
so I did not bother to update it. Two version of the script
are available, a simple version that uses Escape as an Exit MAME key,
and a complex version that uses "=" to exit MAME.
MAJOR LIMITATIONS AND CONSIDERATIONS
This method only has
one major limitation: The script only works under Win2K or
WinXP (WinNT?).
(Win98SE or WinME are not supported. MAME will not
launch the AutoHotKey (AHK) script when paused under these OS's).
MINOR LIMITATIONS AND CONSIDERATIONS
The only minor limitations to the script are that your guests may not know it is threre, and you may need to plan what keys you want to have call and exit Johnny5. Usage is pretty straightforward, though. For my panel, I chose to have either the Player 1 Start, Player 1 Button 1, Player 2 Start, or Player 2 Button 1 activate Johnny5. Any of these keys or the Escape key will exit Johnny5. Most of your guests will figure this out intuitively. If you wanted to, you could set it up so that any button on your panel launched the script, but I am not sure how this might affect gameplay. (I saw no noticeable lag when using the P1 Button1 button in normal gameplay).
The only other minor consideration is that pressing the Escape key with the script loaded and without Johnny5 displayed, causes the script to exit. Therefore, if you have MAME's User Interface display (Dip Switch settings, Key Assignments), you should use the Return To Game option or re-start MAME to use the AHK Script. I consider this barely worth mentioning, as these are configuration issues, and I consider the script to be something I would use after configuration is complete, but it is worth mentioning.
NOTE: The above problem is stated as applying to the Escape key, but it really applies generally to any key to exit MAME. If you set a different key to exit MAME, you will change it using the UI CANCEL assignment, which also changes the key to back out of the config screens and you will also change the exit key in the script so that the script is not running when you quit MAME, so the problem continues, just with a different key.
PRELIMINARY SET-UP
First off, this is optional, but if you are using WinXP, I highly recommend installing the "Open Command Window Here" Powertoy from http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx. This will let you right-click on a folder and have a command prompt pointing to it. I think Win98SE already includes this feature (although you might need TweakUI to add it). I'm not sure about other OS's. I will assume from here on that you have it installed. If you choose not to install it, you will have to navigate to the proper directory using "CD" commands as covered in the batch files below.
Other ways of adding this are shown here (Win2k), here (Win2k), here (Win2k), and here (Win98 up). In case all this fails (and for me in one case it did), you can simply copy cmd.exe from \WindowsRoot\System32\cmd.exe to the applicable folder and double-click that.
AUTOHOTKEY
SCRIPT SETUP - SIMPLE VERSION
The first step is to download and install the AutoHotKey Program. The standard installation defaults are fine, or you can change them, it doesn't really matter.
Next, you want to download the script from here. I recommend extracting the Script to the c:\johnny folder, but I think it will work from a different folder as well.
Below is a copy of the AHK Script. I modified Howard Casto's original version, and am by no means an expert on AHK, but I have added ToolTips in case you are curious what is going on. Right-click on the script and select "Edit" to modify it. Red entries are modified from the original script and MUST be changed for the script to work. Blue entries only need to be changed in some special circumstances, see the ToolTips for information. Black entries are unchanged defaults and should be left alone, unless you are very familiar with AHK:
The script above works as follows:
Discussion Points - See Method 4, following both scripts for discussion points on the AHK script and MAME oddities.
Okay, at this point,
you should have the script properly configured. Now let's try it out!
BATCHFILE SETUP AND TESTING
NOTE: The following suggestions are optimized for EmuLoader 4.7 (and up). EmuLoader 4.7 has very robust batch file support. It will run the default.bat file first, but it will also search the directory for any <gamename.bat> file and run that instead. So for example, if you wanted to use an older version of MAME for Battlezone, you would simply copy the default.bat file and rename it as bzone.bat, then edit the file to point to the older MAME version. MAMEwah will work with a default.bat file, but would be just as happy with a mame.bat file in the MAME directory, or just calling the AHK Script directly prior to launching MAME, but I will get to that later. . .
Create a
new folder, recommended C:\mamebat. Open notepad, copy the
text below (aqua background), paste and modify as required (see
ToolTips), and save as a text file named default.bat.
NOTE: This was a simplified example for maximum compatibility. It is not required to do so, but if your frontend can pass cloneof and driver data to the batch file, you could modify line 5 above (start Johnny5.ahk %1) to read:
To test the batch file, right-click on the C:\mamebat folder and select "Open Command Prompt" (or otherwise open a command prompt at the C:\mamebat prompt) and type default followed by a working rom name and press enter. MAME should launch normally. When you press Pause and press any of the launch keys, Johnny5 should pop up with the correct information for the current game. Pressing any launch key again or Escape should return you to MAME. Pressing Escape should exit MAME. You should not see any viewer windows or the AHK icon in the status bar after you exit.
If the batch file does not work properly, I recommend a systematic approach to troubleshooting:
EMULOADER INTEGRATION
Launch EmuLoader (4.7 or above). Text shown is for 4.7.4.
From the taskbar, select Advanced User>Alternate Batch Files. Ensure the MAME tab is selected, and click the enabled checkbox. Click the icon following default file and navigate to C:\mamebat\default.bat (if you followed the example) and click "open." EmuLoader can pass the Name, cloneof, and driver parameters for use with Johnny5. I recommend using these and modifying the batch file to accept them as shown above. Select the default parameters button and they will be added. Alternately, you can delete cloneof and driver and only pass name and the script should still work. You can also add or remove other parameters as desired. Next, from the taskbar, select the File>Preferences>General>Games tab and click "Use Custom Options by default." Finally, if you want to hide the annoying Command Prompt Window, select the File>Preferences>General>Advanced User tab, under the "MS-DOS Box State" option, select either "Hidden (not recommended)" or "Minimized".
You
can also set Alternate Batch File settings for Zinc, Daphne, AgeMAME,
or PinMAME if you want to use custom batch files with these emulators.
That
should do it, and EmuLoader should now launch the AHK
script prior to
launching a game.
MAMEWAH INTEGRATION
Unfortunately,
I am not
very familiar with MAMEwah. I have set it up and used it
previously, but it is not my frontend of choice (no offense to it or
MinWah), so I am not very familiar with it. I have consulted
with
MinWah on these settings and have personally verified they work, as
described using Versions 1.61 and 1.62B5. I will post file
names
and settings for these versions. BTW, if you are
also new to MAMEwah, I found this
guide
very useful in getting it working. (You might also want to
review the support files at Jcrouse's site.)
NOTE: Ensure that you don't have any trailing spaces after the entries above or the viewer may fail to launch.
OTHER FRONTENDS
Unfortunately, I don't have much info on setup with other frontends.
CONCLUSION
Well, that's about all I have to say. Hopefully this page was helpful for you. If you see anything major that I got wrong, know of a better way to do this, or if you just can't get it to work, shoot me an E-mail and I will either fix the page or try to help you out.