all repos — mgba @ 62f6471c0d4cbf5a7b0849ac7b030759bf0da5e7

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
10extern "C" {
11#include "gba-thread.h"
12#ifdef BUILD_SDL
13#include "sdl-events.h"
14#endif
15}
16
17struct GBAAudio;
18struct GBAVideoSoftwareRenderer;
19
20class QThread;
21
22namespace QGBA {
23
24class AudioProcessor;
25
26class GameController : public QObject {
27Q_OBJECT
28
29public:
30	GameController(QObject* parent = nullptr);
31	~GameController();
32
33	const uint32_t* drawContext() const { return m_drawContext; }
34
35	bool isPaused();
36
37#ifdef USE_GDB_STUB
38	ARMDebugger* debugger();
39	void setDebugger(ARMDebugger*);
40#endif
41
42signals:
43	void frameAvailable(const uint32_t*);
44	void gameStarted(GBAThread*);
45	void gameStopped(GBAThread*);
46
47public slots:
48	void loadGame(const QString& path);
49	void closeGame();
50	void setPaused(bool paused);
51	void frameAdvance();
52	void keyPressed(int key);
53	void keyReleased(int key);
54
55#ifdef BUILD_SDL
56private slots:
57	void testSDLEvents();
58
59private:
60	GBASDLEvents m_sdlEvents;
61	int m_activeButtons;
62#endif
63
64private:
65	void updateKeys();
66
67	uint32_t* m_drawContext;
68	GBAThread m_threadContext;
69	GBAVideoSoftwareRenderer* m_renderer;
70	int m_activeKeys;
71
72	QFile* m_rom;
73	QFile* m_bios;
74
75	QThread* m_audioThread;
76	AudioProcessor* m_audioProcessor;
77
78	QMutex m_pauseMutex;
79	bool m_pauseAfterFrame;
80};
81
82}
83
84#endif