Compare commits

..

3 Commits

Author SHA1 Message Date
Simon Gellis 58bb34e3cc Add elf/isx to file picker 2025-09-06 10:22:17 -04:00
Simon Gellis 132d494cc2 Delete profiles before overwriting 2025-09-06 10:13:09 -04:00
Simon Gellis 30ee8c06f7 Fix off-by-one errors 2025-09-06 09:57:37 -04:00
3 changed files with 5 additions and 2 deletions

View File

@ -154,14 +154,14 @@ fn extract_isx_symbols(input: &[u8]) -> Option<Vec<Symbol>> {
// Range (Virtual Boy) // Range (Virtual Boy)
let count_bytes; let count_bytes;
(count_bytes, buf) = buf.split_first_chunk()?; (count_bytes, buf) = buf.split_first_chunk()?;
let count = u16::from_le_bytes(*count_bytes) + 1; let count = u16::from_le_bytes(*count_bytes);
(_, buf) = buf.split_at_checked(count as usize * 9)?; (_, buf) = buf.split_at_checked(count as usize * 9)?;
} }
0x14 => { 0x14 => {
// Symbol (Virtual Boy) // Symbol (Virtual Boy)
let count_bytes; let count_bytes;
(count_bytes, buf) = buf.split_first_chunk()?; (count_bytes, buf) = buf.split_first_chunk()?;
let count = u16::from_le_bytes(*count_bytes) + 1; let count = u16::from_le_bytes(*count_bytes);
for _ in 0..count { for _ in 0..count {
let name_len; let name_len;
(name_len, buf) = buf.split_first()?; (name_len, buf) = buf.split_first()?;

View File

@ -88,6 +88,7 @@ impl GameWindow {
Command::OpenRom => { Command::OpenRom => {
let rom = rfd::FileDialog::new() let rom = rfd::FileDialog::new()
.add_filter("Virtual Boy ROMs", &["vb", "vbrom"]) .add_filter("Virtual Boy ROMs", &["vb", "vbrom"])
.add_filter("Executable files", &["", "elf", "isx"])
.pick_file(); .pick_file();
if let Some(path) = rom { if let Some(path) = rom {
self.client self.client
@ -140,6 +141,7 @@ impl GameWindow {
{ {
let rom = rfd::FileDialog::new() let rom = rfd::FileDialog::new()
.add_filter("Virtual Boy ROMs", &["vb", "vbrom"]) .add_filter("Virtual Boy ROMs", &["vb", "vbrom"])
.add_filter("Executable files", &["", "elf", "isx"])
.pick_file(); .pick_file();
if let Some(path) = rom { if let Some(path) = rom {
self.client self.client

View File

@ -65,6 +65,7 @@ impl ProfileWindow {
.save_file(); .save_file();
if let Some(path) = file { if let Some(path) = file {
let bytes = pollster::block_on(bytes_receiver)?; let bytes = pollster::block_on(bytes_receiver)?;
let _ = fs::remove_file(&path);
fs::write(&path, bytes)?; fs::write(&path, bytes)?;
Ok(Some(path.display().to_string())) Ok(Some(path.display().to_string()))
} else { } else {