2015-07-26 21:39:49 +00:00
|
|
|
#ifndef CRESCACHE_H
|
|
|
|
#define CRESCACHE_H
|
|
|
|
|
|
|
|
#include <Common/types.h>
|
2015-11-24 06:08:31 +00:00
|
|
|
#include <Common/TString.h>
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <Resource/CPakFile.h>
|
|
|
|
#include <Resource/CResource.h>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
struct SResSource
|
|
|
|
{
|
2015-11-24 06:08:31 +00:00
|
|
|
TString Path;
|
2015-07-26 21:39:49 +00:00
|
|
|
enum {
|
|
|
|
Folder, PakFile
|
|
|
|
} Source;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CResCache
|
|
|
|
{
|
|
|
|
std::unordered_map<u64, CResource*> mResourceCache;
|
|
|
|
CPakFile *mpPak;
|
|
|
|
SResSource mResSource;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CResCache();
|
|
|
|
~CResCache();
|
|
|
|
void Clean();
|
2015-11-24 06:08:31 +00:00
|
|
|
void SetFolder(TString path);
|
|
|
|
void SetPak(const TString& path);
|
2015-07-26 21:39:49 +00:00
|
|
|
void SetResSource(SResSource& ResSource);
|
|
|
|
SResSource GetResSource();
|
2015-11-24 06:08:31 +00:00
|
|
|
TString GetSourcePath();
|
2015-07-26 21:39:49 +00:00
|
|
|
CResource* GetResource(CUniqueID ResID, CFourCC type);
|
2015-11-24 06:08:31 +00:00
|
|
|
CResource* GetResource(const TString& ResPath);
|
2015-07-26 21:39:49 +00:00
|
|
|
void CacheResource(CResource *pRes);
|
|
|
|
void DeleteResource(CUniqueID ResID);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CResCache gResCache;
|
|
|
|
|
|
|
|
#endif // CRESCACHE_H
|