Mercurial > tablet-emu
comparison src/protocol.rs @ 19:ba09079686a0
Add support for different endianness between client and server.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 26 Aug 2021 23:43:36 +0200 |
parents | 3f7b7a3ad8fe |
children |
comparison
equal
deleted
inserted
replaced
18:3f7b7a3ad8fe | 19:ba09079686a0 |
---|---|
12 // GNU Affero General Public License for more details. | 12 // GNU Affero General Public License for more details. |
13 // | 13 // |
14 // You should have received a copy of the GNU Affero General Public License | 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/>. | 15 // along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | 16 |
17 use serde::{Serialize, Deserialize}; | |
17 use bitflags::bitflags; | 18 use bitflags::bitflags; |
18 | 19 |
19 bitflags! { | 20 bitflags! { |
20 /// This is the memory layout of the buttons on the 3DS. | 21 /// This is the memory layout of the buttons on the 3DS. |
21 #[derive(Default)] | 22 #[derive(Serialize, Deserialize, Default)] |
22 pub struct Buttons: u32 { | 23 pub struct Buttons: u32 { |
23 const A = 0x00000001; | 24 const A = 0x00000001; |
24 const B = 0x00000002; | 25 const B = 0x00000002; |
25 const SELECT = 0x00000004; | 26 const SELECT = 0x00000004; |
26 const START = 0x00000008; | 27 const START = 0x00000008; |
53 const CIRCLE_UP = 0x40000000; | 54 const CIRCLE_UP = 0x40000000; |
54 const CIRCLE_DOWN = 0x80000000; | 55 const CIRCLE_DOWN = 0x80000000; |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 #[derive(Debug, Default)] | 59 #[derive(Serialize, Deserialize, Debug, Default)] |
59 pub struct Event { | 60 pub struct Event { |
60 pub buttons: Buttons, | 61 pub buttons: Buttons, |
61 pad: (i16, i16), | 62 pad: (i16, i16), |
62 c_pad: (i16, i16), | 63 c_pad: (i16, i16), |
63 pub touch: (u16, u16), | 64 pub touch: (u16, u16), |