#pragma once #include #include #include #include #include #include "Runtime/CPakFile.hpp" #include "Runtime/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace urde { class IDvdRequest; struct SObjectTag; class CResLoader { std::string m_loaderPath; // std::list> x0_aramList; std::list> x18_pakLoadedList; std::list> x30_pakLoadingList; std::list> m_overridePakList; // URDE Addition, Trilogy has a similar mechanism, need to verify behavior against it u32 x44_pakLoadingCount = 0; std::list>::iterator x48_curPak; mutable CAssetId x4c_cachedResId; mutable const CPakFile::SResInfo* x50_cachedResInfo = nullptr; bool x54_forwardSeek = false; bool _GetTagListForFile(std::vector& out, const std::string& path, const std::unique_ptr& file) const; public: CResLoader(); const std::vector* GetTagListForFile(std::string_view name) const; void AddPakFileAsync(std::string_view name, bool buildDepList, bool worldPak, bool override=false); void AddPakFile(std::string_view name, bool samusPak, bool worldPak, bool override=false); void WaitForPakFileLoadingComplete(); std::unique_ptr LoadNewResourcePartSync(const SObjectTag& tag, u32 length, u32 offset, void* extBuf); void LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr& bufOut, int* sizeOut); std::unique_ptr LoadResourceFromMemorySync(const SObjectTag& tag, const void* buf); std::unique_ptr LoadNewResourceSync(const SObjectTag& tag, void* extBuf = nullptr); std::shared_ptr LoadResourcePartAsync(const SObjectTag& tag, u32 off, u32 size, void* buf); std::shared_ptr LoadResourceAsync(const SObjectTag& tag, void* buf); std::unique_ptr LoadResourceSync(const urde::SObjectTag& tag); std::unique_ptr LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size); void GetTagListForFile(const char* pakName, std::vector& out) const; bool GetResourceCompression(const SObjectTag& tag) const; u32 ResourceSize(const SObjectTag& tag) const; bool ResourceExists(const SObjectTag& tag) const; FourCC GetResourceTypeById(CAssetId id) const; const SObjectTag* GetResourceIdByName(std::string_view name) const; bool AreAllPaksLoaded() const; void AsyncIdlePakLoading(); bool FindResource(CAssetId id) const; CPakFile* FindResourceForLoad(CAssetId id); CPakFile* FindResourceForLoad(const SObjectTag& tag); bool CacheFromPakForLoad(CPakFile& file, CAssetId id); bool CacheFromPak(const CPakFile& file, CAssetId id) const; void MoveToCorrectLoadedList(std::unique_ptr&& file); std::vector> GetResourceIdToNameList() const; void EnumerateResources(const std::function& lambda) const; void EnumerateNamedResources(const std::function& lambda) const; const std::list>& GetPaks() const { return x18_pakLoadedList; } }; } // namespace urde