MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

joeisen
MAME dev newbie
Reged: 03/09/10
Posts: 7
Send PM
Forcing MAME to maintain keyboard input, even when it's not in the foreground.
03/18/10 08:28 PM


Before I start, you should know that I have input.c set to force DirectInput. Raw was not working with my custom onscreen game controller device.

For a variety of reasons I need to have MAME maintain keyboard input, even when it is not the foreground window.

If you look at this code in osd/windows/input.c.

Code:


//============================================================
// device_list_poll_devices
//============================================================

static void device_list_poll_devices(device_info *devlist_head)
{
device_info *curdev;

for (curdev = devlist_head; curdev != NULL; curdev = curdev->next)
{
if (curdev->poll != NULL)
{
(*curdev->poll)(curdev);
}
}
}



When MAME is in the foreground, it enters into the for loop. When MAME is not the foreground window it never enters the for loop.

My first guess was that DirectInput was causing this behavior by automatically unacquiring the keyboard when the window losses focus. To test this theory I changed the cooperative level of DirectInput to DISCL_BACKGROUND | DISCL_NONEXCLUSIVE. (It is set to DISCL_FOREGROUND in the original source). According to the SDK this should allow it to access device input, even when it is not in the foreground.

That didn’t do it unfortunately, and it continues to not enter into the for loop which I’m guessing means that it does not have access to the keyboard input.

I’ve spent a good deal of time walking through the source trying to determine when keyboard_list (which is the device_info struct that is passed to this routine) loses it’s connection to the keyboard data but I can’t seem to locate it.

Does anyone out there have any thoughts on how to accomplish this? Am I on the right track?







Entire thread
Subject Posted by Posted on
* Forcing MAME to maintain keyboard input, even when it's not in the foreground. joeisen 03/18/10 08:28 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 17 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2770