diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-06-02 20:58:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-02 20:58:08 +0200 |
| commit | 45a21ef83f4742b9d58ea8d50c4f1ee0bad84f3b (patch) | |
| tree | 8ec16f6c52142dafb8ce65455a84873b343f0523 /Source/Core/VideoCommon/Assets/CustomAsset.cpp | |
| parent | ca484c7a650449373ac15e96ec06066b6420b0c9 (diff) | |
| parent | b2c5a5485aaca5da9b22527ca79b113082ccaac2 (diff) | |
Merge pull request #11871 from iwubcode/custom-assets
VideoCommon: add custom asset implementation and asset library
Diffstat (limited to 'Source/Core/VideoCommon/Assets/CustomAsset.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Assets/CustomAsset.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Assets/CustomAsset.cpp b/Source/Core/VideoCommon/Assets/CustomAsset.cpp new file mode 100644 index 0000000000..545b60e093 --- /dev/null +++ b/Source/Core/VideoCommon/Assets/CustomAsset.cpp @@ -0,0 +1,45 @@ +// Copyright 2023 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "VideoCommon/Assets/CustomAsset.h" + +namespace VideoCommon +{ +CustomAsset::CustomAsset(std::shared_ptr<CustomAssetLibrary> library, + const CustomAssetLibrary::AssetID& asset_id) + : m_owning_library(std::move(library)), m_asset_id(asset_id) +{ +} + +bool CustomAsset::Load() +{ + const auto load_information = LoadImpl(m_asset_id); + if (load_information.m_bytes_loaded > 0) + { + m_bytes_loaded = load_information.m_bytes_loaded; + m_last_loaded_time = load_information.m_load_time; + } + return load_information.m_bytes_loaded != 0; +} + +CustomAssetLibrary::TimeType CustomAsset::GetLastWriteTime() const +{ + return m_owning_library->GetLastAssetWriteTime(m_asset_id); +} + +const CustomAssetLibrary::TimeType& CustomAsset::GetLastLoadedTime() const +{ + return m_last_loaded_time; +} + +const CustomAssetLibrary::AssetID& CustomAsset::GetAssetId() const +{ + return m_asset_id; +} + +std::size_t CustomAsset::GetByteSizeInMemory() const +{ + return m_bytes_loaded; +} + +} // namespace VideoCommon |
