all repos — mgba @ 669075582d19bac1e67286013bdab26ffa1efab0

mGBA Game Boy Advance Emulator

include/mgba/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 <mgba-util/common.h>
10
11CXX_GUARD_START
12
13enum mStateExtdataTag {
14	EXTDATA_NONE = 0,
15	EXTDATA_SCREENSHOT = 1,
16	EXTDATA_SAVEDATA = 2,
17	EXTDATA_CHEATS = 3,
18	EXTDATA_RTC = 4,
19	EXTDATA_MAX
20};
21
22#define SAVESTATE_SCREENSHOT 1
23#define SAVESTATE_SAVEDATA   2
24#define SAVESTATE_CHEATS     4
25#define SAVESTATE_RTC        8
26
27struct mStateExtdataItem {
28	int32_t size;
29	void* data;
30	void (*clean)(void*);
31};
32
33struct mStateExtdata {
34	struct mStateExtdataItem data[EXTDATA_MAX];
35};
36
37bool mStateExtdataInit(struct mStateExtdata*);
38void mStateExtdataDeinit(struct mStateExtdata*);
39void mStateExtdataPut(struct mStateExtdata*, enum mStateExtdataTag, struct mStateExtdataItem*);
40bool mStateExtdataGet(struct mStateExtdata*, enum mStateExtdataTag, struct mStateExtdataItem*);
41
42struct VFile;
43bool mStateExtdataSerialize(struct mStateExtdata* extdata, struct VFile* vf);
44bool mStateExtdataDeserialize(struct mStateExtdata* extdata, struct VFile* vf);
45
46struct mCore;
47bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags);
48bool mCoreLoadStateNamed(struct mCore* core, struct VFile* vf, int flags);
49void* mCoreExtractState(struct mCore* core, struct VFile* vf, struct mStateExtdata* extdata);
50
51CXX_GUARD_END
52
53#endif