diff --git a/cheat_manager.c b/cheat_manager.c index 4e18ec7be1..9be65585ae 100644 --- a/cheat_manager.c +++ b/cheat_manager.c @@ -933,13 +933,13 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, size_t idx, bool w offset += cheat_st->memory_size_list[i]; } + runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + cheat_st->memory_search_initialized = true; } cheat_st->memory_initialized = true; - runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - #ifdef HAVE_MENU if (!wraparound) menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH @@ -1028,7 +1028,7 @@ static int cheat_manager_search(enum cheat_search_type search_type) struct menu_state *menu_st = menu_state_get_ptr(); #endif - if (cheat_st->num_memory_buffers == 0) + if (cheat_st->num_memory_buffers == 0 || prev == NULL || cheat_st->matches == NULL) { runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_NOT_INITIALIZED), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); return 0; diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 129bec8196..6c69f7da7c 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -744,6 +744,11 @@ void rcheevos_reset_game(bool widgets_ready) rcheevos_init_memory(&rcheevos_locals); } +void rcheevos_refresh_memory() +{ + rcheevos_init_memory(&rcheevos_locals); +} + bool rcheevos_hardcore_active(void) { return rcheevos_locals.hardcore_active; diff --git a/cheevos/cheevos.h b/cheevos/cheevos.h index 9d8c341044..2922befdc7 100644 --- a/cheevos/cheevos.h +++ b/cheevos/cheevos.h @@ -37,6 +37,7 @@ bool rcheevos_unload(void); void rcheevos_test(void); void rcheevos_reset_game(bool widgets_ready); +void rcheevos_refresh_memory(); void rcheevos_pause_hardcore(void); void rcheevos_hardcore_enabled_changed(void); diff --git a/libretro-common/include/libretro.h b/libretro-common/include/libretro.h index 6aaefc88be..2ac9f7bab9 100644 --- a/libretro-common/include/libretro.h +++ b/libretro-common/include/libretro.h @@ -928,8 +928,6 @@ enum retro_mod * anything else. * It is recommended to expose all relevant pointers through * retro_get_memory_* as well. - * - * Can be called from retro_init and retro_load_game. */ #define RETRO_ENVIRONMENT_SET_GEOMETRY 37 /* const struct retro_game_geometry * -- diff --git a/runloop.c b/runloop.c index a396ddc3a6..2862a91163 100644 --- a/runloop.c +++ b/runloop.c @@ -2832,6 +2832,17 @@ bool runloop_environment_cb(unsigned cmd, void *data) mmap_preprocess_descriptors(descriptors, mmaps->num_descriptors); +#ifdef HAVE_CHEEVOS + rcheevos_refresh_memory(); +#endif +#ifdef HAVE_CHEATS + if (cheat_manager_state.memory_initialized) + { + cheat_manager_initialize_memory(NULL, 0, true); + cheat_manager_apply_retro_cheats(); + } +#endif + if (log_level != RETRO_LOG_DEBUG) break;