From 67eee05c141284612f8cea318a6d2e92d3adfb89 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 11 Dec 2024 10:41:53 +0100 Subject: [PATCH] lightgun: wiggle the reported lightgun position in a 2x2 square Fixes claychal not registering shots in menus. --- core/hw/pvr/spg.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/hw/pvr/spg.cpp b/core/hw/pvr/spg.cpp index 5fd93bc86..0e2115c77 100755 --- a/core/hw/pvr/spg.cpp +++ b/core/hw/pvr/spg.cpp @@ -235,7 +235,7 @@ static int spg_line_sched(int tag, int cycles, int jitter, void *arg) void read_lightgun_position(int x, int y) { - static u8 flip; + static u32 flip; maple_int_pending = true; if (y < 0 || y >= 480 || x < 0 || x >= 640) { @@ -245,9 +245,11 @@ void read_lightgun_position(int x, int y) else { lightgun_line = y / (SPG_CONTROL.interlace ? 2 : 1) + SPG_VBLANK_INT.vblank_out_interrupt_line_number; - // For some reason returning the same position twice makes it register off screen - lightgun_hpos = (x + 286) ^ flip; - flip ^= 1; + // For some reason returning the same position twice makes it register off screen. + // Atomiswave Clay Challenge wants more wiggle than others for shots to register. + lightgun_line ^= (flip >> 1) & 1; + lightgun_hpos = (x + 286) ^ (flip & 1); + flip++; } }