all repos — mgba @ 91eb813e564f9ddd1b60dfc371b2a6c793e46e14

mGBA Game Boy Advance Emulator

include/mgba/core/rewind.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_CORE_REWIND_H
 7#define M_CORE_REWIND_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba-util/vector.h>
14#ifndef DISABLE_THREADING
15#include <mgba-util/threading.h>
16#endif
17
18DECLARE_VECTOR(mCoreRewindPatches, struct PatchFast);
19
20struct VFile;
21struct mCoreRewindContext {
22	struct mCoreRewindPatches patchMemory;
23	size_t current;
24	size_t size;
25	struct VFile* previousState;
26	struct VFile* currentState;
27
28#ifndef DISABLE_THREADING
29	bool onThread;
30	Thread thread;
31	Condition cond;
32	Mutex mutex;
33	bool ready;
34#endif
35};
36
37void mCoreRewindContextInit(struct mCoreRewindContext*, size_t entries, bool onThread);
38void mCoreRewindContextDeinit(struct mCoreRewindContext*);
39
40struct mCore;
41void mCoreRewindAppend(struct mCoreRewindContext*, struct mCore*);
42bool mCoreRewindRestore(struct mCoreRewindContext*, struct mCore*);
43
44CXX_GUARD_END
45
46#endif