all repos — mgba @ fa884d071ecaa3e05ff20b45a67bf9500dd3d6b6

mGBA Game Boy Advance Emulator

include/mgba/core/lockstep.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 SIO_LOCKSTEP_H
 7#define SIO_LOCKSTEP_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13enum mLockstepPhase {
14	TRANSFER_IDLE = 0,
15	TRANSFER_STARTING,
16	TRANSFER_STARTED,
17	TRANSFER_FINISHING,
18	TRANSFER_FINISHED
19};
20
21struct mLockstep {
22	int attached;
23	enum mLockstepPhase transferActive;
24	int32_t transferCycles;
25
26	bool (*signal)(struct mLockstep*, unsigned mask);
27	bool (*wait)(struct mLockstep*, unsigned mask);
28	void (*addCycles)(struct mLockstep*, int id, int32_t cycles);
29	int32_t (*useCycles)(struct mLockstep*, int id, int32_t cycles);
30	void (*unload)(struct mLockstep*, int id);
31	void* context;
32#ifndef NDEBUG
33	int transferId;
34#endif
35};
36
37void mLockstepInit(struct mLockstep*);
38
39CXX_GUARD_END
40
41#endif