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