Browse Source

Update PR to build with the latest versions

pull/86/head
Andrea Ciliberti 1 year ago
parent
commit
47f1f78f50
  1. 3
      ctru-rs/src/services/ir_user.rs
  2. 12
      ctru-sys/src/lib.rs

3
ctru-rs/src/services/ir_user.rs

@ -7,7 +7,7 @@ use std::ffi::CString;
use std::ptr::{slice_from_raw_parts, slice_from_raw_parts_mut}; use std::ptr::{slice_from_raw_parts, slice_from_raw_parts_mut};
use std::sync::Mutex; use std::sync::Mutex;
static IR_USER_ACTIVE: Mutex<usize> = Mutex::new(0); static IR_USER_ACTIVE: Mutex<()> = Mutex::new(());
static IR_USER_STATE: Mutex<Option<IrUserState>> = Mutex::new(None); static IR_USER_STATE: Mutex<Option<IrUserState>> = Mutex::new(None);
/// The "ir:USER" service. This service is used to talk to IR devices such as /// The "ir:USER" service. This service is used to talk to IR devices such as
@ -55,7 +55,6 @@ impl IrUser {
) -> crate::Result<Self> { ) -> crate::Result<Self> {
let service_reference = ServiceReference::new( let service_reference = ServiceReference::new(
&IR_USER_ACTIVE, &IR_USER_ACTIVE,
false,
|| unsafe { || unsafe {
// Get the ir:USER service handle // Get the ir:USER service handle
let mut service_handle = Handle::default(); let mut service_handle = Handle::default();

12
ctru-sys/src/lib.rs

@ -4,8 +4,6 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(clippy::all)] #![allow(clippy::all)]
use core::arch::asm;
pub mod result; pub mod result;
pub use result::*; pub use result::*;
@ -17,16 +15,6 @@ pub unsafe fn errno() -> s32 {
*__errno() *__errno()
} }
pub unsafe fn getThreadLocalStorage() -> *mut libc::c_void {
let return_value: *mut libc::c_void;
asm!("mrc p15, 0, {}, c13, c0, 3", out(reg) return_value);
return_value
}
pub unsafe fn getThreadCommandBuffer() -> *mut u32 {
(getThreadLocalStorage() as *mut u8).add(0x80) as *mut u32
}
// TODO: not sure if there's a better way to do this, but I have gotten myself // TODO: not sure if there's a better way to do this, but I have gotten myself
// with this a couple times so having the hint seems nice to have. // with this a couple times so having the hint seems nice to have.
#[cfg(test)] #[cfg(test)]

Loading…
Cancel
Save