From 593e7c125bb3451b25699bff8fe618337b97bd8e Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:46:25 -0700 Subject: [PATCH] force real bios file usage if an encrypted DS rom is used --- .../Consoles/Nintendo/NDS/MelonDS.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs index 2743732d3f..7c43369b9b 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs @@ -190,6 +190,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS _activeSyncSettings.UseRealBIOS |= IsDSi; + if (!_activeSyncSettings.UseRealBIOS) + { + // check if the user is using an encrypted rom + // if they are, they need to be using real bios files + Span decryptedBytePattern = stackalloc byte[] { 0xFF, 0xDE, 0xFF, 0xE7, 0xFF, 0xDE, 0xFF, 0xE7 }; + if (!roms[0].AsSpan(0x4000, 8).SequenceEqual(decryptedBytePattern)) + { + _activeSyncSettings.UseRealBIOS = true; + } + } + byte[] bios9 = null, bios7 = null, firmware = null; if (_activeSyncSettings.UseRealBIOS) {