mirror of
https://github.com/holub/mame
synced 2025-05-30 01:23:07 +03:00
Fixed mouse/lightgun buttons to individually select when using -mouse/-multimouse and -lightgun. Meaning you will not receive Mouse Button 0 Gun Button 0 when selecting in the UI.
This commit is contained in:
parent
bb029346e8
commit
07ed3cdd71
@ -99,7 +99,6 @@ typedef struct _mouse_state mouse_state;
|
||||
struct _mouse_state
|
||||
{
|
||||
DIMOUSESTATE2 state;
|
||||
mouse_state * partner;
|
||||
LONG raw_x, raw_y, raw_z;
|
||||
};
|
||||
|
||||
@ -2012,7 +2011,6 @@ static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST de
|
||||
{
|
||||
guninfo->device = input_device_add(machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo);
|
||||
guninfo->poll = (guninfo == lightgun_list) ? win32_lightgun_poll : NULL;
|
||||
guninfo->mouse.partner = &devinfo->mouse;
|
||||
}
|
||||
|
||||
// populate the axes
|
||||
@ -2034,10 +2032,9 @@ static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST de
|
||||
const char *name = utf8_from_tstring(default_button_name(butnum));
|
||||
|
||||
// add to the mouse device and optionally to the gun device as well
|
||||
// note that the gun device points to the mouse buttons rather than its own
|
||||
input_device_item_add(devinfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
|
||||
if (guninfo != NULL)
|
||||
input_device_item_add(guninfo->device, name, &devinfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
|
||||
input_device_item_add(guninfo->device, name, &guninfo->mouse.state.rgbButtons[butnum], (input_item_id)(ITEM_ID_BUTTON1 + butnum), generic_button_get_state);
|
||||
|
||||
free((void *)name);
|
||||
}
|
||||
@ -2057,8 +2054,6 @@ static void rawinput_mouse_update(HANDLE device, RAWMOUSE *data)
|
||||
for (devinfo = devlist; devinfo != NULL; devinfo = devinfo->next)
|
||||
if (devinfo->rawinput.device == device)
|
||||
{
|
||||
mouse_state *mouseinfo = (devinfo->mouse.partner != NULL) ? devinfo->mouse.partner : &devinfo->mouse;
|
||||
|
||||
// if we got relative data, update it as a mouse
|
||||
if (!(data->usFlags & MOUSE_MOVE_ABSOLUTE))
|
||||
{
|
||||
@ -2081,16 +2076,16 @@ static void rawinput_mouse_update(HANDLE device, RAWMOUSE *data)
|
||||
}
|
||||
|
||||
// update the button states; always update the corresponding mouse buttons
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) mouseinfo->state.rgbButtons[0] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_1_UP) mouseinfo->state.rgbButtons[0] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) mouseinfo->state.rgbButtons[1] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_2_UP) mouseinfo->state.rgbButtons[1] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) mouseinfo->state.rgbButtons[2] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_3_UP) mouseinfo->state.rgbButtons[2] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) mouseinfo->state.rgbButtons[3] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_4_UP) mouseinfo->state.rgbButtons[3] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) mouseinfo->state.rgbButtons[4] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_5_UP) mouseinfo->state.rgbButtons[4] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) devinfo->mouse.state.rgbButtons[0] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_1_UP) devinfo->mouse.state.rgbButtons[0] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) devinfo->mouse.state.rgbButtons[1] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_2_UP) devinfo->mouse.state.rgbButtons[1] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) devinfo->mouse.state.rgbButtons[2] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_3_UP) devinfo->mouse.state.rgbButtons[2] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) devinfo->mouse.state.rgbButtons[3] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_4_UP) devinfo->mouse.state.rgbButtons[3] = 0x00;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) devinfo->mouse.state.rgbButtons[4] = 0x80;
|
||||
if (data->usButtonFlags & RI_MOUSE_BUTTON_5_UP) devinfo->mouse.state.rgbButtons[4] = 0x00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user