2015-08-17 20:33:58 +00:00
|
|
|
#ifndef __RETRO_CRESFACTORY_HPP__
|
|
|
|
#define __RETRO_CRESFACTORY_HPP__
|
|
|
|
|
2015-08-23 06:42:29 +00:00
|
|
|
#include <unordered_map>
|
2015-08-18 05:54:43 +00:00
|
|
|
#include "IFactory.hpp"
|
2015-08-23 06:42:29 +00:00
|
|
|
#include "CResLoader.hpp"
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
namespace Retro
|
|
|
|
{
|
2015-10-29 07:52:15 +00:00
|
|
|
class IDvdRequest;
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2015-08-18 05:54:43 +00:00
|
|
|
class CResFactory : public IFactory
|
2015-08-17 20:33:58 +00:00
|
|
|
{
|
2015-08-23 06:42:29 +00:00
|
|
|
CResLoader x4_loader;
|
2015-08-22 01:58:41 +00:00
|
|
|
public:
|
2015-08-23 06:42:29 +00:00
|
|
|
struct SLoadingData
|
|
|
|
{
|
|
|
|
SObjectTag tag;
|
2015-10-29 07:52:15 +00:00
|
|
|
IDvdRequest* dvdReq;
|
2015-08-23 06:42:29 +00:00
|
|
|
IObj** targetPtr;
|
|
|
|
void* loadBuffer;
|
|
|
|
u32 resSize;
|
|
|
|
};
|
|
|
|
private:
|
|
|
|
std::unordered_map<SObjectTag, SLoadingData> m_loadList;
|
|
|
|
void AddToLoadList(const SLoadingData& data) {m_loadList[data.tag] = data;}
|
|
|
|
public:
|
2015-08-27 00:23:46 +00:00
|
|
|
CResLoader& GetLoader() {return x4_loader;}
|
2015-08-23 06:42:29 +00:00
|
|
|
std::unique_ptr<IObj> Build(const SObjectTag&, const CVParamTransfer&);
|
2015-08-22 01:58:41 +00:00
|
|
|
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**);
|
|
|
|
void CancelBuild(const SObjectTag&);
|
2015-08-23 06:42:29 +00:00
|
|
|
bool CanBuild(const SObjectTag& tag) {return x4_loader.ResourceExists(tag);}
|
2015-08-28 00:11:31 +00:00
|
|
|
const SObjectTag* GetResourceIdByName(const char* name) const {return x4_loader.GetResourceIdByName(name);}
|
2015-08-23 06:42:29 +00:00
|
|
|
|
|
|
|
std::vector<std::pair<std::string, SObjectTag>> GetResourceIdToNameList() const
|
|
|
|
{
|
|
|
|
std::vector<std::pair<std::string, SObjectTag>> retval;
|
|
|
|
return retval;
|
|
|
|
}
|
2015-08-17 20:33:58 +00:00
|
|
|
};
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2015-08-17 20:33:58 +00:00
|
|
|
#endif // __RETRO_CRESFACTORY_HPP__
|