#15423·mame

Model 2 lightgun games reload/miss when using optical lightguns on dark onscreen targets

Author: SoopxCreated May 31, 2026Updated Sep 6, 2026

MAME version

MAME 0.284

System information

aarch64, CRT, Guncon2 using Beardypig's Guncon2 linux drivers

INI configuration details

ini
#
# CORE CONFIGURATION OPTIONS
#
readconfig                1
writeconfig               0

#
# CORE SEARCH PATH OPTIONS
#
homepath                  /home/admin/mame
rompath                   /home/admin/ROMs/mame
hashpath                  hash
samplepath                samples
artpath                   artwork
ctrlrpath                 ctrlr
inipath                   $HOME/.mame;.;ini
fontpath                  .
cheatpath                 cheat
crosshairpath             crosshair
pluginspath               plugins
languagepath              language
swpath                    software

#
# CORE OUTPUT DIRECTORY OPTIONS
#
cfg_directory             cfg
nvram_directory           nvram
input_directory           inp
state_directory           sta
snapshot_directory        snap
diff_directory            diff
comment_directory         comments
share_directory           share

#
# CORE STATE/PLAYBACK OPTIONS
#
state
autosave                  0
rewind                    0
rewind_capacity           100
playback
record
exit_after_playback       0
mngwrite
aviwrite
wavwrite
snapname                  %g/%i
snapsize                  auto
snapview                  auto
snapbilinear              1
statename                 %g
burnin                    0

#
# CORE PERFORMANCE OPTIONS
#
autoframeskip             1
frameskip                 1
seconds_to_run            0
throttle                  1
sleep                     1
speed                     1.0
refreshspeed              0
lowlatency                0

#
# CORE RENDER OPTIONS
#
keepaspect                1
unevenstretch             0
unevenstretchx            0
unevenstretchy            1
autostretchxy             0
intoverscan               1
intscalex                 0
intscaley                 1

#
# CORE ROTATION OPTIONS
#
rotate                    1
ror                       0
rol                       0
autoror                   0
autorol                   0
flipx                     0
flipy                     0

#
# CORE ARTWORK OPTIONS
#
artwork_crop              0
fallback_artwork
override_artwork
artwork_font              default

#
# CORE SCREEN OPTIONS
#
brightness                1.0
contrast                  1.0
gamma                     1.0
pause_brightness          0.65
effect                    none

#
# CORE VECTOR OPTIONS
#
beam_width_min            1.0
beam_width_max            1.0
beam_dot_size             1.0
beam_intensity_weight     0
flicker                   0

#
# CORE SOUND OPTIONS
#
samplerate                48000
samples                   1
volume                    12

#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr
mouse                     1
joystick                  1
lightgun                  1
multikeyboard             0
multimouse                1
steadykey                 0
ui_active                 0
offscreen_reload          0
joystick_map              auto
joystick_deadzone         0
joystick_saturation       1
joystick_threshold        1
natural                   0
joystick_contradictory    0
coin_impulse              0

#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device             keyboard
adstick_device            lightgun
pedal_device              keyboard
dial_device               keyboard
trackball_device          mouse
lightgun_device           lightgun
positional_device         lightgun
mouse_device              mouse

#
# CORE DEBUGGING OPTIONS
#
verbose                   1
log                       0
oslog                     0
debug                     0
update_in_pause           0
debugscript
debuglog                  0

#
# CORE COMM OPTIONS
#
comm_localhost            0.0.0.0
comm_localport            15112
comm_remotehost           127.0.0.1
comm_remoteport           15112
comm_framesync            0

#
# CORE MISC OPTIONS
#
drc                       1
drc_use_c                 0
drc_log_uml               0
drc_log_native            0
bios
cheat                     0
skip_gameinfo             1
uifont                    default
ui                        cabinet
ramsize
confirm_quit              0
ui_mouse                  0
language
nvram_save                1

#
# SCRIPTING OPTIONS
#
autoboot_command
autoboot_delay            0
autoboot_script
console                   0
plugins                   1
plugin
noplugin

#
# HTTP SERVER OPTIONS
#
http                      0
http_port                 8080
http_root                 web

#
# OSD INPUT MAPPING OPTIONS
#
uimodekey                 auto
controller_map            none
background_input          0

#
# OSD FONT OPTIONS
#
uifontprovider            auto

#
# OSD OUTPUT OPTIONS
#
output                    auto

#
# OSD INPUT OPTIONS
#
keyboardprovider          auto
mouseprovider             auto
lightgunprovider          auto
joystickprovider          auto

#
# OSD DEBUGGING OPTIONS
#
debugger                  auto
debugger_host             localhost
debugger_port             23946
debugger_font             auto
debugger_font_size        0
watchdog                  0

#
# OSD PERFORMANCE OPTIONS
#
numprocessors             auto
bench                     0

#
# OSD VIDEO OPTIONS
#
video                     accel
numscreens                1
window                    0
maximize                  1
waitvsync                 0
syncrefresh               0
monitorprovider           auto

#
# OSD PER-WINDOW VIDEO OPTIONS
#
screen                    auto
aspect                    4:3
resolution                2560x240
view                      auto
screen0                   auto
aspect0                   auto
resolution0               auto
view0                     auto
screen1                   auto
aspect1                   auto
resolution1               auto
view1                     auto
screen2                   auto
aspect2                   auto
resolution2               auto
view2                     auto
screen3                   auto
aspect3                   auto
resolution3               auto
view3                     auto

#
# OSD FULL SCREEN OPTIONS
#
switchres                 1

#
# OSD ACCELERATED VIDEO OPTIONS
#
filter                    1
prescale                  1

#
# OpenGL-SPECIFIC OPTIONS
#
gl_forcepow2texture       0
gl_notexturerect          0
gl_vbo                    1
gl_pbo                    1
gl_glsl                   0
gl_glsl_filter            1
glsl_shader_mame0         none
glsl_shader_mame1         none
glsl_shader_mame2         none
glsl_shader_mame3         none
glsl_shader_mame4         none
glsl_shader_mame5         none
glsl_shader_mame6         none
glsl_shader_mame7         none
glsl_shader_mame8         none
glsl_shader_mame9         none
glsl_shader_screen0       none
glsl_shader_screen1       none
glsl_shader_screen2       none
glsl_shader_screen3       none
glsl_shader_screen4       none
glsl_shader_screen5       none
glsl_shader_screen6       none
glsl_shader_screen7       none
glsl_shader_screen8       none
glsl_shader_screen9       none

#
# OSD SOUND OPTIONS
#
sound                     auto
audio_latency             0.0

#
# OSD MIDI OPTIONS
#
midiprovider              auto

#
# OSD EMULATED NETWORKING OPTIONS
#
networkprovider           auto

#
# BGFX POST-PROCESSING OPTIONS
#
bgfx_path                 bgfx
bgfx_backend              auto
bgfx_debug                0
bgfx_screen_chains
bgfx_shadow_mask          slot-mask.png
bgfx_lut                  lut-default.png
bgfx_avi_name             auto

#
# SDL PERFORMANCE OPTIONS
#
sdlvideofps               1

#
# SDL VIDEO OPTIONS
#
centerh                   1
centerv                   1
scalemode                 none

#
# SDL FULL SCREEN OPTIONS
#
useallheads               0
attach_window

#
# SDL KEYBOARD MAPPING
#
keymap                    0
keymap_file               keymap.dat

#
# SDL INPUT OPTIONS
#
enable_touch              0
sixaxis                   0
dual_lightgun             1

#
# SDL LIGHTGUN MAPPING
#
lightgun_index1           auto
lightgun_index2           auto
lightgun_index3           auto
lightgun_index4           auto
lightgun_index5           auto
lightgun_index6           auto
lightgun_index7           auto
lightgun_index8           auto

#
# SDL LOW-LEVEL DRIVER OPTIONS
#
videodriver               auto
renderdriver              auto
audiodriver               auto
gl_lib                    auto

#
# FRONTEND COMMAND OPTIONS
#
dtd                       1
admin@poop:~/mame-src $

Emulated system/software

Sega Model 2 (hotd, vcop2)

Incorrect behaviour

In Model 2 lightgun games, notably hotd and vcop2, shots aimed at dark onscreen areas can be interpreted as offscreen/reload shots when using an optical lightgun such as a GunCon2. The gun reports fallback coordinates when it cannot see the display clearly. In testing these commonly appear as:

HOTD: P1 X=00ad Y=005c, sometimes 0000/0000 VCop2: P1 around X=0089 Y=002a, P2 around X=0086 Y=002a

MAME passes these coordinates through the Model 2 lightgun/offscreen path, and the game treats the shot as offscreen/reload rather than first flashing the screen and sampling recovered coordinates.

Expected behaviour

A shot aimed at an onscreen dark target should behave as an onscreen shot: the game/display should flash, the lightgun should be able to recover valid coordinates, and the shot should be resolved at those coordinates. A genuinely offscreen shot should still reload.

These games are designed for optical lightguns and visibly flash/brighten the screen on firing so the gun can locate the target. Dark onscreen targets should not be equivalent to offscreen reload.

Steps to reproduce

Use a real optical lightgun that depends on display brightness, e.g. GunCon2 via the relevant MAME lightgun input module. Run hotd or vcop2. Enable crosshair temporarily to confirm the aim point is onscreen. Aim at a dark onscreen part of the scene. Pull the trigger. Observe that the game often reloads or treats the shot as offscreen rather than firing at the target. For comparison, aim at a bright onscreen target and pull the trigger. The shot is much more likely to register normally.

Additional details

Local instrumentation of src/mame/sega/model2.cpp suggests the issue is related to the polling order and timing of the Model 2 lightgun interface. For hotd, the game appears to poll in this order each frame:

  1. muxed lightgun coordinate reads
  2. offscreen/reload status
  3. IN1 trigger/buttons

Observed PCs include: coordinate/mux loop: 000a399c, 000a39b0, 000a39c4, 000a39c8, 000a39dc, 000a39f0 offscreen reads: 000a3944, 000a3958 IN1 trigger read: 000158ac

When aimed at a dark onscreen area, the host lightgun reports fallback coordinates. Since coordinates and offscreen status are read before the trigger input, the game sees the shot as offscreen/reload before a useful flash/recovered coordinate sample can occur. Instrumentation also showed that after a flash/bright frame, the same physical gun can recover plausible coordinates, for example:

Y=0128 X=0139 Y=0105 X=011c

So the physical lightgun can see the emulated flash, but the timing/path in MAME’s current Model 2 input handling allows fallback coordinates to be consumed as offscreen/reload first. For vcop2, similar fallback coordinates were observed, but with different values near the input range border:

P1 approximately X=0089 Y=002a P2 approximately X=0086 Y=002a

This may be related to the driver’s current offscreen/border handling and lack of a latched or flash-aware lightgun sample model.