Only warn about unknown magic words if none of the known ones are found.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5563 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-01 20:47:07 +00:00
parent 9d7b569ccb
commit 4ffdba7b92
1 changed files with 19 additions and 27 deletions

View File

@ -214,39 +214,31 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGr
EDiscType GetDiscType(IBlobReader& _rReader) EDiscType GetDiscType(IBlobReader& _rReader)
{ {
CBlobBigEndianReader Reader(_rReader); CBlobBigEndianReader Reader(_rReader);
u32 WiiMagic = Reader.Read32(0x18);
u32 WiiContainerMagic = Reader.Read32(0x60);
u32 WADMagic = Reader.Read32(0x02);
u32 GCMagic = Reader.Read32(0x1C);
// check for wii // check for Wii
{ if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic != 0)
u32 MagicWord = Reader.Read32(0x18); return DISC_TYPE_WII;
if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic == 0)
if (MagicWord == 0x5D1C9EA3) return DISC_TYPE_WII_CONTAINER;
{
if (Reader.Read32(0x60) != 0)
return(DISC_TYPE_WII);
else
return(DISC_TYPE_WII_CONTAINER);
}
WARN_LOG(DISCIO, "Wiidisc magicword not found.\n Offset: 0x18 value: %04x", MagicWord);
}
// check for WAD // check for WAD
{
u32 MagicWord = Reader.Read32(0x02);
// 0x206962 for boot2 wads // 0x206962 for boot2 wads
if (MagicWord == 0x00204973 || MagicWord == 0x00206962) if (WADMagic == 0x00204973 || WADMagic == 0x00206962)
return(DISC_TYPE_WAD); return DISC_TYPE_WAD;
WARN_LOG(DISCIO, "Wad magicword not found.\n Offset: 0x02 value: %04x", MagicWord);
}
// check for GC // check for GC
{ if (GCMagic == 0xC2339F3D)
u32 MagicWord = Reader.Read32(0x1C); return DISC_TYPE_GC;
if (MagicWord == 0xC2339F3D) WARN_LOG(DISCIO, "No known magic words found");
return(DISC_TYPE_GC); WARN_LOG(DISCIO, "Wii offset: 0x18 value: 0x%08x", WiiMagic);
WARN_LOG(DISCIO, "GCM magicword not found.\n Offset: 0x1C value: %04x", MagicWord); WARN_LOG(DISCIO, "WiiC offset: 0x60 value: 0x%08x", WiiContainerMagic);
} WARN_LOG(DISCIO, "WAD offset: 0x02 value: 0x%08x", WADMagic);
WARN_LOG(DISCIO, "GC offset: 0x1C value: 0x%08x", GCMagic);
return DISC_TYPE_UNK; return DISC_TYPE_UNK;
} }