SDL_JoystickOpen() error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SDL_JoystickOpen() error

Ed Phillips
Hello,

I'm getting the following when trying to open a joystick that is DINPUT
using SDL 2.0.4 on Windows:

"IDirectInputDevice8::SetCooperativeLevel() DirectX error 0xx"

Any ideas why I'd be getting this kind of failure?  SDL is init'd and
XINPUT joysticks seem to be working fine when I get this error, so it must
be something specific to DINPUT.

The error code is botched.  It likely has something to do with this code
in SDL_dinputjoystick.c:

/* Convert a DirectInput return code to a text message */
static int
SetDIerror(const char *function, HRESULT code)
{
     /*
     return SDL_SetError("%s() [%s]: %s", function,
     DXGetErrorString9A(code), DXGetErrorDescription9A(code));
     */
     return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
}

It looks like SDL_SetError() doesn't actually handle the "l", and as I
understand it, HRESULT is 32-bit anyway... so that probably explains why
I'm not seeing the actual error code from DINPUT.

  Ed

Ed Phillips <[hidden email]> University of Delaware (302) 831-6082
Systems Programmer IV, Network and Systems Services
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|

Re: SDL_JoystickOpen() error

Ed Phillips
Oddly enough, this problem is not occurring with 2.0.5.  However, the code
in the SDL_SetError call (formatting spec "0x%8.8lx") looks to still be
there and needs fixing so the error codes show up correctly.

On Mon, 19 Dec 2016, Ed Phillips wrote:

> Hello,
>
> I'm getting the following when trying to open a joystick that is DINPUT using
> SDL 2.0.4 on Windows:
>
> "IDirectInputDevice8::SetCooperativeLevel() DirectX error 0xx"
>
> Any ideas why I'd be getting this kind of failure?  SDL is init'd and XINPUT
> joysticks seem to be working fine when I get this error, so it must be
> something specific to DINPUT.
>
> The error code is botched.  It likely has something to do with this code in
> SDL_dinputjoystick.c:
>
> /* Convert a DirectInput return code to a text message */
> static int
> SetDIerror(const char *function, HRESULT code)
> {
>    /*
>    return SDL_SetError("%s() [%s]: %s", function,
>    DXGetErrorString9A(code), DXGetErrorDescription9A(code));
>    */
>    return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);
> }
>
> It looks like SDL_SetError() doesn't actually handle the "l", and as I
> understand it, HRESULT is 32-bit anyway... so that probably explains why I'm
> not seeing the actual error code from DINPUT.
>
> Ed
>
> Ed Phillips <[hidden email]> University of Delaware (302) 831-6082
> Systems Programmer IV, Network and Systems Services
>

Ed Phillips <[hidden email]> University of Delaware (302) 831-6082
Systems Programmer IV, Network and Systems Services
_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org