mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
(Overlay) input_overlay_load_overlays - split up init part into separate
function
This commit is contained in:
parent
52eefc35ff
commit
c08fff5a0c
@ -542,33 +542,11 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool input_overlay_load_overlays(input_overlay_t *ol)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!ol)
|
||||
return false;
|
||||
if (!ol->conf)
|
||||
return false;
|
||||
|
||||
if (!config_get_uint(ol->conf, "overlays", &ol->config.overlays.size))
|
||||
{
|
||||
RARCH_ERR("overlays variable not defined in config.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!ol->config.overlays.size)
|
||||
goto error;
|
||||
|
||||
ol->overlays = (struct overlay*)calloc(
|
||||
ol->config.overlays.size, sizeof(*ol->overlays));
|
||||
if (!ol->overlays)
|
||||
goto error;
|
||||
|
||||
ol->size = ol->config.overlays.size;
|
||||
ol->pos = 0;
|
||||
ol->resolve_pos = 0;
|
||||
|
||||
for (i = 0; i < ol->size; i++)
|
||||
{
|
||||
char conf_key[64];
|
||||
@ -721,6 +699,34 @@ bool input_overlay_new_done(input_overlay_t *ol)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool input_overlay_load_overlays_init(input_overlay_t *ol)
|
||||
{
|
||||
if (!config_get_uint(ol->conf, "overlays", &ol->config.overlays.size))
|
||||
{
|
||||
RARCH_ERR("overlays variable not defined in config.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!ol->config.overlays.size)
|
||||
goto error;
|
||||
|
||||
ol->overlays = (struct overlay*)calloc(
|
||||
ol->config.overlays.size, sizeof(*ol->overlays));
|
||||
if (!ol->overlays)
|
||||
goto error;
|
||||
|
||||
ol->size = ol->config.overlays.size;
|
||||
ol->pos = 0;
|
||||
ol->resolve_pos = 0;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
ol->state = OVERLAY_STATUS_DEFERRED_ERROR;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_overlay_new:
|
||||
* @path : Path to overlay file.
|
||||
@ -768,6 +774,8 @@ input_overlay_t *input_overlay_new(const char *path, bool enable,
|
||||
ol->deferred.opacity = opacity;
|
||||
ol->deferred.scale_factor = scale_factor;
|
||||
|
||||
input_overlay_load_overlays_init(ol);
|
||||
|
||||
return ol;
|
||||
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user