Hi all,
I'm trying/failing to do a bit of C++.
My project is to inject a DLL into XInput to emulate xbox controllers via a mouse.
I'm hopefully going to allow the user to connect up to 4 virtual xbox controllers, and switch between them using F1/F2/F3/F4, and the 'controller' will then be controlled via a mouse/keyboard.
Ideally I'd have done this in a language I know - C# or something. But to inject a DLL into xInput it seems I need to use C++.
Fortunately I've found a bit of code that's doing just this. But, compiling it seems to give me a few errors and I can't for the life of me work out whats causing it.
Here is an example of some of the code that's not compiling:
c++ code:
DWORD WINAPI XInputGetBatteryInformation
(
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
BYTE devType, // [in] Which device on this user index
XINPUT_BATTERY_INFORMATION* pBatteryInformation // [out] Contains the level and types of batteries
)
{
if(!GamepadMapping[dwUserIndex].enabled) return ERROR_DEVICE_NOT_CONNECTED;
// Report a wired controller
pBatteryInformation->BatteryType = BATTERY_TYPE_WIRED;
return ERROR_SUCCESS;
}
It's reporting that XINPUT_BATTERY_INFORMATION is undefined - but I'm confused because if I "go to definition" for that, it takes me to the XInput.h file within the XInput library - seems quite defined to me?
I've also tried explicitly including "XInput.h" at the top of this file and still no luck.
I know it's a long shot, but maybe someone can point me in the right direction? I'm using VS11 Beta.