File tree 4 files changed +34
-0
lines changed
4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ static HANDLE s_kickEvent = nullptr;
59
59
static std::shared_mutex s_listLock;
60
60
static unsigned s_numOpened = 0 ;
61
61
62
+ static PCSX::GUI* s_gui = nullptr ;
63
+
62
64
PCSX::FTDI::Device::~Device () {
63
65
assert (m_private->m_state == Private::DeviceData::STATE_CLOSED);
64
66
assert (!m_private->m_event );
@@ -189,4 +191,6 @@ void PCSX::FTDI::Devices::stopThread() {
189
191
190
192
bool PCSX::FTDI::Devices::isThreadRunning () { return s_threadRunning; }
191
193
194
+ void PCSX::FTDI::Devices::setGUI (GUI* gui) { s_gui = gui; }
195
+
192
196
#endif
Original file line number Diff line number Diff line change 21
21
22
22
#include < stdint.h>
23
23
24
+ #include < atomic>
24
25
#include < functional>
25
26
#include < string>
26
27
#include < vector>
27
28
29
+ #include " gui/gui.h"
30
+ #include " support/slice.h"
31
+
28
32
namespace PCSX {
29
33
30
34
namespace FTDI {
@@ -60,6 +64,27 @@ class Device {
60
64
61
65
Private::DeviceData* m_private;
62
66
67
+ static const unsigned SLICES_COUNT = 256 ;
68
+ Slice m_slices[SLICES_COUNT];
69
+ std::atomic_uint16_t m_slicesIndexes = 0 ;
70
+
71
+ unsigned usedSlices () {
72
+ uint16_t indexes = m_slicesIndexes.load ();
73
+ unsigned first = indexes & 0xff ;
74
+ unsigned last = (indexes >> 8 ) & 0xff ;
75
+ if (last < first) last += 256 ;
76
+ return last - first;
77
+ }
78
+
79
+ unsigned availableSlices () { return 256 - usedSlices (); }
80
+
81
+ Slice& allocateSlice () {
82
+ while (availableSlices () == 0 )
83
+ ;
84
+ uint16_t indexes = m_slicesIndexes.fetch_add (0x100 );
85
+ return m_slices[(indexes >> 8 ) & 0xff ];
86
+ }
87
+
63
88
friend class Devices ;
64
89
};
65
90
@@ -70,6 +95,7 @@ class Devices {
70
95
static bool isThreadRunning ();
71
96
static void startThread ();
72
97
static void stopThread ();
98
+ static void setGUI (GUI*);
73
99
74
100
// technically private, but difficult to enforce properly
75
101
static void threadProc ();
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ class GUI final {
105
105
}
106
106
}
107
107
108
+ uv_loop_t &loop ();
109
+
108
110
private:
109
111
GLFWwindow *m_window = nullptr ;
110
112
int &m_glfwPosX = settings.get<WindowPosX>().value;
Original file line number Diff line number Diff line change 30
30
#include " core/r3000a.h"
31
31
#include " core/sstate.h"
32
32
#include " flags.h"
33
+ #include " ftdi/abstract.h"
33
34
#include " gui/gui.h"
34
35
#include " spu/interface.h"
35
36
#include " support/slice.h"
@@ -197,6 +198,7 @@ int main(int argc, char **argv) {
197
198
LoadPlugins ();
198
199
PCSX::g_emulator.m_gpu ->open (s_gui);
199
200
PCSX::g_emulator.m_spu ->open ();
201
+ PCSX::FTDI::setGUI (s_gui);
200
202
201
203
PCSX::g_emulator.EmuInit ();
202
204
PCSX::g_emulator.EmuReset ();
You can’t perform that action at this time.
0 commit comments