Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of all FS code and member renaming #150

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ctru-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ shim-3ds = { git = "https://github.com/rust3ds/shim-3ds.git" }
pthread-3ds = { git = "https://github.com/rust3ds/pthread-3ds.git" }
libc = "0.2.121"
bitflags = "2.3.3"
widestring = "0.2.2"

[build-dependencies]
toml = "0.5"
Expand Down
10 changes: 5 additions & 5 deletions ctru-rs/examples/title-info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use ctru::prelude::*;
use ctru::services::am::Am;
use ctru::services::fs::FsMediaType;
use ctru::services::fs::MediaType;

fn main() {
let gfx = Gfx::new().expect("Couldn't obtain GFX controller");
Expand All @@ -20,20 +20,20 @@ fn main() {

// Amount of titles installed on the SD card.
let sd_count = am
.title_count(FsMediaType::Sd)
.title_count(MediaType::Sd)
.expect("Failed to get sd title count");
// List of titles installed on the SD card.
let sd_list = am
.title_list(FsMediaType::Sd)
.title_list(MediaType::Sd)
.expect("Failed to get sd title list");

// Amount of titles installed on the NAND storage.
let nand_count = am
.title_count(FsMediaType::Nand)
.title_count(MediaType::Nand)
.expect("Failed to get nand title count");
// List of titles installed on the NAND storage.
let nand_list = am
.title_list(FsMediaType::Nand)
.title_list(MediaType::Nand)
.expect("Failed to get nand title list");

let mut offset = 0;
Expand Down
18 changes: 9 additions & 9 deletions ctru-rs/src/services/am.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#![doc(alias = "manager")]

use crate::error::ResultCode;
use crate::services::fs::FsMediaType;
use crate::services::fs::MediaType;
use std::marker::PhantomData;

/// General information about a specific title entry.
#[doc(alias = "AM_TitleEntry")]
pub struct Title<'a> {
id: u64,
mediatype: FsMediaType,
mediatype: MediaType,
size: u64,
version: u16,
_am: PhantomData<&'a Am>,
Expand Down Expand Up @@ -91,20 +91,20 @@ impl Am {
/// # fn main() -> Result<(), Box<dyn Error>> {
/// #
/// use ctru::services::am::Am;
/// use ctru::services::fs::FsMediaType;
/// use ctru::services::fs::MediaType;
/// let app_manager = Am::new()?;
///
/// // Number of titles installed on the Nand storage.
/// let nand_count = app_manager.title_count(FsMediaType::Nand);
/// let nand_count = app_manager.title_count(MediaType::Nand);
///
/// // Number of apps installed on the SD card storage
/// let sd_count = app_manager.title_count(FsMediaType::Sd);
/// let sd_count = app_manager.title_count(MediaType::Sd);
/// #
/// # Ok(())
/// # }
/// ```
#[doc(alias = "AM_GetTitleCount")]
pub fn title_count(&self, mediatype: FsMediaType) -> crate::Result<u32> {
pub fn title_count(&self, mediatype: MediaType) -> crate::Result<u32> {
unsafe {
let mut count = 0;
ResultCode(ctru_sys::AM_GetTitleCount(mediatype.into(), &mut count))?;
Expand All @@ -122,11 +122,11 @@ impl Am {
/// # fn main() -> Result<(), Box<dyn Error>> {
/// #
/// use ctru::services::am::Am;
/// use ctru::services::fs::FsMediaType;
/// use ctru::services::fs::MediaType;
/// let app_manager = Am::new()?;
///
/// // Number of apps installed on the SD card storage
/// let sd_titles = app_manager.title_list(FsMediaType::Sd)?;
/// let sd_titles = app_manager.title_list(MediaType::Sd)?;
///
/// // Unique product code identifier of the 5th installed title.
/// let product_code = sd_titles[4].product_code();
Expand All @@ -135,7 +135,7 @@ impl Am {
/// # }
/// ```
#[doc(alias = "AM_GetTitleList")]
pub fn title_list(&self, mediatype: FsMediaType) -> crate::Result<Vec<Title>> {
pub fn title_list(&self, mediatype: MediaType) -> crate::Result<Vec<Title>> {
let count = self.title_count(mediatype)?;
let mut buf = vec![0; count as usize];
let mut read_amount = 0;
Expand Down
Loading
Loading