Browse Source

Add Soc::init_with_buffer_size

pull/10/head
Fenrir 7 years ago committed by FenrirWolf
parent
commit
43c251c10b
  1. 8
      ctru-rs/src/services/soc.rs

8
ctru-rs/src/services/soc.rs

@ -8,12 +8,14 @@ pub struct Soc {
impl Soc { impl Soc {
pub fn init() -> ::Result<Soc> { pub fn init() -> ::Result<Soc> {
const SOC_MEM_SIZE: usize = 0x100000; Soc::init_with_buffer_size(0x100000)
}
pub fn init_with_buffer_size(num_bytes: usize) -> ::Result<Soc> {
unsafe { unsafe {
let soc_mem = memalign(0x1000, SOC_MEM_SIZE) as *mut u32; let soc_mem = memalign(0x1000, num_bytes) as *mut u32;
let r = socInit(soc_mem, SOC_MEM_SIZE as u32); let r = socInit(soc_mem, num_bytes as u32);
if r < 0 { if r < 0 {
Err(r.into()) Err(r.into())
} else { } else {

Loading…
Cancel
Save