-
Notifications
You must be signed in to change notification settings - Fork 0
/
specification.txt
114 lines (90 loc) · 3.27 KB
/
specification.txt
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
##################################
# Joystick Capture Specification #
##################################
Description
===========
This is the specification for Joystick Capture files generated by JoystickCapture.
Specification
=============
Each Joystick Capture file is split up into sections, which all follow a few similar guidelines: Every section
has a unique byte which specifies the section that is starting, as well as a non-unique byte which specifies the
end of the section.
_____________
| Magic | <- 4 bytes
|_____________|
| Header | <- 4 bytes
|_____________|
| Instruction | <- n bytes
| Set |
|_____________|
| EOF Byte | <- 1 byte
|_____________|
| EOF |
|_____________|
The file starts off with a magic number which specifies that this is a valid Joystick Capture file.
The magic number is immediately followed by the Header section, which defines how many instructions exist.
Note that this is not the number of *bytes* the section uses, just the number of instructions themselves.
The Header Section
==================
________________
| Start Byte | <- 1 byte
|________________|
| # of | <- 2 bytes
| Instructions |
|________________|
| End of Section | <- 1 byte
| Byte |
|________________|
The Instruction Set Section
===========================
The Instruction Set Section contains every Instruction Section.
It is important to keep in mind that this section does not define the instructions, it merely encapsulates them.
Also, there is a variable number of instructions. As such, it is reccommended that you just loop until the section
has ended.
________________
| Start Byte | <- 1 byte
|________________|
| Instruction | <- n bytes
| Section |
|________________|
.
.
.
________________
| End of Section | <- 1 byte
| Byte |
|________________|
The Instruction Section
=======================
The Instruction Section defines each instruction as a series of commands.
The first command in an instruction is always the actual command, with each subsequent 'command' being a parameter
for the command.
The 'actual command' can be either a button press, or a joystick axis, which should only take one parameter each.
However, since other types of commands may be possible in the future, the number of parameters is not limited.
________________
| Start Byte | <- 1 byte
|________________|
| Command | <- n bytes
|________________|
| Command end | <- 1 byte
|________________|
.
. <- Any number of Commands
.
________________
| End of Section | <- 1 byte
|________________|
Defines
=======
Here, all of the numbers that are referred to in this document will be defined.
MAGIC - 0x41 0x55 0x54 0x4f (A)(U)(T)(O)
Header Start Byte - 0x48 (H)
Instruction Set Start Byte - 0x54 (T)
Instruction Start Byte - 0x49 (I)
Section End Byte - 0x45 (E)
Command End Byte - 0x2c (,)
Button Command ID - 0x1000
Axis Command ID - 0x2000
Important note about Command ID's: Each command ID is simply the type of ID. The ID itself will be that type as
well as the number of that type.
For example, the ID for Button 4 would be: 0x1004