From 7de0d51345a9f18901b5045b268c546e503dc37d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 25 Sep 2016 17:24:44 -0400 Subject: [PATCH] WiiWad: Move static implementation details to cpp file These functions don't actually depend on any state from the class instance, so they don't really belong in the header, and are just an implementation detail. --- Source/Core/DiscIO/WiiWad.cpp | 55 ++++++++++++++++++----------------- Source/Core/DiscIO/WiiWad.h | 2 -- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Source/Core/DiscIO/WiiWad.cpp b/Source/Core/DiscIO/WiiWad.cpp index 5e0894926d..0c93d601a9 100644 --- a/Source/Core/DiscIO/WiiWad.cpp +++ b/Source/Core/DiscIO/WiiWad.cpp @@ -16,6 +16,34 @@ namespace DiscIO { +namespace +{ +std::vector CreateWADEntry(IBlobReader& reader, u32 size, u64 offset) +{ + if (size == 0) + return {}; + + std::vector buffer(size); + + if (!reader.Read(offset, size, buffer.data())) + { + ERROR_LOG(DISCIO, "WiiWAD: Could not read from file"); + PanicAlertT("WiiWAD: Could not read from file"); + } + + return buffer; +} + +bool IsWiiWAD(const CBlobBigEndianReader& reader) +{ + u32 header_size = 0; + u32 header_type = 0; + reader.ReadSwapped(0x0, &header_size); + reader.ReadSwapped(0x4, &header_type); + return header_size == 0x20 && (header_type == 0x49730000 || header_type == 0x69620000); +} +} // Anonymous namespace + WiiWAD::WiiWAD(const std::string& name) { std::unique_ptr reader(CreateBlobReader(name)); @@ -32,22 +60,6 @@ WiiWAD::~WiiWAD() { } -std::vector WiiWAD::CreateWADEntry(IBlobReader& reader, u32 size, u64 offset) -{ - if (size == 0) - return {}; - - std::vector buffer(size); - - if (!reader.Read(offset, size, buffer.data())) - { - ERROR_LOG(DISCIO, "WiiWAD: Could not read from file"); - PanicAlertT("WiiWAD: Could not read from file"); - } - - return buffer; -} - bool WiiWAD::ParseWAD(IBlobReader& reader) { CBlobBigEndianReader big_endian_reader(reader); @@ -88,13 +100,4 @@ bool WiiWAD::ParseWAD(IBlobReader& reader) return true; } -bool WiiWAD::IsWiiWAD(const CBlobBigEndianReader& reader) -{ - u32 header_size = 0; - u32 header_type = 0; - reader.ReadSwapped(0x0, &header_size); - reader.ReadSwapped(0x4, &header_type); - return header_size == 0x20 && (header_type == 0x49730000 || header_type == 0x69620000); -} - -} // namespace end +} // namespace DiscIO diff --git a/Source/Core/DiscIO/WiiWad.h b/Source/Core/DiscIO/WiiWad.h index 454454a71f..bdc9cb910f 100644 --- a/Source/Core/DiscIO/WiiWad.h +++ b/Source/Core/DiscIO/WiiWad.h @@ -28,8 +28,6 @@ public: const std::vector& GetFooter() const { return m_footer; } private: bool ParseWAD(IBlobReader& reader); - static std::vector CreateWADEntry(IBlobReader& reader, u32 size, u64 offset); - static bool IsWiiWAD(const CBlobBigEndianReader& reader); bool m_valid;