Hey all - I'm hoping someone might be able to shed some light on a problem I'm having with mame output messages and MaLa - this is a software development issue. Here's the story...
I recently added support for headkaze's MameInteropSDK (mame.dll) to the MaLa LEDBlinky plugin. This allows the plugin to respond when mame is paused and also to light LEDs based on mame output messages - similar to the ledutil app. For development testing I use my MaLa stub app run the plugin and launch mame. Swindus has provided me with the code he uses to launch mame, so I think (hope) that my stub app and MaLa both do the same thing.
Ok, back when I was coding the output message features into LEDBlinky, I was mostly focused on the pause message which I fully tested with both my test stub and MaLa on my mame cab. For the other output messages (LED0, LED1, LAMP0, LAMP1, etc) I only qa'd with my test stub - mistake, DOH!
So, it turns out that something is not quite right when I run LEDBlinky from MaLa - there's some sort of timing problem with the output messages coming from mame. This is what happens; for testing purposes, I was using Asteroids which like many games flashes the start buttons when credits are available using the LED0 and LED1 messages. When running from my test stub, LED0 will blink on/off/on/off about every second - with approximately a 250ms delay between messages.
LED0 on
250ms delay
LED0 off
250ms delay
LED0 on
250ms delay
LED0 off
250ms delay
repeat
But, when running the same code from MaLa, LED0 will blink on/off/on/off about every 10ms and then there's a 1 second delay until the next message burst.
LED0 on
10ms delay
LED0 off
10ms delay
LED0 on
10ms delay
LED0 off
1000ms delay
repeat
With a 10ms delay between messages, the LED code can't keep up and the LEDs end up blinking very sporadically. So that's the problem. I've done some additional testing using ledutil and headkazes's output message test app - as long as the code is launched external to MaLa, it works fine.
I'm wondering if this is some sort of threading issue, but I don't think MaLa uses multiple threads. If anyone has thoughts on how to resolve this - the help would be greatly appreciated!!!
Thanks,
arzoo