Skip to content

Commit

Permalink
Change Language repr to i8 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaF1 committed Nov 8, 2024
1 parent 4a15ec9 commit cc98398
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ctru-rs/src/services/cfgu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum Region {
/// Language set for the console's OS.
#[doc(alias = "CFG_Language")]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u8)]
#[repr(i8)]
pub enum Language {
/// Japanese.
Japanese = ctru_sys::CFG_LANGUAGE_JP,
Expand Down Expand Up @@ -174,7 +174,7 @@ impl Cfgu {
let mut language: u8 = 0;

ResultCode(unsafe { ctru_sys::CFGU_GetSystemLanguage(&mut language) })?;
Ok(Language::try_from(language).unwrap())
Ok(Language::try_from(language as i8).unwrap())
}

/// Check if NFC is supported by the console.
Expand Down Expand Up @@ -244,7 +244,7 @@ impl Drop for Cfgu {
}

from_impl!(Region, u8);
from_impl!(Language, u8);
from_impl!(Language, i8);
from_impl!(SystemModel, u8);

impl TryFrom<u8> for Region {
Expand All @@ -264,10 +264,10 @@ impl TryFrom<u8> for Region {
}
}

impl TryFrom<u8> for Language {
impl TryFrom<i8> for Language {
type Error = ();

fn try_from(value: u8) -> Result<Self, Self::Error> {
fn try_from(value: i8) -> Result<Self, Self::Error> {
match value {
ctru_sys::CFG_LANGUAGE_JP => Ok(Language::Japanese),
ctru_sys::CFG_LANGUAGE_EN => Ok(Language::English),
Expand Down

0 comments on commit cc98398

Please sign in to comment.