mirror of
https://github.com/open-goal/jak-project
synced 2026-08-05 17:44:39 -04:00
decomp: stash changes
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace decompiler {
|
||||
|
||||
TextureDB::TextureDB() : replacement_cache(TextureLRUCache(25)) {
|
||||
TextureDB::TextureDB() : replacement_cache(TextureLRUCache(50)) {
|
||||
std::vector<u32> data(16 * 16, 0xffffffff);
|
||||
add_texture(kPlaceholderWhiteTexturePage, kPlaceholderWhiteTextureId, data, 16, 16,
|
||||
"placeholder-white", "placeholder", {}, 1, 0);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -26,10 +27,18 @@ struct TextureLRUCache {
|
||||
size_t capacity;
|
||||
List entries; // front = most recently used
|
||||
std::unordered_map<u32, Iterator> lookup;
|
||||
std::mutex mutex;
|
||||
|
||||
TextureLRUCache(size_t capacity) : capacity(capacity) {}
|
||||
|
||||
void clear() {
|
||||
std::lock_guard lock(mutex);
|
||||
entries.clear();
|
||||
lookup.clear();
|
||||
}
|
||||
|
||||
ResolvedTextureData* get(u32 id) {
|
||||
std::lock_guard lock(mutex);
|
||||
auto it = lookup.find(id);
|
||||
if (it == lookup.end()) {
|
||||
return nullptr;
|
||||
@@ -39,6 +48,7 @@ struct TextureLRUCache {
|
||||
}
|
||||
|
||||
void put(u32 id, ResolvedTextureData data) {
|
||||
std::lock_guard lock(mutex);
|
||||
auto it = lookup.find(id);
|
||||
if (it != lookup.end()) {
|
||||
it->second->second = std::move(data);
|
||||
|
||||
@@ -358,8 +358,7 @@ std::unique_ptr<TextureDB> handle_textures(Config config,
|
||||
tex_db->merge_textures(texture_merge_path);
|
||||
}
|
||||
|
||||
auto replacements_path = file_util::get_jak_project_dir() / "custom_assets" /
|
||||
game_version_names[config.game_version] / "texture_replacements";
|
||||
auto replacements_path = "E:\\awful_texture_pack\\"; // DONT MERGE
|
||||
if (fs::exists(replacements_path)) {
|
||||
tex_db->replace_textures(replacements_path);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "extract_level.h"
|
||||
|
||||
#include <set>
|
||||
#include <thread>
|
||||
|
||||
#include "extract_anim.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user