diff --git a/ctru-sys/src/gpu/shaderProgram.rs b/ctru-sys/src/gpu/shaderProgram.rs index f81f772..4d56d1d 100644 --- a/ctru-sys/src/gpu/shaderProgram.rs +++ b/ctru-sys/src/gpu/shaderProgram.rs @@ -1,4 +1,3 @@ -use ::Result; use ::types::*; use gpu::shbin::*; diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs index d3cb2f3..fdfae33 100644 --- a/ctru-sys/src/lib.rs +++ b/ctru-sys/src/lib.rs @@ -25,8 +25,3 @@ pub mod types; pub use self::sys::*; pub use self::types::*; - -pub type Result = i32; -pub type Handle = u32; - -pub type ThreadFunc = Option ()>; diff --git a/ctru-sys/src/os.rs b/ctru-sys/src/os.rs index ce0df6c..768ece0 100644 --- a/ctru-sys/src/os.rs +++ b/ctru-sys/src/os.rs @@ -1,6 +1,5 @@ //TODO: Fix Bindgen's issues again. -use ::Result; use libc::c_void; use types::*; diff --git a/ctru-sys/src/services/cam.rs b/ctru-sys/src/services/cam.rs index 811956b..5b8398a 100644 --- a/ctru-sys/src/services/cam.rs +++ b/ctru-sys/src/services/cam.rs @@ -1,7 +1,6 @@ // TODO: Determine if anonymous enums are properly represented (they probably aren't) -use ::{Handle, Result}; -use libc::c_void; +use ::libc::c_void; use ::types::*; #[derive(Clone, Copy)] diff --git a/ctru-sys/src/services/gspgpu.rs b/ctru-sys/src/services/gspgpu.rs index ffe4703..f4ea25e 100644 --- a/ctru-sys/src/services/gspgpu.rs +++ b/ctru-sys/src/services/gspgpu.rs @@ -1,4 +1,3 @@ -use ::{Handle, Result}; use ::libc::c_void; use ::types::*; @@ -74,8 +73,6 @@ pub enum GSPGPU_Event { GSPGPU_EVENT_MAX = 7, } -use ThreadFunc; - extern "C" { pub fn gspInit() -> Result; pub fn gspExit(); diff --git a/ctru-sys/src/services/hid.rs b/ctru-sys/src/services/hid.rs index 8e3a025..129ef7e 100644 --- a/ctru-sys/src/services/hid.rs +++ b/ctru-sys/src/services/hid.rs @@ -1,5 +1,4 @@ use ::types::*; -use ::{Result, Handle}; pub const HID_SHAREDMEM_DEFAULT: u32 = 0x10000000; diff --git a/ctru-sys/src/services/irrst.rs b/ctru-sys/src/services/irrst.rs index 2f4c6eb..12ebcb4 100644 --- a/ctru-sys/src/services/irrst.rs +++ b/ctru-sys/src/services/irrst.rs @@ -1,4 +1,3 @@ -use ::{Result, Handle}; use ::types::*; use super::hid::circlePosition; diff --git a/ctru-sys/src/services/y2r.rs b/ctru-sys/src/services/y2r.rs index 6554ad6..96d7ac4 100644 --- a/ctru-sys/src/services/y2r.rs +++ b/ctru-sys/src/services/y2r.rs @@ -1,6 +1,5 @@ -use ::{Handle, Result}; -use ::libc::c_void; use ::types::*; +use ::libc::c_void; #[derive(Clone, Copy)] #[repr(C)] diff --git a/ctru-sys/src/sys/libc.rs b/ctru-sys/src/sys/libc.rs index e7870a9..ab8eb7c 100644 --- a/ctru-sys/src/sys/libc.rs +++ b/ctru-sys/src/sys/libc.rs @@ -1,3 +1,8 @@ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] + pub const STDOUT_FILENO: c_int = 1; #[repr(u8)] @@ -19,10 +24,66 @@ pub type c_longlong = i64; pub type c_ulonglong = u64; pub type c_float = f32; pub type c_double = f64; - pub type size_t = usize; pub type ssize_t = isize; +pub type u_char = c_uchar; +pub type u_short = c_ushort; +pub type u_int = c_uint; +pub type u_long = c_ulong; +pub type ushort = c_ushort; +pub type uint_ = c_uint; +pub type ulong = c_ulong; +pub type clock_t = c_ulong; +pub type time_t = c_long; +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct timespec { + pub tv_sec: time_t, + pub tv_nsec: c_long, +} +impl ::core::default::Default for timespec { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +impl ::core::default::Default for itimerspec { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +pub type daddr_t = c_long; +pub type caddr_t = *mut c_char; +pub type ino_t = c_uint; +pub type off_t = c_long; +pub type dev_t = c_int; +pub type uid_t = c_ushort; +pub type gid_t = c_ushort; +pub type pid_t = c_int; +pub type key_t = c_long; +pub type mode_t = c_uint; +pub type nlink_t = c_ushort; +pub type fd_mask = c_long; +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct _types_fd_set { + pub fds_bits: [fd_mask; 1usize], +} +impl ::core::default::Default for _types_fd_set { + fn default() -> Self { unsafe { ::core::mem::zeroed() } } +} +pub type clockid_t = c_ulong; +pub type timer_t = c_ulong; +pub type useconds_t = c_ulong; +pub type suseconds_t = c_long; +pub type fsblkcnt_t = c_uint; +pub type fsfilcnt_t = c_uint; + extern "C" { pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; diff --git a/ctru-sys/src/sys/mod.rs b/ctru-sys/src/sys/mod.rs index ca421e7..357a4d6 100644 --- a/ctru-sys/src/sys/mod.rs +++ b/ctru-sys/src/sys/mod.rs @@ -1,2 +1,2 @@ -pub mod lock; pub mod libc; +pub mod lock; diff --git a/ctru-sys/src/types.rs b/ctru-sys/src/types.rs index 3861e72..d5baa88 100644 --- a/ctru-sys/src/types.rs +++ b/ctru-sys/src/types.rs @@ -1,35 +1,27 @@ -#[repr(C)] -pub enum mediatypes_enum { - mediatype_NAND = 0, - mediatype_SDMC = 1, - mediatype_GAMECARD = 2, -} +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +pub type u8_ = u8; +pub type u16_ = u16; +pub type u32_ = u32; +pub type u64_ = u64; pub type s8 = i8; pub type s16 = i16; pub type s32 = i32; pub type s64 = i64; - -// UHH, DUNNO HOW TO USE VOLATILES ???? -pub type vu8 = u8; -pub type vu32 = u32; - -// typedef uint8_t u8; -// typedef uint16_t u16; -// typedef uint32_t u32; -// typedef uint64_t u64; -// -// typedef int8_t s8; -// typedef int16_t s16; -// typedef int32_t s32; -// typedef int64_t s64; -// -// typedef volatile u8 vu8; -// typedef volatile u16 vu16; -// typedef volatile u32 vu32; -// typedef volatile u64 vu64; -// -// typedef volatile s8 vs8; -// typedef volatile s16 vs16; -// typedef volatile s32 vs32; -// typedef volatile s64 vs64; +pub type vu8 = u8_; +pub type vu16 = u16_; +pub type vu32 = u32_; +pub type vu64 = u64_; +pub type vs8 = s8; +pub type vs16 = s16; +pub type vs32 = s32; +pub type vs64 = s64; +pub type Handle = u32_; +pub type Result = s32; +pub type ThreadFunc = + ::core::option::Option; +pub type voidfn = ::core::option::Option;