diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index b432c0d2ca39..63ed9d4354bc 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -119,11 +119,10 @@ std::string CVolumeGC::GetCompany() const if (!LoadBannerFile()) return ""; - auto const pBanner = (GCBanner*)m_banner_file.data(); - std::string company = DecodeString(pBanner->comment[0].longMaker); + std::string company = DecodeString(m_banner_file.comment[0].longMaker); if (company.empty()) - company = DecodeString(pBanner->comment[0].shortMaker); + company = DecodeString(m_banner_file.comment[0].shortMaker); return company; } @@ -138,8 +137,7 @@ std::vector CVolumeGC::GetBanner(int* width, int* height) const } std::vector 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); + ColorUtil::decode5A3image(image_buffer.data(), m_banner_file.image, GC_BANNER_WIDTH, GC_BANNER_HEIGHT); *width = GC_BANNER_WIDTH; *height = GC_BANNER_HEIGHT; return image_buffer; @@ -220,22 +218,20 @@ bool CVolumeGC::LoadBannerFile() const size_t file_size = (size_t)file_system->GetFileSize("opening.bnr"); if (file_size == BNR1_SIZE || file_size == BNR2_SIZE) { - m_banner_file.resize(file_size); - file_system->ReadFile("opening.bnr", m_banner_file.data(), m_banner_file.size()); + file_system->ReadFile("opening.bnr", reinterpret_cast(&m_banner_file), file_size); - u32 bannerSignature = *(u32*)m_banner_file.data(); - if (file_size == BNR1_SIZE && bannerSignature == 0x31524e42) // "BNR1" + if (file_size == BNR1_SIZE && m_banner_file.id == 0x31524e42) // "BNR1" { m_banner_file_type = BANNER_BNR1; } - else if (file_size == BNR2_SIZE && bannerSignature == 0x32524e42) // "BNR2" + else if (file_size == BNR2_SIZE && m_banner_file.id == 0x32524e42) // "BNR2" { m_banner_file_type = BANNER_BNR2; } else { m_banner_file_type = BANNER_INVALID; - WARN_LOG(DISCIO, "Invalid opening.bnr. Type: %0x Size: %0zx", bannerSignature, file_size); + WARN_LOG(DISCIO, "Invalid opening.bnr. Type: %0x Size: %0zx", m_banner_file.id, file_size); } } else @@ -276,11 +272,9 @@ std::map CVolumeGC::ReadMultiLanguageStrings(bo break; } - auto const banner = reinterpret_cast(m_banner_file.data()); - for (u32 i = 0; i < number_of_languages; ++i) { - GCBannerComment comment = banner->comment[i]; + const GCBannerComment& comment = m_banner_file.comment[i]; std::string string; if (description) diff --git a/Source/Core/DiscIO/VolumeGC.h b/Source/Core/DiscIO/VolumeGC.h index eebc7f21f69d..6e98e942c07b 100644 --- a/Source/Core/DiscIO/VolumeGC.h +++ b/Source/Core/DiscIO/VolumeGC.h @@ -79,7 +79,7 @@ class CVolumeGC : public IVolume }; mutable BannerFileType m_banner_file_type = BANNER_NOT_LOADED; - mutable std::vector m_banner_file; + mutable GCBanner m_banner_file; std::unique_ptr m_pReader; };