diff --git a/Assets/dll/melonDS.wbx.zst b/Assets/dll/melonDS.wbx.zst index 9c3ff58e3d..170a7737f7 100644 Binary files a/Assets/dll/melonDS.wbx.zst and b/Assets/dll/melonDS.wbx.zst differ diff --git a/waterbox/melon/BizFileManager.cpp b/waterbox/melon/BizFileManager.cpp index 0674a9f1d0..06ae174808 100644 --- a/waterbox/melon/BizFileManager.cpp +++ b/waterbox/melon/BizFileManager.cpp @@ -376,6 +376,12 @@ const char* InitNAND(FirmwareSettings& fwSettings, bool clearNand, bool dsiWare) if (dsiWare) { + auto rom = GetFileData("dsiware.rom"); + if (!rom) + { + return "Failed to obtain DSiWare ROM!"; + } + auto tmdData = GetFileData("tmd.rom"); if (!tmdData) { @@ -390,10 +396,24 @@ const char* InitNAND(FirmwareSettings& fwSettings, bool clearNand, bool dsiWare) DSi_TMD::TitleMetadata tmd; memcpy(&tmd, tmdData->first.get(), sizeof(DSi_TMD::TitleMetadata)); - if (!mount.ImportTitle("dsiware.rom", tmd, false)) + if (!mount.ImportTitle(rom->first.get(), rom->second, tmd, false)) { return "Loading DSiWare failed!"; } + + // verify that the imported title is supported by this NAND + // it will not actually appear otherwise + DSi_NAND::DSiSerialData serialData; + if (!mount.ReadSerialData(serialData)) + { + return "Failed to obtain serial data!"; + } + + auto regionFlags = rom->second > 0x1B0 ? rom->first[0x1B0] : 0; + if (!(regionFlags & (1 << static_cast(serialData.Region)))) + { + return "Loaded NAND region does not support this DSiWare title!"; + } } }