From 43c251c10b3823cbe4fea3159b44c575c63bd37d Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sun, 11 Feb 2018 16:24:09 -0700 Subject: [PATCH] Add Soc::init_with_buffer_size --- ctru-rs/src/services/soc.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ctru-rs/src/services/soc.rs b/ctru-rs/src/services/soc.rs index 4d4666a..1f11b6c 100644 --- a/ctru-rs/src/services/soc.rs +++ b/ctru-rs/src/services/soc.rs @@ -8,12 +8,14 @@ pub struct Soc { impl Soc { pub fn init() -> ::Result { - const SOC_MEM_SIZE: usize = 0x100000; + Soc::init_with_buffer_size(0x100000) + } + pub fn init_with_buffer_size(num_bytes: usize) -> ::Result { 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 { Err(r.into()) } else {