b3feddfef3
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
37 lines
1.9 KiB
C++
37 lines
1.9 KiB
C++
#pragma once
|
|
#include "RegionFile.h"
|
|
#include "Reference.h"
|
|
#include "File.h"
|
|
|
|
class RegionFileCache
|
|
{
|
|
friend class ConsoleSaveFileOriginal;
|
|
private:
|
|
static const int MAX_CACHE_SIZE = 256;
|
|
|
|
unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> cache;
|
|
|
|
static RegionFileCache s_defaultCache;
|
|
|
|
public:
|
|
// Made public and non-static so we can have a cache for input and output files
|
|
RegionFileCache() {}
|
|
~RegionFileCache();
|
|
|
|
RegionFile *_getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); // 4J - TODO was synchronized
|
|
void _clear(); // 4J - TODO was synchronized
|
|
int _getSizeDelta(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ);
|
|
DataInputStream *_getChunkDataInputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ);
|
|
DataOutputStream *_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ);
|
|
|
|
// Keep static version for general game usage
|
|
static RegionFile *getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getRegionFile(saveFile, prefix, chunkX, chunkZ); }
|
|
static void clear() { s_defaultCache._clear(); }
|
|
static int getSizeDelta(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); }
|
|
static DataInputStream *getChunkDataInputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); }
|
|
static DataOutputStream *getChunkDataOutputStream(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); }
|
|
|
|
private:
|
|
bool useSplitSaves(ESavePlatform platform);
|
|
};
|