mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-07-11 02:24:44 -06:00
Fixes regression from #18546 and #18679. ## Problem The is_from_yml ISO branch constructed iso_archive unconditionally, bypassing the cache check inside add_game, making the cache write-only for yml-sourced ISOs. ## Fix Added a lightweight index cache entry (iso_path + "//index") storing the subdir list + mtime. On hit, skips archive construction entirely. On miss, walks as before and writes the index
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "Loader/PSF.h"
|
|
#include "Utilities/File.h"
|
|
#include "util/types.hpp"
|
|
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
// Cached metadata extracted from an ISO during game list scanning.
|
|
struct iso_metadata_cache_entry
|
|
{
|
|
s64 mtime = 0;
|
|
std::vector<u8> psf_data{};
|
|
std::string icon_path{};
|
|
std::vector<u8> icon_data{};
|
|
std::string movie_path{};
|
|
std::string audio_path{};
|
|
std::vector<std::string> subdirs{};
|
|
};
|
|
|
|
namespace iso_cache
|
|
{
|
|
// Returns false if no valid cache entry exists or mtime has changed.
|
|
bool load(const std::string& iso_path, const std::string& cache_key, iso_metadata_cache_entry& out_entry);
|
|
|
|
// Persists a populated cache entry to disk.
|
|
void save(const std::string& iso_path, const std::string& cache_key, const iso_metadata_cache_entry& entry);
|
|
|
|
bool load_index(const std::string& iso_path, std::vector<std::string>& out_subdirs);
|
|
void save_index(const std::string& iso_path, const std::vector<std::string>& subdirs);
|
|
|
|
// Remove cache entries for ISOs that are no longer in the scanned set.
|
|
void cleanup(const std::unordered_set<std::string>& valid_iso_paths);
|
|
}
|