mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
(core_info.c) Cleanups
This commit is contained in:
parent
ac85405598
commit
efbfe3610a
1 changed files with 199 additions and 182 deletions
75
core_info.c
75
core_info.c
|
@ -104,9 +104,21 @@ static bool CCJSONObjectMemberHandler(void *context,
|
|||
{
|
||||
CCJSONContext *pCtx = (CCJSONContext *)context;
|
||||
|
||||
if ( (pCtx->object_depth == 2)
|
||||
&& (pCtx->array_depth == 1)
|
||||
&& length)
|
||||
if (length)
|
||||
{
|
||||
switch (pCtx->array_depth)
|
||||
{
|
||||
case 0:
|
||||
if (pCtx->object_depth == 1)
|
||||
{
|
||||
pCtx->current_string_val = NULL;
|
||||
|
||||
if (string_is_equal(pValue, "version"))
|
||||
pCtx->current_string_val = &pCtx->core_info_cache_list->version;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pCtx->object_depth == 2)
|
||||
{
|
||||
pCtx->current_string_val = NULL;
|
||||
pCtx->current_string_list_val = NULL;
|
||||
|
@ -209,9 +221,7 @@ static bool CCJSONObjectMemberHandler(void *context,
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if ( (pCtx->object_depth == 3)
|
||||
&& (pCtx->array_depth == 1)
|
||||
&& length)
|
||||
else if (pCtx->object_depth == 3)
|
||||
{
|
||||
pCtx->current_string_val = NULL;
|
||||
pCtx->current_entry_uint_val = NULL;
|
||||
|
@ -224,9 +234,9 @@ static bool CCJSONObjectMemberHandler(void *context,
|
|||
pCtx->current_entry_uint_val = &pCtx->core_info->core_file_id.hash;
|
||||
}
|
||||
}
|
||||
else if ( (pCtx->object_depth == 3)
|
||||
&& (pCtx->array_depth == 2)
|
||||
&& length)
|
||||
break;
|
||||
case 2:
|
||||
if (pCtx->object_depth == 3)
|
||||
{
|
||||
pCtx->current_string_val = NULL;
|
||||
pCtx->current_entry_bool_val = NULL;
|
||||
|
@ -243,14 +253,9 @@ static bool CCJSONObjectMemberHandler(void *context,
|
|||
pCtx->current_entry_bool_val = &pCtx->core_info->firmware[firmware_idx].optional;
|
||||
}
|
||||
}
|
||||
else if ( (pCtx->object_depth == 1)
|
||||
&& (pCtx->array_depth == 0)
|
||||
&& length)
|
||||
{
|
||||
pCtx->current_string_val = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (string_is_equal(pValue, "version"))
|
||||
pCtx->current_string_val = &pCtx->core_info_cache_list->version;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -315,16 +320,19 @@ static bool CCJSONStartObjectHandler(void *context)
|
|||
|
||||
pCtx->object_depth++;
|
||||
|
||||
if ( (pCtx->object_depth == 1)
|
||||
&& (pCtx->array_depth == 0))
|
||||
switch (pCtx->array_depth)
|
||||
{
|
||||
case 0:
|
||||
if (pCtx->object_depth == 1)
|
||||
{
|
||||
if (pCtx->core_info_cache_list)
|
||||
return false;
|
||||
if (!(pCtx->core_info_cache_list = core_info_cache_list_new()))
|
||||
return false;
|
||||
}
|
||||
else if ((pCtx->object_depth == 2)
|
||||
&& (pCtx->array_depth == 1))
|
||||
break;
|
||||
case 1:
|
||||
if (pCtx->object_depth == 2)
|
||||
{
|
||||
if (pCtx->core_info)
|
||||
{
|
||||
|
@ -341,10 +349,9 @@ static bool CCJSONStartObjectHandler(void *context)
|
|||
pCtx->core_info->savestate_support_level =
|
||||
CORE_INFO_SAVESTATE_DETERMINISTIC;
|
||||
}
|
||||
else if ((pCtx->object_depth == 3)
|
||||
&& (pCtx->array_depth == 2))
|
||||
{
|
||||
if (pCtx->to_firmware)
|
||||
break;
|
||||
case 2:
|
||||
if (pCtx->object_depth == 3 && pCtx->to_firmware)
|
||||
{
|
||||
size_t new_idx = pCtx->core_info->firmware_count;
|
||||
core_info_firmware_t *tmp = (core_info_firmware_t*)
|
||||
|
@ -363,8 +370,10 @@ static bool CCJSONStartObjectHandler(void *context)
|
|||
pCtx->core_info->firmware = tmp;
|
||||
pCtx->core_info->firmware_count++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -372,18 +381,26 @@ static bool CCJSONEndObjectHandler(void *context)
|
|||
{
|
||||
CCJSONContext *pCtx = (CCJSONContext*)context;
|
||||
|
||||
if ( (pCtx->object_depth == 2)
|
||||
&& (pCtx->array_depth == 1)
|
||||
&& (pCtx->core_info))
|
||||
if (pCtx->array_depth == 1)
|
||||
{
|
||||
switch (pCtx->object_depth)
|
||||
{
|
||||
case 2:
|
||||
if (pCtx->core_info)
|
||||
{
|
||||
core_info_cache_add(
|
||||
pCtx->core_info_cache_list, pCtx->core_info, true);
|
||||
free(pCtx->core_info);
|
||||
pCtx->core_info = NULL;
|
||||
}
|
||||
else if ((pCtx->object_depth == 3)
|
||||
&& (pCtx->array_depth == 1))
|
||||
break;
|
||||
case 3:
|
||||
pCtx->to_core_file_id = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pCtx->object_depth--;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue