Mercurial > tablet-emu
comparison src/protocol.rs @ 18:3f7b7a3ad8fe
Build three binaries instead of using arguments.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 26 Aug 2021 22:15:55 +0200 |
parents | |
children | ba09079686a0 |
comparison
equal
deleted
inserted
replaced
17:0bce7fe96937 | 18:3f7b7a3ad8fe |
---|---|
1 // Tablet emulator, for people who don’t own one | |
2 // Copyright © 2020 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | |
3 // | |
4 // This program is free software: you can redistribute it and/or modify | |
5 // it under the terms of the GNU Affero General Public License as published by | |
6 // the Free Software Foundation, either version 3 of the License, or | |
7 // (at your option) any later version. | |
8 // | |
9 // This program is distributed in the hope that it will be useful, | |
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 // GNU Affero General Public License for more details. | |
13 // | |
14 // You should have received a copy of the GNU Affero General Public License | |
15 // along with this program. If not, see <https://www.gnu.org/licenses/>. | |
16 | |
17 use bitflags::bitflags; | |
18 | |
19 bitflags! { | |
20 /// This is the memory layout of the buttons on the 3DS. | |
21 #[derive(Default)] | |
22 pub struct Buttons: u32 { | |
23 const A = 0x00000001; | |
24 const B = 0x00000002; | |
25 const SELECT = 0x00000004; | |
26 const START = 0x00000008; | |
27 const RIGHT = 0x00000010; | |
28 const LEFT = 0x00000020; | |
29 const UP = 0x00000040; | |
30 const DOWN = 0x00000080; | |
31 const R = 0x00000100; | |
32 const L = 0x00000200; | |
33 const X = 0x00000400; | |
34 const Y = 0x00000800; | |
35 // Nothing | |
36 // Nothing | |
37 const ZL = 0x00004000; | |
38 const ZR = 0x00008000; | |
39 const RESIZE = 0x00010000; // Not an actual 3DS button! | |
40 // Nothing | |
41 // Nothing | |
42 // Nothing | |
43 const TOUCH = 0x00100000; | |
44 // Nothing | |
45 // Nothing | |
46 // Nothing | |
47 const C_RIGHT = 0x01000000; | |
48 const C_LEFT = 0x02000000; | |
49 const C_UP = 0x04000000; | |
50 const C_DOWN = 0x08000000; | |
51 const CIRCLE_RIGHT = 0x10000000; | |
52 const CIRCLE_LEFT = 0x20000000; | |
53 const CIRCLE_UP = 0x40000000; | |
54 const CIRCLE_DOWN = 0x80000000; | |
55 } | |
56 } | |
57 | |
58 #[derive(Debug, Default)] | |
59 pub struct Event { | |
60 pub buttons: Buttons, | |
61 pad: (i16, i16), | |
62 c_pad: (i16, i16), | |
63 pub touch: (u16, u16), | |
64 } |