fix crashes, add custom texture cache, load textures from load directory

This commit is contained in:
Khangaroo 2019-08-06 08:43:24 -04:00 committed by James Rowe
parent f866b2a917
commit 6d90c42a79
16 changed files with 167 additions and 49 deletions

View file

@ -0,0 +1,28 @@
#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:
const bool IsTextureDumped(const u64 hash);
void SetTextureDumped(const u64 hash);
const bool IsTextureCached(const u64 hash);
const CustomTexInfo& LookupTexture(const u64 hash);
void CacheTexture(const u64 hash, const std::vector<u8>& tex, u32 width, u32 height);
private:
std::unordered_map<u64, bool> dumped_textures;
std::unordered_map<u64, CustomTexInfo> custom_textures;
};
} // namespace Core