mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 04:49:14 +12:00
Use message queues
This commit is contained in:
parent
63f54478f0
commit
a473a34794
7 changed files with 266 additions and 269 deletions
|
@ -17,12 +17,19 @@
|
|||
#include "panda_qt/text_editor.hpp"
|
||||
#include "services/hid.hpp"
|
||||
|
||||
struct CheatMessage
|
||||
{
|
||||
u32 handle;
|
||||
std::vector<uint8_t> cheat;
|
||||
std::function<void(u32)> callback;
|
||||
};
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
// Types of messages we might send from the GUI thread to the emulator thread
|
||||
enum class MessageType { LoadROM, Reset, Pause, Resume, TogglePause, DumpRomFS, PressKey, ReleaseKey, LoadLuaScript };
|
||||
enum class MessageType { LoadROM, Reset, Pause, Resume, TogglePause, DumpRomFS, PressKey, ReleaseKey, LoadLuaScript, EditCheat };
|
||||
|
||||
// Tagged union representing our message queue messages
|
||||
struct EmulatorMessage {
|
||||
|
@ -40,6 +47,10 @@ class MainWindow : public QMainWindow {
|
|||
struct {
|
||||
std::string* str;
|
||||
} string;
|
||||
|
||||
struct {
|
||||
CheatMessage* c;
|
||||
} cheat;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -59,8 +70,6 @@ class MainWindow : public QMainWindow {
|
|||
TextEditorWindow* luaEditor;
|
||||
QMenuBar* menuBar = nullptr;
|
||||
|
||||
QAction* cheatsEditorAction = nullptr;
|
||||
|
||||
void swapEmuBuffer();
|
||||
void emuThreadMainLoop();
|
||||
void selectLuaFile();
|
||||
|
@ -83,4 +92,5 @@ class MainWindow : public QMainWindow {
|
|||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
void loadLuaScript(const std::string& code);
|
||||
void editCheat(u32 handle, const std::vector<uint8_t>& cheat, const std::function<void(u32)>& callback);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue