1 | if(XInputGetState(ControllerIndex, &ControllerState) == ERROR_SUCCESS) |
1 | identifier "XInputGetState" is undefined" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #define X_INPUT_GET_STATE(name) DWORD WINAPI name(DWORD dwUserIndex, XINPUT_STATE *pState) typedef X_INPUT_GET_STATE(x_input_get_state); X_INPUT_GET_STATE(XInputGetStateStub) { return(ERROR_DEVICE_NOT_CONNECTED); } global_variable x_input_get_state *XInputGetState_ = XInputGetStateStub; #define XInputGetState XInputGetState_ internal void Win32LoadXInput(void) { HMODULE XInputLibrary = LoadLibraryA("xinput1_4.dll"); if(!XInputLibrary) { XInputLibrary = LoadLibraryA("xinput1_3.ll"); } if(XInputLibrary) { XInputGetState = (x_input_get_state *)GetProcAddress(XInputLibrary, "XInputGetState"); XInputSetState = (x_input_set_state *)GetProcAddress(XInputLibrary, "XInputSetState"); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | internal void Win32LoadXInput(void) { // TODO(casey): Test this on Windows 8 HMODULE XInputLibrary = LoadLibraryA("xinput1_4.dll"); if(!XInputLibrary) { // TODO(casey): Diagnostic XInputLibrary = LoadLibraryA("xinput9_1_0.dll"); } if(!XInputLibrary) { // TODO(casey): Diagnostic XInputLibrary = LoadLibraryA("xinput1_3.dll"); } if(XInputLibrary) { XInputGetState = (x_input_get_state *)GetProcAddress(XInputLibrary, "XInputGetState"); if(!XInputGetState) {XInputGetState = XInputGetStateStub;} XInputSetState = (x_input_set_state *)GetProcAddress(XInputLibrary, "XInputSetState"); if(!XInputSetState) {XInputSetState = XInputSetStateStub;} // TODO(casey): Diagnostic } else { // TODO(casey): Diagnostic } } |
mmozeiko
What value it actually returns? Assign to local variable to see its value.
mrmixer
Put a breakpoint on each LoadLiraryA call to see if XInputLibrary gets a correct value (not 0)