2019-08-06 17:24:07 +01:00
|
|
|
// Copyright 2019 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2019-08-06 13:43:24 +01:00
|
|
|
#include <stdexcept>
|
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "custom_tex_cache.h"
|
|
|
|
|
|
|
|
namespace Core {
|
2019-08-07 03:56:56 +01:00
|
|
|
CustomTexCache::CustomTexCache() = default;
|
2019-08-06 17:24:07 +01:00
|
|
|
|
2019-08-07 03:56:56 +01:00
|
|
|
CustomTexCache::~CustomTexCache() = default;
|
2019-08-06 17:24:07 +01:00
|
|
|
|
|
|
|
bool CustomTexCache::IsTextureDumped(u64 hash) const {
|
2019-08-06 13:43:24 +01:00
|
|
|
return dumped_textures.find(hash) != dumped_textures.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomTexCache::SetTextureDumped(const u64 hash) {
|
|
|
|
dumped_textures[hash] = true;
|
|
|
|
}
|
|
|
|
|
2019-08-06 17:24:07 +01:00
|
|
|
bool CustomTexCache::IsTextureCached(u64 hash) const {
|
2019-08-06 13:43:24 +01:00
|
|
|
return custom_textures.find(hash) != custom_textures.end();
|
|
|
|
}
|
|
|
|
|
2019-08-07 19:21:47 +01:00
|
|
|
const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) {
|
2019-08-06 13:43:24 +01:00
|
|
|
return custom_textures.at(hash);
|
|
|
|
}
|
|
|
|
|
2019-08-07 19:26:25 +01:00
|
|
|
void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height) {
|
2019-08-06 13:43:24 +01:00
|
|
|
custom_textures[hash] = {width, height, tex};
|
|
|
|
}
|
2019-08-07 19:26:25 +01:00
|
|
|
} // namespace Core
|