mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-26 22:57:52 -05:00
ObjLoading: Be able to load and index IWD files
This commit is contained in:
@ -3,10 +3,13 @@
|
||||
#include "Exception/IPakLoadException.h"
|
||||
|
||||
#include <sstream>
|
||||
#include "Utils/PathUtils.h"
|
||||
|
||||
const uint32_t IPak::MAGIC = 'IPAK';
|
||||
const uint32_t IPak::VERSION = 0x50000;
|
||||
|
||||
ObjContainerRepository<IPak, Zone> IPak::Repository;
|
||||
|
||||
uint32_t IPak::R_HashString(const char* str, uint32_t hash)
|
||||
{
|
||||
for (const char* pos = str; *pos; pos++)
|
||||
@ -17,8 +20,9 @@ uint32_t IPak::R_HashString(const char* str, uint32_t hash)
|
||||
return hash;
|
||||
}
|
||||
|
||||
IPak::IPak(FileAPI::IFile* file)
|
||||
IPak::IPak(std::string path, FileAPI::IFile* file)
|
||||
{
|
||||
m_path = std::move(path);
|
||||
m_file = file;
|
||||
m_initialized = false;
|
||||
m_index_section = nullptr;
|
||||
@ -34,6 +38,11 @@ IPak::~IPak()
|
||||
m_data_section = nullptr;
|
||||
}
|
||||
|
||||
std::string IPak::GetName()
|
||||
{
|
||||
return utils::Path::GetFilename(m_path);
|
||||
}
|
||||
|
||||
void IPak::ReadSection()
|
||||
{
|
||||
IPakSection section{};
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "Utils/FileAPI.h"
|
||||
#include "ObjContainer/IPak/IPakTypes.h"
|
||||
#include "ObjContainer/ObjContainerReferenceable.h"
|
||||
#include "ObjContainer/ObjContainerRepository.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -11,6 +13,7 @@ class IPak final : public ObjContainerReferenceable
|
||||
static const uint32_t MAGIC;
|
||||
static const uint32_t VERSION;
|
||||
|
||||
std::string m_path;
|
||||
FileAPI::IFile* m_file;
|
||||
|
||||
bool m_initialized;
|
||||
@ -26,9 +29,13 @@ class IPak final : public ObjContainerReferenceable
|
||||
void ReadHeader();
|
||||
|
||||
public:
|
||||
explicit IPak(FileAPI::IFile* file);
|
||||
static ObjContainerRepository<IPak, Zone> Repository;
|
||||
|
||||
IPak(std::string path, FileAPI::IFile* file);
|
||||
~IPak();
|
||||
|
||||
std::string GetName() override;
|
||||
|
||||
void Initialize();
|
||||
FileAPI::IFile* GetEntryData(IPakHash nameHash, IPakHash dataHash);
|
||||
|
||||
|
Reference in New Issue
Block a user