Merge pull request #11334 from Jamiras/rcheevos_runtime

(cheevos) use rcheevos for trigger management
This commit is contained in:
Autechre 2020-09-15 17:31:16 +02:00 committed by GitHub
commit fb0c6899ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 406 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

@ -7,6 +7,8 @@
#include <string/stdstring.h>
#include <compat/strl.h>
#include "../deps/rcheevos/include/rcheevos.h"
/* C89 wants only int values in enums. */
#define CHEEVOS_JSON_KEY_GAMEID 0xb4960eecU
#define CHEEVOS_JSON_KEY_ACHIEVEMENTS 0x69749ae1U
@ -407,25 +409,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 +700,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