We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 675

Summary: c_dfDIMouse and friends defined incorrectly, fail on 64-bit Windows
Product: SDL Reporter: maf6
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.13   
Hardware: x86   
OS: Windows Vista   

Description maf6 2009-01-10 14:07:52 UTC
Assuming the SDL project doesn't just want to pick these up from dinput8.lib or whatever instead, the definitions in SDL_dx5video.c should be:

const DIDATAFORMAT c_dfDIKeyboard = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 256, 256, KBD_fmt };
const DIDATAFORMAT c_dfDIMouse = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000002, 16, 7, PTR_fmt };
const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000001, 80, 44, JOY_fmt };

This way the call to IDirectInputDevice2_SetDataFormat in SDL_dx5events.c will succeed on x64.

Thanks.
Comment 1 Sam Lantinga 2009-01-10 16:16:11 UTC
Thanks, I'm a little confused.  The bug is listed for SDL 1.3.0, but SDL_dx5video.c doesn't exist in 1.3.  In SDL 1.2 in subversion there are no definitions for c_df*

What's the actual problem you're fixing?
Comment 2 maf6 2009-01-10 16:52:05 UTC
Sorry for the lack of clarity.  Let me try again.  :-)

I'm using the 1.2.13 sources, downloaded from http://www.libsdl.org/download-1.2.php.  I've updated the bug's version field to that effect.

What I'm trying to do is use SDL for Windows x64 in a build of the openmsx emulator.  I noticed SDL has different video drivers on Win32 (windibs and directx), and I decided to enable the latter in openmsx.

The problem I'm trying to fix is that with the x64 compilation, SDL's calls to IDirectInputDevice2_SetDataFormat fails with E_INVALIDARG because the size fields in the c_df* structures aren't set correctly.  Hence my report and suggested patch.
Comment 3 Sam Lantinga 2009-04-13 01:50:07 UTC
This fix was submitted with revision 4486.

Thanks!