Support full controller input
This commit is contained in:
+25
-2
@@ -1,6 +1,7 @@
|
||||
use std::{ffi::c_void, ptr, slice};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use bitflags::bitflags;
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
|
||||
#[repr(C)]
|
||||
@@ -24,6 +25,28 @@ enum VBDataType {
|
||||
F32 = 5,
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct VBKey: u16 {
|
||||
const PWR = 0x0001;
|
||||
const SGN = 0x0002;
|
||||
const A = 0x0004;
|
||||
const B = 0x0008;
|
||||
const RT = 0x0010;
|
||||
const LT = 0x0020;
|
||||
const RU = 0x0040;
|
||||
const RR = 0x0080;
|
||||
const LR = 0x0100;
|
||||
const LL = 0x0200;
|
||||
const LD = 0x0400;
|
||||
const LU = 0x0800;
|
||||
const STA = 0x1000;
|
||||
const SEL = 0x2000;
|
||||
const RL = 0x4000;
|
||||
const RD = 0x8000;
|
||||
}
|
||||
}
|
||||
|
||||
type OnFrame = extern "C" fn(sim: *mut VB) -> c_int;
|
||||
|
||||
#[link(name = "vb")]
|
||||
@@ -198,8 +221,8 @@ impl CoreVB {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn set_keys(&mut self, keys: u16) {
|
||||
unsafe { vb_set_keys(self.sim, keys) };
|
||||
pub fn set_keys(&mut self, keys: VBKey) {
|
||||
unsafe { vb_set_keys(self.sim, keys.bits()) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user