all repos — mgba @ edc6de046743bfdc777d46eeb9e5ce482b74b9d7

mGBA Game Boy Advance Emulator

src/platform/qt/GameController.h (view raw)

 1#ifndef QGBA_GAME_CONTROLLER
 2#define QGBA_GAME_CONTROLLER
 3
 4#include <QFile>
 5#include <QImage>
 6#include <QObject>
 7#include <QMutex>
 8#include <QString>
 9
10#include "AudioDevice.h"
11
12extern "C" {
13#include "gba-thread.h"
14}
15
16struct GBAAudio;
17struct GBAVideoSoftwareRenderer;
18
19namespace QGBA {
20
21class GameController : public QObject {
22Q_OBJECT
23
24public:
25	GameController(QObject* parent = nullptr);
26	~GameController();
27
28	const uint32_t* drawContext() const { return m_drawContext; }
29
30	bool isPaused();
31
32#ifdef USE_GDB_STUB
33	ARMDebugger* debugger();
34	void setDebugger(ARMDebugger*);
35#endif
36
37signals:
38	void frameAvailable(const uint32_t*);
39	void gameStarted(GBAThread*);
40	void gameStopped(GBAThread*);
41
42public slots:
43	void loadGame(const QString& path);
44	void closeGame();
45	void setPaused(bool paused);
46	void frameAdvance();
47	void keyPressed(int key);
48	void keyReleased(int key);
49
50private:
51	void setupAudio(GBAAudio* audio);
52
53	uint32_t* m_drawContext;
54	AudioDevice* m_audioContext;
55	GBAThread m_threadContext;
56	GBAVideoSoftwareRenderer* m_renderer;
57
58	QFile* m_rom;
59	QFile* m_bios;
60
61	QMutex m_pauseMutex;
62	bool m_pauseAfterFrame;
63};
64
65}
66
67#endif