std::vector<u32> CVolumeGC::GetBanner(int* width, int* height) const { LoadBannerFile(); *width = m_image_width; *height = m_image_height; return m_image_buffer; }
VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) : m_reader(std::move(reader)) { ASSERT(m_reader); m_file_system = [this]() -> std::unique_ptr<FileSystem> { auto file_system = std::make_unique<FileSystemGCWii>(this, PARTITION_NONE); return file_system->IsValid() ? std::move(file_system) : nullptr; }; m_converted_banner = [this] { return LoadBannerFile(); }; }
std::string CVolumeGC::GetCompany() const { if (!LoadBannerFile()) return ""; auto const pBanner = (GCBanner*)m_banner_file.data(); std::string company = DecodeString(pBanner->comment[0].longMaker); if (company.empty()) company = DecodeString(pBanner->comment[0].shortMaker); return company; }
std::vector<u32> CVolumeGC::GetBanner(int* width, int* height) const { if (!LoadBannerFile()) { *width = 0; *height = 0; return std::vector<u32>(); } std::vector<u32> image_buffer(GC_BANNER_WIDTH * GC_BANNER_HEIGHT); auto const pBanner = (GCBanner*)m_banner_file.data(); ColorUtil::decode5A3image(image_buffer.data(), pBanner->image, GC_BANNER_WIDTH, GC_BANNER_HEIGHT); *width = GC_BANNER_WIDTH; *height = GC_BANNER_HEIGHT; return image_buffer; }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetNames() const { std::map<IVolume::ELanguage, std::string> names; if (!LoadBannerFile()) return names; u32 name_count = 0; IVolume::ELanguage language; bool is_japanese = GetCountry() == IVolume::ECountry::COUNTRY_JAPAN; switch (m_banner_file_type) { case BANNER_BNR1: name_count = 1; language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_BNR2: name_count = 6; language = IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_INVALID: case BANNER_NOT_LOADED: break; } auto const banner = reinterpret_cast<const GCBanner*>(m_banner_file.data()); for (u32 i = 0; i < name_count; ++i) { auto& comment = banner->comment[i]; std::string name = DecodeString(comment.longTitle); if (name.empty()) name = DecodeString(comment.shortTitle); if (!name.empty()) names[(IVolume::ELanguage)(language + i)] = name; } return names; }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetDescriptions() const { std::map<IVolume::ELanguage, std::string> descriptions; if (!LoadBannerFile()) return descriptions; u32 desc_count = 0; IVolume::ELanguage language; bool is_japanese = GetCountry() == IVolume::ECountry::COUNTRY_JAPAN; switch (m_banner_file_type) { case BANNER_BNR1: desc_count = 1; language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_BNR2: language = IVolume::ELanguage::LANGUAGE_ENGLISH; desc_count = 6; break; case BANNER_INVALID: case BANNER_NOT_LOADED: break; } auto banner = reinterpret_cast<const GCBanner*>(m_banner_file.data()); for (u32 i = 0; i < desc_count; ++i) { auto& data = banner->comment[i].comment; std::string description = DecodeString(data); if (!description.empty()) descriptions[(IVolume::ELanguage)(language + i)] = description; } return descriptions; }
std::map<Language, std::string> CVolumeGC::GetDescriptions() const { LoadBannerFile(); return m_descriptions; }
std::map<Language, std::string> CVolumeGC::GetLongMakers() const { LoadBannerFile(); return m_long_makers; }
std::map<Language, std::string> CVolumeGC::GetShortMakers() const { LoadBannerFile(); return m_short_makers; }
std::map<Language, std::string> CVolumeGC::GetLongNames() const { LoadBannerFile(); return m_long_names; }
std::map<Language, std::string> CVolumeGC::GetShortNames() const { LoadBannerFile(); return m_short_names; }