Browse Source

Merge branch 'master' into example/futures-tokio

pull/42/head
AzureMarker 3 years ago
parent
commit
56b056d721
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 8
      Cargo.toml
  2. 3
      ctru-sys/Cargo.toml
  3. 2
      ctru-sys/bindgen.sh
  4. 114
      ctru-sys/src/bindings.rs

8
Cargo.toml

@ -1,2 +1,10 @@
[workspace] [workspace]
members = ["ctru-rs", "ctru-sys"] members = ["ctru-rs", "ctru-sys"]
[patch.crates-io]
# We have some changes not in the upstream
libc = { git = "https://github.com/Meziu/libc.git" }
[patch.'https://github.com/Meziu/ctru-rs']
# Make sure all dependencies use the local ctru-sys package
ctru-sys = { path = "ctru-sys" }

3
ctru-sys/Cargo.toml

@ -1,8 +1,9 @@
[package] [package]
name = "ctru-sys" name = "ctru-sys"
version = "0.4.0" version = "0.4.1"
authors = ["Ronald Kinard <furyhunter600@gmail.com>"] authors = ["Ronald Kinard <furyhunter600@gmail.com>"]
license = "https://en.wikipedia.org/wiki/Zlib_License" license = "https://en.wikipedia.org/wiki/Zlib_License"
links = "ctru"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

2
ctru-sys/bindgen.sh

@ -26,5 +26,5 @@ bindgen "$DEVKITPRO/libctru/include/3ds.h" \
-mtune=mpcore \ -mtune=mpcore \
-mfpu=vfp \ -mfpu=vfp \
-DARM11 \ -DARM11 \
-D_3DS \ -D__3DS__ \
> src/bindings.rs > src/bindings.rs

114
ctru-sys/src/bindings.rs

@ -215,8 +215,12 @@ pub const CUR_PROCESS_HANDLE: u32 = 4294934529;
pub const ARBITRATION_SIGNAL_ALL: i32 = -1; pub const ARBITRATION_SIGNAL_ALL: i32 = -1;
pub const CUR_THREAD_HANDLE: u32 = 4294934528; pub const CUR_THREAD_HANDLE: u32 = 4294934528;
pub const SYSCLOCK_SOC: u32 = 16756991; pub const SYSCLOCK_SOC: u32 = 16756991;
pub const SYSCLOCK_SYS: u32 = 33513982;
pub const SYSCLOCK_SDMMC: u32 = 67027964;
pub const SYSCLOCK_ARM9: u32 = 134055928; pub const SYSCLOCK_ARM9: u32 = 134055928;
pub const SYSCLOCK_ARM11: u32 = 268111856; pub const SYSCLOCK_ARM11: u32 = 268111856;
pub const SYSCLOCK_ARM11_LGR1: u32 = 536223712;
pub const SYSCLOCK_ARM11_LGR2: u32 = 804335568;
pub const SYSCLOCK_ARM11_NEW: u32 = 804335568; pub const SYSCLOCK_ARM11_NEW: u32 = 804335568;
pub const CPU_TICKS_PER_MSEC: f64 = 268111.856; pub const CPU_TICKS_PER_MSEC: f64 = 268111.856;
pub const CPU_TICKS_PER_USEC: f64 = 268.111856; pub const CPU_TICKS_PER_USEC: f64 = 268.111856;
@ -277,6 +281,8 @@ pub const CONSOLE_BLINK_FAST: u32 = 32;
pub const CONSOLE_COLOR_REVERSE: u32 = 64; pub const CONSOLE_COLOR_REVERSE: u32 = 64;
pub const CONSOLE_CONCEAL: u32 = 128; pub const CONSOLE_CONCEAL: u32 = 128;
pub const CONSOLE_CROSSED_OUT: u32 = 256; pub const CONSOLE_CROSSED_OUT: u32 = 256;
pub const CONSOLE_FG_CUSTOM: u32 = 512;
pub const CONSOLE_BG_CUSTOM: u32 = 1024;
pub const __GNUCLIKE_ASM: u32 = 3; pub const __GNUCLIKE_ASM: u32 = 3;
pub const __GNUCLIKE___TYPEOF: u32 = 1; pub const __GNUCLIKE___TYPEOF: u32 = 1;
pub const __GNUCLIKE___OFFSETOF: u32 = 1; pub const __GNUCLIKE___OFFSETOF: u32 = 1;
@ -1216,6 +1222,7 @@ pub const MIISELECTOR_GUESTMII_SLOTS: u32 = 6;
pub const MIISELECTOR_USERMII_SLOTS: u32 = 100; pub const MIISELECTOR_USERMII_SLOTS: u32 = 100;
pub const MIISELECTOR_GUESTMII_NAME_LEN: u32 = 12; pub const MIISELECTOR_GUESTMII_NAME_LEN: u32 = 12;
pub const ARCHIVE_DIRITER_MAGIC: u32 = 1751347809; pub const ARCHIVE_DIRITER_MAGIC: u32 = 1751347809;
pub const LINK3DS_COMM_PORT: u32 = 17491;
pub type __int8_t = ::libc::c_schar; pub type __int8_t = ::libc::c_schar;
pub type __uint8_t = ::libc::c_uchar; pub type __uint8_t = ::libc::c_uchar;
pub type __int16_t = ::libc::c_short; pub type __int16_t = ::libc::c_short;
@ -3446,7 +3453,10 @@ extern "C" {
fb_b: *const ::libc::c_void, fb_b: *const ::libc::c_void,
stride: u32_, stride: u32_,
mode: u32_, mode: u32_,
); ) -> bool;
}
extern "C" {
pub fn gspIsPresentPending(screen: ::libc::c_uint) -> bool;
} }
extern "C" { extern "C" {
pub fn gspSetEventCallback( pub fn gspSetEventCallback(
@ -3628,8 +3638,8 @@ pub struct PrintConsole {
pub windowWidth: ::libc::c_int, pub windowWidth: ::libc::c_int,
pub windowHeight: ::libc::c_int, pub windowHeight: ::libc::c_int,
pub tabSize: ::libc::c_int, pub tabSize: ::libc::c_int,
pub fg: ::libc::c_int, pub fg: u16_,
pub bg: ::libc::c_int, pub bg: u16_,
pub flags: ::libc::c_int, pub flags: ::libc::c_int,
pub PrintChar: ConsolePrint, pub PrintChar: ConsolePrint,
pub consoleInitialised: bool, pub consoleInitialised: bool,
@ -4040,12 +4050,26 @@ extern "C" {
extern "C" { extern "C" {
pub fn mappableFree(mem: *mut ::libc::c_void); pub fn mappableFree(mem: *mut ::libc::c_void);
} }
pub const VRAM_ALLOC_A: vramAllocPos = 1;
pub const VRAM_ALLOC_B: vramAllocPos = 2;
pub const VRAM_ALLOC_ANY: vramAllocPos = 3;
pub type vramAllocPos = ::libc::c_uint;
extern "C" { extern "C" {
pub fn vramAlloc(size: size_t) -> *mut ::libc::c_void; pub fn vramAlloc(size: size_t) -> *mut ::libc::c_void;
} }
extern "C" {
pub fn vramAllocAt(size: size_t, pos: vramAllocPos) -> *mut ::libc::c_void;
}
extern "C" { extern "C" {
pub fn vramMemAlign(size: size_t, alignment: size_t) -> *mut ::libc::c_void; pub fn vramMemAlign(size: size_t, alignment: size_t) -> *mut ::libc::c_void;
} }
extern "C" {
pub fn vramMemAlignAt(
size: size_t,
alignment: size_t,
pos: vramAllocPos,
) -> *mut ::libc::c_void;
}
extern "C" { extern "C" {
pub fn vramRealloc(mem: *mut ::libc::c_void, size: size_t) -> *mut ::libc::c_void; pub fn vramRealloc(mem: *mut ::libc::c_void, size: size_t) -> *mut ::libc::c_void;
} }
@ -4414,6 +4438,13 @@ impl Default for FS_Path {
} }
} }
} }
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct FS_SdMmcSpeedInfo {
pub highSpeedModeEnabled: bool,
pub usesHighestClockRate: bool,
pub sdClkCtrl: u16_,
}
pub type FS_Archive = u64_; pub type FS_Archive = u64_;
extern "C" { extern "C" {
pub fn fsInit() -> Result; pub fn fsInit() -> Result;
@ -4553,10 +4584,10 @@ extern "C" {
pub fn FSUSER_GetNandCid(out: *mut u8_, length: u32_) -> Result; pub fn FSUSER_GetNandCid(out: *mut u8_, length: u32_) -> Result;
} }
extern "C" { extern "C" {
pub fn FSUSER_GetSdmcSpeedInfo(speedInfo: *mut u32_) -> Result; pub fn FSUSER_GetSdmcSpeedInfo(speedInfo: *mut FS_SdMmcSpeedInfo) -> Result;
} }
extern "C" { extern "C" {
pub fn FSUSER_GetNandSpeedInfo(speedInfo: *mut u32_) -> Result; pub fn FSUSER_GetNandSpeedInfo(speedInfo: *mut FS_SdMmcSpeedInfo) -> Result;
} }
extern "C" { extern "C" {
pub fn FSUSER_GetSdmcLog(out: *mut u8_, length: u32_) -> Result; pub fn FSUSER_GetSdmcLog(out: *mut u8_, length: u32_) -> Result;
@ -5027,6 +5058,19 @@ pub struct AM_TWLPartitionInfo {
pub titlesCapacity: u64_, pub titlesCapacity: u64_,
pub titlesFreeSpace: u64_, pub titlesFreeSpace: u64_,
} }
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct AM_ContentInfo {
pub index: u16_,
pub type_: u16_,
pub contentId: u32_,
pub size: u64_,
pub flags: u8_,
pub padding: [u8_; 7usize],
}
pub const AM_CONTENT_DOWNLOADED: AM_ContentInfoFlags = 1;
pub const AM_CONTENT_OWNED: AM_ContentInfoFlags = 2;
pub type AM_ContentInfoFlags = ::libc::c_uint;
extern "C" { extern "C" {
pub fn amInit() -> Result; pub fn amInit() -> Result;
} }
@ -5325,6 +5369,23 @@ extern "C" {
extern "C" { extern "C" {
pub fn AM_DeleteAllTwlTitles() -> Result; pub fn AM_DeleteAllTwlTitles() -> Result;
} }
extern "C" {
pub fn AMAPP_GetDLCContentInfoCount(
count: *mut u32_,
mediatype: FS_MediaType,
titleID: u64_,
) -> Result;
}
extern "C" {
pub fn AMAPP_ListDLCContentInfos(
contentInfoRead: *mut u32_,
mediatype: FS_MediaType,
titleID: u64_,
contentInfoCount: u32_,
offset: u32_,
contentInfos: *mut AM_ContentInfo,
) -> Result;
}
extern "C" { extern "C" {
pub fn ampxiInit(servhandle: Handle) -> Result; pub fn ampxiInit(servhandle: Handle) -> Result;
} }
@ -7305,10 +7366,10 @@ extern "C" {
pub fn FSPXI_GetNandCid(serviceHandle: Handle, out: *mut ::libc::c_void, size: u32_) -> Result; pub fn FSPXI_GetNandCid(serviceHandle: Handle, out: *mut ::libc::c_void, size: u32_) -> Result;
} }
extern "C" { extern "C" {
pub fn FSPXI_GetSdmcSpeedInfo(serviceHandle: Handle, out: *mut u32_) -> Result; pub fn FSPXI_GetSdmcSpeedInfo(serviceHandle: Handle, out: *mut FS_SdMmcSpeedInfo) -> Result;
} }
extern "C" { extern "C" {
pub fn FSPXI_GetNandSpeedInfo(serviceHandle: Handle, out: *mut u32_) -> Result; pub fn FSPXI_GetNandSpeedInfo(serviceHandle: Handle, out: *mut FS_SdMmcSpeedInfo) -> Result;
} }
extern "C" { extern "C" {
pub fn FSPXI_GetSdmcLog(serviceHandle: Handle, out: *mut ::libc::c_void, size: u32_) -> Result; pub fn FSPXI_GetSdmcLog(serviceHandle: Handle, out: *mut ::libc::c_void, size: u32_) -> Result;
@ -10314,6 +10375,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn ptmuExit(); pub fn ptmuExit();
} }
extern "C" {
pub fn ptmuGetSessionHandle() -> *mut Handle;
}
extern "C" { extern "C" {
pub fn PTMU_GetShellState(out: *mut u8_) -> Result; pub fn PTMU_GetShellState(out: *mut u8_) -> Result;
} }
@ -10361,6 +10425,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn ptmSysmExit(); pub fn ptmSysmExit();
} }
extern "C" {
pub fn ptmSysmGetSessionHandle() -> *mut Handle;
}
extern "C" { extern "C" {
pub fn PTMSYSM_RequestSleep() -> Result; pub fn PTMSYSM_RequestSleep() -> Result;
} }
@ -10379,6 +10446,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn PTMSYSM_Awaken() -> Result; pub fn PTMSYSM_Awaken() -> Result;
} }
extern "C" {
pub fn PTMSYSM_SetUserTime(msY2k: s64) -> Result;
}
extern "C" { extern "C" {
pub fn PTMSYSM_InvalidateSystemTime() -> Result; pub fn PTMSYSM_InvalidateSystemTime() -> Result;
} }
@ -10400,6 +10470,30 @@ extern "C" {
extern "C" { extern "C" {
pub fn PTMSYSM_RebootAsync(timeout: u64_) -> Result; pub fn PTMSYSM_RebootAsync(timeout: u64_) -> Result;
} }
extern "C" {
pub fn ptmGetsInit() -> Result;
}
extern "C" {
pub fn ptmGetsExit();
}
extern "C" {
pub fn ptmGetsGetSessionHandle() -> *mut Handle;
}
extern "C" {
pub fn PTMGETS_GetSystemTime(outMsY2k: *mut s64) -> Result;
}
extern "C" {
pub fn ptmSetsInit() -> Result;
}
extern "C" {
pub fn ptmSetsExit();
}
extern "C" {
pub fn ptmSetsGetSessionHandle() -> *mut Handle;
}
extern "C" {
pub fn PTMSETS_SetSystemTime(msY2k: s64) -> Result;
}
pub const WAIT_NONE: PXIDEV_WaitType = 0; pub const WAIT_NONE: PXIDEV_WaitType = 0;
pub const WAIT_SLEEP: PXIDEV_WaitType = 1; pub const WAIT_SLEEP: PXIDEV_WaitType = 1;
pub const WAIT_IREQ_RETURN: PXIDEV_WaitType = 2; pub const WAIT_IREQ_RETURN: PXIDEV_WaitType = 2;
@ -13543,3 +13637,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn gdbHioDevSystem(command: *const ::libc::c_char) -> ::libc::c_int; pub fn gdbHioDevSystem(command: *const ::libc::c_char) -> ::libc::c_int;
} }
extern "C" {
pub static mut __3dslink_host: in_addr;
}
extern "C" {
pub fn link3dsConnectToHost(redirStdout: bool, redirStderr: bool) -> ::libc::c_int;
}

Loading…
Cancel
Save