I have written the following but when I have dwUserIndex as 0,1,2,3 or any number, doesn't really matter, it always returns ERROR_BAD_ARGUMENTS.
DWORD XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) { FIXME("Stub - Controller: %d \n", dwUserIndex);
if (dwUserIndex >= 0 && dwUserIndex < 4) { return ERROR_DEVICE_NOT_CONNECTED; /* If controller is connected return ERROR_SUCCESS */ } return ERROR_BAD_ARGUMENTS; }
Hi Andrew,
I have written the following but when I have dwUserIndex as 0,1,2,3 or any number, doesn't really matter, it always returns ERROR_BAD_ARGUMENTS.
Not sure why it's not returning ERROR_DEVICE_NOT_CONNECTED for you. I'll just point out:
DWORD XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) { FIXME("Stub - Controller: %d \n", dwUserIndex);
if (dwUserIndex >= 0 && dwUserIndex < 4) { return ERROR_DEVICE_NOT_CONNECTED;
The first part of this is always true, since DWORD is unsigned. You can write this more simply as: if (dwUserIndex < 4) { ... }
--Juan
Thanks Juan. It's fixed now.
On Sat, Oct 25, 2008 at 5:13 PM, Juan Lang juan.lang@gmail.com wrote:
Hi Andrew,
I have written the following but when I have dwUserIndex as 0,1,2,3 or any number, doesn't really matter, it always returns ERROR_BAD_ARGUMENTS.
Not sure why it's not returning ERROR_DEVICE_NOT_CONNECTED for you. I'll just point out:
DWORD XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState) { FIXME("Stub - Controller: %d \n", dwUserIndex);
if (dwUserIndex >= 0 && dwUserIndex < 4) { return ERROR_DEVICE_NOT_CONNECTED;
The first part of this is always true, since DWORD is unsigned. You can write this more simply as: if (dwUserIndex < 4) { ... }
--Juan
-----Original Message----- From: wine-devel-bounces@winehq.org [mailto:wine-devel- bounces@winehq.org] On Behalf Of Andrew Fenn Sent: Saturday, October 25, 2008 6:43 PM To: Juan Lang Cc: wine-devel@winehq.org Subject: Re: DWORD help
Thanks Juan. It's fixed now.
Are you sure? If the calling convention is wrong(as suggested in my other mail), the result could be random depending on what happens to be on the stack or the registers.
Yes, it was a combination of a simple mistake and not compiling wine again before issuing the make test.
I very much doubt it's a failing of wine, anyway I have posted the patches in my other thread about xinput if you still think there's a problem with wine.
Regards, Andrew
On Sat, Oct 25, 2008 at 4:54 PM, Stefan Dösinger stefan@codeweavers.com wrote:
-----Original Message----- From: wine-devel-bounces@winehq.org [mailto:wine-devel- bounces@winehq.org] On Behalf Of Andrew Fenn Sent: Saturday, October 25, 2008 6:43 PM To: Juan Lang Cc: wine-devel@winehq.org Subject: Re: DWORD help
Thanks Juan. It's fixed now.
Are you sure? If the calling convention is wrong(as suggested in my other mail), the result could be random depending on what happens to be on the stack or the registers.
I have written the following but when I have dwUserIndex as 0,1,2,3
or
any number, doesn't really matter, it always returns ERROR_BAD_ARGUMENTS.
Not sure why it's not returning ERROR_DEVICE_NOT_CONNECTED for you. I'll just point out:
Probably the calling convention is wrong. Usually Windows API functions have to be declared like this:
DWORD WINAPI XInputGetState(DWORD dwUserIndex, XINPUT_STATE* pState);
The difference is (among others) that the first parameter is passed in the ECX register instead of the stack
2008/10/25 Stefan Dösinger stefan@codeweavers.com:
The difference is (among others) that the first parameter is passed in the ECX register instead of the stack
No, that would be thiscall. The main difference between stdcall and cdecl is who's responsible for popping arguments from the stack (callee vs. caller). Getting the calling convention wrong would screw up the stack after the call, but the call itself would still get the right parameters. Besides, you would notice the wrong value in the FIXME.