ST-V: critcrsh hammer on the right input ports, lightgun crosshair (#2197)

critcrsh / tatacot: the hammer was read from input ports 10 and 11,
which don't exist (the lightgun ports are 7 and 8), so the game always
saw it in the top left corner. The lightgun ports default to the
centre, since in this core the lightgun moves from the default value,
and the crosshair is drawn as in MAME. Fixes #2195.


Claude-Session: https://claude.ai/code/session_013Vje3pEtpLHubqCGwCgoQX

Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
zanacandClaude Opus 5.5 authored and GitHub committed 2026-11-02 07:41:07 -05:00
1 parent e455f1783a
commit 6d162f313c
3 files changed
+25 -4

No files matched your search

+21 -4
View File
@@ -2463,8 +2463,8 @@ READ32_HANDLER ( stv_io_r32 )
{
/* the hammer position, with the hit latch */
int hit = (readinputport(4) & 0x10) ? 0 : 4;
UINT8 x = (BITSWAP8(readinputport(10), 2,3,0,1,6,7,5,4) & 0xf3) | hit;
UINT8 y = (BITSWAP8(readinputport(11), 2,3,0,1,6,7,5,4) & 0xf3) | hit;
UINT8 x = (BITSWAP8(readinputport(7), 2,3,0,1,6,7,5,4) & 0xf3) | hit;
UINT8 y = (BITSWAP8(readinputport(8), 2,3,0,1,6,7,5,4) & 0xf3) | hit;
return 0xff00ff00 | (x << 16) | y;
}
return ((readinputport(2) | (stv_hopper && hopper_status ? 0x02 : 0)) << 16) | (readinputport(3));
@@ -3376,11 +3376,12 @@ INPUT_PORTS_START( critcrsh )
PORT_BITX(0x80, IP_ACTIVE_HIGH, 0, "R trig", KEYCODE_S, IP_JOY_NONE )
#endif
/* the default values are the centre: the lightgun moves from there */
PORT_START /* the hammer X */
PORT_ANALOG( 0x3f, 0x00, IPT_LIGHTGUN_X, 50, 1, 0, 0x3f )
PORT_ANALOG( 0x3f, 0x20, IPT_LIGHTGUN_X, 50, 1, 0, 0x3f )
PORT_START /* the hammer Y */
PORT_ANALOG( 0x3f, 0x02, IPT_LIGHTGUN_Y, 50, 1, 0x02, 0x2e )
PORT_ANALOG( 0x3f, 0x18, IPT_LIGHTGUN_Y, 50, 1, 0x02, 0x2e )
INPUT_PORTS_END
/* the medal games (MAME's patocar and micrombc inputs), with a hopper */
@@ -5211,6 +5212,22 @@ static DRIVER_INIT( critcrsh )
stv_critcrsh = 1;
}
/* the hammer of critcrsh is a lightgun: its crosshair, on the whole screen as in MAME
(X 0x00-0x3f, Y 0x02-0x2e) */
void stv_draw_crosshairs(struct mame_bitmap *bitmap, const struct rectangle *clip)
{
int w, h, x, y;
if (!stv_critcrsh)
return;
w = clip->max_x - clip->min_x + 1;
h = clip->max_y - clip->min_y + 1;
x = clip->min_x + (readinputport(7) & 0x3f) * (w - 1) / 0x3f;
y = clip->min_y + ((readinputport(8) & 0x3f) - 0x02) * (h - 1) / (0x2e - 0x02);
draw_crosshair(1, bitmap, x, y, clip);
}
static DRIVER_INIT( stvmedal )
{
init_ic13();
+3
View File
@@ -31,6 +31,9 @@ VIDEO_START( stv_vdp2 );
VIDEO_STOP( stv_vdp2 );
VIDEO_UPDATE( stv_vdp2 );
/* drivers/stv.c: the lightgun crosshairs, over the finished screen */
void stv_draw_crosshairs(struct mame_bitmap *bitmap, const struct rectangle *clip);
/* frame timing, from the driver's scanline interrupt */
int stv_vdp2_vblank_start_line(void); /* the line vblank-in happens on */
void stv_vdp2_scanline(int line); /* the start of each line, 0 to 262 */
+1
View File
@@ -10778,4 +10778,5 @@ VIDEO_UPDATE( stv_vdp2 )
set_visible_area(0, vdp2_visarea.max_x, 0, vdp2_visarea.max_y);
copybitmap(bitmap, vdp2_screen, 0, 0, 0, 0, &vdp2_visarea, TRANSPARENCY_NONE, 0);
stv_draw_crosshairs(bitmap, &vdp2_visarea);
}