From 9aa866d35f7f0ed9f36630dd73a792cc7f590f45 Mon Sep 17 00:00:00 2001 From: Mark Drobnak Date: Fri, 13 Jan 2023 21:09:10 -0800 Subject: [PATCH] Fix some type issues in ir_user service --- ctru-rs/src/services/ir_user.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ctru-rs/src/services/ir_user.rs b/ctru-rs/src/services/ir_user.rs index 303490a..adbc690 100644 --- a/ctru-rs/src/services/ir_user.rs +++ b/ctru-rs/src/services/ir_user.rs @@ -1,6 +1,5 @@ use crate::error::ResultCode; use crate::services::ServiceReference; -use crate::Error; use ctru_sys::{Handle, MEMPERM_READ, MEMPERM_READWRITE}; use std::alloc::Layout; use std::cmp::max; @@ -42,7 +41,7 @@ const SHARED_MEM_INFO_SECTIONS_SIZE: usize = 0x30; const SHARED_MEM_RECV_BUFFER_OFFSET: usize = 0x20; const PAGE_SIZE: usize = 0x1000; const IR_BITRATE: u32 = 4; -const PACKET_INFO_SIZE: u32 = 8; +const PACKET_INFO_SIZE: usize = 8; const CIRCLE_PAD_PRO_INPUT_RESPONSE_PACKET_ID: u8 = 0x10; impl IrUser { @@ -269,12 +268,12 @@ impl IrUser { ]); // Parse the packets - (0..valid_packet_count) + (0..valid_packet_count as usize) .map(|i| { // Get the packet info - let packet_index = (i + start_index) % user_state.recv_packet_count as u32; + let packet_index = (i + start_index as usize) % user_state.recv_packet_count; let packet_info_offset = - SHARED_MEM_RECV_BUFFER_OFFSET + (packet_index * PACKET_INFO_SIZE) as usize; + SHARED_MEM_RECV_BUFFER_OFFSET + (packet_index * PACKET_INFO_SIZE); let packet_info = &shared_mem[packet_info_offset..packet_info_offset + PACKET_INFO_SIZE];