diff options
| author | flacs <tilkax@gmail.com> | 2015-09-29 03:49:08 +0200 |
|---|---|---|
| committer | flacs <tilkax@gmail.com> | 2015-09-29 03:49:08 +0200 |
| commit | d5ec7124e4f875a16ddaa14415a7cfa57f0af2b0 (patch) | |
| tree | 1de87043cfb362a344a1663b474517f58891a6c5 /Source/Core/DiscIO/VolumeGC.cpp | |
| parent | aaa48e19fea02597c8057fbd2bf309890d64f27d (diff) | |
| parent | 7317dd4be218e75e7dcf1ea1e94c1a19a5933629 (diff) | |
Merge pull request #3099 from lioncash/banner
VolumeGC: Get rid of banner pointer casts
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeGC.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index b432c0d2ca..63ed9d4354 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<u32> CVolumeGC::GetBanner(int* width, int* height) const } 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); + 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<u8*>(&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<IVolume::ELanguage, std::string> CVolumeGC::ReadMultiLanguageStrings(bo break; } - auto const banner = reinterpret_cast<const GCBanner*>(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) |
