From 07307edd49497da157dcb29e5b32bb884b4f4b89 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Fri, 2 Jun 2023 14:24:21 -0500 Subject: VideoCommon: add an asset library that loads directly from the filesystem --- .../Assets/DirectFilesystemAssetLibrary.h | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h') diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h new file mode 100644 index 0000000000..d04981dac3 --- /dev/null +++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.h @@ -0,0 +1,37 @@ +// Copyright 2023 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once +#include +#include +#include +#include + +#include "VideoCommon/Assets/CustomAssetLibrary.h" + +namespace VideoCommon +{ +class CustomTextureData; + +// This class implements 'CustomAssetLibrary' and loads any assets +// directly from the filesystem +class DirectFilesystemAssetLibrary final : public CustomAssetLibrary +{ +public: + LoadInfo LoadTexture(const AssetID& asset_id, CustomTextureData* data) override; + + // Gets the latest time from amongst all the files in the asset map + TimeType GetLastAssetWriteTime(const AssetID& asset_id) const override; + + // Assigns the asset id to a map of files, how this map is read is dependent on the data + // For instance, a raw texture would expect the map to have a single entry and load that + // file as the asset. But a model file data might have its data spread across multiple files + void SetAssetIDMapData(const AssetID& asset_id, + std::map asset_path_map); + +private: + // Loads additional mip levels into the texture structure until _mip texture is not found + bool LoadMips(const std::filesystem::path& asset_path, CustomTextureData* data); + std::map> m_assetid_to_asset_map_path; +}; +} // namespace VideoCommon -- cgit v1.2.3