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
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
struct CustomTexInfo {
|
|
|
|
u32 width;
|
|
|
|
u32 height;
|
|
|
|
std::vector<u8> tex;
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: think of a better name for this class...
|
|
|
|
class CustomTexCache {
|
|
|
|
public:
|
2019-08-06 17:24:07 +01:00
|
|
|
CustomTexCache();
|
|
|
|
~CustomTexCache();
|
|
|
|
|
|
|
|
bool IsTextureDumped(u64 hash) const;
|
|
|
|
void SetTextureDumped(u64 hash);
|
2019-08-06 13:43:24 +01:00
|
|
|
|
2019-08-06 17:24:07 +01:00
|
|
|
bool IsTextureCached(u64 hash) const;
|
2019-08-06 13:43:24 +01:00
|
|
|
const CustomTexInfo& LookupTexture(const u64 hash);
|
2019-08-06 17:24:07 +01:00
|
|
|
void CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height);
|
2019-08-06 13:43:24 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unordered_map<u64, bool> dumped_textures;
|
|
|
|
std::unordered_map<u64, CustomTexInfo> custom_textures;
|
|
|
|
};
|
|
|
|
} // namespace Core
|