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-11-21 01:16:07 +00:00
|
|
|
enum class EAsyncPhase
|
2015-08-23 06:42:29 +00:00
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
Warmup = 0,
|
|
|
|
InitialHeader = 1,
|
|
|
|
DataLoad = 2,
|
|
|
|
Loaded = 3
|
2015-08-23 06:42:29 +00:00
|
|
|
} x2c_asyncLoadPhase;
|
2015-10-29 07:52:15 +00:00
|
|
|
IDvdRequest* x34_dvdReq;
|
2015-08-23 06:42:29 +00:00
|
|
|
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()
|
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
if (x2c_asyncLoadPhase == EAsyncPhase::Loaded)
|
2015-08-23 06:42:29 +00:00
|
|
|
return;
|
|
|
|
if (x34_dvdReq && x34_dvdReq->IsComplete())
|
|
|
|
return;
|
|
|
|
switch (x2c_asyncLoadPhase)
|
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
case EAsyncPhase::Warmup:
|
2015-08-23 06:42:29 +00:00
|
|
|
Warmup();
|
|
|
|
break;
|
2015-11-21 01:16:07 +00:00
|
|
|
case EAsyncPhase::InitialHeader:
|
2015-08-23 06:42:29 +00:00
|
|
|
InitialHeaderLoad();
|
|
|
|
break;
|
2015-11-21 01:16:07 +00:00
|
|
|
case EAsyncPhase::DataLoad:
|
2015-08-23 06:42:29 +00:00
|
|
|
DataLoad();
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __RETRO_CPAKFILE_HPP__
|