Core: Add creator metadata extdata to savestates

This commit is contained in:
Vicki Pfau 2022-01-04 03:55:28 -08:00
parent 398ee0c827
commit ea1abe2fcc
2 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@ enum mStateExtdataTag {
EXTDATA_CHEATS = 3,
EXTDATA_RTC = 4,
EXTDATA_META_TIME = 0x101,
EXTDATA_META_CREATOR = 0x102,
EXTDATA_MAX
};

View File

@ -8,6 +8,7 @@
#include <mgba/core/core.h>
#include <mgba/core/cheats.h>
#include <mgba/core/interface.h>
#include <mgba/core/version.h>
#include <mgba-util/memory.h>
#include <mgba-util/vfs.h>
@ -386,6 +387,15 @@ bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags) {
};
mStateExtdataPut(&extdata, EXTDATA_META_TIME, &item);
}
char creator[256];
snprintf(creator, sizeof(creator), "%s %s", projectName, projectVersion);
struct mStateExtdataItem item = {
.size = strlen(creator) + 1,
.data = strdup(creator),
.clean = free
};
mStateExtdataPut(&extdata, EXTDATA_META_CREATOR, &item);
}
if (flags & SAVESTATE_SAVEDATA) {