forked from Skarsnik/QUsb2snes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
usb2snes.h
133 lines (109 loc) · 2.75 KB
/
usb2snes.h
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
#ifndef USB2SNES_H
#define USB2SNES_H
#include <QObject>
#include <QStringList>
namespace SD2Snes {
Q_NAMESPACE
enum opcode {
GET = 0,
PUT,
VGET,
VPUT,
LS,
MKDIR,
RM,
MV,
RESET,
BOOT,
POWER_CYCLE,
INFO,
MENU_RESET,
STREAM,
TIME,
RESPONSE
};
Q_ENUM_NS(opcode)
enum space {
FILE = 0,
SNES,
MSU,
CMD,
CONFIG
};
Q_ENUM_NS(space)
enum server_flags {
NONE = 0,
SKIPRESET = 1,
ONLYRESET = 2,
CLRX = 4,
SETX = 8,
STREAM_BURST = 16,
NORESP = 64,
DATA64B = 128,
};
Q_ENUM_NS(server_flags)
enum info_flags {
FEAT_DSPX = 1,
FEAT_ST0010 = 2,
FEAT_SRTC = 4,
FEAT_MSU1 = 8,
FEAT_213F = 0x10,
FEAT_CMD_UNLOCK = 0x20,
FEAT_USB1 = 0x40,
FEAT_DMA1 = 0x80
};
Q_ENUM_NS(info_flags)
enum class file_type {
FILE = 1,
DIRECTORY = 0
};
Q_ENUM_NS(file_type)
}
/*
* Commands are send in JSON format
*/
namespace USB2SnesWS {
Q_NAMESPACE
enum opcode {
// Format is [argument to send]->what is returned, {} mean a result json reply
// Size are in hexformat
// Connection
DeviceList, // List the available Device {portdevice1, portdevice2, portdevice3...}
Attach, // Attach to the devise using the name [portdevice]
AppVersion, // Give the version of the App {version}
Name, // Specificy the name of the client [name]
// Special
Info, // Give information about the sd2snes firmware {firmwareversion, versionstring, romrunning, flag1, flag2...}TOFIX
Boot, // Boot a rom [romname] TOTEST
Menu, // Get back to the menu TOTEST
Reset, // Reset TOTEST
Stream, // TODO
Fence, // TODO
GetAddress, // Get the value of the address, space is important [offset, size]->datarequested TOFIX multiarg form
PutAddress, // put value to the address [offset, size] then send the binary data.
// Also support multiple request in one [offset1, size1, offset2, size2] TOFIX work on size check/boundary
PutIPS, // Apply a patch - [name, size] then send binary data
// a special name is 'hook' for the sd2snes
GetFile, // Get a file - [filepath]->{size}->filedata
PutFile, // Post a file - [filepath, size] then send the binary data
List, // LS command - [dirpath]->{typefile1, namefile1, typefile2, namefile2...}
Remove, // remove a file [filepath]
Rename, // rename a file [filepath, newfilename]
MakeDir // create a directory [dirpath]
};
Q_ENUM_NS(opcode)
enum extra_info_flags {
NO_FILE_CMD,
NO_CONTROL_CMD,
NO_ROM_WRITE,
NO_ROM_READ
};
Q_ENUM_NS(extra_info_flags)
}
struct USB2SnesInfo {
QString version;
QString romPlaying;
QString deviceName;
QStringList flags;
};
#endif // USB2SNES_H