diff --git a/cheats.c b/cheats.c index 3076c0e2af..1f345afb0c 100644 --- a/cheats.c +++ b/cheats.c @@ -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 diff --git a/libretro_version_1.c b/libretro_version_1.c index 91fddfedd0..339658fa32 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -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; diff --git a/libretro_version_1.h b/libretro_version_1.h index cfda123a0d..dd164cb0e7 100644 --- a/libretro_version_1.h +++ b/libretro_version_1.h @@ -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;