The Dragon King
Mame Hooker Sniping Tutorial 
About Mame Hooker Overview:

There are hundreds upon hundreds of games in mame that support outputs and no real way to know which ones do. Fortunately mamehooker is designed to help you with this. Assuming you have mamehooker setup like described in the setup tutorial, you can simply play mame games normally and mamehooker will let you know when a game has outputs. Assuming you have a keyboard and mouse handy, you can assign outputs as you play.

For this tutorial let us assume that you have launched digdug, a game known to have outputs, from your front-end of choice.

After digdug goes through it's startup routine, assuming you have mamehooker setup as suggested you are going to hear a "ping!" sound. If you have text to speech enabled mamehooker will utter the Phrase "New outputs detected.... led 0 ....led 1" This is our cue! Press left alt+enter on your keyboard to put mame in windowed mode and click mamehooker in the taskbar to bring up the debug window.

Note the date displayed in the debug window.... we've got mame's current status, followed by some rom information, followed by the actual output section. Right now both led0 and led1 are showing a value of 0 (off) so it is hard to determine what they actually are.

If you insert a coin, however led0 will start to blink.. if you insert an additional coin, led1 will also blink. This tells us that led0 and led1 are the outputs for the player 1 and player 2 start lights.

We should probably hook those up to something! In this example we will assume that you have a ledwiz with start button leds hooked up to the first two pins on the device.

You'll want to click "Script Editor/Edit INI For Current Rom" from the menu.

At this point the script editor will open up and you will be presented with a text file that looks something like this:

Note the General and Keystates sections... they will be covered in other tutorials. For now, move the cursor to led0 and click "Add/Command" in the menu.

Now the function selector window will pop up. This is the same exact window that popped up when you tested your devices in the setup tutorial so I'll skim over this. Simply select the "LedWiz Set Pin State" from the drop-down box and click "Ok" You will be presented with the following options:

Led0 controls the player 1 start lamp, and in our example the start led on our mame cabinet is hooked up to pin 1 on our ledwiz. Since we only have one ledwiz, the device number is also 1, so the first two boxes are left as-is. Note the last box though. We have the option of hard coding it to "on" or "off" but that is only useful for state-unique scripts, which will be covered later. For our purposes, we want to leave it set to the special "Output" setting which automatically sets the value of the pin to the value of the output in mame. Anyway, click "Done" and you will be sent back to the script editor.

Note the new text in blue. This is the actual command mamehooker will run everytime that output changes in mame. The function tool helps you write these commands, but you can always do it manually. Anyway, we've setup the player 1 start lamp but not player 2. Move the cursor to led1 and run the function tool again, only this time set the pin # to 2 so it'll control the led connected to pin 2 on the ledwiz.

Now that we have both outputs assigned to a function, so ahead and click "File/Save"

You will be presented with a warning about restarting and then be dumped back to the debug menu. Your ledwiz outputs should immediately start working. Go ahead and minimize mamehooker, click on digdug and press leftalt+enter again to go back to fullscreen.

You have succesfully hooked up the outputs on digdug!

Check out other tutorials for more specific examples and advanced usage.