metaforce/Runtime/CPakFile.hpp

78 lines
2.0 KiB
C++
Raw Normal View History

2015-08-23 06:42:29 +00:00
#ifndef __RETRO_CPAKFILE_HPP__
#define __RETRO_CPAKFILE_HPP__
#include <vector>
#include "RetroTypes.hpp"
#include "CStringExtras.hpp"
#include "CDvdFile.hpp"
#include "CDvdRequest.hpp"
namespace Retro
{
class CPakFile : public CDvdFile
{
friend class CResLoader;
public:
struct SResInfo
{
2015-08-23 23:58:07 +00:00
FourCC x0_type;
u32 x4_offset;
u32 x8_size;
bool xb_compressed;
2015-08-23 06:42:29 +00:00
};
private:
2015-08-23 23:58:07 +00:00
bool x28_b24_ctFlag;
2015-08-23 06:42:29 +00:00
enum EAsyncPhase
{
PakAsyncWarmup = 0,
PakAsyncInitialHeader = 1,
PakAsyncDataLoad = 2,
PakAsyncLoaded = 3
} x2c_asyncLoadPhase;
CDvdRequest* x34_dvdReq;
std::vector<std::pair<std::string, SObjectTag>> x4c_nameList;
std::vector<u32> x5c_depList;
std::vector<std::pair<u32, SResInfo>> x6c_resList;
public:
2015-08-25 07:04:50 +00:00
CPakFile(const std::string& filename, bool flag) : CDvdFile(filename.c_str()) {}
2015-08-23 06:42:29 +00:00
const std::vector<u32>& GetDepList() const {return x5c_depList;}
2015-08-28 00:11:31 +00:00
const SObjectTag* GetResIdByName(const char* name) const
2015-08-23 06:42:29 +00:00
{
for (const std::pair<std::string, SObjectTag>& p : x4c_nameList)
if (!CStringExtras::CompareCaseInsensitive(p.first.c_str(), name))
2015-08-28 00:11:31 +00:00
return &p.second;
return nullptr;
2015-08-23 06:42:29 +00:00
}
2015-08-31 03:44:42 +00:00
const SResInfo* GetResInfoForLoad(u32 id) {return nullptr;}
const SResInfo* GetResInfo(u32 id) const {return nullptr;}
u32 GetFakeStaticSize() const {return 0;}
2015-08-25 07:04:50 +00:00
void DataLoad() {}
void InitialHeaderLoad() {}
void Warmup() {}
2015-08-23 06:42:29 +00:00
void AsyncIdle()
{
if (x2c_asyncLoadPhase == PakAsyncLoaded)
return;
if (x34_dvdReq && x34_dvdReq->IsComplete())
return;
switch (x2c_asyncLoadPhase)
{
case PakAsyncWarmup:
Warmup();
break;
case PakAsyncInitialHeader:
InitialHeaderLoad();
break;
case PakAsyncDataLoad:
DataLoad();
break;
default: break;
}
}
};
}
#endif // __RETRO_CPAKFILE_HPP__