Option to hide crosshairs for lightgun games. Fixes #24

This commit is contained in:
Keith Bowes 2021-03-20 17:01:52 -04:00
parent aac15a622f
commit e1e46ddb26
2 changed files with 31 additions and 4 deletions

View File

@ -67,7 +67,13 @@ static bool overscan_v;
static bool overscan_h;
static unsigned aspect_ratio_mode;
static unsigned tpulse;
static bool show_crosshair = false;
static enum {
SHOW_CROSSHAIR_DISABLED,
SHOW_CROSSHAIR_OFF,
SHOW_CROSSHAIR_ON,
} show_crosshair;
static bool libretro_supports_bitmasks = false;
static bool show_advanced_av_settings = true;
@ -545,7 +551,8 @@ static void update_input()
input_poll_cb();
input->pad[1].mic = 0;
input->vsSystem.insertCoin = 0;
show_crosshair = false;
if (show_crosshair)
show_crosshair = SHOW_CROSSHAIR_OFF;
int min_x = overscan_h ? 8 : 0;
int max_x = overscan_h ? 247 : 255;
@ -667,7 +674,8 @@ static void update_input()
static int zapy = overscan_v ? 8 : 0;
input->zapper.fire = 0;
show_crosshair = true;
if (show_crosshair)
show_crosshair = SHOW_CROSSHAIR_ON;
switch (zapper_device)
{
@ -770,6 +778,15 @@ static void check_variables(void)
zapper_device = ZAPPER_DEVICE_POINTER;
}
var.key = "nestopia_show_crosshair";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
if (strcmp(var.value, "disabled") == 0)
show_crosshair = SHOW_CROSSHAIR_DISABLED;
else
show_crosshair = SHOW_CROSSHAIR_OFF;
}
var.key = "nestopia_button_shift";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
@ -1199,7 +1216,7 @@ void retro_run(void)
update_input();
emulator.Execute(video, audio, input);
if (show_crosshair)
if (show_crosshair == SHOW_CROSSHAIR_ON)
draw_crosshair(crossx, crossy);
unsigned frames = is_pal ? SAMPLERATE / 50 : SAMPLERATE / 60;

View File

@ -224,6 +224,16 @@ struct retro_core_option_definition option_defs_us[] = {
},
"lightgun",
},
{
"nestopia_show_crosshair",
"Show Crosshair",
"Set whether to show the crosshair when the Zapper is used.",
{
{ "enabled", NULL },
{ "disabled", NULL},
},
"enabled"
},
{
"nestopia_turbo_pulse",
"Turbo Pulse Speed",