all repos — mgba @ 5167fce4c70711a221c4179ae245aca19b6f394a

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	bool ready;
35#endif
36};
37
38void mCoreRewindContextInit(struct mCoreRewindContext*, size_t entries, bool onThread);
39void mCoreRewindContextDeinit(struct mCoreRewindContext*);
40
41struct mCore;
42void mCoreRewindAppend(struct mCoreRewindContext*, struct mCore*);
43bool mCoreRewindRestore(struct mCoreRewindContext*, struct mCore*);
44
45CXX_GUARD_END
46
47#endif