all repos — mgba @ c662b59e9942bfffd69ed6754cc334de86f89e63

mGBA Game Boy Advance Emulator

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