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