mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Turn cheat_manager_new into static function
This commit is contained in:
parent
c142b123a1
commit
6dc267ef1c
63
cheats.c
63
cheats.c
@ -177,6 +177,38 @@ bool cheat_manager_save(const char *path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cheat_manager_t *cheat_manager_new(unsigned size)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
cheat_manager_t *handle = (cheat_manager_t*)
|
||||||
|
calloc(1, sizeof(struct cheat_manager));
|
||||||
|
|
||||||
|
if (!handle)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
handle->buf_size = size;
|
||||||
|
handle->size = size;
|
||||||
|
handle->cheats = (struct item_cheat*)
|
||||||
|
calloc(handle->buf_size, sizeof(struct item_cheat));
|
||||||
|
|
||||||
|
if (!handle->cheats)
|
||||||
|
{
|
||||||
|
handle->buf_size = 0;
|
||||||
|
handle->size = 0;
|
||||||
|
handle->cheats = NULL;
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < handle->size; i++)
|
||||||
|
{
|
||||||
|
handle->cheats[i].desc = NULL;
|
||||||
|
handle->cheats[i].code = NULL;
|
||||||
|
handle->cheats[i].state = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
bool cheat_manager_load(const char *path)
|
bool cheat_manager_load(const char *path)
|
||||||
{
|
{
|
||||||
unsigned cheats = 0, i;
|
unsigned cheats = 0, i;
|
||||||
@ -230,37 +262,6 @@ bool cheat_manager_load(const char *path)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cheat_manager_t *cheat_manager_new(unsigned size)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
cheat_manager_t *handle = (cheat_manager_t*)
|
|
||||||
calloc(1, sizeof(struct cheat_manager));
|
|
||||||
|
|
||||||
if (!handle)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
handle->buf_size = size;
|
|
||||||
handle->size = size;
|
|
||||||
handle->cheats = (struct item_cheat*)
|
|
||||||
calloc(handle->buf_size, sizeof(struct item_cheat));
|
|
||||||
|
|
||||||
if (!handle->cheats)
|
|
||||||
{
|
|
||||||
handle->buf_size = 0;
|
|
||||||
handle->size = 0;
|
|
||||||
handle->cheats = NULL;
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < handle->size; i++)
|
|
||||||
{
|
|
||||||
handle->cheats[i].desc = NULL;
|
|
||||||
handle->cheats[i].code = NULL;
|
|
||||||
handle->cheats[i].state = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cheat_manager_realloc(unsigned new_size)
|
bool cheat_manager_realloc(unsigned new_size)
|
||||||
{
|
{
|
||||||
|
2
cheats.h
2
cheats.h
@ -27,8 +27,6 @@ typedef struct cheat_manager cheat_manager_t;
|
|||||||
|
|
||||||
unsigned cheat_manager_get_size(void);
|
unsigned cheat_manager_get_size(void);
|
||||||
|
|
||||||
cheat_manager_t *cheat_manager_new(unsigned size);
|
|
||||||
|
|
||||||
bool cheat_manager_load(const char *path);
|
bool cheat_manager_load(const char *path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user