diff options
author | Arisotura <thetotalworm@gmail.com> | 2022-01-08 11:20:21 +0100 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2022-01-08 11:20:21 +0100 |
commit | 80564ba947eae83bdcb4f18ece7e36617a217fbb (patch) | |
tree | 4fc8c61d131660584c3fb64aa5ad630c9d4c83c4 /src | |
parent | e665e25bd3ea4b9af932e182b1c93e77b762ccb0 (diff) |
explicitly eject the cart before a load with reset, preventing a spurious cart-eject IRQ on startup
also fix possible KEY1 issues when using internal BIOS
Diffstat (limited to 'src')
-rw-r--r-- | src/NDSCart.cpp | 20 | ||||
-rw-r--r-- | src/frontend/qt_sdl/ROMManager.cpp | 1 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp index 940827f..54b136f 100644 --- a/src/NDSCart.cpp +++ b/src/NDSCart.cpp @@ -137,13 +137,21 @@ void Key1_LoadKeyBuf(bool dsi) // it is possible that this gets called before the BIOSes are loaded // so we will read from the BIOS files directly - std::string path = Platform::GetConfigString(dsi ? Platform::DSi_BIOS7Path : Platform::BIOS7Path); - FILE* f = Platform::OpenLocalFile(path, "rb"); - if (f) + if (Platform::GetConfigBool(Platform::ExternalBIOSEnable)) { - fseek(f, dsi ? 0xC6D0 : 0x0030, SEEK_SET); - fread(Key1_KeyBuf, 0x1048, 1, f); - fclose(f); + std::string path = Platform::GetConfigString(dsi ? Platform::DSi_BIOS7Path : Platform::BIOS7Path); + FILE* f = Platform::OpenLocalFile(path, "rb"); + if (f) + { + fseek(f, dsi ? 0xC6D0 : 0x0030, SEEK_SET); + fread(Key1_KeyBuf, 0x1048, 1, f); + fclose(f); + } + } + else + { + // well + memset(Key1_KeyBuf, 0, 0x1048); } } diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp index 2b9bbd3..1d8bd87 100644 --- a/src/frontend/qt_sdl/ROMManager.cpp +++ b/src/frontend/qt_sdl/ROMManager.cpp @@ -535,6 +535,7 @@ bool LoadROM(QStringList filepath, bool reset) if (reset) { NDS::SetConsoleType(Config::ConsoleType); + NDS::EjectCart(); NDS::Reset(); } |