Skip to content

Commit

Permalink
Overlay lightgun fixes
Browse files Browse the repository at this point in the history
- Fix the "Allow Off-Screen" setting not working since #17308
- Prevent offscreen shot from disabling the lightgun with some cores
- Fullscreen pointer coordinates no longer needed
  • Loading branch information
neil4 committed Jan 3, 2025
1 parent ee191f3 commit 2105823
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions input/input_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,9 @@ static int16_t input_overlay_lightgun_state(settings_t *settings,
else
return -0x8000;
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
return input_driver_pointer_is_offscreen(ptr_st->ptr[0].x, ptr_st->ptr[0].y);
ptr_st->device_mask |= (1 << RETRO_DEVICE_LIGHTGUN);
return ( settings->bools.input_overlay_lightgun_allow_offscreen
&& input_driver_pointer_is_offscreen(ptr_st->ptr[0].x, ptr_st->ptr[0].y));
case RETRO_DEVICE_ID_LIGHTGUN_AUX_A:
case RETRO_DEVICE_ID_LIGHTGUN_AUX_B:
case RETRO_DEVICE_ID_LIGHTGUN_AUX_C:
Expand Down Expand Up @@ -3307,10 +3309,9 @@ static void input_overlay_update_pointer_coords(
RETRO_DEVICE_ID_POINTER_Y);
}

/* Need fullscreen pointer for mouse and lightgun */
/* Need fullscreen pointer for mouse only */
if ( !ptr_st->count
&& (ptr_st->device_mask &
((1 << RETRO_DEVICE_MOUSE) | (1 << RETRO_DEVICE_LIGHTGUN))))
&& (ptr_st->device_mask & (1 << RETRO_DEVICE_MOUSE)))
{
ptr_st->screen_x = current_input->input_state(
input_data, NULL, NULL, NULL, NULL, true, 0,
Expand Down Expand Up @@ -3477,14 +3478,11 @@ static void input_poll_overlay(

if (ol_ptr_enable)
{
input_overlay_pointer_state_t *ptr_st = &ol->pointer_state;
struct input_overlay_mouse_state *mouse_st = (struct input_overlay_mouse_state*)&ptr_st->mouse;

if (ptr_state->device_mask & (1 << RETRO_DEVICE_LIGHTGUN))
input_overlay_poll_lightgun(settings, ol, old_ptr_count);
if (ptr_state->device_mask & (1 << RETRO_DEVICE_MOUSE))
input_overlay_poll_mouse(settings, mouse_st, ol,
ptr_st->count, old_ptr_count);
input_overlay_poll_mouse(settings, &ptr_state->mouse, ol,
ptr_state->count, old_ptr_count);

ptr_state->device_mask = 0;
}
Expand Down

0 comments on commit 2105823

Please sign in to comment.