#ifndef __DNAMP1_PAK_HPP__ #define __DNAMP1_PAK_HPP__ #include #include "../Logging.hpp" #include "../DNACommon/DNACommon.hpp" namespace Retro { namespace DNAMP1 { class PAK : public BigDNA { public: struct NameEntry : public BigDNA { DECL_DNA HECL::FourCC type; UniqueID32 id; Value nameLen; String name; }; struct Entry : BigDNA { DECL_DNA Value compressed; HECL::FourCC type; UniqueID32 id; Value size; Value offset; }; private: std::vector m_nameEntries; std::vector m_entries; std::unordered_map m_idMap; std::unordered_map m_nameMap; public: DECL_EXPLICIT_DNA inline const Entry* lookupEntry(const UniqueID32& id) const { std::unordered_map::const_iterator result = m_idMap.find(id); if (result != m_idMap.end()) return result->second; return nullptr; } inline const Entry* lookupEntry(const std::string& name) const { std::unordered_map::const_iterator result = m_nameMap.find(name); if (result != m_nameMap.end()) return result->second; return nullptr; } inline std::vector::iterator begin() {return m_entries.begin();} inline std::vector::iterator end() {return m_entries.end();} }; } } #endif // __DNAMP1_PAK_HPP__