mirror of
https://github.com/libretro/RetroArch
synced 2025-02-26 06:40:39 +00:00
Add input_overlay_enable option
This commit is contained in:
parent
f1f9096e91
commit
49ad98e543
@ -373,6 +373,7 @@ struct settings
|
||||
unsigned turbo_period;
|
||||
unsigned turbo_duty_cycle;
|
||||
|
||||
bool overlay_enable;
|
||||
char overlay[PATH_MAX];
|
||||
float overlay_opacity;
|
||||
float overlay_scale;
|
||||
|
@ -624,7 +624,7 @@ static void input_overlay_load_active(input_overlay_t *ol)
|
||||
ol->iface->full_screen(ol->iface_data, ol->active->full_screen);
|
||||
}
|
||||
|
||||
input_overlay_t *input_overlay_new(const char *overlay)
|
||||
input_overlay_t *input_overlay_new(const char *overlay, bool enable)
|
||||
{
|
||||
input_overlay_t *ol = (input_overlay_t*)calloc(1, sizeof(*ol));
|
||||
|
||||
@ -657,8 +657,7 @@ input_overlay_t *input_overlay_new(const char *overlay)
|
||||
ol->active = &ol->overlays[0];
|
||||
|
||||
input_overlay_load_active(ol);
|
||||
ol->iface->enable(ol->iface_data, true);
|
||||
ol->enable = true;
|
||||
input_overlay_enable(ol, enable);
|
||||
|
||||
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
|
||||
input_overlay_set_scale_factor(ol, g_settings.input.overlay_scale);
|
||||
|
@ -48,7 +48,7 @@ typedef struct input_overlay_state
|
||||
#define OVERLAY_SET_KEY(state, key) (state)->keys[(key) / 32] |= 1 << ((key) % 32)
|
||||
#define OVERLAY_CLEAR_KEY(state, key) (state)->keys[(key) / 32] &= ~(1 << ((key) % 32))
|
||||
|
||||
input_overlay_t *input_overlay_new(const char *overlay);
|
||||
input_overlay_t *input_overlay_new(const char *overlay, bool enable);
|
||||
void input_overlay_free(input_overlay_t *ol);
|
||||
|
||||
void input_overlay_enable(input_overlay_t *ol, bool enable);
|
||||
|
@ -2368,7 +2368,7 @@ bool rarch_main_command(unsigned cmd)
|
||||
if (!*g_settings.input.overlay)
|
||||
break;
|
||||
|
||||
driver.overlay = input_overlay_new(g_settings.input.overlay);
|
||||
driver.overlay = input_overlay_new(g_settings.input.overlay, g_settings.input.overlay_enable);
|
||||
if (!driver.overlay)
|
||||
RARCH_ERR("Failed to load overlay.\n");
|
||||
#endif
|
||||
|
@ -474,6 +474,7 @@ static void config_set_defaults(void)
|
||||
g_settings.input.turbo_period = turbo_period;
|
||||
g_settings.input.turbo_duty_cycle = turbo_duty_cycle;
|
||||
|
||||
g_settings.input.overlay_enable = true;
|
||||
g_settings.input.overlay_opacity = 0.7f;
|
||||
g_settings.input.overlay_scale = 1.0f;
|
||||
g_settings.input.autodetect_enable = input_autodetect_enable;
|
||||
@ -1121,6 +1122,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
*g_extern.overlay_dir = '\0';
|
||||
|
||||
CONFIG_GET_PATH(input.overlay, "input_overlay");
|
||||
CONFIG_GET_BOOL(input.overlay_enable, "input_overlay_enable");
|
||||
CONFIG_GET_FLOAT(input.overlay_opacity, "input_overlay_opacity");
|
||||
CONFIG_GET_FLOAT(input.overlay_scale, "input_overlay_scale");
|
||||
#endif
|
||||
@ -1715,6 +1717,7 @@ bool config_save_file(const char *path)
|
||||
config_set_path(conf, "overlay_directory",
|
||||
*g_extern.overlay_dir ? g_extern.overlay_dir : "default");
|
||||
config_set_path(conf, "input_overlay", g_settings.input.overlay);
|
||||
config_set_bool(conf, "input_overlay_enable", g_settings.input.overlay_enable);
|
||||
config_set_float(conf, "input_overlay_opacity",
|
||||
g_settings.input.overlay_opacity);
|
||||
config_set_float(conf, "input_overlay_scale",
|
||||
|
@ -4644,6 +4644,18 @@ static bool setting_data_append_list_overlay_options(
|
||||
START_GROUP(group_info, "Overlay Options");
|
||||
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
|
||||
|
||||
CONFIG_BOOL(
|
||||
g_settings.input.overlay_enable,
|
||||
"input_overlay_enable",
|
||||
"Overlay Enable",
|
||||
true,
|
||||
"OFF",
|
||||
"ON",
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
|
||||
CONFIG_PATH(
|
||||
g_settings.input.overlay,
|
||||
"input_overlay",
|
||||
|
Loading…
x
Reference in New Issue
Block a user