IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum) { std::unique_ptr<IBlobReader> reader(CreateBlobReader(_rFilename)); if (reader == nullptr) return nullptr; switch (GetDiscType(*reader)) { case DISC_TYPE_WII: case DISC_TYPE_GC: return new CVolumeGC(std::move(reader)); case DISC_TYPE_WAD: return new CVolumeWAD(std::move(reader)); case DISC_TYPE_WII_CONTAINER: return CreateVolumeFromCryptedWiiImage(std::move(reader), _PartitionGroup, 0, _VolumeNum); case DISC_TYPE_UNK: default: std::string Filename, ext; SplitPath(_rFilename, nullptr, &Filename, &ext); Filename += ext; NOTICE_LOG(DISCIO, "%s does not have the Magic word for a gcm, wiidisc or wad file\n" "Set Log Verbosity to Warning and attempt to load the game again to view the values", Filename.c_str()); } return nullptr; }
IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionGroup, u32 _VolumeNum) { IBlobReader* pReader = CreateBlobReader(_rFilename.c_str()); if (pReader == NULL) return NULL; switch (GetDiscType(*pReader)) { case DISC_TYPE_WII: case DISC_TYPE_GC: return new CVolumeGC(pReader); case DISC_TYPE_WAD: return new CVolumeWAD(pReader); case DISC_TYPE_WII_CONTAINER: { u8 region; pReader->Read(0x3,1,®ion); IVolume* pVolume = CreateVolumeFromCryptedWiiImage(*pReader, _PartitionGroup, 0, _VolumeNum, region == 'K'); if (pVolume == NULL) { delete pReader; } return pVolume; } break; case DISC_TYPE_UNK: default: std::string Filename, ext; SplitPath(_rFilename, NULL, &Filename, &ext); Filename += ext; NOTICE_LOG(DISCIO, "%s does not have the Magic word for a gcm, wiidisc or wad file\n" "Set Log Verbosity to Warning and attempt to load the game again to view the values", Filename.c_str()); delete pReader; return NULL; } // unreachable code return NULL; }