Browse Source

More modules starndardised

pull/107/head
Andrea Ciliberti 2 years ago
parent
commit
43b83b5356
  1. 10
      ctru-rs/examples/audio-filters.rs
  2. 10
      ctru-rs/examples/buttons.rs
  3. 4
      ctru-rs/examples/camera-image.rs
  4. 12
      ctru-rs/examples/file-explorer.rs
  5. 4
      ctru-rs/examples/gfx-3d-mode.rs
  6. 4
      ctru-rs/examples/gfx-wide-mode.rs
  7. 2
      ctru-rs/examples/graphics-bitmap.rs
  8. 2
      ctru-rs/examples/hashmaps.rs
  9. 2
      ctru-rs/examples/hello-both-screens.rs
  10. 2
      ctru-rs/examples/hello-world.rs
  11. 2
      ctru-rs/examples/linear-memory.rs
  12. 2
      ctru-rs/examples/mii-selector.rs
  13. 2
      ctru-rs/examples/network-sockets.rs
  14. 2
      ctru-rs/examples/output-3dslink.rs
  15. 2
      ctru-rs/examples/romfs.rs
  16. 4
      ctru-rs/examples/software-keyboard.rs
  17. 2
      ctru-rs/examples/system-configuration.rs
  18. 2
      ctru-rs/examples/time-rtc.rs
  19. 8
      ctru-rs/examples/title-info.rs
  20. 6
      ctru-rs/src/lib.rs
  21. 58
      ctru-rs/src/services/fs.rs
  22. 56
      ctru-rs/src/services/hid.rs
  23. 32
      ctru-rs/src/services/ps.rs
  24. 8
      ctru-rs/src/services/soc.rs
  25. 4
      ctru-rs/src/services/sslc.rs
  26. 2
      ctru-rs/src/test_runner.rs

10
ctru-rs/examples/audio-filters.rs

@ -102,23 +102,23 @@ fn main() {
hid.scan_input(); hid.scan_input();
let keys_down = hid.keys_down(); let keys_down = hid.keys_down();
if keys_down.contains(KeyPad::KEY_START) { if keys_down.contains(KeyPad::START) {
break; break;
} // break in order to return to hbmenu } // break in order to return to hbmenu
if keys_down.intersects(KeyPad::KEY_DOWN) { if keys_down.intersects(KeyPad::DOWN) {
note = note.saturating_sub(1); note = note.saturating_sub(1);
} else if keys_down.intersects(KeyPad::KEY_UP) { } else if keys_down.intersects(KeyPad::UP) {
note = std::cmp::min(note + 1, NOTEFREQ.len() - 1); note = std::cmp::min(note + 1, NOTEFREQ.len() - 1);
} }
let mut update_params = false; let mut update_params = false;
if keys_down.intersects(KeyPad::KEY_LEFT) { if keys_down.intersects(KeyPad::LEFT) {
filter -= 1; filter -= 1;
filter = filter.rem_euclid(filter_names.len() as _); filter = filter.rem_euclid(filter_names.len() as _);
update_params = true; update_params = true;
} else if keys_down.intersects(KeyPad::KEY_RIGHT) { } else if keys_down.intersects(KeyPad::RIGHT) {
filter += 1; filter += 1;
filter = filter.rem_euclid(filter_names.len() as _); filter = filter.rem_euclid(filter_names.len() as _);

10
ctru-rs/examples/buttons.rs

@ -42,19 +42,19 @@ fn main() {
// You can also use the .bits() method to do direct comparisons on // You can also use the .bits() method to do direct comparisons on
// the underlying bits // the underlying bits
if keys.contains(KeyPad::KEY_A) { if keys.contains(KeyPad::A) {
println!("You held A!"); println!("You held A!");
} }
if keys.bits() & KeyPad::KEY_B.bits() != 0 { if keys.bits() & KeyPad::B.bits() != 0 {
println!("You held B!"); println!("You held B!");
} }
if keys.contains(KeyPad::KEY_X | KeyPad::KEY_Y) { if keys.contains(KeyPad::X | KeyPad::Y) {
println!("You held X and Y!"); println!("You held X and Y!");
} }
if keys.intersects(KeyPad::KEY_L | KeyPad::KEY_R | KeyPad::KEY_ZL | KeyPad::KEY_ZR) { if keys.intersects(KeyPad::L | KeyPad::R | KeyPad::ZL | KeyPad::ZR) {
println!("You held a shoulder button!"); println!("You held a shoulder button!");
} }
if keys.intersects(KeyPad::KEY_START) { if keys.intersects(KeyPad::START) {
println!("See ya!"); println!("See ya!");
break; break;
} }

4
ctru-rs/examples/camera-image.rs

@ -65,11 +65,11 @@ fn main() {
hid.scan_input(); hid.scan_input();
keys_down = hid.keys_down(); keys_down = hid.keys_down();
if keys_down.contains(KeyPad::KEY_START) { if keys_down.contains(KeyPad::START) {
break; break;
} }
if keys_down.contains(KeyPad::KEY_R) { if keys_down.contains(KeyPad::R) {
println!("Capturing new image"); println!("Capturing new image");
let camera = &mut cam.outer_right_cam; let camera = &mut cam.outer_right_cam;

12
ctru-rs/examples/file-explorer.rs

@ -56,15 +56,15 @@ impl<'a> FileExplorer<'a> {
self.hid.scan_input(); self.hid.scan_input();
let input = self.hid.keys_down(); let input = self.hid.keys_down();
if input.contains(KeyPad::KEY_START) { if input.contains(KeyPad::START) {
break; break;
} else if input.contains(KeyPad::KEY_B) && self.path.components().count() > 1 { } else if input.contains(KeyPad::B) && self.path.components().count() > 1 {
self.path.pop(); self.path.pop();
self.console.clear(); self.console.clear();
self.print_menu(); self.print_menu();
} else if input.contains(KeyPad::KEY_A) { } else if input.contains(KeyPad::A) {
self.get_input_and_run(Self::set_next_path); self.get_input_and_run(Self::set_next_path);
} else if input.contains(KeyPad::KEY_X) { } else if input.contains(KeyPad::X) {
self.get_input_and_run(Self::set_exact_path); self.get_input_and_run(Self::set_exact_path);
} }
@ -147,11 +147,11 @@ impl<'a> FileExplorer<'a> {
self.hid.scan_input(); self.hid.scan_input();
let input = self.hid.keys_down(); let input = self.hid.keys_down();
if input.contains(KeyPad::KEY_A) { if input.contains(KeyPad::A) {
break; break;
} }
if input.contains(KeyPad::KEY_START) { if input.contains(KeyPad::START) {
self.running = false; self.running = false;
return; return;
} }

4
ctru-rs/examples/gfx-3d-mode.rs

@ -31,7 +31,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
@ -44,7 +44,7 @@ fn main() {
right_buf.ptr.copy_from(ZERO.as_ptr(), ZERO.len()); right_buf.ptr.copy_from(ZERO.as_ptr(), ZERO.len());
} }
if hid.keys_down().contains(KeyPad::KEY_A) { if hid.keys_down().contains(KeyPad::A) {
// flip which buffer we're writing to // flip which buffer we're writing to
current_side = match current_side { current_side = match current_side {
Side::Left => Side::Right, Side::Left => Side::Right,

4
ctru-rs/examples/gfx-wide-mode.rs

@ -13,11 +13,11 @@ fn main() {
while apt.main_loop() { while apt.main_loop() {
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
if hid.keys_down().contains(KeyPad::KEY_A) { if hid.keys_down().contains(KeyPad::A) {
drop(console); drop(console);
let wide_mode = gfx.top_screen.borrow().get_wide_mode(); let wide_mode = gfx.top_screen.borrow().get_wide_mode();

2
ctru-rs/examples/graphics-bitmap.rs

@ -43,7 +43,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }

2
ctru-rs/examples/hashmaps.rs

@ -26,7 +26,7 @@ fn main() {
gfx.wait_for_vblank(); gfx.wait_for_vblank();
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
} }

2
ctru-rs/examples/hello-both-screens.rs

@ -32,7 +32,7 @@ fn main() {
gfx.wait_for_vblank(); gfx.wait_for_vblank();
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
} }

2
ctru-rs/examples/hello-world.rs

@ -26,7 +26,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

2
ctru-rs/examples/linear-memory.rs

@ -34,7 +34,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

2
ctru-rs/examples/mii-selector.rs

@ -30,7 +30,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

2
ctru-rs/examples/network-sockets.rs

@ -61,7 +61,7 @@ fn main() {
} }
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
}; };
} }

2
ctru-rs/examples/output-3dslink.rs

@ -30,7 +30,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

2
ctru-rs/examples/romfs.rs

@ -33,7 +33,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

4
ctru-rs/examples/software-keyboard.rs

@ -18,7 +18,7 @@ fn main() {
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_A) { if hid.keys_down().contains(KeyPad::A) {
// Prepares a software keyboard with two buttons: One to cancel input and one // Prepares a software keyboard with two buttons: One to cancel input and one
// to accept it. You can also use `Swkbd::init()` to launch the keyboard in different // to accept it. You can also use `Swkbd::init()` to launch the keyboard in different
// configurations. // configurations.
@ -37,7 +37,7 @@ fn main() {
} }
} }
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
} }

2
ctru-rs/examples/system-configuration.rs

@ -19,7 +19,7 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
// Flush and swap framebuffers // Flush and swap framebuffers

2
ctru-rs/examples/time-rtc.rs

@ -16,7 +16,7 @@ fn main() {
// Scan all the inputs. This should be done once for each frame // Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }

8
ctru-rs/examples/title-info.rs

@ -35,10 +35,10 @@ fn main() {
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
if hid.keys_down().contains(KeyPad::KEY_SELECT) { if hid.keys_down().contains(KeyPad::SELECT) {
refresh = true; refresh = true;
offset = 0; offset = 0;
use_nand = !use_nand; use_nand = !use_nand;
@ -46,12 +46,12 @@ fn main() {
let cur_list = if use_nand { &nand_list } else { &sd_list }; let cur_list = if use_nand { &nand_list } else { &sd_list };
if hid.keys_down().intersects(KeyPad::KEY_DOWN) { if hid.keys_down().intersects(KeyPad::DOWN) {
if offset + 1 < cur_list.len() { if offset + 1 < cur_list.len() {
offset = offset + 1; offset = offset + 1;
refresh = true; refresh = true;
} }
} else if hid.keys_down().intersects(KeyPad::KEY_UP) { } else if hid.keys_down().intersects(KeyPad::UP) {
if offset > 0 { if offset > 0 {
offset = offset - 1; offset = offset - 1;
refresh = true; refresh = true;

6
ctru-rs/src/lib.rs

@ -15,10 +15,10 @@ extern crate pthread_3ds;
#[cfg(feature = "big-stack")] #[cfg(feature = "big-stack")]
static __stacksize__: usize = 2 * 1024 * 1024; // 2MB static __stacksize__: usize = 2 * 1024 * 1024; // 2MB
/// Activate ´ctru-rs´' default panic handler. /// Activate the default panic handler.
/// ///
/// With this implementation, the main thread will stop and try to print debug info to an available [console::Console]. /// With this implementation, the main thread will stop and try to print debug info to an available [console::Console].
/// In case it fails to find an active [console::Console], the program will just exit. /// In case it fails to find an active [console::Console] the program will just exit.
/// ///
/// # Notes /// # Notes
/// ///
@ -48,7 +48,7 @@ fn panic_hook_setup() {
Ok(hid) => loop { Ok(hid) => loop {
hid.scan_input(); hid.scan_input();
let keys = hid.keys_down(); let keys = hid.keys_down();
if keys.contains(KeyPad::KEY_SELECT) { if keys.contains(KeyPad::SELECT) {
break; break;
} }
}, },

58
ctru-rs/src/services/fs.rs

@ -1,7 +1,7 @@
//! Filesystem service //! Filesystem service
//! //!
//! This module contains basic methods to manipulate the contents of the 3DS's filesystem. //! This module contains basic methods to manipulate the contents of the 3DS's filesystem.
//! Only the SD card is currently supported. //! Only the SD card is currently supported. You should prefer using `std::fs`.
use bitflags::bitflags; use bitflags::bitflags;
use std::ffi::OsString; use std::ffi::OsString;
@ -52,38 +52,40 @@ pub enum FsMediaType {
} }
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(u32)]
pub enum PathType { pub enum PathType {
Invalid, Invalid = ctru_sys::PATH_INVALID,
Empty, Empty = ctru_sys::PATH_EMPTY,
Binary, Binary = ctru_sys::PATH_BINARY,
ASCII, ASCII = ctru_sys::PATH_ASCII,
UTF16, UTF16 = ctru_sys::PATH_UTF16,
} }
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(u32)]
pub enum ArchiveID { pub enum ArchiveID {
RomFS, RomFS = ctru_sys::ARCHIVE_ROMFS,
Savedata, Savedata = ctru_sys::ARCHIVE_ROMFS,
Extdata, Extdata = ctru_sys::ARCHIVE_ROMFS,
SharedExtdata, SharedExtdata = ctru_sys::ARCHIVE_ROMFS,
SystemSavedata, SystemSavedata = ctru_sys::ARCHIVE_ROMFS,
Sdmc, Sdmc = ctru_sys::ARCHIVE_ROMFS,
SdmcWriteOnly, SdmcWriteOnly = ctru_sys::ARCHIVE_ROMFS,
BossExtdata, BossExtdata = ctru_sys::ARCHIVE_ROMFS,
CardSpiFS, CardSpiFS = ctru_sys::ARCHIVE_ROMFS,
ExtDataAndBossExtdata, ExtDataAndBossExtdata = ctru_sys::ARCHIVE_ROMFS,
SystemSaveData2, SystemSaveData2 = ctru_sys::ARCHIVE_ROMFS,
NandRW, NandRW = ctru_sys::ARCHIVE_ROMFS,
NandRO, NandRO = ctru_sys::ARCHIVE_ROMFS,
NandROWriteAccess, NandROWriteAccess = ctru_sys::ARCHIVE_ROMFS,
SaveDataAndContent, SaveDataAndContent = ctru_sys::ARCHIVE_ROMFS,
SaveDataAndContent2, SaveDataAndContent2 = ctru_sys::ARCHIVE_ROMFS,
NandCtrFS, NandCtrFS = ctru_sys::ARCHIVE_ROMFS,
TwlPhoto, TwlPhoto = ctru_sys::ARCHIVE_ROMFS,
NandTwlFS, NandTwlFS = ctru_sys::ARCHIVE_ROMFS,
GameCardSavedata, GameCardSavedata = ctru_sys::ARCHIVE_ROMFS,
UserSavedata, UserSavedata = ctru_sys::ARCHIVE_ROMFS,
DemoSavedata, DemoSavedata = ctru_sys::ARCHIVE_ROMFS,
} }
/// Represents the filesystem service. No file IO can be performed /// Represents the filesystem service. No file IO can be performed

56
ctru-rs/src/services/hid.rs

@ -10,34 +10,34 @@ bitflags::bitflags! {
/// inputs on the 3DS /// inputs on the 3DS
#[derive(Default)] #[derive(Default)]
pub struct KeyPad: u32 { pub struct KeyPad: u32 {
const KEY_A = 1u32 << 0; const A = ctru_sys::KEY_A;
const KEY_B = 1u32 << 1; const B = ctru_sys::KEY_B;
const KEY_SELECT = 1u32 << 2; const SELECT = ctru_sys::KEY_SELECT;
const KEY_START = 1u32 << 3; const START = ctru_sys::KEY_START;
const KEY_DRIGHT = 1u32 << 4; const DRIGHT = ctru_sys::KEY_DRIGHT;
const KEY_DLEFT = 1u32 << 5; const DLEFT = ctru_sys::KEY_DLEFT;
const KEY_DUP = 1u32 << 6; const DUP = ctru_sys::KEY_DUP;
const KEY_DDOWN = 1u32 << 7; const DDOWN = ctru_sys::KEY_DDOWN;
const KEY_R = 1u32 << 8; const R = ctru_sys::KEY_R;
const KEY_L = 1u32 << 9; const L = ctru_sys::KEY_L;
const KEY_X = 1u32 << 10; const X = ctru_sys::KEY_X;
const KEY_Y = 1u32 << 11; const Y = ctru_sys::KEY_Y;
const KEY_ZL = 1u32 << 14; const ZL = ctru_sys::KEY_ZL;
const KEY_ZR = 1u32 << 15; const ZR = ctru_sys::KEY_ZR;
const KEY_TOUCH = 1u32 << 20; const TOUCH = ctru_sys::KEY_TOUCH;
const KEY_CSTICK_RIGHT = 1u32 << 24; const CSTICK_RIGHT = ctru_sys::KEY_CSTICK_RIGHT;
const KEY_CSTICK_LEFT = 1u32 << 25; const CSTICK_LEFT = ctru_sys::KEY_CSTICK_LEFT;
const KEY_CSTICK_UP = 1u32 << 26; const CSTICK_UP = ctru_sys::KEY_CSTICK_UP;
const KEY_CSTICK_DOWN = 1u32 << 27; const CSTICK_DOWN = ctru_sys::KEY_CSTICK_DOWN;
const KEY_CPAD_RIGHT = 1u32 << 28; const CPAD_RIGHT = ctru_sys::KEY_CPAD_RIGHT;
const KEY_CPAD_LEFT = 1u32 << 29; const CPAD_LEFT = ctru_sys::KEY_CPAD_LEFT;
const KEY_CPAD_UP = 1u32 << 30; const CPAD_UP = ctru_sys::KEY_CPAD_UP;
const KEY_CPAD_DOWN = 1u32 << 31; const CPAD_DOWN = ctru_sys::KEY_CPAD_DOWN;
// convenience catch-all for the dpad and cpad // Convenience catch-all for the dpad and cpad
const KEY_UP = KeyPad::KEY_DUP.bits | KeyPad::KEY_CPAD_UP.bits; const UP = KeyPad::DUP.bits() | KeyPad::CPAD_UP.bits();
const KEY_DOWN = KeyPad::KEY_DDOWN.bits | KeyPad::KEY_CPAD_DOWN.bits; const DOWN = KeyPad::DDOWN.bits() | KeyPad::CPAD_DOWN.bits();
const KEY_LEFT = KeyPad::KEY_DLEFT.bits | KeyPad::KEY_CPAD_LEFT.bits; const LEFT = KeyPad::DLEFT.bits() | KeyPad::CPAD_LEFT.bits();
const KEY_RIGHT = KeyPad::KEY_DRIGHT.bits | KeyPad::KEY_CPAD_RIGHT.bits; const RIGHT = KeyPad::DRIGHT.bits() | KeyPad::CPAD_RIGHT.bits();
} }
} }

32
ctru-rs/src/services/ps.rs

@ -8,26 +8,26 @@ use crate::Result;
#[repr(u32)] #[repr(u32)]
pub enum AESAlgorithm { pub enum AESAlgorithm {
CbcEnc, CbcEnc = ctru_sys::PS_ALGORITHM_CBC_ENC,
CbcDec, CbcDec = ctru_sys::PS_ALGORITHM_CBC_DEC,
CtrEnc, CtrEnc = ctru_sys::PS_ALGORITHM_CTR_ENC,
CtrDec, CtrDec = ctru_sys::PS_ALGORITHM_CTR_DEC,
CcmEnc, CcmEnc = ctru_sys::PS_ALGORITHM_CCM_ENC,
CcmDec, CcmDec = ctru_sys::PS_ALGORITHM_CCM_DEC,
} }
#[repr(u32)] #[repr(u32)]
pub enum AESKeyType { pub enum AESKeyType {
Keyslot0D, Keyslot0D = ctru_sys::PS_KEYSLOT_0D,
Keyslot2D, Keyslot2D = ctru_sys::PS_KEYSLOT_2D,
Keyslot31, Keyslot2E = ctru_sys::PS_KEYSLOT_2E,
Keyslot38, Keyslot31 = ctru_sys::PS_KEYSLOT_31,
Keyslot32, Keyslot32 = ctru_sys::PS_KEYSLOT_32,
Keyslot39Dlp, Keyslot36 = ctru_sys::PS_KEYSLOT_36,
Keyslot2E, Keyslot38 = ctru_sys::PS_KEYSLOT_38,
KeyslotInvalid, Keyslot39Dlp = ctru_sys::PS_KEYSLOT_39_DLP,
Keyslot36, Keyslot39Nfc = ctru_sys::PS_KEYSLOT_39_NFC,
Keyslot39Nfc, KeyslotInvalid = ctru_sys::PS_KEYSLOT_INVALID,
} }
pub struct Ps(()); pub struct Ps(());

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

@ -1,3 +1,5 @@
//! Network Socket
use libc::memalign; use libc::memalign;
use std::net::Ipv4Addr; use std::net::Ipv4Addr;
use std::sync::Mutex; use std::sync::Mutex;
@ -6,8 +8,10 @@ use crate::error::ResultCode;
use crate::services::ServiceReference; use crate::services::ServiceReference;
use crate::Error; use crate::Error;
/// Soc service. Initializing this service will enable the use of network sockets and utilities /// Network socket service
/// such as those found in `std::net`. The service will be closed when this struct is is dropped. ///
/// Initializing this service will enable the use of network sockets and utilities
/// such as those found in `std::net`. The service will close once this struct gets dropped.
pub struct Soc { pub struct Soc {
_service_handler: ServiceReference, _service_handler: ServiceReference,
sock_3dslink: libc::c_int, sock_3dslink: libc::c_int,

4
ctru-rs/src/services/sslc.rs

@ -1,3 +1,5 @@
//! SSLC (TLS) service
// TODO: Implement remaining functions // TODO: Implement remaining functions
use crate::error::ResultCode; use crate::error::ResultCode;
@ -5,7 +7,7 @@ use crate::error::ResultCode;
pub struct SslC(()); pub struct SslC(());
impl SslC { impl SslC {
/// Initialize sslc /// Initialize the service
pub fn init() -> crate::Result<Self> { pub fn init() -> crate::Result<Self> {
unsafe { unsafe {
ResultCode(ctru_sys::sslcInit(0))?; ResultCode(ctru_sys::sslcInit(0))?;

2
ctru-rs/src/test_runner.rs

@ -44,7 +44,7 @@ pub(crate) fn run(tests: &[&TestDescAndFn]) {
gfx.wait_for_vblank(); gfx.wait_for_vblank();
hid.scan_input(); hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) { if hid.keys_down().contains(KeyPad::START) {
break; break;
} }
} }

Loading…
Cancel
Save