But what about the mame double lightgun action? Lets fix that right now. First, download the sdlmame-source. I used SDLMame 0.135u1 but later versions probably work too. Download and extract, and then apply my wii-mote-enabling hack patch on it:
cd sdlmame0135u1; patch -p1 < wiimote-sdlmame0134u2.diff
Compile and install sdlmame as you usually would. (See the Internet for howto's and requirements.) After you've got your default Mame running and can play the standard joystick-based games, go and edit your mame.ini. Look for these lines:
lightgun_index1 auto lightgun_index2 auto
Change them to the following (or add the following two lines to mame.ini if you didn't find the previous 2 lines). This passes the names of the X input devices to use to the patch.
lightgun_index1 WiiMote0 lightgun_index2 WiiMote1
Make sure to enable the lightguns and to disable joysticks (or else the accel meter will interfere with the optical sensor) too, and make sure the wiimote actually acts as a lightgun, and that its mouse function isn't picked up accidentally. Find and change the values of these lines to the indicated ones:
joystick 0 lightgun 1 [...] lightgun_device lightgun mouse_device lightgun
Now your lightgun should be detected. You can now run mame on a game which uses lightguns. First, configure the inputs: you need to select lightgun AD X/Y and wiggle your WiiMote horizontally and vertically at the screen, respectively. If the game does react but your shots are off, you may have to go into the games service mode to calibrate the lightguns.
(If hacking the ini-file looks too difficult, you can download my version too, if you want. You'll still have to modify the paths to the roms etc though.)