aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys
diff options
context:
space:
mode:
authorFenrir <[email protected]>2017-01-19 01:30:05 -0700
committerFenrir <[email protected]>2017-01-21 17:44:58 -0700
commit08b71a18cd917724ee3d270d49a78e508a176e36 (patch)
treeb5eb42603929957f4bc826942e29b154c863003a /ctru-sys
parentUpdate Cargo.toml (diff)
downloadctru-rs-08b71a18cd917724ee3d270d49a78e508a176e36.tar.xz
ctru-rs-08b71a18cd917724ee3d270d49a78e508a176e36.zip
We stdlib now
Diffstat (limited to 'ctru-sys')
-rw-r--r--ctru-sys/Cargo.toml5
-rw-r--r--ctru-sys/src/applets/mod.rs1
-rw-r--r--ctru-sys/src/applets/swkbd.rs258
-rw-r--r--ctru-sys/src/lib.rs7
-rw-r--r--ctru-sys/src/ndsp/channel.rs82
-rw-r--r--ctru-sys/src/ndsp/mod.rs2
-rw-r--r--ctru-sys/src/ndsp/ndsp.rs112
-rw-r--r--ctru-sys/src/os.rs62
-rw-r--r--ctru-sys/src/romfs.rs64
-rw-r--r--ctru-sys/src/sdmc.rs24
-rw-r--r--ctru-sys/src/services/apt.rs28
-rw-r--r--ctru-sys/src/services/mod.rs1
-rw-r--r--ctru-sys/src/services/nfc.rs6
-rw-r--r--ctru-sys/src/services/ps.rs2
-rw-r--r--ctru-sys/src/services/soc.rs2
-rw-r--r--ctru-sys/src/services/sslc.rs4
-rw-r--r--ctru-sys/src/svc.rs244
-rw-r--r--ctru-sys/src/sys/inaddr.rs6
-rw-r--r--ctru-sys/src/sys/libc.rs6
-rw-r--r--ctru-sys/src/sys/mod.rs3
-rw-r--r--ctru-sys/src/sys/socket.rs20
-rw-r--r--ctru-sys/src/types.rs4
22 files changed, 737 insertions, 206 deletions
diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml
index 578ee82..fa204ee 100644
--- a/ctru-sys/Cargo.toml
+++ b/ctru-sys/Cargo.toml
@@ -1,5 +1,8 @@
[package]
name = "ctru-sys"
-version = "0.2.0"
+version = "0.3.0"
authors = ["Ronald Kinard <[email protected]>"]
license = "https://en.wikipedia.org/wiki/Zlib_License"
+
+[dependencies]
+ctr-libc = { path = "../ctr-libc", default-features = false }
diff --git a/ctru-sys/src/applets/mod.rs b/ctru-sys/src/applets/mod.rs
new file mode 100644
index 0000000..73469a3
--- /dev/null
+++ b/ctru-sys/src/applets/mod.rs
@@ -0,0 +1 @@
+pub mod swkbd;
diff --git a/ctru-sys/src/applets/swkbd.rs b/ctru-sys/src/applets/swkbd.rs
new file mode 100644
index 0000000..3fba279
--- /dev/null
+++ b/ctru-sys/src/applets/swkbd.rs
@@ -0,0 +1,258 @@
+// automatically generated by rust-bindgen
+
+
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum SwkbdType {
+ SWKBD_TYPE_NORMAL = 0,
+ SWKBD_TYPE_QWERTY = 1,
+ SWKBD_TYPE_NUMPAD = 2,
+ SWKBD_TYPE_WESTERN = 3,
+}
+pub const SWKBD_NOTBLANK_NOTEMPTY: SwkbdValidInput = SwkbdValidInput::SWKBD_NOTEMPTY_NOTBLANK;
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum SwkbdValidInput {
+ SWKBD_ANYTHING = 0,
+ SWKBD_NOTEMPTY = 1,
+ SWKBD_NOTEMPTY_NOTBLANK = 2,
+ SWKBD_NOTBLANK = 3,
+ SWKBD_FIXEDLEN = 4,
+}
+pub const SWKBD_BUTTON_CONFIRM: SwkbdButton = SwkbdButton::SWKBD_BUTTON_RIGHT;
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum SwkbdButton {
+ SWKBD_BUTTON_LEFT = 0,
+ SWKBD_BUTTON_MIDDLE = 1,
+ SWKBD_BUTTON_RIGHT = 2,
+ SWKBD_BUTTON_NONE = 3,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum SwkbdPasswordMode {
+ SWKBD_PASSWORD_NONE = 0,
+ SWKBD_PASSWORD_HIDE = 1,
+ SWKBD_PASSWORD_HIDE_DELAY = 2,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum Enum_Unnamed1 {
+ SWKBD_FILTER_DIGITS = 1,
+ SWKBD_FILTER_AT = 2,
+ SWKBD_FILTER_PERCENT = 4,
+ SWKBD_FILTER_BACKSLASH = 8,
+ SWKBD_FILTER_PROFANITY = 16,
+ SWKBD_FILTER_CALLBACK = 32,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum Enum_Unnamed2 {
+ SWKBD_PARENTAL = 1,
+ SWKBD_DARKEN_TOP_SCREEN = 2,
+ SWKBD_PREDICTIVE_INPUT = 4,
+ SWKBD_MULTILINE = 8,
+ SWKBD_FIXED_WIDTH = 16,
+ SWKBD_ALLOW_HOME = 32,
+ SWKBD_ALLOW_RESET = 64,
+ SWKBD_ALLOW_POWER = 128,
+ SWKBD_DEFAULT_QWERTY = 512,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum SwkbdCallbackResult {
+ SWKBD_CALLBACK_OK = 0,
+ SWKBD_CALLBACK_CLOSE = 1,
+ SWKBD_CALLBACK_CONTINUE = 2,
+}
+#[derive(Copy, Clone)]
+#[repr(i32)]
+#[derive(Debug)]
+pub enum SwkbdResult {
+ SWKBD_NONE = -1,
+ SWKBD_INVALID_INPUT = -2,
+ SWKBD_OUTOFMEM = -3,
+ SWKBD_D0_CLICK = 0,
+ SWKBD_D1_CLICK0 = 1,
+ SWKBD_D1_CLICK1 = 2,
+ SWKBD_D2_CLICK0 = 3,
+ SWKBD_D2_CLICK1 = 4,
+ SWKBD_D2_CLICK2 = 5,
+ SWKBD_HOMEPRESSED = 10,
+ SWKBD_RESETPRESSED = 11,
+ SWKBD_POWERPRESSED = 12,
+ SWKBD_PARENTAL_OK = 20,
+ SWKBD_PARENTAL_FAIL = 21,
+ SWKBD_BANNED_INPUT = 30,
+}
+#[repr(C)]
+#[derive(Copy)]
+pub struct SwkbdDictWord {
+ pub reading: [u16; 41usize],
+ pub word: [u16; 41usize],
+ pub language: u8,
+ pub all_languages: u8,
+}
+impl ::core::clone::Clone for SwkbdDictWord {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for SwkbdDictWord {
+ fn default() -> Self {
+ unsafe { ::core::mem::zeroed() }
+ }
+}
+pub type SwkbdCallbackFn =
+ ::core::option::Option<unsafe extern "C" fn(user: *mut ::libc::c_void,
+ ppMessage: *mut *const u8,
+ text: *const u8,
+ textlen: usize)
+ -> SwkbdCallbackResult>;
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct SwkbdStatusData {
+ pub data: [u32; 17usize],
+}
+impl ::core::default::Default for SwkbdStatusData {
+ fn default() -> Self {
+ unsafe { ::core::mem::zeroed() }
+ }
+}
+#[repr(C)]
+#[derive(Copy)]
+pub struct SwkbdLearningData {
+ pub data: [u32; 10523usize],
+}
+impl ::core::clone::Clone for SwkbdLearningData {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for SwkbdLearningData {
+ fn default() -> Self {
+ unsafe { ::core::mem::zeroed() }
+ }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct SwkbdExtra {
+ pub initial_text: *const u8,
+ pub dict: *const SwkbdDictWord,
+ pub status_data: *mut SwkbdStatusData,
+ pub learning_data: *mut SwkbdLearningData,
+ pub callback: SwkbdCallbackFn,
+ pub callback_user: *mut ::libc::c_void,
+}
+impl ::core::default::Default for SwkbdExtra {
+ fn default() -> Self {
+ unsafe { ::core::mem::zeroed() }
+ }
+}
+#[repr(C)]
+#[derive(Copy)]
+pub struct SwkbdState {
+ pub type_: i32,
+ pub num_buttons_m1: i32,
+ pub valid_input: i32,
+ pub password_mode: i32,
+ pub is_parental_screen: i32,
+ pub darken_top_screen: i32,
+ pub filter_flags: u32,
+ pub save_state_flags: u32,
+ pub max_text_len: u16,
+ pub dict_word_count: u16,
+ pub max_digits: u16,
+ pub button_text: [[u16; 17usize]; 3usize],
+ pub numpad_keys: [u16; 2usize],
+ pub hint_text: [u16; 65usize],
+ pub predictive_input: u8,
+ pub multiline: u8,
+ pub fixed_width: u8,
+ pub allow_home: u8,
+ pub allow_reset: u8,
+ pub allow_power: u8,
+ pub unknown: u8,
+ pub default_qwerty: u8,
+ pub button_submits_text: [u8; 4usize],
+ pub language: u16,
+ pub initial_text_offset: i32,
+ pub dict_offset: i32,
+ pub initial_status_offset: i32,
+ pub initial_learning_offset: i32,
+ pub shared_memory_size: usize,
+ pub version: u32,
+ pub result: SwkbdResult,
+ pub status_offset: i32,
+ pub learning_offset: i32,
+ pub text_offset: i32,
+ pub text_length: u16,
+ pub callback_result: i32,
+ pub callback_msg: [u16; 257usize],
+ pub skip_at_check: u8,
+ pub union: _bindgen_data_1_,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union _bindgen_data_1_ {
+ pub reserved: [u8; 171usize],
+ pub extra: SwkbdExtra,
+}
+impl ::core::clone::Clone for SwkbdState {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for SwkbdState {
+ fn default() -> Self {
+ unsafe { ::core::mem::zeroed() }
+ }
+}
+extern "C" {
+ pub fn swkbdInit(swkbd: *mut SwkbdState,
+ type_: SwkbdType,
+ numButtons: i32,
+ maxTextLength: i32);
+ pub fn swkbdSetFeatures(swkbd: *mut SwkbdState, features: u32);
+ pub fn swkbdSetHintText(swkbd: *mut SwkbdState, text: *const u8);
+ pub fn swkbdSetButton(swkbd: *mut SwkbdState,
+ button: SwkbdButton,
+ text: *const u8,
+ submit: u8);
+ pub fn swkbdSetInitialText(swkbd: *mut SwkbdState, text: *const u8);
+ pub fn swkbdSetDictWord(word: *mut SwkbdDictWord,
+ reading: *const u8,
+ text: *const u8);
+ pub fn swkbdSetDictionary(swkbd: *mut SwkbdState,
+ dict: *const SwkbdDictWord,
+ wordCount: i32);
+ pub fn swkbdSetStatusData(swkbd: *mut SwkbdState,
+ data: *mut SwkbdStatusData,
+ in_: u8,
+ out: u8);
+ pub fn swkbdSetLearningData(swkbd: *mut SwkbdState,
+ data: *mut SwkbdLearningData,
+ in_: u8,
+ out: u8);
+ pub fn swkbdSetFilterCallback(swkbd: *mut SwkbdState,
+ callback: SwkbdCallbackFn,
+ user: *mut ::libc::c_void);
+ pub fn swkbdInputText(swkbd: *mut SwkbdState,
+ buf: *mut u8,
+ bufsize: usize)
+ -> SwkbdButton;
+}
diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs
index fdfae33..5bbc54d 100644
--- a/ctru-sys/src/lib.rs
+++ b/ctru-sys/src/lib.rs
@@ -2,18 +2,23 @@
* C bindings generation:
* bindgen --match=file.h --use-core --ctypes-prefix=libc -- --sysroot=$DEVKITARM/arm-none-eabi -I$CTRULIB/include $CTRULIB/include/3ds.h
*
- * bindgen --sysroot=$DEVKITARM/arm-none-eabi -I$CTRULIB/include $CTRULIB/include/3ds.h
*/
#![no_std]
#![allow(non_camel_case_types, non_snake_case, overflowing_literals)]
+#![feature(untagged_unions)]
+extern crate ctr_libc as libc;
+
+pub mod applets;
pub mod console;
pub mod env;
pub mod gfx;
pub mod gpu;
pub mod ipc;
+pub mod ndsp;
pub mod os;
+pub mod romfs;
pub mod sdmc;
pub mod services;
pub mod svc;
diff --git a/ctru-sys/src/ndsp/channel.rs b/ctru-sys/src/ndsp/channel.rs
new file mode 100644
index 0000000..be5b91e
--- /dev/null
+++ b/ctru-sys/src/ndsp/channel.rs
@@ -0,0 +1,82 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+
+use ::types::*;
+use super::ndsp::ndspWaveBuf;
+
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum Enum_Unnamed1 {
+ NDSP_ENCODING_PCM8 = 0,
+ NDSP_ENCODING_PCM16 = 1,
+ NDSP_ENCODING_ADPCM = 2,
+}
+pub const NDSP_FORMAT_PCM8: Enum_Unnamed2 =
+ Enum_Unnamed2::NDSP_FORMAT_MONO_PCM8;
+pub const NDSP_FORMAT_PCM16: Enum_Unnamed2 =
+ Enum_Unnamed2::NDSP_FORMAT_MONO_PCM16;
+pub const NDSP_FORMAT_ADPCM: Enum_Unnamed2 =
+ Enum_Unnamed2::NDSP_FORMAT_MONO_ADPCM;
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum Enum_Unnamed2 {
+ NDSP_FORMAT_MONO_PCM8 = 1,
+ NDSP_FORMAT_MONO_PCM16 = 5,
+ NDSP_FORMAT_MONO_ADPCM = 9,
+ NDSP_FORMAT_STEREO_PCM8 = 2,
+ NDSP_FORMAT_STEREO_PCM16 = 6,
+ NDSP_FRONT_BYPASS = 16,
+ NDSP_3D_SURROUND_PREPROCESSED = 64,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ndspInterpType {
+ NDSP_INTERP_POLYPHASE = 0,
+ NDSP_INTERP_LINEAR = 1,
+ NDSP_INTERP_NONE = 2,
+}
+extern "C" {
+ pub fn ndspChnReset(id: ::libc::c_int);
+ pub fn ndspChnInitParams(id: ::libc::c_int);
+ pub fn ndspChnIsPlaying(id: ::libc::c_int) -> u8;
+ pub fn ndspChnGetSamplePos(id: ::libc::c_int) -> u32_;
+ pub fn ndspChnGetWaveBufSeq(id: ::libc::c_int) -> u16_;
+ pub fn ndspChnIsPaused(id: ::libc::c_int) -> u8;
+ pub fn ndspChnSetPaused(id: ::libc::c_int, paused: u8);
+ pub fn ndspChnSetFormat(id: ::libc::c_int, format: u16_);
+ pub fn ndspChnSetInterp(id: ::libc::c_int, type_: ndspInterpType);
+ pub fn ndspChnSetRate(id: ::libc::c_int, rate: f32);
+ pub fn ndspChnSetMix(id: ::libc::c_int, mix: *mut f32);
+ pub fn ndspChnSetAdpcmCoefs(id: ::libc::c_int, coefs: *mut u16_);
+ pub fn ndspChnWaveBufClear(id: ::libc::c_int);
+ pub fn ndspChnWaveBufAdd(id: ::libc::c_int, buf: *mut ndspWaveBuf);
+ pub fn ndspChnIirMonoSetEnable(id: ::libc::c_int, enable: u8);
+ pub fn ndspChnIirMonoSetParamsCustomFilter(id: ::libc::c_int, a0: f32,
+ a1: f32, b0: f32) -> u8;
+ pub fn ndspChnIirMonoSetParamsLowPassFilter(id: ::libc::c_int, f0: f32)
+ -> u8;
+ pub fn ndspChnIirMonoSetParamsHighPassFilter(id: ::libc::c_int, f0: f32)
+ -> u8;
+ pub fn ndspChnIirBiquadSetEnable(id: ::libc::c_int, enable: u8);
+ pub fn ndspChnIirBiquadSetParamsCustomFilter(id: ::libc::c_int, a0: f32,
+ a1: f32, a2: f32, b0: f32,
+ b1: f32, b2: f32) -> u8;
+ pub fn ndspChnIirBiquadSetParamsLowPassFilter(id: ::libc::c_int, f0: f32,
+ Q: f32) -> u8;
+ pub fn ndspChnIirBiquadSetParamsHighPassFilter(id: ::libc::c_int, f0: f32,
+ Q: f32) -> u8;
+ pub fn ndspChnIirBiquadSetParamsBandPassFilter(id: ::libc::c_int, f0: f32,
+ Q: f32) -> u8;
+ pub fn ndspChnIirBiquadSetParamsNotchFilter(id: ::libc::c_int, f0: f32,
+ Q: f32) -> u8;
+ pub fn ndspChnIirBiquadSetParamsPeakingEqualizer(id: ::libc::c_int,
+ f0: f32, Q: f32,
+ gain: f32) -> u8;
+}
diff --git a/ctru-sys/src/ndsp/mod.rs b/ctru-sys/src/ndsp/mod.rs
new file mode 100644
index 0000000..bfebfe6
--- /dev/null
+++ b/ctru-sys/src/ndsp/mod.rs
@@ -0,0 +1,2 @@
+pub mod channel;
+pub mod ndsp;
diff --git a/ctru-sys/src/ndsp/ndsp.rs b/ctru-sys/src/ndsp/ndsp.rs
new file mode 100644
index 0000000..6139f26
--- /dev/null
+++ b/ctru-sys/src/ndsp/ndsp.rs
@@ -0,0 +1,112 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ndspOutputMode {
+ NDSP_OUTPUT_MONO = 0,
+ NDSP_OUTPUT_STEREO = 1,
+ NDSP_OUTPUT_SURROUND = 2,
+}
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ndspClippingMode { NDSP_CLIP_NORMAL = 0, NDSP_CLIP_SOFT = 1, }
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum ndspSpeakerPos {
+ NDSP_SPKPOS_SQUARE = 0,
+ NDSP_SPKPOS_WIDE = 1,
+ NDSP_SPKPOS_NUM = 2,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct ndspAdpcmData {
+ pub index: u16_,
+ pub history0: s16,
+ pub history1: s16,
+}
+impl ::core::default::Default for ndspAdpcmData {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ndspWaveBuf = tag_ndspWaveBuf;
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum Enum_Unnamed1 {
+ NDSP_WBUF_FREE = 0,
+ NDSP_WBUF_QUEUED = 1,
+ NDSP_WBUF_PLAYING = 2,
+ NDSP_WBUF_DONE = 3,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct tag_ndspWaveBuf {
+ pub _bindgen_data_1_: [u64; 1usize],
+ pub nsamples: u32_,
+ pub adpcm_data: *mut ndspAdpcmData,
+ pub offset: u32_,
+ pub looping: u8,
+ pub status: u8_,
+ pub sequence_id: u16_,
+ pub next: *mut ndspWaveBuf,
+}
+impl tag_ndspWaveBuf {
+ pub unsafe fn data_pcm8(&mut self) -> *mut *mut s8 {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn data_pcm16(&mut self) -> *mut *mut s16 {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn data_adpcm(&mut self) -> *mut *mut u8_ {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+ pub unsafe fn data_vaddr(&mut self) -> *mut *const ::libc::c_void {
+ let raw: *mut u8 = ::core::mem::transmute(&self._bindgen_data_1_);
+ ::core::mem::transmute(raw.offset(0))
+ }
+}
+impl ::core::default::Default for tag_ndspWaveBuf {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub type ndspCallback =
+ ::core::option::Option<unsafe extern "C" fn(data: *mut ::libc::c_void)>;
+pub type ndspAuxCallback =
+ ::core::option::Option<unsafe extern "C" fn(data: *mut ::libc::c_void,
+ nsamples: ::libc::c_int,
+ samples:
+ *mut *mut ::libc::c_void)>;
+extern "C" {
+ pub fn ndspUseComponent(binary: *const ::libc::c_void, size: u32_,
+ progMask: u16_, dataMask: u16_);
+ pub fn ndspInit() -> Result;
+ pub fn ndspExit();
+ pub fn ndspGetDroppedFrames() -> u32_;
+ pub fn ndspGetFrameCount() -> u32_;
+ pub fn ndspSetMasterVol(volume: f32);
+ pub fn ndspSetOutputMode(mode: ndspOutputMode);
+ pub fn ndspSetClippingMode(mode: ndspClippingMode);
+ pub fn ndspSetOutputCount(count: ::libc::c_int);
+ pub fn ndspSetCapture(capture: *mut ndspWaveBuf);
+ pub fn ndspSetCallback(callback: ndspCallback, data: *mut ::libc::c_void);
+ pub fn ndspSurroundSetDepth(depth: u16_);
+ pub fn ndspSurroundSetPos(pos: ndspSpeakerPos);
+ pub fn ndspSurroundSetRearRatio(ratio: u16_);
+ pub fn ndspAuxSetEnable(id: ::libc::c_int, enable: u8);
+ pub fn ndspAuxSetFrontBypass(id: ::libc::c_int, bypass: u8);
+ pub fn ndspAuxSetVolume(id: ::libc::c_int, volume: f32);
+ pub fn ndspAuxSetCallback(id: ::libc::c_int, callback: ndspAuxCallback,
+ data: *mut ::libc::c_void);
+}
+
+use ::types::*;
diff --git a/ctru-sys/src/os.rs b/ctru-sys/src/os.rs
index 768ece0..c3dff74 100644
--- a/ctru-sys/src/os.rs
+++ b/ctru-sys/src/os.rs
@@ -1,53 +1,47 @@
-//TODO: Fix Bindgen's issues again.
+/* automatically generated by rust-bindgen */
-use libc::c_void;
-use types::*;
-
-#[inline]
-pub fn SYSTEM_VERSION(major: i32, minor: i32, revision: i32) {
- (((major)<<24)|((minor)<<16)|((revision)<<8));
-}
-
-#[derive(Clone, Copy)]
-#[repr(C)]
-pub enum Enum_Unnamed1 {
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+#[derive(Copy, Clone)]
+#[repr(u32)]
+#[derive(Debug)]
+pub enum MemRegion {
MEMREGION_ALL = 0,
MEMREGION_APPLICATION = 1,
MEMREGION_SYSTEM = 2,
MEMREGION_BASE = 3,
}
-pub type MemRegion = Enum_Unnamed1;
#[repr(C)]
-#[derive(Copy)]
-pub struct Struct_Unnamed2 {
- pub build: u8,
- pub minor: u8,
- pub mainver: u8,
- pub reserved_x3: u8,
- pub region: u8,
- pub reserved_x5: [u8; 3usize],
-}
-impl ::core::clone::Clone for Struct_Unnamed2 {
- fn clone(&self) -> Self { *self }
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct OS_VersionBin {
+ pub build: u8_,
+ pub minor: u8_,
+ pub mainver: u8_,
+ pub reserved_x3: u8_,
+ pub region: ::libc::c_char,
+ pub reserved_x5: [u8_; 3usize],
}
-impl ::core::default::Default for Struct_Unnamed2 {
+impl ::core::default::Default for OS_VersionBin {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-pub type OS_VersionBin = Struct_Unnamed2;
extern "C" {
- pub fn osConvertVirtToPhys(vaddr: *const c_void) -> u32;
- pub fn osConvertOldLINEARMemToNew(vaddr: *const c_void)
- -> *mut c_void;
- pub fn osStrError(error: u32) -> *const u8;
+ pub fn osConvertVirtToPhys(vaddr: *const ::libc::c_void) -> u32_;
+ pub fn osConvertOldLINEARMemToNew(vaddr: *const ::libc::c_void)
+ -> *mut ::libc::c_void;
+ pub fn osStrError(error: u32_) -> *const ::libc::c_char;
pub fn osGetMemRegionUsed(region: MemRegion) -> s64;
- pub fn osGetTime() -> u64;
+ pub fn osGetTime() -> u64_;
pub fn osSetSpeedupEnable(enable: u8);
pub fn osGetSystemVersionData(nver_versionbin: *mut OS_VersionBin,
cver_versionbin: *mut OS_VersionBin)
-> Result;
pub fn osGetSystemVersionDataString(nver_versionbin: *mut OS_VersionBin,
cver_versionbin: *mut OS_VersionBin,
- sysverstr:
- *mut u8,
- sysverstr_maxsize: u32) -> Result;
+ sysverstr: *mut ::libc::c_char,
+ sysverstr_maxsize: u32_) -> Result;
}
+
+use ::types::*;
diff --git a/ctru-sys/src/romfs.rs b/ctru-sys/src/romfs.rs
new file mode 100644
index 0000000..dc25e39
--- /dev/null
+++ b/ctru-sys/src/romfs.rs
@@ -0,0 +1,64 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct romfs_header {
+ pub headerSize: u32_,
+ pub dirHashTableOff: u32_,
+ pub dirHashTableSize: u32_,
+ pub dirTableOff: u32_,
+ pub dirTableSize: u32_,
+ pub fileHashTableOff: u32_,
+ pub fileHashTableSize: u32_,
+ pub fileTableOff: u32_,
+ pub fileTableSize: u32_,
+ pub fileDataOff: u32_,
+}
+impl ::core::default::Default for romfs_header {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct romfs_dir {
+ pub parent: u32_,
+ pub sibling: u32_,
+ pub childDir: u32_,
+ pub childFile: u32_,
+ pub nextHash: u32_,
+ pub nameLen: u32_,
+ pub name: [u16_; 0usize],
+}
+impl ::core::default::Default for romfs_dir {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+#[derive(Debug)]
+pub struct romfs_file {
+ pub parent: u32_,
+ pub sibling: u32_,
+ pub dataOff: u64_,
+ pub dataSize: u64_,
+ pub nextHash: u32_,
+ pub nameLen: u32_,
+ pub name: [u16_; 0usize],
+}
+impl ::core::default::Default for romfs_file {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
+pub enum romfs_mount { }
+extern "C" {
+ pub fn romfsMount(mount: *mut *mut romfs_mount) -> Result;
+ pub fn romfsMountFromFile(file: Handle, offset: u32_,
+ mount: *mut *mut romfs_mount) -> Result;
+ pub fn romfsBind(mount: *mut romfs_mount) -> Result;
+ pub fn romfsUnmount(mount: *mut romfs_mount) -> Result;
+}
+
+use ::types::*;
diff --git a/ctru-sys/src/sdmc.rs b/ctru-sys/src/sdmc.rs
index ee70839..9cf1209 100644
--- a/ctru-sys/src/sdmc.rs
+++ b/ctru-sys/src/sdmc.rs
@@ -1,7 +1,29 @@
-use Result;
+/* automatically generated by rust-bindgen */
+#![allow(dead_code,
+ non_camel_case_types,
+ non_upper_case_globals,
+ non_snake_case)]
+use ::types::*;
+use services::fs::FS_DirectoryEntry;
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct sdmc_dir_t {
+ pub magic: u32_,
+ pub fd: Handle,
+ pub index: ::libc::ssize_t,
+ pub size: ::libc::size_t,
+ pub entry_data: [FS_DirectoryEntry; 32usize],
+}
+impl ::core::default::Default for sdmc_dir_t {
+ fn default() -> Self { unsafe { ::core::mem::zeroed() } }
+}
extern "C" {
pub fn sdmcInit() -> Result;
+ pub fn sdmcWriteSafe(enable: u8);
pub fn sdmcExit() -> Result;
+ pub fn sdmc_getmtime(name: *const ::libc::c_char, mtime: *mut u64_)
+ -> Result;
}
diff --git a/ctru-sys/src/services/apt.rs b/ctru-sys/src/services/apt.rs
index 22acd27..d713102 100644
--- a/ctru-sys/src/services/apt.rs
+++ b/ctru-sys/src/services/apt.rs
@@ -143,7 +143,7 @@ pub type aptMessageCb =
::core::option::Option<unsafe extern "C" fn(user: *mut ::libc::c_void,
sender: NS_APPID,
msg: *mut ::libc::c_void,
- msgsize: size_t)>;
+ msgsize: ::libc::size_t)>;
extern "C" {
pub fn aptInit() -> Result;
pub fn aptExit();
@@ -157,7 +157,7 @@ extern "C" {
pub fn aptSetMessageCallback(callback: aptMessageCb,
user: *mut ::libc::c_void);
pub fn aptLaunchLibraryApplet(appId: NS_APPID, buf: *mut ::libc::c_void,
- bufsize: size_t, handle: Handle) -> u8;
+ bufsize: ::libc::size_t, handle: Handle) -> u8;
pub fn APT_GetLockHandle(flags: u16_, lockHandle: *mut Handle) -> Result;
pub fn APT_Initialize(appId: NS_APPID, attr: APT_AppletAttr,
signalEvent: *mut Handle, resumeEvent: *mut Handle)
@@ -178,31 +178,31 @@ extern "C" {
titleversion: *mut u16_) -> Result;
pub fn APT_GetProgramID(pProgramID: *mut u64_) -> Result;
pub fn APT_PrepareToJumpToHomeMenu() -> Result;
- pub fn APT_JumpToHomeMenu(param: *const ::libc::c_void, paramSize: size_t,
+ pub fn APT_JumpToHomeMenu(param: *const ::libc::c_void, paramSize: ::libc::size_t,
handle: Handle) -> Result;
pub fn APT_PrepareToJumpToApplication(exiting: u8) -> Result;
pub fn APT_JumpToApplication(param: *const ::libc::c_void,
- paramSize: size_t, handle: Handle) -> Result;
+ paramSize: ::libc::size_t, handle: Handle) -> Result;
pub fn APT_IsRegistered(appID: NS_APPID, out: *mut u8) -> Result;
pub fn APT_InquireNotification(appID: u32_, signalType: *mut APT_Signal)
-> Result;
pub fn APT_NotifyToWait(appID: NS_APPID) -> Result;
pub fn APT_AppletUtility(id: ::libc::c_int, out: *mut ::libc::c_void,
- outSize: size_t, in_: *const ::libc::c_void,
- inSize: size_t) -> Result;
+ outSize: ::libc::size_t, in_: *const ::libc::c_void,
+ inSize: ::libc::size_t) -> Result;
pub fn APT_SleepIfShellClosed() -> Result;
pub fn APT_TryLockTransition(transition: u32_, succeeded: *mut u8)
-> Result;
pub fn APT_UnlockTransition(transition: u32_) -> Result;
pub fn APT_GlanceParameter(appID: NS_APPID, buffer: *mut ::libc::c_void,
- bufferSize: size_t, sender: *mut NS_APPID,
+ bufferSize: ::libc::size_t, sender: *mut NS_APPID,
command: *mut APT_Command,
- actualSize: *mut size_t,
+ actualSize: *mut ::libc::size_t,
parameter: *mut Handle) -> Result;
pub fn APT_ReceiveParameter(appID: NS_APPID, buffer: *mut ::libc::c_void,
- bufferSize: size_t, sender: *mut NS_APPID,
+ bufferSize: ::libc::size_t, sender: *mut NS_APPID,
command: *mut APT_Command,
- actualSize: *mut size_t,
+ actualSize: *mut ::libc::size_t,
parameter: *mut Handle) -> Result;
pub fn APT_SendParameter(source: NS_APPID, dest: NS_APPID,
command: APT_Command,
@@ -217,24 +217,24 @@ extern "C" {
pub fn APT_ReplySleepNotificationComplete(appID: NS_APPID) -> Result;
pub fn APT_PrepareToCloseApplication(cancelPreload: u8) -> Result;
pub fn APT_CloseApplication(param: *const ::libc::c_void,
- paramSize: size_t, handle: Handle) -> Result;
+ paramSize: ::libc::size_t, handle: Handle) -> Result;
pub fn APT_SetAppCpuTimeLimit(percent: u32_) -> Result;
pub fn APT_GetAppCpuTimeLimit(percent: *mut u32_) -> Result;
pub fn APT_CheckNew3DS(out: *mut u8) -> Result;
pub fn APT_PrepareToDoApplicationJump(flags: u8_, programID: u64_,
mediatype: u8_) -> Result;
pub fn APT_DoApplicationJump(param: *const ::libc::c_void,
- paramSize: size_t,
+ paramSize: ::libc::size_t,
hmac: *const ::libc::c_void) -> Result;
pub fn APT_PrepareToStartLibraryApplet(appID: NS_APPID) -> Result;
pub fn APT_StartLibraryApplet(appID: NS_APPID,
param: *const ::libc::c_void,
- paramSize: size_t, handle: Handle)
+ paramSize: ::libc::size_t, handle: Handle)
-> Result;
pub fn APT_PrepareToStartSystemApplet(appID: NS_APPID) -> Result;
pub fn APT_StartSystemApplet(appID: NS_APPID,
param: *const ::libc::c_void,
- paramSize: size_t, handle: Handle) -> Result;
+ paramSize: ::libc::size_t, handle: Handle) -> Result;
pub fn APT_GetSharedFont(fontHandle: *mut Handle, mapAddr: *mut u32_)
-> Result;
}
diff --git a/ctru-sys/src/services/mod.rs b/ctru-sys/src/services/mod.rs
index 30d0f68..880b32d 100644
--- a/ctru-sys/src/services/mod.rs
+++ b/ctru-sys/src/services/mod.rs
@@ -25,7 +25,6 @@ pub mod ptmsysm;
pub mod ptmu;
pub mod pxidev;
pub mod qtm;
-pub mod soc;
pub mod srvpm;
pub mod sslc;
pub mod uds;
diff --git a/ctru-sys/src/services/nfc.rs b/ctru-sys/src/services/nfc.rs
index 09a6a63..c6ac09e 100644
--- a/ctru-sys/src/services/nfc.rs
+++ b/ctru-sys/src/services/nfc.rs
@@ -116,10 +116,10 @@ extern "C" {
pub fn nfcGetTagInfo(out: *mut NFC_TagInfo) -> Result;
pub fn nfcOpenAppData(amiibo_appid: u32_) -> Result;
pub fn nfcInitializeWriteAppData(amiibo_appid: u32_,
- buf: *const ::libc::c_void, size: size_t)
+ buf: *const ::libc::c_void, size: ::libc::size_t)
-> Result;
- pub fn nfcReadAppData(buf: *mut ::libc::c_void, size: size_t) -> Result;
- pub fn nfcWriteAppData(buf: *const ::libc::c_void, size: size_t,
+ pub fn nfcReadAppData(buf: *mut ::libc::c_void, size: ::libc::size_t) -> Result;
+ pub fn nfcWriteAppData(buf: *const ::libc::c_void, size: ::libc::size_t,
taginfo: *mut NFC_TagInfo) -> Result;
pub fn nfcGetAmiiboSettings(out: *mut NFC_AmiiboSettings) -> Result;
pub fn nfcGetAmiiboConfig(out: *mut NFC_AmiiboConfig) -> Result;
diff --git a/ctru-sys/src/services/ps.rs b/ctru-sys/src/services/ps.rs
index 8198dbb..3a1e16c 100644
--- a/ctru-sys/src/services/ps.rs
+++ b/ctru-sys/src/services/ps.rs
@@ -47,7 +47,7 @@ extern "C" {
nonce: *mut u8_) -> Result;
pub fn PS_GetLocalFriendCodeSeed(seed: *mut u64_) -> Result;
pub fn PS_GetDeviceId(device_id: *mut u32_) -> Result;
- pub fn PS_GenerateRandomBytes(out: *mut ::libc::c_void, len: size_t)
+ pub fn PS_GenerateRandomBytes(out: *mut ::libc::c_void, len: ::libc::size_t)
-> Result;
}
use ::types::*;
diff --git a/ctru-sys/src/services/soc.rs b/ctru-sys/src/services/soc.rs
index 8fa7a3d..94ac632 100644
--- a/ctru-sys/src/services/soc.rs
+++ b/ctru-sys/src/services/soc.rs
@@ -92,7 +92,7 @@ extern "C" {
pub fn socInit(context_addr: *mut u32_, context_size: u32_) -> Result;
pub fn socExit() -> Result;
pub fn gethostid() -> ::libc::c_long;
- pub fn gethostname(name: *mut ::libc::c_char, namelen: size_t)
+ pub fn gethostname(name: *mut ::libc::c_char, namelen: ::libc::size_t)
-> ::libc::c_int;
pub fn SOCU_ShutdownSockets() -> ::libc::c_int;
pub fn SOCU_CloseSockets() -> ::libc::c_int;
diff --git a/ctru-sys/src/services/sslc.rs b/ctru-sys/src/services/sslc.rs
index 5a18e59..f310269 100644
--- a/ctru-sys/src/services/sslc.rs
+++ b/ctru-sys/src/services/sslc.rs
@@ -89,9 +89,9 @@ extern "C" {
internal_retval: *mut ::libc::c_int,
out: *mut u32_) -> Result;
pub fn sslcRead(context: *mut sslcContext, buf: *mut ::libc::c_void,
- len: size_t, peek: u8) -> Result;
+ len: ::libc::size_t, peek: u8) -> Result;
pub fn sslcWrite(context: *mut sslcContext, buf: *const ::libc::c_void,
- len: size_t) -> Result;
+ len: ::libc::size_t) -> Result;
pub fn sslcContextSetRootCertChain(context: *mut sslcContext,
handle: u32_) -> Result;
pub fn sslcContextSetClientCert(context: *mut sslcContext, handle: u32_)
diff --git a/ctru-sys/src/svc.rs b/ctru-sys/src/svc.rs
index 88a6992..fb41bc0 100644
--- a/ctru-sys/src/svc.rs
+++ b/ctru-sys/src/svc.rs
@@ -4,10 +4,6 @@
non_camel_case_types,
non_upper_case_globals,
non_snake_case)]
-
-use ::{Handle, Result};
-use ::ThreadFunc;
-
#[derive(Copy, Clone)]
#[repr(u32)]
#[derive(Debug)]
@@ -56,10 +52,10 @@ pub enum MemPerm {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct MemInfo {
- pub base_addr: u32,
- pub size: u32,
- pub perm: u32,
- pub state: u32,
+ pub base_addr: u32_,
+ pub size: u32_,
+ pub perm: u32_,
+ pub state: u32_,
}
impl ::core::default::Default for MemInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -68,7 +64,7 @@ impl ::core::default::Default for MemInfo {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct PageInfo {
- pub flags: u32,
+ pub flags: u32_,
}
impl ::core::default::Default for PageInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -99,10 +95,10 @@ pub enum ProcessEventReason { REASON_CREATE = 1, REASON_ATTACH = 2, }
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct ProcessEvent {
- pub program_id: u64,
- pub process_name: [u8; 8usize],
- pub process_id: u32,
- pub reason: u32,
+ pub program_id: u64_,
+ pub process_name: [u8_; 8usize],
+ pub process_id: u32_,
+ pub reason: u32_,
}
impl ::core::default::Default for ProcessEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -119,7 +115,7 @@ pub enum ExitProcessEventReason {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct ExitProcessEvent {
- pub reason: u32,
+ pub reason: u32_,
}
impl ::core::default::Default for ExitProcessEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -128,9 +124,9 @@ impl ::core::default::Default for ExitProcessEvent {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct CreateThreadEvent {
- pub creator_thread_id: u32,
- pub base_addr: u32,
- pub entry_point: u32,
+ pub creator_thread_id: u32_,
+ pub base_addr: u32_,
+ pub entry_point: u32_,
}
impl ::core::default::Default for CreateThreadEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -148,7 +144,7 @@ pub enum ExitThreadEventReason {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct ExitThreadEvent {
- pub reason: u32,
+ pub reason: u32_,
}
impl ::core::default::Default for ExitThreadEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -179,9 +175,9 @@ pub enum ExceptionEventType {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct ExceptionEvent {
- pub type_: u32,
- pub address: u32,
- pub argument: u32,
+ pub type_: u32_,
+ pub address: u32_,
+ pub argument: u32_,
}
impl ::core::default::Default for ExceptionEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -190,7 +186,7 @@ impl ::core::default::Default for ExceptionEvent {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SchedulerInOutEvent {
- pub clock_tick: u64,
+ pub clock_tick: u64_,
}
impl ::core::default::Default for SchedulerInOutEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -199,8 +195,8 @@ impl ::core::default::Default for SchedulerInOutEvent {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct SyscallInOutEvent {
- pub clock_tick: u64,
- pub syscall: u32,
+ pub clock_tick: u64_,
+ pub syscall: u32_,
_bindgen_padding_0_: [u8; 4usize],
}
impl ::core::default::Default for SyscallInOutEvent {
@@ -210,8 +206,8 @@ impl ::core::default::Default for SyscallInOutEvent {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct OutputStringEvent {
- pub string_addr: u32,
- pub string_size: u32,
+ pub string_addr: u32_,
+ pub string_size: u32_,
}
impl ::core::default::Default for OutputStringEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -220,10 +216,10 @@ impl ::core::default::Default for OutputStringEvent {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct MapEvent {
- pub mapped_addr: u32,
- pub mapped_size: u32,
- pub memperm: u32,
- pub memstate: u32,
+ pub mapped_addr: u32_,
+ pub mapped_size: u32_,
+ pub memperm: u32_,
+ pub memstate: u32_,
}
impl ::core::default::Default for MapEvent {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -250,9 +246,9 @@ pub enum DebugEventType {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct DebugEventInfo {
- pub type_: u32,
- pub thread_id: u32,
- pub unknown: [u32; 2usize],
+ pub type_: u32_,
+ pub thread_id: u32_,
+ pub unknown: [u32_; 2usize],
pub _bindgen_data_1_: [u64; 3usize],
}
impl DebugEventInfo {
@@ -300,21 +296,21 @@ impl ::core::default::Default for DebugEventInfo {
#[derive(Copy, Clone)]
#[derive(Debug)]
pub struct CodeSetInfo {
- pub name: [u8; 8usize],
- pub unk1: u16,
- pub unk2: u16,
- pub unk3: u32,
- pub text_addr: u32,
- pub text_size: u32,
- pub ro_addr: u32,
- pub ro_size: u32,
- pub rw_addr: u32,
- pub rw_size: u32,
- pub text_size_total: u32,
- pub ro_size_total: u32,
- pub rw_size_total: u32,
- pub unk4: u32,
- pub program_id: u64,
+ pub name: [u8_; 8usize],
+ pub unk1: u16_,
+ pub unk2: u16_,
+ pub unk3: u32_,
+ pub text_addr: u32_,
+ pub text_size: u32_,
+ pub ro_addr: u32_,
+ pub ro_size: u32_,
+ pub rw_addr: u32_,
+ pub rw_size: u32_,
+ pub text_size_total: u32_,
+ pub ro_size_total: u32_,
+ pub rw_size_total: u32_,
+ pub unk4: u32_,
+ pub program_id: u64_,
}
impl ::core::default::Default for CodeSetInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
@@ -324,62 +320,62 @@ impl ::core::default::Default for CodeSetInfo {
#[derive(Debug)]
pub struct StartupInfo {
pub priority: ::libc::c_int,
- pub stack_size: u32,
+ pub stack_size: u32_,
pub argc: ::libc::c_int,
- pub argv: *mut u16,
- pub envp: *mut u16,
+ pub argv: *mut u16_,
+ pub envp: *mut u16_,
}
impl ::core::default::Default for StartupInfo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
extern "C" {
- pub fn svcControlMemory(addr_out: *mut u32, addr0: u32, addr1: u32,
- size: u32, op: MemOp, perm: MemPerm) -> Result;
- pub fn svcControlProcessMemory(process: Handle, addr0: u32, addr1: u32,
- size: u32, type_: u32, perm: u32)
+ pub fn svcControlMemory(addr_out: *mut u32_, addr0: u32_, addr1: u32_,
+ size: u32_, op: MemOp, perm: MemPerm) -> Result;
+ pub fn svcControlProcessMemory(process: Handle, addr0: u32_, addr1: u32_,
+ size: u32_, type_: u32_, perm: u32_)
-> Result;
- pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32, size: u32,
+ pub fn svcCreateMemoryBlock(memblock: *mut Handle, addr: u32_, size: u32_,
my_perm: MemPerm, other_perm: MemPerm)
-> Result;
- pub fn svcMapMemoryBlock(memblock: Handle, addr: u32, my_perm: MemPerm,
+ pub fn svcMapMemoryBlock(memblock: Handle, addr: u32_, my_perm: MemPerm,
other_perm: MemPerm) -> Result;
- pub fn svcMapProcessMemory(process: Handle, startAddr: u32,
- endAddr: u32) -> Result;
- pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32,
- endAddr: u32) -> Result;
- pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32) -> Result;
+ pub fn svcMapProcessMemory(process: Handle, startAddr: u32_,
+ endAddr: u32_) -> Result;
+ pub fn svcUnmapProcessMemory(process: Handle, startAddr: u32_,
+ endAddr: u32_) -> Result;
+ pub fn svcUnmapMemoryBlock(memblock: Handle, addr: u32_) -> Result;
pub fn svcStartInterProcessDma(dma: *mut Handle, dstProcess: Handle,
dst: *mut ::libc::c_void,
srcProcess: Handle,
- src: *const ::libc::c_void, size: u32,
+ src: *const ::libc::c_void, size: u32_,
dmaConfig: *mut ::libc::c_void) -> Result;
pub fn svcStopDma(dma: Handle) -> Result;
pub fn svcGetDmaState(dmaState: *mut ::libc::c_void, dma: Handle)
-> Result;
- pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32)
+ pub fn svcQueryMemory(info: *mut MemInfo, out: *mut PageInfo, addr: u32_)
-> Result;
pub fn svcQueryProcessMemory(info: *mut MemInfo, out: *mut PageInfo,
- process: Handle, addr: u32) -> Result;
+ process: Handle, addr: u32_) -> Result;
pub fn svcInvalidateProcessDataCache(process: Handle,
addr: *mut ::libc::c_void,
- size: u32) -> Result;
+ size: u32_) -> Result;
pub fn svcFlushProcessDataCache(process: Handle,
- addr: *const ::libc::c_void, size: u32)
+ addr: *const ::libc::c_void, size: u32_)
-> Result;
pub fn svcReadProcessMemory(buffer: *mut ::libc::c_void, debug: Handle,
- addr: u32, size: u32) -> Result;
+ addr: u32_, size: u32_) -> Result;
pub fn svcWriteProcessMemory(debug: Handle, buffer: *const ::libc::c_void,
- addr: u32, size: u32) -> Result;
- pub fn svcOpenProcess(process: *mut Handle, processId: u32) -> Result;
+ addr: u32_, size: u32_) -> Result;
+ pub fn svcOpenProcess(process: *mut Handle, processId: u32_) -> Result;
pub fn svcExitProcess();
pub fn svcTerminateProcess(process: Handle) -> Result;
- pub fn svcGetProcessInfo(out: *mut i64, process: Handle, type_: u32)
+ pub fn svcGetProcessInfo(out: *mut s64, process: Handle, type_: u32_)
-> Result;
- pub fn svcGetProcessId(out: *mut u32, handle: Handle) -> Result;
- pub fn svcGetProcessList(processCount: *mut i32, processIds: *mut u32,
- processIdMaxCount: i32) -> Result;
+ pub fn svcGetProcessId(out: *mut u32_, handle: Handle) -> Result;
+ pub fn svcGetProcessList(processCount: *mut s32, processIds: *mut u32_,
+ processIdMaxCount: s32) -> Result;
pub fn svcCreatePort(portServer: *mut Handle, portClient: *mut Handle,
- name: *const ::libc::c_char, maxSessions: i32)
+ name: *const ::libc::c_char, maxSessions: s32)
-> Result;
pub fn svcConnectToPort(out: *mut Handle, portName: *const ::libc::c_char)
-> Result;
@@ -388,94 +384,96 @@ extern "C" {
ro_ptr: *mut ::libc::c_void,
data_ptr: *mut ::libc::c_void) -> Result;
pub fn svcCreateProcess(out: *mut Handle, codeset: Handle,
- arm11kernelcaps: *const u32,
- arm11kernelcaps_num: u32) -> Result;
+ arm11kernelcaps: *const u32_,
+ arm11kernelcaps_num: u32_) -> Result;
pub fn svcSetProcessAffinityMask(process: Handle,
- affinitymask: *const u8,
- processorcount: i32) -> Result;
- pub fn svcSetProcessIdealProcessor(process: Handle, processorid: i32)
+ affinitymask: *const u8_,
+ processorcount: s32) -> Result;
+ pub fn svcSetProcessIdealProcessor(process: Handle, processorid: s32)
-> Result;
pub fn svcRun(process: Handle, info: *const StartupInfo) -> Result;
pub fn svcCreateThread(thread: *mut Handle, entrypoint: ThreadFunc,
- arg: u32, stack_top: *mut u32,
- thread_priority: i32, processor_id: i32) -> Result;
- pub fn svcOpenThread(thread: *mut Handle, process: Handle, threadId: u32)
+ arg: u32_, stack_top: *mut u32_,
+ thread_priority: s32, processor_id: s32) -> Result;
+ pub fn svcOpenThread(thread: *mut Handle, process: Handle, threadId: u32_)
-> Result;
pub fn svcExitThread();
- pub fn svcSleepThread(ns: i64);
- pub fn svcGetThreadPriority(out: *mut i32, handle: Handle) -> Result;
- pub fn svcSetThreadPriority(thread: Handle, prio: i32) -> Result;
- pub fn svcGetThreadAffinityMask(affinitymask: *mut u8, thread: Handle,
- processorcount: i32) -> Result;
- pub fn svcSetThreadAffinityMask(thread: Handle, affinitymask: *const u8,
- processorcount: i32) -> Result;
- pub fn svcGetThreadIdealProcessor(processorid: *mut i32, thread: Handle)
+ pub fn svcSleepThread(ns: s64);
+ pub fn svcGetThreadPriority(out: *mut s32, handle: Handle) -> Result;
+ pub fn svcSetThreadPriority(thread: Handle, prio: s32) -> Result;
+ pub fn svcGetThreadAffinityMask(affinitymask: *mut u8_, thread: Handle,
+ processorcount: s32) -> Result;
+ pub fn svcSetThreadAffinityMask(thread: Handle, affinitymask: *const u8_,
+ processorcount: s32) -> Result;
+ pub fn svcGetThreadIdealProcessor(processorid: *mut s32, thread: Handle)
-> Result;
- pub fn svcSetThreadIdealProcessor(thread: Handle, processorid: i32)
+ pub fn svcSetThreadIdealProcessor(thread: Handle, processorid: s32)
-> Result;
- pub fn svcGetProcessorID() -> i32;
- pub fn svcGetThreadId(out: *mut u32, handle: Handle) -> Result;
+ pub fn svcGetProcessorID() -> s32;
+ pub fn svcGetThreadId(out: *mut u32_, handle: Handle) -> Result;
pub fn svcGetResourceLimit(resourceLimit: *mut Handle, process: Handle)
-> Result;
- pub fn svcGetResourceLimitLimitValues(values: *mut i64,
+ pub fn svcGetResourceLimitLimitValues(values: *mut s64,
resourceLimit: Handle,
- names: *mut u32, nameCount: i32)
+ names: *mut u32_, nameCount: s32)
-> Result;
- pub fn svcGetResourceLimitCurrentValues(values: *mut i64,
+ pub fn svcGetResourceLimitCurrentValues(values: *mut s64,
resourceLimit: Handle,
- names: *mut u32, nameCount: i32)
+ names: *mut u32_, nameCount: s32)
-> Result;
- pub fn svcGetProcessIdOfThread(out: *mut u32, handle: Handle) -> Result;
- pub fn svcGetThreadInfo(out: *mut i64, thread: Handle,
+ pub fn svcGetProcessIdOfThread(out: *mut u32_, handle: Handle) -> Result;
+ pub fn svcGetThreadInfo(out: *mut s64, thread: Handle,
type_: ThreadInfoType) -> Result;
pub fn svcCreateMutex(mutex: *mut Handle, initially_locked: u8) -> Result;
pub fn svcReleaseMutex(handle: Handle) -> Result;
- pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: i32,
- max_count: i32) -> Result;
- pub fn svcReleaseSemaphore(count: *mut i32, semaphore: Handle,
- release_count: i32) -> Result;
+ pub fn svcCreateSemaphore(semaphore: *mut Handle, initial_count: s32,
+ max_count: s32) -> Result;
+ pub fn svcReleaseSemaphore(count: *mut s32, semaphore: Handle,
+ release_count: s32) -> Result;
pub fn svcCreateEvent(event: *mut Handle, reset_type: ResetType)
-> Result;
pub fn svcSignalEvent(handle: Handle) -> Result;
pub fn svcClearEvent(handle: Handle) -> Result;
- pub fn svcWaitSynchronization(handle: Handle, nanoseconds: i64) -> Result;
- pub fn svcWaitSynchronizationN(out: *mut i32, handles: *mut Handle,
- handles_num: i32, wait_all: u8,
- nanoseconds: i64) -> Result;
+ pub fn svcWaitSynchronization(handle: Handle, nanoseconds: s64) -> Result;
+ pub fn svcWaitSynchronizationN(out: *mut s32, handles: *mut Handle,
+ handles_num: s32, wait_all: u8,
+ nanoseconds: s64) -> Result;
pub fn svcCreateAddressArbiter(arbiter: *mut Handle) -> Result;
- pub fn svcArbitrateAddress(arbiter: Handle, addr: u32,
- type_: ArbitrationType, value: i32,
- nanoseconds: i64) -> Result;
+ pub fn svcArbitrateAddress(arbiter: Handle, addr: u32_,
+ type_: ArbitrationType, value: s32,
+ nanoseconds: s64) -> Result;
pub fn svcSendSyncRequest(session: Handle) -> Result;
pub fn svcAcceptSession(session: *mut Handle, port: Handle) -> Result;
- pub fn svcReplyAndReceive(index: *mut i32, handles: *mut Handle,
- handleCount: i32, replyTarget: Handle)
+ pub fn svcReplyAndReceive(index: *mut s32, handles: *mut Handle,
+ handleCount: s32, replyTarget: Handle)
-> Result;
- pub fn svcBindInterrupt(interruptId: u32, event: Handle, priority: i32,
+ pub fn svcBindInterrupt(interruptId: u32_, event: Handle, priority: s32,
isManualClear: u8) -> Result;
- pub fn svcUnbindInterrupt(interruptId: u32, event: Handle) -> Result;
+ pub fn svcUnbindInterrupt(interruptId: u32_, event: Handle) -> Result;
pub fn svcCreateTimer(timer: *mut Handle, reset_type: ResetType)
-> Result;
- pub fn svcSetTimer(timer: Handle, initial: i64, interval: i64) -> Result;
+ pub fn svcSetTimer(timer: Handle, initial: s64, interval: s64) -> Result;
pub fn svcCancelTimer(timer: Handle) -> Result;
pub fn svcClearTimer(timer: Handle) -> Result;
- pub fn svcGetSystemTick() -> u64;
+ pub fn svcGetSystemTick() -> u64_;
pub fn svcCloseHandle(handle: Handle) -> Result;
pub fn svcDuplicateHandle(out: *mut Handle, original: Handle) -> Result;
- pub fn svcGetSystemInfo(out: *mut i64, type_: u32, param: i32) -> Result;
- pub fn svcKernelSetState(type_: u32, param0: u32, param1: u32,
- param2: u32) -> Result;
+ pub fn svcGetSystemInfo(out: *mut s64, type_: u32_, param: s32) -> Result;
+ pub fn svcKernelSetState(type_: u32_, param0: u32_, param1: u32_,
+ param2: u32_) -> Result;
pub fn svcBreak(breakReason: UserBreakType);
pub fn svcOutputDebugString(str: *const ::libc::c_char,
length: ::libc::c_int) -> Result;
- pub fn svcDebugActiveProcess(debug: *mut Handle, processId: u32)
+ pub fn svcDebugActiveProcess(debug: *mut Handle, processId: u32_)
-> Result;
pub fn svcBreakDebugProcess(debug: Handle) -> Result;
pub fn svcTerminateDebugProcess(debug: Handle) -> Result;
pub fn svcGetProcessDebugEvent(info: *mut DebugEventInfo, debug: Handle)
-> Result;
- pub fn svcContinueDebugEvent(debug: Handle, flags: u32) -> Result;
+ pub fn svcContinueDebugEvent(debug: Handle, flags: u32_) -> Result;
pub fn svcBackdoor(callback:
- ::core::option::Option<extern "C" fn() -> i32>)
+ ::core::option::Option<extern "C" fn() -> s32>)
-> Result;
}
+
+use ::types::*;
diff --git a/ctru-sys/src/sys/inaddr.rs b/ctru-sys/src/sys/inaddr.rs
index f16e233..d188f2c 100644
--- a/ctru-sys/src/sys/inaddr.rs
+++ b/ctru-sys/src/sys/inaddr.rs
@@ -5,11 +5,10 @@
non_upper_case_globals,
non_snake_case)]
-use ::types::*;
use super::socket::*;
-pub type in_port_t = uint16_t;
-pub type in_addr_t = uint32_t;
+pub type in_port_t = ::libc::uint16_t;
+pub type in_addr_t = ::libc::uint32_t;
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
@@ -41,4 +40,3 @@ pub struct ip_mreq {
impl ::core::default::Default for ip_mreq {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
-
diff --git a/ctru-sys/src/sys/libc.rs b/ctru-sys/src/sys/libc.rs
index ab8eb7c..3ae6456 100644
--- a/ctru-sys/src/sys/libc.rs
+++ b/ctru-sys/src/sys/libc.rs
@@ -85,8 +85,8 @@ 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;
+ pub fn memchr(cx: *const c_void, c: c_int, n: ::libc::size_t) -> *mut c_void;
+ pub fn memrchr(cx: *const c_void, c: c_int, n: ::libc::size_t) -> *mut c_void;
pub fn strlen(cs: *const c_char) -> size_t;
- pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
+ pub fn write(fd: c_int, buf: *const c_void, count: ::libc::size_t) -> ::libc::ssize_t;
}
diff --git a/ctru-sys/src/sys/mod.rs b/ctru-sys/src/sys/mod.rs
index af15a1c..d2d4cbe 100644
--- a/ctru-sys/src/sys/mod.rs
+++ b/ctru-sys/src/sys/mod.rs
@@ -1,4 +1,3 @@
-pub mod libc;
pub mod lock;
-pub mod socket;
pub mod inaddr;
+pub mod socket;
diff --git a/ctru-sys/src/sys/socket.rs b/ctru-sys/src/sys/socket.rs
index ec544dc..19d1cb1 100644
--- a/ctru-sys/src/sys/socket.rs
+++ b/ctru-sys/src/sys/socket.rs
@@ -4,8 +4,8 @@
non_camel_case_types,
non_upper_case_globals,
non_snake_case)]
-pub type socklen_t = uint32_t;
-pub type sa_family_t = uint16_t;
+pub type socklen_t = ::libc::uint32_t;
+pub type sa_family_t = ::libc::uint16_t;
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Debug)]
@@ -53,17 +53,17 @@ extern "C" {
optlen: *mut socklen_t) -> ::libc::c_int;
pub fn listen(sockfd: ::libc::c_int, backlog: ::libc::c_int)
-> ::libc::c_int;
- pub fn recv(sockfd: ::libc::c_int, buf: *mut ::libc::c_void, len: size_t,
- flags: ::libc::c_int) -> ssize_t;
+ pub fn recv(sockfd: ::libc::c_int, buf: *mut ::libc::c_void, len: ::libc::size_t,
+ flags: ::libc::c_int) -> ::libc::ssize_t;
pub fn recvfrom(sockfd: ::libc::c_int, buf: *mut ::libc::c_void,
- len: size_t, flags: ::libc::c_int,
+ len: ::libc::size_t, flags: ::libc::c_int,
src_addr: *mut sockaddr, addrlen: *mut socklen_t)
- -> ssize_t;
+ -> ::libc::ssize_t;
pub fn send(sockfd: ::libc::c_int, buf: *const ::libc::c_void,
- len: size_t, flags: ::libc::c_int) -> ssize_t;
+ len: ::libc::size_t, flags: ::libc::c_int) -> ::libc::ssize_t;
pub fn sendto(sockfd: ::libc::c_int, buf: *const ::libc::c_void,
- len: size_t, flags: ::libc::c_int,
- dest_addr: *const sockaddr, addrlen: socklen_t) -> ssize_t;
+ len: ::libc::size_t, flags: ::libc::c_int,
+ dest_addr: *const sockaddr, addrlen: socklen_t) -> ::libc::ssize_t;
pub fn setsockopt(sockfd: ::libc::c_int, level: ::libc::c_int,
optname: ::libc::c_int, optval: *const ::libc::c_void,
optlen: socklen_t) -> ::libc::c_int;
@@ -73,5 +73,3 @@ extern "C" {
protocol: ::libc::c_int) -> ::libc::c_int;
pub fn sockatmark(sockfd: ::libc::c_int) -> ::libc::c_int;
}
-
-use ::types::*;
diff --git a/ctru-sys/src/types.rs b/ctru-sys/src/types.rs
index 92534b7..d5baa88 100644
--- a/ctru-sys/src/types.rs
+++ b/ctru-sys/src/types.rs
@@ -22,10 +22,6 @@ pub type vs32 = s32;
pub type vs64 = s64;
pub type Handle = u32_;
pub type Result = s32;
-pub type size_t = usize;
-pub type ssize_t = isize;
-pub type uint32_t = u32;
-pub type uint16_t = u16;
pub type ThreadFunc =
::core::option::Option<unsafe extern "C" fn(arg1: *mut ::libc::c_void)>;
pub type voidfn = ::core::option::Option<extern "C" fn()>;