Compare commits
2 Commits
f72701b4c5
...
b62046045d
Author | SHA1 | Date |
---|---|---|
|
b62046045d | |
|
6687b1f12f |
|
@ -34,9 +34,14 @@ impl Cart {
|
||||||
.truncate(false)
|
.truncate(false)
|
||||||
.open(sram_path(file_path, sim_id))?;
|
.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 {
|
let sram = if sram_file.metadata()?.len() == 0 {
|
||||||
// new SRAM file, randomize the contents
|
// new SRAM file, randomize the contents
|
||||||
let mut sram = vec![0; contents.sram_size];
|
let mut sram = vec![0; sram_file_size];
|
||||||
let mut rng = rand::rng();
|
let mut rng = rand::rng();
|
||||||
for dst in sram
|
for dst in sram
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
|
@ -46,9 +51,9 @@ impl Cart {
|
||||||
}
|
}
|
||||||
sram
|
sram
|
||||||
} else {
|
} else {
|
||||||
let mut sram = Vec::with_capacity(contents.sram_size);
|
let mut sram = Vec::with_capacity(sram_file_size);
|
||||||
sram_file.read_to_end(&mut sram)?;
|
sram_file.read_to_end(&mut sram)?;
|
||||||
sram.resize(contents.sram_size, 0);
|
sram.resize(sram_file_size, 0);
|
||||||
sram
|
sram
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue