fix bug when loading different roms

This commit is contained in:
2024-11-06 22:39:30 -05:00
parent 05c72726d7
commit 368f358179
2 changed files with 2 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ impl LoROM {
impl ROM for LoROM {
fn load(&mut self, filename: &str) -> std::io::Result<bool> {
self.data = vec![];
load_rom(filename, &mut self.data)
}

View File

@@ -10,6 +10,7 @@ pub fn build_menu_bar(emulator: &mut Emulator, ui: &mut egui::Ui, state: &mut Ap
if ui.button("Load ROM file").clicked() {
if let Some(path) = rfd::FileDialog::new().pick_file() {
let picked_path = path.display().to_string();
// TODO: replace this load function by an external function as each ROM may not always be LoROM
match emulator.bus.rom.load(&picked_path) {
Ok(_) => {
emulator.hard_reset();