From d0f13de4c5747c3082a81b9c6c01cd020886c8c1 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:25:38 +0300 Subject: [PATCH] Fix swapping loaded ELF files --- src/emulator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/emulator.cpp b/src/emulator.cpp index db6c2e1f..921af08f 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -299,6 +299,11 @@ bool Emulator::load3DSX(const std::filesystem::path& path) { } bool Emulator::loadELF(const std::filesystem::path& path) { + // We can't open a new file with this ifstream if it's associated with a file + if (loadedELF.is_open()) { + loadedELF.close(); + } + loadedELF.open(path, std::ios_base::binary); // Open ROM in binary mode romType = ROMType::ELF;