#include "AssetNameMap.hpp" #include "athena/MemoryReader.hpp" extern "C" const uint8_t ASSET_NAME_MP32[]; extern "C" const size_t ASSET_NAME_MP32_SZ; extern "C" const uint8_t ASSET_NAME_MP64[]; extern "C" const size_t ASSET_NAME_MP64_SZ; namespace DataSpec::AssetNameMap { logvisor::Module Log("AssetNameMap"); struct SAsset { std::string name; std::string directory; hecl::FourCC type; SAsset() = default; SAsset(const hecl::FourCC& typeIn, athena::io::IStreamReader& in) : type(typeIn) { uint32_t nameLen = in.readUint32Big(); name = in.readString(nameLen); uint32_t dirLen = in.readUint32Big(); directory = in.readString(dirLen); } }; static std::unordered_map g_AssetNameMap; static bool g_AssetNameMapInit = false; void LoadAssetMap(athena::io::MemoryReader& ar) { if (!ar.hasError()) { hecl::FourCC magic; if (ar.length() >= 4) ar.readBytesToBuf(&magic, 4); if (magic != FOURCC('AIDM')) Log.report(logvisor::Warning, _S("Unable to load asset map; Assets will not have proper filenames for most files.")); else { uint32_t assetCount = ar.readUint32Big(); g_AssetNameMap.reserve(assetCount); for (uint32_t i = 0 ; i