mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Start using g_extern.cheat instead of having a separate cheat
manager in the menu struct
This commit is contained in:
parent
61c98d8893
commit
be5a76cb91
@ -166,7 +166,6 @@ void *menu_init(const void *data)
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
menu->shader = (struct gfx_shader*)calloc(1, sizeof(struct gfx_shader));
|
||||
#endif
|
||||
menu->cheats = cheat_manager_new(0);
|
||||
menu->push_start_screen = g_settings.menu_show_start_screen;
|
||||
g_settings.menu_show_start_screen = false;
|
||||
|
||||
@ -219,10 +218,6 @@ void menu_free(void *data)
|
||||
menu->shader = NULL;
|
||||
#endif
|
||||
|
||||
if (menu->cheats)
|
||||
cheat_manager_free(menu->cheats);
|
||||
menu->cheats = NULL;
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->free)
|
||||
driver.menu_ctx->free(menu);
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include "menu_list.h"
|
||||
#include "../cheats.h"
|
||||
#include "../settings_list.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -109,7 +108,6 @@ typedef struct
|
||||
bool load_no_content;
|
||||
|
||||
struct gfx_shader *shader;
|
||||
cheat_manager_t *cheats;
|
||||
|
||||
struct menu_bind_state binds;
|
||||
|
||||
|
@ -273,7 +273,7 @@ static int action_ok_shader_apply_changes(const char *path,
|
||||
static int action_ok_cheat_apply_changes(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
cheat_manager_t *cheat = driver.menu->cheats;
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
|
||||
if (!cheat)
|
||||
return -1;
|
||||
@ -1198,7 +1198,7 @@ static int action_start_shader_num_passes(unsigned type, const char *label,
|
||||
static int action_start_cheat_num_passes(unsigned type, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
cheat_manager_t *cheat = driver.menu->cheats;
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
|
||||
if (!cheat)
|
||||
return -1;
|
||||
@ -1216,7 +1216,7 @@ static int action_toggle_cheat_num_passes(unsigned type, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
unsigned new_size = 0;
|
||||
cheat_manager_t *cheat = driver.menu->cheats;
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
|
||||
if (!cheat)
|
||||
return -1;
|
||||
@ -1896,14 +1896,23 @@ static int deferred_push_core_cheat_options(void *data, void *userdata,
|
||||
{
|
||||
unsigned i;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
cheat_manager_t *cheat = driver.menu->cheats;
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
|
||||
(void)userdata;
|
||||
(void)type;
|
||||
|
||||
if (!list || !cheat)
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
if (!cheat)
|
||||
{
|
||||
g_extern.cheat = cheat_manager_new(0);
|
||||
|
||||
if (!g_extern.cheat)
|
||||
return -1;
|
||||
cheat = g_extern.cheat;
|
||||
}
|
||||
|
||||
menu_list_clear(list);
|
||||
menu_list_push(list, "Cheat File Load", "cheat_file_load",
|
||||
MENU_SETTING_ACTION, 0);
|
||||
|
@ -113,7 +113,7 @@ void st_string_callback(void *userdata, const char *str)
|
||||
void st_cheat_callback(void *userdata, const char *str)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||
cheat_manager_t *cheat = (cheat_manager_t*)menu->cheats;
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
|
||||
if (cheat && str && *str)
|
||||
{
|
||||
|
@ -2399,16 +2399,16 @@ void setting_data_get_label(char *type_str,
|
||||
else
|
||||
#endif
|
||||
if (!strcmp(label, "cheat_num_passes"))
|
||||
snprintf(type_str, type_str_size, "%u", driver.menu->cheats->buf_size);
|
||||
snprintf(type_str, type_str_size, "%u", g_extern.cheat->buf_size);
|
||||
else if (type >= MENU_SETTINGS_CHEAT_BEGIN
|
||||
&& type <= MENU_SETTINGS_CHEAT_END)
|
||||
{
|
||||
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
|
||||
if (cheat_index < driver.menu->cheats->buf_size)
|
||||
if (cheat_index < g_extern.cheat->buf_size)
|
||||
snprintf(type_str, type_str_size, "%s",
|
||||
(
|
||||
(driver.menu->cheats->cheats[cheat_index].code != NULL)
|
||||
) ? driver.menu->cheats->cheats[cheat_index].code : "N/A");
|
||||
(g_extern.cheat->cheats[cheat_index].code != NULL)
|
||||
) ? g_extern.cheat->cheats[cheat_index].code : "N/A");
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
|
||||
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
||||
|
Loading…
x
Reference in New Issue
Block a user