I'm wondering if someone could be kind enough to explain what's going on for the X_INPUT_GET_STATE #define and typedef.
I understand the purpose of the code, I'm just not getting the why. I'm trying really grill all this code into my head.
1 2 3 4 5 6 7 8 | #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_ |
The first line I understand, we're just 'mapping' X_INPUT_... to call the Windows function, but what are the name attributes doing here?
The second line I think is a function pointer? The function definition from line 3 is throwing me off completely.
I don't understand how XInputGetStateStub can be assigned to *XInputGetState_, infact I can't see how it can actually be anything at all?
I understand the final #define.
Sorry if I'm asking a lot but I'm banging my head against a wall here.
thanks.