Create CORE_CTL_RETRO_CHEAT_SET

This commit is contained in:
twinaphex 2016-01-28 04:34:39 +01:00
parent 0d81f669e0
commit 277f08022d
3 changed files with 24 additions and 1 deletions

View File

@ -84,7 +84,15 @@ void cheat_manager_apply_cheats(void)
for (i = 0; i < handle->size; i++)
{
if (handle->cheats[i].state)
core.retro_cheat_set(idx++, true, handle->cheats[i].code);
{
retro_ctx_cheat_info_t cheat_info;
cheat_info.index = idx++;
cheat_info.enabled = true;
cheat_info.code = handle->cheats[i].code;
core_ctl(CORE_CTL_RETRO_CHEAT_SET, &cheat_info);
}
}
#ifdef HAVE_CHEEVOS

View File

@ -174,6 +174,12 @@ bool core_ctl(enum core_ctl_state state, void *data)
switch (state)
{
case CORE_CTL_RETRO_CHEAT_SET:
{
retro_ctx_cheat_info_t *info = (retro_ctx_cheat_info_t*)data;
core.retro_cheat_set(info->index, info->enabled, info->code);
}
break;
case CORE_CTL_RETRO_CHEAT_RESET:
core.retro_cheat_reset();
break;

View File

@ -80,6 +80,8 @@ enum core_ctl_state
CORE_CTL_RETRO_SYMBOLS_INIT,
CORE_CTL_RETRO_CHEAT_SET,
CORE_CTL_RETRO_CHEAT_RESET,
CORE_CTL_RETRO_API_VERSION,
@ -106,6 +108,13 @@ enum core_ctl_state
CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE
};
typedef struct retro_ctx_cheat_info
{
unsigned index;
bool enabled;
const char *code;
} retro_ctx_cheat_info_t;
typedef struct retro_ctx_api_info
{
unsigned version;