diff --git a/Source/Core/DiscIO/Src/VolumeCreator.cpp b/Source/Core/DiscIO/Src/VolumeCreator.cpp index 3bf319e41c..be8c0fc076 100644 --- a/Source/Core/DiscIO/Src/VolumeCreator.cpp +++ b/Source/Core/DiscIO/Src/VolumeCreator.cpp @@ -214,39 +214,31 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGr EDiscType GetDiscType(IBlobReader& _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 - { - u32 MagicWord = Reader.Read32(0x18); - - if (MagicWord == 0x5D1C9EA3) - { - 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 Wii + if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic != 0) + return DISC_TYPE_WII; + if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic == 0) + return DISC_TYPE_WII_CONTAINER; // check for WAD - { - u32 MagicWord = Reader.Read32(0x02); - - // 0x206962 for boot2 wads - if (MagicWord == 0x00204973 || MagicWord == 0x00206962) - return(DISC_TYPE_WAD); - WARN_LOG(DISCIO, "Wad magicword not found.\n Offset: 0x02 value: %04x", MagicWord); - } + // 0x206962 for boot2 wads + if (WADMagic == 0x00204973 || WADMagic == 0x00206962) + return DISC_TYPE_WAD; // check for GC - { - u32 MagicWord = Reader.Read32(0x1C); + if (GCMagic == 0xC2339F3D) + return DISC_TYPE_GC; - if (MagicWord == 0xC2339F3D) - return(DISC_TYPE_GC); - WARN_LOG(DISCIO, "GCM magicword not found.\n Offset: 0x1C value: %04x", MagicWord); - } + WARN_LOG(DISCIO, "No known magic words found"); + WARN_LOG(DISCIO, "Wii offset: 0x18 value: 0x%08x", WiiMagic); + 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; }