The last time I tried it it worked pretty well. I'll have to get out my old LED rig and see what I can get it to do in respects to mame.
I just realized something. You don't need ot do anything to the drivers, except possibly add more set_led_status calls.
Now, with set_led_status and osd_set_leds the state is an int. Meaning it is 32bits, hence being able to handle 32 leds, but parallel port can only handle 8.
set_led_status just ands or nots a bitmast (led_status) where each bit represents the state of a led. osd_set_leds, which is OS dependent as it is implemented in the OS folder, gets called each video_and_audio_update to update the leds. It only looks at the first three bits.
So in the case of warlords (centiped.c)
static WRITE8_HANDLER( led_w )
{
set_led_status(offset, ~data & 0x80);
}
The handler takes whatever offset and applies the bit at 0x80 at that memory location. Note this is a generic handlers that all games in that driver use.
Not that it matters to most people but the memory location of led status for warlords is
AM_RANGE(0x1c03, 0x1c06) AM_WRITE(led_w)
Anyway, an offset of 3 does get set (remember 0 is led 1, 1 is led 2, 2 is led3, and 3 is led4). But since osd_set_leds only looks at the first three to output to keyoard it gets ignored.
So, someone would just have to put code in osd_set_leds to handle taking the led state and outputting it to the parallel port. And make sure all the driver set all the leds, some only deal with three even though they have more. Though it probably would be better if on a per game basis (which can be done with something like ctrlr files) to dictate which pin on the parallel port is going to be used for which led in the game. And have a command line option to enable the support. If that happened it might get into mame for the windows port since it would be OS dependant. Heck, the keyboard leds are OS/keyboard type dependant. In the windows code for the keyboard leds it needs to know if the keyboard is ps/2 or usb.
The biggest thing is the stuff sirp was talking about. IE the headers required to get inp and outp to work in mingw.
Right, in mame source just need precompiler if defines to determine if the port opener is needed or not. Would have to create an outp function for each platform, powerpc, x86, etc... The code I found was for x86. So it would work for any x86 machine no matter what the OS is.
But I am sure the led driver people have figured all this out already.
However, that porttalk might not work. Well, it will. Ok, let me explain.
It will definately work if oyu use it to open the ports before running mame. Though this is the less than ideal solution. It does provide an interface to use it in code. However, the question is if mingw supports the functions it uses. It looks like it just uses CreateFile, which mingw has implemented. So it could possible work just by adding the the .sys and .c file.
Now, this is what would cause this to not officially be added to mame. However, it might be possible to look at the source of porttalk and figure out how it is being done, and possibly add that directly in mame and not need the .sys driver. But that's going to take alot of work and I don;t see it happening
