diff --git a/src/drivers/win/joystick.cpp b/src/drivers/win/joystick.cpp index df75f999..8983cb50 100644 --- a/src/drivers/win/joystick.cpp +++ b/src/drivers/win/joystick.cpp @@ -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; diff --git a/src/drivers/win/keyboard.cpp b/src/drivers/win/keyboard.cpp index 1f984f70..90187b43 100644 --- a/src/drivers/win/keyboard.cpp +++ b/src/drivers/win/keyboard.cpp @@ -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; diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index cce5f30f..5408a69f 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -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);