Compare commits

..
1 Commits
Author SHA1 Message Date
SonicSwordcane f72701b4c5 Support reading VBX files in cart 2025-08-06 23:38:17 -04:00
+3 -8
View File
@@ -34,14 +34,9 @@ impl Cart {
.truncate(false)
.open(sram_path(file_path, sim_id))?;
let sram_file_size = if contents.sram_small_bus {
contents.sram_size * 2
} else {
contents.sram_size
};
let sram = if sram_file.metadata()?.len() == 0 {
// new SRAM file, randomize the contents
let mut sram = vec![0; sram_file_size];
let mut sram = vec![0; contents.sram_size];
let mut rng = rand::rng();
for dst in sram
.iter_mut()
@@ -51,9 +46,9 @@ impl Cart {
}
sram
} else {
let mut sram = Vec::with_capacity(sram_file_size);
let mut sram = Vec::with_capacity(contents.sram_size);
sram_file.read_to_end(&mut sram)?;
sram.resize(sram_file_size, 0);
sram.resize(contents.sram_size, 0);
sram
};