dinput: Move the config for the buttons from the JoyDev into the JoystickImpl.

This commit is contained in:
Christoph Frick 2007-01-15 12:08:00 +01:00 committed by Alexandre Julliard
parent 424d302115
commit 0855a6be4c

View file

@ -111,8 +111,6 @@ struct JoyDev {
/* data returned by the EVIOCGABS() ioctl */
int axes[ABS_MAX][5];
/* LUT for KEY_ to offset in rgbButtons */
BYTE buttons[KEY_MAX];
};
struct ObjProps
@ -142,6 +140,9 @@ struct JoystickImpl
struct ObjProps props[ABS_MAX];
/* LUT for KEY_ to offset in rgbButtons */
BYTE buttons[KEY_MAX];
/* Force feedback variables */
EffectListItem* top_effect;
int ff_state;
@ -181,7 +182,7 @@ static void find_joydevs(void)
struct JoyDev joydev = {0};
int fd;
int no_ff_check = 0;
int j, buttons;
int j;
snprintf(buf,MAX_PATH,EVDEVPREFIX"%d",i);
buf[MAX_PATH-1] = 0;
@ -262,15 +263,6 @@ static void find_joydevs(void)
}
}
buttons = 0;
for (j=0;j<KEY_MAX;j++) {
if (test_bit(joydev.keybits,j)) {
TRACE(" ... with button %d: %d\n", j, buttons);
joydev.buttons[j] = 0x80 | buttons;
buttons++;
}
}
if (have_joydevs==0) {
joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
} else {
@ -417,6 +409,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
if (!test_bit(newDevice->joydev->keybits, i)) continue;
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[btn + WINE_JOYSTICK_BUTTON_BASE], df->dwObjSize);
newDevice->buttons[i] = 0x80 | btn;
df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(btn++) | DIDFT_PSHBUTTON;
}
df->dwNumObjs = idx;
@ -723,7 +716,7 @@ static void joy_polldev(JoystickImpl *This)
switch (ie.type) {
case EV_KEY: /* button */
{
int btn = This->joydev->buttons[ie.code];
int btn = This->buttons[ie.code];
TRACE("(%p) %d -> %d\n", This, ie.code, btn);
if (btn & 0x80)