all repos — mgba @ e1a8befcbb4cd4f7b5f5239563f4a3e1d49dfd5f

mGBA Game Boy Advance Emulator

src/gba/sio/lockstep.h (view raw)

 1/* Copyright (c) 2013-2015 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 "gba/sio.h"
10
11#include "util/threading.h"
12
13struct GBASIOLockstep {
14	struct GBASIOLockstepNode* players[MAX_GBAS];
15	int attached;
16
17	uint16_t data[MAX_GBAS];
18	Mutex mutex;
19	Condition barrier;
20};
21
22struct GBASIOLockstepNode {
23	struct GBASIODriver d;
24	struct GBASIOLockstep* p;
25};
26
27void GBASIOLockstepInit(struct GBASIOLockstep*);
28void GBASIOLockstepDeinit(struct GBASIOLockstep*);
29
30void GBASIOLockstepNodeCreate(struct GBASIOLockstepNode*);
31
32bool GBASIOLockstepAttachNode(struct GBASIOLockstep*, struct GBASIOLockstepNode*);
33void GBASIOLockstepDetachNode(struct GBASIOLockstep*, struct GBASIOLockstepNode*);
34
35#endif