all repos — mgba @ 253719d7a14e0002c8e987beff4c6a6a3604704f

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	int stateFlags;
26	struct VFile* previousState;
27	struct VFile* currentState;
28
29#ifndef DISABLE_THREADING
30	bool onThread;
31	Thread thread;
32	Condition cond;
33	Mutex mutex;
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