Fix the DirectInput breakage on Win64.

It was caused by the definition of c_dfDIJoystick using literal 24 and 16 values in place of sizeof(DIDATAFORMAT) and sizeof(DIOBJECTDATAFORMAT), which include pointers. On 64-bit, the values end up being 32 and 24, causing a discrepancy in which DIERR_INVALIDPARAM was thrown.

1b1e05db06/diffs

git-svn-id: https://svn.eduke32.com/eduke32@3300 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2012-12-16 05:46:20 +00:00
parent 0f690797f5
commit bb46b57d89
4 changed files with 26 additions and 22 deletions

View File

@ -28,6 +28,10 @@ libdxguid.a : dxguid.o
ar -r libdxguid.a dxguid.o
ranlib libdxguid.a
libdinput_custom.a : dinput.o
ar r libdinput_custom.a dinput.o
ranlib libdinput_custom.a
libdinput8.a : dinput8.def dinput.o
dlltool -k --output-lib libdinput8.a --def dinput8.def
ar r libdinput8.a dinput.o

View File

@ -1,7 +1,7 @@
#include <dinput.h>
/* This is a replacement for parts of dinput.lib. */
const DIOBJECTDATAFORMAT rgodf_c_dfDIKeyboard[] = {
DIOBJECTDATAFORMAT rgodf_c_dfDIKeyboard[] = {
{&GUID_Key, 0, -2147483636, 0},
{&GUID_Key, 1, -2147483380, 0},
{&GUID_Key, 2, -2147483124, 0},
@ -260,14 +260,14 @@ const DIOBJECTDATAFORMAT rgodf_c_dfDIKeyboard[] = {
{&GUID_Key, 255, -2147418356, 0}
};
const DIDATAFORMAT c_dfDIKeyboard = {24,
16,
2,
const DIDATAFORMAT c_dfDIKeyboard = {sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
0x00000002,
256,
256,
&rgodf_c_dfDIKeyboard[0]};
const DIOBJECTDATAFORMAT rgodf_c_dfDIMouse[] = {
DIOBJECTDATAFORMAT rgodf_c_dfDIMouse[] = {
{&GUID_XAxis, 0, 16776963, 0},
{&GUID_YAxis, 4, 16776963, 0},
{&GUID_ZAxis, 8, -2130706685, 0},
@ -275,14 +275,14 @@ const DIOBJECTDATAFORMAT rgodf_c_dfDIMouse[] = {
{0, 13, 16776972, 0},
{0, 14, -2130706676, 0},
{0, 15, -2130706676, 0}};
const DIDATAFORMAT c_dfDIMouse = {24,
16,
2,
const DIDATAFORMAT c_dfDIMouse = {sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
0x00000002,
16,
7,
rgodf_c_dfDIMouse};
const DIOBJECTDATAFORMAT rgodf_c_dfDIMouse2[] = {
DIOBJECTDATAFORMAT rgodf_c_dfDIMouse2[] = {
{&GUID_XAxis, 0, 16776963, 0},
{&GUID_YAxis, 4, 16776963, 0},
{&GUID_ZAxis, 8, -2130706685, 0},
@ -294,14 +294,14 @@ const DIOBJECTDATAFORMAT rgodf_c_dfDIMouse2[] = {
{0, 17, -2130706676, 0},
{0, 18, -2130706676,0},
{0, 19, -2130706676, 0}};
const DIDATAFORMAT c_dfDIMouse2 = {24,
16,
2,
const DIDATAFORMAT c_dfDIMouse2 = {sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
0x00000002,
20,
11,
rgodf_c_dfDIMouse2};
const DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick[] = {
DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick[] = {
{&GUID_XAxis, 0, -2130706685, 256},
{&GUID_YAxis, 4, -2130706685, 256},
{&GUID_ZAxis, 8, -2130706685, 256},
@ -346,14 +346,14 @@ const DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick[] = {
{0, 77, -2130706676, 0},
{0, 78, -2130706676, 0},
{0, 79, -2130706676, 0}};
const DIDATAFORMAT c_dfDIJoystick = {24,
16,
1,
const DIDATAFORMAT c_dfDIJoystick = {sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
0x00000001,
80,
44,
rgodf_c_dfDIJoystick};
const DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick2[] = {
DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick2[] = {
{&GUID_XAxis, 0, -2130706685, 256},
{&GUID_YAxis, 4, -2130706685, 256},
{&GUID_ZAxis, 8, -2130706685, 256},
@ -518,9 +518,9 @@ const DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick2[] = {
{&GUID_RzAxis, 260, -2130706685, 1024},
{&GUID_Slider, 24, -2130706685, 1024},
{&GUID_Slider, 28, -2130706685, 1024}};
const DIDATAFORMAT c_dfDIJoystick2 = {24,
16,
1,
const DIDATAFORMAT c_dfDIJoystick2 = {sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
0x00000001,
272,
164,
rgodf_c_dfDIJoystick2};

View File

@ -50,6 +50,6 @@ static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = {
{ NULL, 79, 0x80FFFF0C, 0x00000000 }
};
const DIDATAFORMAT c_dfDIJoystick = { 24, 16, 0x00000001, 80, 44, c_dfDIJoystick_odf };
const DIDATAFORMAT c_dfDIJoystick = { sizeof(DIDATAFORMAT), sizeof(DIOBJECTDATAFORMAT), 0x00000001, 80, 44, c_dfDIJoystick_odf };
#endif // __dxdidf_h__

View File

@ -177,7 +177,7 @@ static struct
{
char *name;
LPDIRECTINPUTDEVICE7A *did;
const DIDATAFORMAT *df;
LPCDIDATAFORMAT df;
} devicedef = { "joystick", &lpDID, &c_dfDIJoystick };
static struct _joydef