mgba/src/gba/gba-thread.h

46 lines
966 B
C
Raw Normal View History

2013-04-20 22:54:09 +00:00
#ifndef GBA_THREAD_H
#define GBA_THREAD_H
#include <pthread.h>
struct GBAThread {
2013-04-20 23:16:37 +00:00
// Output
int started;
2013-09-22 01:10:13 +00:00
int useDebugger;
2013-04-20 22:54:09 +00:00
struct GBA* gba;
struct ARMDebugger* debugger;
2013-04-20 23:16:37 +00:00
// Input
struct GBAVideoRenderer* renderer;
2013-04-20 22:54:09 +00:00
int fd;
const char* fname;
2013-04-21 07:35:21 +00:00
int activeKeys;
2013-10-05 09:11:53 +00:00
int frameskip;
// Threading state
2013-04-20 23:44:03 +00:00
pthread_t thread;
2013-10-05 09:11:53 +00:00
pthread_mutex_t startMutex;
pthread_cond_t startCond;
struct GBASync {
int videoFramePending;
int videoFrameWait;
int videoFrameSkip;
pthread_mutex_t videoFrameMutex;
pthread_cond_t videoFrameAvailableCond;
pthread_cond_t videoFrameRequiredCond;
} sync;
2013-04-20 22:54:09 +00:00
};
2013-04-20 23:44:03 +00:00
int GBAThreadStart(struct GBAThread* threadContext);
void GBAThreadJoin(struct GBAThread* threadContext);
2013-09-30 08:42:31 +00:00
struct GBAThread* GBAThreadGetContext(void);
2013-04-20 22:54:09 +00:00
2013-10-05 09:11:53 +00:00
void GBASyncPostFrame(struct GBASync* sync);
void GBASyncWaitFrameStart(struct GBASync* sync, int frameskip);
void GBASyncWaitFrameEnd(struct GBASync* sync);
int GBASyncDrawingFrame(struct GBASync* sync);
2013-04-20 22:54:09 +00:00
#endif