let rc_runtime_t manage triggers

This commit is contained in:
Jamiras 2020-08-26 12:38:36 -06:00
parent 5838817bbd
commit 0d6f0e4826
4 changed files with 404 additions and 442 deletions

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,8 @@ typedef struct rcheevos_ctx_desc
enum
{
RCHEEVOS_ACTIVE_SOFTCORE = 1 << 0,
RCHEEVOS_ACTIVE_HARDCORE = 1 << 1
RCHEEVOS_ACTIVE_HARDCORE = 1 << 1,
RCHEEVOS_ACTIVE_UNOFFICIAL = 1 << 2
};
bool rcheevos_load(const void *data);

View File

@ -407,25 +407,30 @@ static int rcheevos_new_cheevo(rcheevos_readud_t* ud)
static int rcheevos_new_lboard(rcheevos_readud_t* ud)
{
rcheevos_ralboard_t* lboard = ud->patchdata->lboards + ud->lboard_count++;
char format[32];
lboard->title = rcheevos_unescape_string(ud->title.string, ud->title.length);
lboard->description = rcheevos_unescape_string(ud->desc.string, ud->desc.length);
lboard->format = rcheevos_unescape_string(ud->format.string, ud->format.length);
lboard->mem = rcheevos_unescape_string(ud->memaddr.string, ud->memaddr.length);
lboard->id = (unsigned)strtol(ud->id.string, NULL, 10);
if ( !lboard->title
|| !lboard->description
|| !lboard->format
|| !lboard->mem)
{
CHEEVOS_FREE(lboard->title);
CHEEVOS_FREE(lboard->description);
CHEEVOS_FREE(lboard->format);
CHEEVOS_FREE(lboard->mem);
return -1;
}
if (ud->format.length > 0 && ud->format.length < sizeof(format) - 1)
{
memcpy(format, ud->format.string, ud->format.length);
format[ud->format.length] = '\0';
lboard->format = rc_parse_format(format);
}
return 0;
}
@ -693,7 +698,6 @@ void rcheevos_free_patchdata(rcheevos_rapatchdata_t* patchdata)
{
CHEEVOS_FREE(lboard->title);
CHEEVOS_FREE(lboard->description);
CHEEVOS_FREE(lboard->format);
CHEEVOS_FREE(lboard->mem);
}

View File

@ -32,15 +32,16 @@ typedef struct
const char* memaddr;
unsigned points;
unsigned id;
unsigned active;
} rcheevos_racheevo_t;
typedef struct
{
const char* title;
const char* description;
const char* format;
const char* mem;
unsigned id;
unsigned format;
} rcheevos_ralboard_t;
typedef struct