fixes from nes

This commit is contained in:
2025-11-17 08:10:03 -07:00
parent 691ef2b26b
commit 1c1000dfcb
19 changed files with 212 additions and 57 deletions

View File

@@ -5,6 +5,6 @@ edition = "2024"
[dependencies]
abi = { path = "../../abi" }
embedded-graphics = "0.8.1"
selection_ui = { path = "../../selection_ui" }
embedded-graphics = "0.8.1"
tinygif = { git = "https://github.com/LegitCamper/tinygif" }

View File

@@ -7,7 +7,7 @@ use abi::{
fs::{Entries, file_len, list_dir, read_file},
get_key, get_ms,
keyboard::{KeyCode, KeyState},
print, sleep,
println, sleep,
};
use alloc::{format, vec, vec::Vec};
use core::panic::PanicInfo;
@@ -23,7 +23,7 @@ use tinygif::Gif;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
print!("user panic: {} @ {:?}", info.message(), info.location(),);
println!("user panic: {} @ {:?}", info.message(), info.location(),);
loop {}
}
@@ -33,7 +33,7 @@ pub extern "Rust" fn _start() {
}
pub fn main() {
print!("Starting Gif app");
println!("Starting Gif app");
let mut display = Display::take().unwrap();
let mut entries = Entries::new();
@@ -41,9 +41,10 @@ pub fn main() {
let mut files = entries.entries();
files.retain(|e| e.extension().unwrap_or("") == "gif");
let gifs = &files.iter().map(|e| e.full_name()).collect::<Vec<&str>>();
let mut gifs = files.iter().map(|e| e.full_name()).collect::<Vec<&str>>();
gifs.sort();
let mut selection_ui = SelectionUi::new(&gifs);
let mut selection_ui = SelectionUi::new(&mut gifs);
let selection = match selection_ui.run_selection_ui(&mut display) {
Ok(maybe_sel) => maybe_sel,
Err(e) => match e {
@@ -66,7 +67,7 @@ pub fn main() {
let size = file_len(&file_name);
let mut buf = vec![0_u8; size];
let read = read_file(&file_name, 0, &mut buf);
print!("read: {}, file size: {}", read, size);
println!("read: {}, file size: {}", read, size);
assert!(read == size);
let gif = Gif::<Rgb565>::from_slice(&buf).expect("Failed to parse gif");