mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-30 11:02:39 -06:00
b82d4315fe
Removes direct usages of Core::System::GetInstance() and instead passes the direct necessities through the interface.
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
// Copyright 2019 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
#include "common/common_types.h"
|
|
|
|
namespace Frontend {
|
|
class ImageInterface;
|
|
} // namespace Frontend
|
|
|
|
namespace Core {
|
|
struct CustomTexInfo {
|
|
u32 width;
|
|
u32 height;
|
|
std::vector<u8> tex;
|
|
};
|
|
|
|
// This is to avoid parsing the filename multiple times
|
|
struct CustomTexPathInfo {
|
|
std::string path;
|
|
u64 hash;
|
|
};
|
|
|
|
// TODO: think of a better name for this class...
|
|
class CustomTexCache {
|
|
public:
|
|
explicit CustomTexCache();
|
|
~CustomTexCache();
|
|
|
|
bool IsTextureDumped(u64 hash) const;
|
|
void SetTextureDumped(u64 hash);
|
|
|
|
bool IsTextureCached(u64 hash) const;
|
|
const CustomTexInfo& LookupTexture(u64 hash) const;
|
|
void CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height);
|
|
|
|
void AddTexturePath(u64 hash, const std::string& path);
|
|
void FindCustomTextures(u64 program_id);
|
|
void PreloadTextures(Frontend::ImageInterface& image_interface);
|
|
bool CustomTextureExists(u64 hash) const;
|
|
const CustomTexPathInfo& LookupTexturePathInfo(u64 hash) const;
|
|
bool IsTexturePathMapEmpty() const;
|
|
|
|
private:
|
|
std::unordered_set<u64> dumped_textures;
|
|
std::unordered_map<u64, CustomTexInfo> custom_textures;
|
|
std::unordered_map<u64, CustomTexPathInfo> custom_texture_paths;
|
|
};
|
|
} // namespace Core
|