File tree Expand file tree Collapse file tree 6 files changed +103
-5
lines changed Expand file tree Collapse file tree 6 files changed +103
-5
lines changed Original file line number Diff line number Diff line change 17
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
18
18
***************************************************************************/
19
19
20
+ #ifdef _WIN32
21
+
22
+ #define WIN32_LEAN_AND_MEAN
23
+ #include " ftd2xx.h"
20
24
#include " ftdi/abstract.h"
25
+
26
+ static std::vector<PCSX::FTDI::Device> s_devices;
27
+
28
+ void PCSX::FTDI::DeviceList::scan () {
29
+ FT_STATUS status;
30
+ DWORD numDevs = 0 ;
31
+
32
+ s_devices.clear ();
33
+ status = FT_CreateDeviceInfoList (&numDevs);
34
+
35
+ if (status != FT_OK || numDevs == 0 ) return ;
36
+
37
+ FT_DEVICE_LIST_INFO_NODE* nodes = new FT_DEVICE_LIST_INFO_NODE[numDevs];
38
+
39
+ status = FT_GetDeviceInfoList (nodes, &numDevs);
40
+
41
+ if (status == FT_OK && numDevs != 0 ) {
42
+ s_devices.resize (numDevs);
43
+ for (DWORD i = 0 ; i < numDevs; i++) {
44
+ const FT_DEVICE_LIST_INFO_NODE* n = nodes + i;
45
+ s_devices[i].m_locked = n->Flags & FT_FLAGS_OPENED;
46
+ s_devices[i].m_highSpeed = n->Flags & FT_FLAGS_HISPEED;
47
+ s_devices[i].m_vendorID = (n->ID >> 16 ) & 0xffff ;
48
+ s_devices[i].m_deviceID = n->ID & 0xffff ;
49
+ s_devices[i].m_type = n->Type ;
50
+ s_devices[i].m_serial = n->SerialNumber ;
51
+ s_devices[i].m_description = n->Description ;
52
+ }
53
+ }
54
+
55
+ delete[] nodes;
56
+ }
57
+
58
+ const std::vector<PCSX::FTDI::Device>& PCSX::FTDI::DeviceList::get () { return s_devices; }
59
+
60
+ #endif
Original file line number Diff line number Diff line change 18
18
***************************************************************************/
19
19
20
20
#pragma once
21
+
22
+ #include < stdint.h>
23
+
24
+ #include < string>
25
+ #include < vector>
26
+
27
+ namespace PCSX {
28
+
29
+ namespace FTDI {
30
+
31
+ class DeviceList ;
32
+ class Device {
33
+ public:
34
+ bool isLocked () const { return m_locked; }
35
+ bool isHighSpeed () const { return m_highSpeed; }
36
+ uint16_t getVendorID () const { return m_vendorID; }
37
+ uint16_t getDeviceID () const { return m_deviceID; }
38
+ uint32_t getType () const { return m_type; }
39
+ const std::string& getSerial () const { return m_serial; }
40
+ const std::string& getDescription () const { return m_description; }
41
+
42
+ private:
43
+ bool m_locked = false ;
44
+ bool m_highSpeed = false ;
45
+ uint16_t m_vendorID = 0 ;
46
+ uint16_t m_deviceID = 0 ;
47
+ uint32_t m_type = 0 ;
48
+ std::string m_serial = " " ;
49
+ std::string m_description = " " ;
50
+ void * m_handle = nullptr ;
51
+
52
+ friend class DeviceList ;
53
+ };
54
+
55
+ class DeviceList {
56
+ public:
57
+ static void scan ();
58
+ static const std::vector<Device>& get ();
59
+ };
60
+
61
+ } // namespace FTDI
62
+
63
+ } // namespace PCSX
Original file line number Diff line number Diff line change @@ -465,6 +465,7 @@ void PCSX::GUI::endFrame() {
465
465
ImGui::MenuItem (_ (" Show ImGui Demo" ), nullptr , &m_showDemo);
466
466
ImGui::Separator ();
467
467
ImGui::MenuItem (_ (" About" ), nullptr , &m_showAbout);
468
+ ImGui::MenuItem (_ (" FTDI" ), nullptr , &m_showFTDI);
468
469
ImGui::EndMenu ();
469
470
}
470
471
ImGui::Separator ();
@@ -572,6 +573,10 @@ void PCSX::GUI::endFrame() {
572
573
m_breakpoints.draw (_ (" Breakpoints" ));
573
574
}
574
575
576
+ if (m_showFTDI) {
577
+ m_ftdi.draw (_ (" FTDI" ));
578
+ }
579
+
575
580
about ();
576
581
biosCounters ();
577
582
interruptsScaler ();
Original file line number Diff line number Diff line change 24
24
25
25
#include < string>
26
26
27
- #include " flags.h"
28
-
29
- #include " imgui.h"
30
- #include " imgui_memory_editor/imgui_memory_editor.h"
31
-
32
27
#include " core/system.h"
28
+ #include " flags.h"
33
29
#include " gui/widgets/assembly.h"
34
30
#include " gui/widgets/breakpoints.h"
35
31
#include " gui/widgets/filedialog.h"
32
+ #include " gui/widgets/ftdi.h"
36
33
#include " gui/widgets/log.h"
37
34
#include " gui/widgets/registers.h"
38
35
#include " gui/widgets/vram-viewer.h"
36
+ #include " imgui.h"
37
+ #include " imgui_memory_editor/imgui_memory_editor.h"
39
38
#include " main/settings.h"
40
39
41
40
#if defined(__MACOSX__)
@@ -132,6 +131,7 @@ class GUI final {
132
131
bool m_showDemo = false ;
133
132
bool m_showAbout = false ;
134
133
bool m_showInterruptsScaler = false ;
134
+ bool m_showFTDI = false ;
135
135
Widgets::Log m_log = {settings.get <ShowLog>().value };
136
136
struct MemoryEditorWrapper {
137
137
MemoryEditorWrapper () {
@@ -173,6 +173,8 @@ class GUI final {
173
173
Widgets::VRAMViewer m_clutVRAMviewer;
174
174
Widgets::VRAMViewer m_VRAMviewers[4 ];
175
175
176
+ Widgets::FTDI m_ftdi = {m_showFTDI};
177
+
176
178
uv_loop_t m_loop;
177
179
};
178
180
Original file line number Diff line number Diff line change 142
142
<ClCompile Include =" ..\..\src\gui\widgets\assembly.cc" />
143
143
<ClCompile Include =" ..\..\src\gui\widgets\breakpoints.cc" />
144
144
<ClCompile Include =" ..\..\src\gui\widgets\filedialog.cc" />
145
+ <ClCompile Include =" ..\..\src\gui\widgets\ftdi.cc" />
145
146
<ClCompile Include =" ..\..\src\gui\widgets\log.cc" />
146
147
<ClCompile Include =" ..\..\src\gui\widgets\registers.cc" />
147
148
<ClCompile Include =" ..\..\src\gui\widgets\vram-viewer.cc" />
151
152
<ClInclude Include =" ..\..\src\gui\widgets\assembly.h" />
152
153
<ClInclude Include =" ..\..\src\gui\widgets\breakpoints.h" />
153
154
<ClInclude Include =" ..\..\src\gui\widgets\filedialog.h" />
155
+ <ClInclude Include =" ..\..\src\gui\widgets\ftdi.h" />
154
156
<ClInclude Include =" ..\..\src\gui\widgets\log.h" />
155
157
<ClInclude Include =" ..\..\src\gui\widgets\registers.h" />
156
158
<ClInclude Include =" ..\..\src\gui\widgets\vram-viewer.h" />
Original file line number Diff line number Diff line change 42
42
<ClCompile Include =" ..\..\src\gui\widgets\vram-viewer.cc" >
43
43
<Filter >Source Files\widgets</Filter >
44
44
</ClCompile >
45
+ <ClCompile Include =" ..\..\src\gui\widgets\ftdi.cc" >
46
+ <Filter >Source Files\widgets</Filter >
47
+ </ClCompile >
45
48
</ItemGroup >
46
49
<ItemGroup >
47
50
<ClInclude Include =" ..\..\src\gui\gui.h" >
68
71
<ClInclude Include =" ..\..\src\gui\widgets\vram-viewer.h" >
69
72
<Filter >Header Files\widgets</Filter >
70
73
</ClInclude >
74
+ <ClInclude Include =" ..\..\src\gui\widgets\ftdi.h" >
75
+ <Filter >Header Files\widgets</Filter >
76
+ </ClInclude >
71
77
</ItemGroup >
72
78
<ItemGroup >
73
79
<None Include =" packages.config" />
You can’t perform that action at this time.
0 commit comments