address more comments
This commit is contained in:
parent
3534ad0835
commit
c2a32e942b
15 changed files with 87 additions and 56 deletions
|
@ -196,10 +196,11 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
|
|||
}
|
||||
perf_stats = std::make_unique<PerfStats>(title_id);
|
||||
custom_tex_cache = std::make_unique<Core::CustomTexCache>();
|
||||
if (Settings::values.custom_textures)
|
||||
if (Settings::values.custom_textures) {
|
||||
FileUtil::CreateFullPath(fmt::format("{}textures/{:016X}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
|
||||
Kernel().GetCurrentProcess()->codeset->program_id));
|
||||
}
|
||||
if (Settings::values.preload_textures)
|
||||
PreloadCustomTextures();
|
||||
status = ResultStatus::Success;
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
#include "custom_tex_cache.h"
|
||||
#include "core/custom_tex_cache.h"
|
||||
|
||||
namespace Core {
|
||||
CustomTexCache::CustomTexCache() = default;
|
||||
|
@ -13,18 +10,18 @@ CustomTexCache::CustomTexCache() = default;
|
|||
CustomTexCache::~CustomTexCache() = default;
|
||||
|
||||
bool CustomTexCache::IsTextureDumped(u64 hash) const {
|
||||
return dumped_textures.find(hash) != dumped_textures.end();
|
||||
return dumped_textures.count(hash);
|
||||
}
|
||||
|
||||
void CustomTexCache::SetTextureDumped(const u64 hash) {
|
||||
dumped_textures[hash] = true;
|
||||
dumped_textures.insert(hash);
|
||||
}
|
||||
|
||||
bool CustomTexCache::IsTextureCached(u64 hash) const {
|
||||
return custom_textures.find(hash) != custom_textures.end();
|
||||
return custom_textures.count(hash);
|
||||
}
|
||||
|
||||
const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) {
|
||||
const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) const {
|
||||
return custom_textures.at(hash);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
|
||||
|
@ -25,11 +26,11 @@ public:
|
|||
void SetTextureDumped(u64 hash);
|
||||
|
||||
bool IsTextureCached(u64 hash) const;
|
||||
const CustomTexInfo& LookupTexture(const u64 hash);
|
||||
const CustomTexInfo& LookupTexture(u64 hash) const;
|
||||
void CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height);
|
||||
|
||||
private:
|
||||
std::unordered_map<u64, bool> dumped_textures;
|
||||
std::unordered_set<u64> dumped_textures;
|
||||
std::unordered_map<u64, CustomTexInfo> custom_textures;
|
||||
};
|
||||
} // namespace Core
|
|
@ -7,7 +7,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace Frontend {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue