forked from ruedigergad/emumaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-patch.patch
158 lines (144 loc) · 3.76 KB
/
enable-patch.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
diff --git a/src/emumaster.pro b/src/emumaster.pro
index 498c60c..87b767b 100644
--- a/src/emumaster.pro
+++ b/src/emumaster.pro
@@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += \
base \
- amiga snes gba \
+ nes pico amiga snes gba \
diskgallery
# nes gba snes psx amiga pico \
diff --git a/src/nes/cheats.cpp b/src/nes/cheats.cpp
index 8dab161..9287a08 100644
--- a/src/nes/cheats.cpp
+++ b/src/nes/cheats.cpp
@@ -131,11 +131,9 @@ QValidator::State GameGenieValidator::validate(QString &input, int &pos) const
NesCheats::NesCheats()
{
- QHash<int, QByteArray> roles;
- roles.insert(CodeRole, "code");
- roles.insert(DescriptionRole, "codeDescription");
- roles.insert(EnableRole, "codeEnabled");
- setRoleNames(roles);
+ _roles.insert(CodeRole, "code");
+ _roles.insert(DescriptionRole, "codeDescription");
+ _roles.insert(EnableRole, "codeEnabled");
}
void NesCheats::sl()
@@ -147,8 +145,9 @@ void NesCheats::sl()
emsl.end();
if (!emsl.save) {
+ beginResetModel();
setCurrent(enabledList());
- reset();
+ endResetModel();
}
}
diff --git a/src/nes/cheats.h b/src/nes/cheats.h
index ed84835..42dff58 100644
--- a/src/nes/cheats.h
+++ b/src/nes/cheats.h
@@ -75,12 +75,15 @@ public:
Q_INVOKABLE void setEnabled(int i, bool on);
Q_INVOKABLE void addNew(const QString &code, const QString &description);
Q_INVOKABLE void removeAt(int i);
+
+ virtual QHash<int, QByteArray> roleNames() const { return _roles; }
private:
void setCurrent(const QList<GameGenieCode> &codes);
QStringList m_codes;
QStringList m_descriptions;
QList<bool> m_enable;
+ QHash<int, QByteArray> _roles;
};
extern NesCheats nesCheats;
diff --git a/src/nes/disk.cpp b/src/nes/disk.cpp
index 5beec17..d1229e3 100644
--- a/src/nes/disk.cpp
+++ b/src/nes/disk.cpp
@@ -17,7 +17,7 @@
#include "disk.h"
#include "mapper.h"
#include <base/crc32.h>
-#include <QAbstractFileEngine>
+#include <QFile>
class NesDiskHeader
{
diff --git a/src/nes/mapper/mapper018.h b/src/nes/mapper/mapper018.h
index c4ac3f6..ba79c58 100644
--- a/src/nes/mapper/mapper018.h
+++ b/src/nes/mapper/mapper018.h
@@ -19,6 +19,14 @@
#include "../mapper.h"
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
class Mapper018 : public NesMapper
{
public:
diff --git a/src/nes/nes.cpp b/src/nes/nes.cpp
index 7993b32..09f1193 100644
--- a/src/nes/nes.cpp
+++ b/src/nes/nes.cpp
@@ -31,8 +31,9 @@
#include <base/emuview.h>
#include <base/configuration.h>
#include <QSettings>
-#include <QApplication>
-#include <qdeclarative.h>
+#include <QGuiApplication>
+#include <QQuickView>
+#include <QtQml>
NesEmu nesEmu;
SystemType nesSystemType;
@@ -289,11 +290,14 @@ int main(int argc, char *argv[])
{
if (argc < 2)
return -1;
- QApplication app(argc, argv);
qmlRegisterType<NesPpu>();
- EmuView view(&nesEmu, argv[1]);
+ QGuiApplication *app = new QGuiApplication(argc, argv);
+ QQuickView *view = new QQuickView();
+
+ EmuView emuView(&nesEmu, argv[1], view);
#if defined(ENABLE_DEBUGGING)
- view.disableSafetyTimer();
+ emuView.disableSafetyTimer();
#endif
- return app.exec();
+
+ return app->exec();
}
diff --git a/src/pico/pico.cpp b/src/pico/pico.cpp
index 8f9e52b..5fa1da5 100644
--- a/src/pico/pico.cpp
+++ b/src/pico/pico.cpp
@@ -13,7 +13,8 @@
#include <base/pathmanager.h>
#include <base/emuview.h>
#include <QImage>
-#include <QApplication>
+#include <QGuiApplication>
+#include <QQuickView>
#include <QFile>
#include <QDir>
@@ -649,7 +650,9 @@ int main(int argc, char *argv[])
{
if (argc < 2)
return -1;
- QApplication app(argc, argv);
- EmuView view(&picoEmu, argv[1]);
- return app.exec();
+ QGuiApplication *app = new QGuiApplication(argc, argv);
+ QQuickView *view = new QQuickView();
+
+ EmuView emuView(&picoEmu, argv[1], view);
+ return app->exec();
}