diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h index 29a8ced696..fe15543e80 100644 --- a/Source/Core/DiscIO/Blob.h +++ b/Source/Core/DiscIO/Blob.h @@ -17,6 +17,7 @@ #include #include #include +#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" namespace DiscIO @@ -77,6 +78,36 @@ private: std::array m_cache_tags; }; +class CBlobBigEndianReader +{ +public: + CBlobBigEndianReader(IBlobReader& reader) : m_reader(reader) {} + + u32 Read32(u64 offset) const + { + u32 temp; + m_reader.Read(offset, sizeof(u32), reinterpret_cast(&temp)); + return Common::swap32(temp); + } + + u16 Read16(u64 offset) const + { + u16 temp; + m_reader.Read(offset, sizeof(u16), reinterpret_cast(&temp)); + return Common::swap16(temp); + } + + u8 Read8(u64 offset) const + { + u8 temp; + m_reader.Read(offset, sizeof(u8), &temp); + return temp; + } + +private: + IBlobReader& m_reader; +}; + // Factory function - examines the path to choose the right type of IBlobReader, and returns one. std::unique_ptr CreateBlobReader(const std::string& filename); diff --git a/Source/Core/DiscIO/VolumeCreator.cpp b/Source/Core/DiscIO/VolumeCreator.cpp index a6305941ac..636a7159e7 100644 --- a/Source/Core/DiscIO/VolumeCreator.cpp +++ b/Source/Core/DiscIO/VolumeCreator.cpp @@ -34,33 +34,6 @@ enum EDiscType DISC_TYPE_WAD }; -class CBlobBigEndianReader -{ -public: - CBlobBigEndianReader(IBlobReader& _rReader) : m_rReader(_rReader) {} - - u32 Read32(u64 _Offset) - { - u32 Temp; - m_rReader.Read(_Offset, 4, (u8*)&Temp); - return Common::swap32(Temp); - } - u16 Read16(u64 _Offset) - { - u16 Temp; - m_rReader.Read(_Offset, 2, (u8*)&Temp); - return Common::swap16(Temp); - } - u8 Read8(u64 _Offset) - { - u8 Temp; - m_rReader.Read(_Offset, 1, &Temp); - return Temp; - } -private: - IBlobReader& m_rReader; -}; - static const unsigned char s_master_key[16] = { 0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4, 0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7 diff --git a/Source/Core/DiscIO/WiiWad.cpp b/Source/Core/DiscIO/WiiWad.cpp index d3d145faff..62232ff8c0 100644 --- a/Source/Core/DiscIO/WiiWad.cpp +++ b/Source/Core/DiscIO/WiiWad.cpp @@ -18,22 +18,6 @@ namespace DiscIO { -class CBlobBigEndianReader -{ -public: - CBlobBigEndianReader(DiscIO::IBlobReader& _rReader) : m_rReader(_rReader) {} - - u32 Read32(u64 _Offset) - { - u32 Temp; - m_rReader.Read(_Offset, 4, (u8*)&Temp); - return(Common::swap32(Temp)); - } - -private: - DiscIO::IBlobReader& m_rReader; -}; - WiiWAD::WiiWAD(const std::string& name) { std::unique_ptr reader(DiscIO::CreateBlobReader(name));