Direct *INPUT* doesn't work on Nvidia cards

Started by
4 comments, last by theZapper 19 years, 2 months ago
I know this is a bit strange because Direct Input shouldn't be related to video cards, but when I try to run my game on a PC with an Nvidia card it crashes when trying to aquire the mouse. It works on these setups: ATI 9800 pro, DirectX 9; ATI X300, DirectX 9; Some rubbish unknown IBM card, DirectX 8; But not on these: GeForce FX 5200 128mb (desktop), DirectX 9; GeForce FX 5200 64mb (laptop), DirectX 9; Quadro4 XGL 380, DirectX 8; Can anyone tell me if they have encountered this stupid problem before. Thanks.
---When I'm in command, every mission's a suicide mission!
Advertisement
Do you have any more information? I'm using nVidia FX 5500, and everything is fine here...
Do ALL games using direct input crash on that system? Its quite possibly you have a bug in your code that you need to fix. Also try running dxdiag

try installing the latest mouse drivers or uninstalling the drivers you have and reinstalling the microsoft ones. (yes mice have drivers, in fact its almost always a good idea to use the manufacturer drivers instead of microsofts when using logitech mice).

Also try updating the video drivers to the latest ones.

Its quite possible a conflict of drivers or a bug that just dont crop up on your other pcs for whatever reason.

does dxdiag crash or show any problems when you run that?
Other games are working fine. I did a but of debugging today and actually found that the keyboard is failing too. I step through the code and have valid pointers to everything but the "Aquire" function fails and always returns E_ACCESSDENIED, this is my setup code:

HRESULT err;	// first create base DirectInput interface	if FAILED(DirectInput8Create(mainInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi8, NULL))		strcpy(errorMessage, "Failed");	// Create devices: Keyboard	if FAILED(lpdi8->CreateDevice(GUID_SysKeyboard, &lpKeyboard, NULL))		strcpy(errorMessage, "Failed");	if FAILED(lpKeyboard->SetDataFormat(&c_dfDIKeyboard))		strcpy(errorMessage, "Failed");	if FAILED(lpKeyboard->SetCooperativeLevel(mainWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE))		strcpy(errorMessage, "Failed");	if (lpKeyboard) 		err = lpKeyboard->Acquire();	// Mouse	if FAILED(lpdi8->CreateDevice(GUID_SysMouse, &lpMouse, NULL))		strcpy(errorMessage, "Failed");	if FAILED(lpMouse->SetDataFormat(&c_dfDIMouse2))		strcpy(errorMessage, "Failed");	if FAILED(lpMouse->SetCooperativeLevel(mainWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE))			strcpy(errorMessage, "Failed");		if (lpMouse) 		err = lpMouse->Acquire();
---When I'm in command, every mission's a suicide mission!
DIERR_OTHERAPPHASPRIO Another application has a higher priority level, preventing this call from succeeding. This value is equal to the E_ACCESSDENIED standard COM return value. This error can be returned when an application has only foreground access to a device but is attempting to acquire the device while in the background. 

IE: If you are using your debugger then it should be in the foreground and your application in the background, which would explain it failing.

What does your Update() function to your mouse and keyboard class look like? It should look something like this.
	bool cMouse::tryUpdate()	{		return SUCCEEDED(mouse->GetDeviceState(sizeof(m_pmousestate),(LPVOID)&m_pmousestate));	};	bool cMouse::Update()	{		if(mouse == NULL)			return false;		if(tryUpdate() == false){			mouse->Acquire();            if(tryUpdate() == false)				return false;		}		return true;	};
int CinputSystem::getInput(void){	// Get mouse state	HRESULT err1 = lpMouse->Acquire();		if FAILED(lpMouse->GetDeviceState(sizeof(DIMOUSESTATE2), (LPVOID)&MouseState))	{		return 1;	}	else	{		angle.y = (float)MouseState.lX / 10.0f; // round wrong way because of 2d to 3d mapping		angle.x = (float)MouseState.lY / 10.0f;		mouseButtons[0] = MouseState.rgbButtons[0];		mouseButtons[1] = MouseState.rgbButtons[1];		mouseButtons[2] = MouseState.rgbButtons[2];		mouseButtons[3] = MouseState.rgbButtons[3];	}	// Get keyboard state	HRESULT err2 = lpKeyboard->Acquire();	if FAILED(lpKeyboard->GetDeviceState(256, &keyboardKeys))	{		return 2;	}	return CONTINUE_APP;}
---When I'm in command, every mission's a suicide mission!

This topic is closed to new replies.

Advertisement