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 = 0);
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 audioDeviceAvailable(GBAAudio*);
40 void gameStarted(GBAThread*);
41
42public slots:
43 void loadGame(const QString& path);
44 void setPaused(bool paused);
45 void frameAdvance();
46 void keyPressed(int key);
47 void keyReleased(int key);
48
49private:
50 void setupAudio(GBAAudio* audio);
51
52 uint32_t* m_drawContext;
53 AudioDevice* m_audioContext;
54 GBAThread m_threadContext;
55 GBAVideoSoftwareRenderer* m_renderer;
56
57 QFile* m_rom;
58 QFile* m_bios;
59
60 QMutex m_pauseMutex;
61 bool m_pauseAfterFrame;
62};
63
64}
65
66#endif