mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-22 22:01:06 -06:00
Fix detection of native NDS ARM BIOS images (#1910)
* Fix detection of native NDS ARM BIOS images - Instead of checking for built-in BIOS images, now the altered methods check for native ones - The CRC32 must match exactly; patched BIOS images will result in `false` * Encapsulate `NDS::ARM9BIOS` and `ARM7BIOS` - Also compute the checksum only when setting the BIOS
This commit is contained in:
18
src/NDS.cpp
18
src/NDS.cpp
@ -92,6 +92,8 @@ NDS::NDS(NDSArgs&& args, int type) noexcept :
|
||||
ConsoleType(type),
|
||||
ARM7BIOS(args.ARM7BIOS),
|
||||
ARM9BIOS(args.ARM9BIOS),
|
||||
ARM7BIOSNative(CRC32(ARM7BIOS.data(), ARM7BIOS.size()) == ARM7BIOSCRC32),
|
||||
ARM9BIOSNative(CRC32(ARM9BIOS.data(), ARM9BIOS.size()) == ARM9BIOSCRC32),
|
||||
JIT(*this, args.JIT),
|
||||
SPU(*this, args.BitDepth, args.Interpolation),
|
||||
GPU(*this, std::move(args.Renderer3D)),
|
||||
@ -270,7 +272,7 @@ bool NDS::NeedsDirectBoot() const
|
||||
return true;
|
||||
|
||||
// FreeBIOS requires direct boot (it can't boot firmware)
|
||||
if (IsLoadedARM7BIOSBuiltIn() || IsLoadedARM9BIOSBuiltIn())
|
||||
if (!IsLoadedARM9BIOSKnownNative() || !IsLoadedARM7BIOSKnownNative())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -286,7 +288,7 @@ void NDS::SetupDirectBoot()
|
||||
|
||||
// Copy the Nintendo logo from the NDS ROM header to the ARM9 BIOS if using FreeBIOS
|
||||
// Games need this for DS<->GBA comm to work
|
||||
if (IsLoadedARM9BIOSBuiltIn())
|
||||
if (!IsLoadedARM9BIOSKnownNative())
|
||||
{
|
||||
memcpy(ARM9BIOS.data() + 0x20, header.NintendoLogo, 0x9C);
|
||||
}
|
||||
@ -756,6 +758,18 @@ void NDS::LoadBIOS()
|
||||
Reset();
|
||||
}
|
||||
|
||||
void NDS::SetARM7BIOS(const std::array<u8, ARM7BIOSSize>& bios) noexcept
|
||||
{
|
||||
ARM7BIOS = bios;
|
||||
ARM7BIOSNative = CRC32(ARM7BIOS.data(), ARM7BIOS.size()) == ARM7BIOSCRC32;
|
||||
}
|
||||
|
||||
void NDS::SetARM9BIOS(const std::array<u8, ARM9BIOSSize>& bios) noexcept
|
||||
{
|
||||
ARM9BIOS = bios;
|
||||
ARM9BIOSNative = CRC32(ARM9BIOS.data(), ARM9BIOS.size()) == ARM9BIOSCRC32;
|
||||
}
|
||||
|
||||
u64 NDS::NextTarget()
|
||||
{
|
||||
u64 minEvent = UINT64_MAX;
|
||||
|
Reference in New Issue
Block a user