all repos — mgba @ daaa2fa5236df5e8976e7e0ba7ac39e0d9233422

mGBA Game Boy Advance Emulator

src/core/serialize.h (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef M_SERIALIZE_H
 7#define M_SERIALIZE_H
 8
 9#include "util/common.h"
10
11enum mStateExtdataTag {
12	EXTDATA_NONE = 0,
13	EXTDATA_SCREENSHOT = 1,
14	EXTDATA_SAVEDATA = 2,
15	EXTDATA_CHEATS = 3,
16	EXTDATA_MAX
17};
18
19#define SAVESTATE_SCREENSHOT 1
20#define SAVESTATE_SAVEDATA   2
21#define SAVESTATE_CHEATS     4
22
23struct mStateExtdataItem {
24	int32_t size;
25	void* data;
26	void (*clean)(void*);
27};
28
29struct mStateExtdata {
30	struct mStateExtdataItem data[EXTDATA_MAX];
31};
32
33bool mStateExtdataInit(struct mStateExtdata*);
34void mStateExtdataDeinit(struct mStateExtdata*);
35void mStateExtdataPut(struct mStateExtdata*, enum mStateExtdataTag, struct mStateExtdataItem*);
36bool mStateExtdataGet(struct mStateExtdata*, enum mStateExtdataTag, struct mStateExtdataItem*);
37
38struct VFile;
39bool mStateExtdataSerialize(struct mStateExtdata* extdata, struct VFile* vf);
40bool mStateExtdataDeserialize(struct mStateExtdata* extdata, struct VFile* vf);
41
42struct mCore;
43bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags);
44bool mCoreLoadStateNamed(struct mCore* core, struct VFile* vf, int flags);
45void* mCoreExtractState(struct mCore* core, struct VFile* vf, struct mStateExtdata* extdata);
46
47#endif