bool LoadBanner(std::string filename, u32 *Banner) { DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename); if (pVolume != NULL) { bool bIsWad = false; if (DiscIO::IsVolumeWadFile(pVolume)) bIsWad = true; m_volume_names = pVolume->GetNames(); // check if we can get some info from the banner file too DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume); if (pFileSystem != NULL || bIsWad) { DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume); if (pBannerLoader != NULL) if (pBannerLoader->IsValid()) { m_names = pBannerLoader->GetNames(); if (pBannerLoader->GetBanner(Banner)) return true; } } } return false; }
GameListItem::GameListItem(const std::string& _rFileName) : m_FileName(_rFileName) , m_emu_state(0) , m_FileSize(0) , m_Revision(0) , m_Valid(false) , m_BlobCompressed(false) , m_ImageWidth(0) , m_ImageHeight(0) { if (LoadFromCache()) { m_Valid = true; } else { DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_rFileName); if (pVolume != nullptr) { m_Platform = pVolume->GetVolumeType(); m_names = pVolume->GetNames(true); m_descriptions = pVolume->GetDescriptions(); m_company = pVolume->GetCompany(); m_Country = pVolume->GetCountry(); m_FileSize = pVolume->GetRawSize(); m_VolumeSize = pVolume->GetSize(); m_UniqueID = pVolume->GetUniqueID(); m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName); m_disc_number = pVolume->GetDiscNumber(); m_Revision = pVolume->GetRevision(); std::vector<u32> Buffer = pVolume->GetBanner(&m_ImageWidth, &m_ImageHeight); u32* pData = Buffer.data(); m_pImage.resize(m_ImageWidth * m_ImageHeight * 3); for (int i = 0; i < m_ImageWidth * m_ImageHeight; i++) { m_pImage[i * 3 + 0] = (pData[i] & 0xFF0000) >> 16; m_pImage[i * 3 + 1] = (pData[i] & 0x00FF00) >> 8; m_pImage[i * 3 + 2] = (pData[i] & 0x0000FF) >> 0; } delete pVolume; m_Valid = true; // Create a cache file only if we have an image. // Wii ISOs create their images after you have generated the first savegame if (!m_pImage.empty()) SaveToCache(); } }