Files
mtgodot-poc/extension/src/port/EterPack/EterPackManager.h
T
shenleiandClaude Opus 5 9a8e11f3dd port 2A step 4: platform skeleton + rest of the 2V3 header closure
- Mirror the remaining non-Python 2V3 closure headers (98 more, 173 total): EffectLib,
  EterGrnLib, SpeedTreeLib, SphereLib, PRTerrainLib, EterImageLib, EterBase/Poly, cipher/tea,
  EterLib Grp*/IME/Input/MSWindow/StateManager, GameLib actor/map/race headers, EterPack.
- SDK shims: granny.h, SpeedTreeRT.h, imm.h, Dimm.h (the SDK MIDL header, not mirrored),
  dinput/d3dx8 additions; D3D8 render-state enums, FVF macros and the COM resource hierarchy;
  more Win32 GDI/handle types with layout static_asserts.
- PORT edits for MSVC-permissive code (typename, friend visibility, <algorithm>, pointer→uintptr_t)
  and PRTerrainLib/StdAfx.h dropping the ScriptLib/Python include.
- port_logic links the vendored cryptopp/minilzo.
- extension/src/platform: port_platform target with 103 generated stub files (1917 function
  stubs, 146 static members) from the new platform_stub.py (clang -ast-dump-filter);
  MT_PLATFORM_STUB() marks every unimplemented body. libmtgodot links port_platform and
  port_gate.sh builds it.

Gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 21:46:24 +09:00

97 lines
2.4 KiB
C++

#pragma once
#include <windows.h>
#include <unordered_map>
#include "../EterBase/Singleton.h"
#include "../EterBase/Stl.h"
#include "EterPack.h"
class CEterPackManager : public CSingleton<CEterPackManager>
{
public:
struct SCache
{
BYTE* m_abBufData;
DWORD m_dwBufSize;
};
public:
enum ESearchModes
{
SEARCH_FILE_FIRST,
SEARCH_PACK_FIRST
};
typedef std::list<CEterPack*> TEterPackList;
typedef std::unordered_map<std::string, CEterPack*, stringhash> TEterPackMap;
public:
CEterPackManager();
virtual ~CEterPackManager();
void SetCacheMode();
void SetRelativePathMode();
void LoadStaticCache(const char* c_szFileName);
void SetSearchMode(bool bPackFirst);
int GetSearchMode();
//THEMIDA
bool Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
//THEMIDA
bool GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
//THEMIDA
bool GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
bool isExist(const char * c_szFileName);
bool isExistInPack(const char * c_szFileName);
bool RegisterPack(const char * c_szName, const char * c_szDirectory, const BYTE* c_pbIV = NULL);
void RegisterRootPack(const char * c_szName);
bool RegisterPackWhenPackMaking(const char * c_szName, const char * c_szDirectory, CEterPack* pPack);
bool DecryptPackIV(DWORD key);
const char * GetRootPackFileName();
//for hybridcrypt
//THEMIDA
void WriteHybridCryptPackInfo(const char* pFileName);
//THEMIDA
void RetrieveHybridCryptPackKeys( const BYTE* pStream );
//THEMIDA
void RetrieveHybridCryptPackSDB( const BYTE* pStream );
// 메모리에 매핑된 팩들 가운데, 정리해야할 것들 정리.
public:
void ArrangeMemoryMappedPack();
protected:
int ConvertFileName(const char * c_szFileName, std::string & rstrFileName); // StringPath std::string 버전
bool CompareName(const char * c_szDirectoryName, DWORD iLength, const char * c_szFileName);
CEterPack* FindPack(const char* c_szPathName);
SCache* __FindCache(DWORD dwFileNameHash);
void __ClearCacheMap();
protected:
bool m_bTryRelativePath;
bool m_isCacheMode;
int m_iSearchMode;
CEterFileDict m_FileDict;
CEterPack m_RootPack;
TEterPackList m_PackList;
TEterPackMap m_PackMap;
TEterPackMap m_DirPackMap;
std::unordered_map<DWORD, SCache> m_kMap_dwNameKey_kCache;
CRITICAL_SECTION m_csFinder;
};