diff --git a/ctru-rs/src/services/soc.rs b/ctru-rs/src/services/soc.rs index 23cba3f..bb150df 100644 --- a/ctru-rs/src/services/soc.rs +++ b/ctru-rs/src/services/soc.rs @@ -1,5 +1,5 @@ +use std::net::Ipv4Addr; use libctru::{socInit, socExit}; - use libc::{memalign, free}; /// Soc service. Initializing this service will enable the use of network sockets and utilities @@ -37,6 +37,12 @@ impl Soc { } } } + + /// IP Address of the Nintendo 3DS system. + pub fn host_address(&self) -> Ipv4Addr { + let raw_id = unsafe { libc::gethostid() }; + Ipv4Addr::from(raw_id.to_ne_bytes()) + } } impl Drop for Soc {