mirror of https://github.com/mgba-emu/mgba.git
Core: Add creator metadata extdata to savestates
This commit is contained in:
parent
398ee0c827
commit
ea1abe2fcc
|
@ -17,6 +17,7 @@ enum mStateExtdataTag {
|
||||||
EXTDATA_CHEATS = 3,
|
EXTDATA_CHEATS = 3,
|
||||||
EXTDATA_RTC = 4,
|
EXTDATA_RTC = 4,
|
||||||
EXTDATA_META_TIME = 0x101,
|
EXTDATA_META_TIME = 0x101,
|
||||||
|
EXTDATA_META_CREATOR = 0x102,
|
||||||
EXTDATA_MAX
|
EXTDATA_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <mgba/core/core.h>
|
#include <mgba/core/core.h>
|
||||||
#include <mgba/core/cheats.h>
|
#include <mgba/core/cheats.h>
|
||||||
#include <mgba/core/interface.h>
|
#include <mgba/core/interface.h>
|
||||||
|
#include <mgba/core/version.h>
|
||||||
#include <mgba-util/memory.h>
|
#include <mgba-util/memory.h>
|
||||||
#include <mgba-util/vfs.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);
|
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) {
|
if (flags & SAVESTATE_SAVEDATA) {
|
||||||
|
|
Loading…
Reference in New Issue