Create CORE_CTL_RETRO_LOAD_GAME

This commit is contained in:
twinaphex 2016-01-27 09:13:26 +01:00
parent 5e3e0bcbe4
commit e516a64a0c
3 changed files with 27 additions and 7 deletions

View File

@ -495,7 +495,7 @@ static bool load_content(
) )
{ {
unsigned i; unsigned i;
bool ret = true; retro_ctx_load_content_info_t load_info;
if (!info || !additional_path_allocs) if (!info || !additional_path_allocs)
return false; return false;
@ -539,12 +539,11 @@ static bool load_content(
} }
} }
if (special) load_info.content = content;
ret = core.retro_load_game_special(special->id, info, content->size); load_info.special = special;
else load_info.info = info;
ret = core.retro_load_game(*content->elems[0].data ? info : NULL);
if (!ret) if (!core_ctl(CORE_CTL_RETRO_LOAD_GAME, &load_info))
{ {
RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT)); RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
return false; return false;

View File

@ -174,6 +174,18 @@ bool core_ctl(enum core_ctl_state state, void *data)
switch (state) switch (state)
{ {
case CORE_CTL_RETRO_LOAD_GAME:
{
retro_ctx_load_content_info_t *load_info =
(retro_ctx_load_content_info_t*)data;
if (!load_info)
return false;
if (load_info->special)
return core.retro_load_game_special(load_info->special->id, load_info->info, load_info->content->size);
return core.retro_load_game(*load_info->content->elems[0].data ? load_info->info : NULL);
}
break;
case CORE_CTL_RETRO_GET_SYSTEM_INFO: case CORE_CTL_RETRO_GET_SYSTEM_INFO:
{ {
struct retro_system_info *system = (struct retro_system_info*)data; struct retro_system_info *system = (struct retro_system_info*)data;

View File

@ -87,9 +87,18 @@ enum core_ctl_state
**/ **/
CORE_CTL_INIT_SYSTEM_AV_INFO, CORE_CTL_INIT_SYSTEM_AV_INFO,
CORE_CTL_RETRO_GET_SYSTEM_INFO CORE_CTL_RETRO_GET_SYSTEM_INFO,
CORE_CTL_RETRO_LOAD_GAME
}; };
typedef struct retro_ctx_load_content_info
{
struct retro_game_info *info;
const struct string_list *content;
const struct retro_subsystem_info *special;
} retro_ctx_load_content_info_t;
typedef struct retro_ctx_serialize_info typedef struct retro_ctx_serialize_info
{ {
const void *data_const; const void *data_const;