locked
Moving mouse in games with 360 controller win32 sendinput RRS feed

  • Question

  • I am making a program similar to XPadder but for the 360 controller only. I am using win32 and Xinput as well as sendinput for my input. here is my code.

    if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)	{		
    
    GetCursorPos(&mousepos);	
    
    mousepos.x += _controllerState.Gamepad.sThumbRX / 7000;
    mousepos.y += 1;								
    profile->Buttons[6]->input.type = INPUT_MOUSE;	
    profile->Buttons[6]->input.mi.dwExtraInfo = GetMessageExtraInfo();	
    
    profile->Buttons[6]->input.mi.time = 0;	
    profile->Buttons[6]->input.mi.dwFlags =  MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE ;
    
    profile->Buttons[6]->input.mi.mouseData = 0;	
    profile->Buttons[6]->input.mi.dx = mousepos.x * (65535.0f / GetSystemMetrics(SM_CXSCREEN));
    
    profile->Buttons[6]->input.mi.dy = mousepos.y * (65535.0f / GetSystemMetrics(SM_CYSCREEN));			
    	
    SendInput(1, &profile->Buttons[6]->input, sizeof(INPUT));					}

    this works to move the mouse for most games but some like stalker games and q.u.b.e the mouse movement is funny its basically like playing a game with really high mouse sensitivity.

    Monday, August 12, 2013 6:05 PM

Answers