(task_overlay.c) Cleanups

This commit is contained in:
twinaphex 2016-05-24 02:21:49 +02:00
parent 8f054aeb29
commit 28ef2201cd
1 changed files with 11 additions and 12 deletions

View File

@ -494,8 +494,7 @@ static void rarch_task_overlay_deferred_load(overlay_loader_t *loader)
if (config_get_array(conf, overlay->config.rect.key, if (config_get_array(conf, overlay->config.rect.key,
overlay->config.rect.array, sizeof(overlay->config.rect.array))) overlay->config.rect.array, sizeof(overlay->config.rect.array)))
{ {
struct string_list *list = struct string_list *list = string_split(overlay->config.rect.array, ", ");
string_split(overlay->config.rect.array, ", ");
if (!list || list->size < 4) if (!list || list->size < 4)
{ {
@ -515,8 +514,8 @@ static void rarch_task_overlay_deferred_load(overlay_loader_t *loader)
/* Assume for now that scaling center is in the middle. /* Assume for now that scaling center is in the middle.
* TODO: Make this configurable. */ * TODO: Make this configurable. */
overlay->block_scale = false; overlay->block_scale = false;
overlay->center_x = overlay->x + 0.5f * overlay->w; overlay->center_x = overlay->x + 0.5f * overlay->w;
overlay->center_y = overlay->y + 0.5f * overlay->h; overlay->center_y = overlay->y + 0.5f * overlay->h;
} }
return; return;
@ -546,18 +545,17 @@ static ssize_t rarch_task_overlay_find_index(const struct overlay *ol,
static bool rarch_task_overlay_resolve_targets(struct overlay *ol, static bool rarch_task_overlay_resolve_targets(struct overlay *ol,
size_t idx, size_t size) size_t idx, size_t size)
{ {
size_t i; unsigned i;
struct overlay *current = NULL; struct overlay *current = (struct overlay*)&ol[idx];
current = (struct overlay*)&ol[idx];
for (i = 0; i < current->size; i++) for (i = 0; i < current->size; i++)
{ {
const char *next = current->descs[i].next_index_name; const char *next = current->descs[i].next_index_name;
size_t next_idx = 0;
if (*next) if (*next)
{ {
ssize_t next_idx = rarch_task_overlay_find_index(ol, next, size); next_idx = rarch_task_overlay_find_index(ol, next, size);
if (next_idx < 0) if (next_idx < 0)
{ {
@ -565,12 +563,13 @@ static bool rarch_task_overlay_resolve_targets(struct overlay *ol,
next); next);
return false; return false;
} }
current->descs[i].next_index = next_idx;
} }
else else
current->descs[i].next_index = (idx + 1) % size; next_idx = (idx + 1) & size;
current->descs[i].next_index = next_idx;
} }
return true; return true;
} }