win32: properly use background input flag on emulator bootup

This commit is contained in:
zeromus 2009-11-20 15:45:55 +00:00
parent 3fd7c05579
commit b145ac8b67
3 changed files with 7 additions and 14 deletions

View File

@ -32,6 +32,7 @@ static GUID JoyGUID[MAX_JOYSTICKS];
static int numjoysticks = 0;
static int HavePolled[MAX_JOYSTICKS];
static int background = 0;
static DIJOYSTATE2 StatusSave[MAX_JOYSTICKS];
static int FindByGUID(GUID how)
@ -374,7 +375,7 @@ static BOOL CALLBACK JoystickFound(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
return(DIENUM_CONTINUE);
}
if(DI_OK != IDirectInputDevice7_SetCooperativeLevel(Joysticks[n],*(HWND *)pvRef, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))
if(DI_OK != IDirectInputDevice7_SetCooperativeLevel(Joysticks[n],*(HWND *)pvRef, (background?DISCL_BACKGROUND:DISCL_FOREGROUND)|DISCL_NONEXCLUSIVE))
{
FCEU_printf("Cooperative level set of a joystick failed during init.\n");
IDirectInputDevice7_Release(Joysticks[n]);
@ -412,16 +413,6 @@ int InitJoysticks(HWND hwnd)
return(1);
}
void SetJoystickBackgroundAccess(int background)
{
}
static int background = 0;
static bool curr = false;

View File

@ -25,7 +25,7 @@
#include "keyboard.h"
static HRESULT ddrval; //mbg merge 7/17/06 made static
static int background = 0;
static LPDIRECTINPUTDEVICE7 lpdid=0;
void KeyboardClose(void)
@ -146,7 +146,7 @@ int KeyboardInitialize(void)
return 0;
}
ddrval=IDirectInputDevice7_SetCooperativeLevel(lpdid, hAppWnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
ddrval=IDirectInputDevice7_SetCooperativeLevel(lpdid, hAppWnd,(background?DISCL_BACKGROUND:DISCL_FOREGROUND)|DISCL_NONEXCLUSIVE);
if(ddrval != DI_OK)
{
FCEUD_PrintError("DirectInput: Error setting keyboard cooperative level.");
@ -181,7 +181,6 @@ int KeyboardInitialize(void)
return 1;
}
static int background = 0;
static bool curr = false;

View File

@ -638,6 +638,9 @@ int main(int argc,char *argv[])
pauseAfterPlayback = !!pauseAfterPlayback;
EnableBackgroundInput = !!EnableBackgroundInput;
KeyboardSetBackgroundAccess(EnableBackgroundInput!=0);
JoystickSetBackgroundAccess(EnableBackgroundInput!=0);
FCEUI_SetSoundVolume(soundvolume);
FCEUI_SetSoundQuality(soundquality);
FCEUI_SetTriangleVolume(soundTrianglevol);