Skip to content

Commit

Permalink
Debug input issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zaksabeast committed Mar 25, 2024
1 parent 8ada521 commit a0e59bd
Showing 5 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions 3gx/includes/hid.h
Original file line number Diff line number Diff line change
@@ -4,3 +4,4 @@ void set_key_addr(vu32 *key_addr);
void scan_input();
u32 get_current_keys();
u32 get_previous_keys();
u32 get_key_addr();
5 changes: 5 additions & 0 deletions 3gx/sources/hid.c
Original file line number Diff line number Diff line change
@@ -27,3 +27,8 @@ u32 get_previous_keys()
{
return g_previous_keys;
}

u32 get_key_addr()
{
return g_key_addr;
}
4 changes: 3 additions & 1 deletion reader_core/src/gen7/frame.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use super::{
reader::Gen7Reader,
};
use crate::{
pnp,
pnp::{self, key_addr},
rng::{RngWrapper, Sfmt},
utils::{
menu::{Menu, MenuOption, MenuOptionValue},
@@ -93,6 +93,8 @@ fn run_frame(reader: Gen7Reader) {
state.view = state.main_menu.next_view(Gen7View::MainMenu, state.view);
draw_header(Gen7View::MainMenu, state.view, is_locked);

pnp::println!("Key addr {:x}", pnp::key_addr());

match state.view {
Gen7View::Rng => draw_rng(&reader, &state.sfmt),
Gen7View::Daycare => draw_daycare(&reader),
6 changes: 6 additions & 0 deletions reader_core/src/pnp/bindings.rs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ extern "C" {
pub fn host_set_print_max_len(max_len: u32);
pub fn host_get_game_title_id() -> u64;
pub fn host_game_start_ms() -> u64;
pub fn get_key_addr() -> u32;
}

#[cfg(feature = "test_stubs")]
@@ -30,4 +31,9 @@ pub mod test_stubs {
pub extern "C" fn host_game_start_ms() -> u64 {
0
}

#[no_mangle]
pub extern "C" fn get_key_addr() -> u32 {
0
}
}
4 changes: 4 additions & 0 deletions reader_core/src/pnp/input.rs
Original file line number Diff line number Diff line change
@@ -66,3 +66,7 @@ pub fn is_just_pressed(io_bits: impl Into<u32>) -> bool {
let is_pressed = unsafe { bindings::host_is_just_pressed(io_bits.into()) };
is_pressed != 0
}

pub fn key_addr() -> u32 {
unsafe { bindings::get_key_addr() }
}

0 comments on commit a0e59bd

Please sign in to comment.