Files
mtgodot-poc/extension/src/port/EterLib/Resource.h
T
shenleiandClaude Opus 5 fc47582017 port 2A step 2: copy the 40250 header closure into the port mirror
76 closure headers (EterBase, EterLocale, EterPack, EterLib, GameLib, MilesLib,
EffectLib, SphereLib, EterImageLib) copied by the new port_copy.py (CP949->UTF-8,
LF, include-path case only); platform-class headers go to the mirror path too, as
the interface platform/ implements. Six manual `// PORT:` edits (Random, Singleton,
Pool, Stl, Utils, FlyTarget).

- common/D3D8Types.h: D3D8 value types with SDK values/layout, opaque COM interfaces
- common/shim/sdk (d3d8/d3dx8/mss) on every platform, common/shim/win32 off Windows
- Win32Types/Win32Crt: HRESULT, GUID, LARGE_INTEGER, LOGFONT/TEXTMETRIC, _atoi64,
  CRITICAL_SECTION on std::recursive_mutex
- header gate prepends each library's StdAfx.h (40250's precompiled header)

port_gate: macOS, Android, iOS, Windows (mingw) PASS; Linux BLOCKED (no toolchain).
ScriptLib/EterPythonLib/UserInterface wait for 2P (their StdAfx includes Python).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 20:27:57 +09:00

70 lines
1.5 KiB
C++

#pragma once
#include "ReferenceObject.h"
#include <string>
class CResource : public CReferenceObject
{
public:
typedef DWORD TType;
enum EState
{
STATE_EMPTY,
STATE_ERROR,
STATE_EXIST,
STATE_LOAD,
STATE_FREE
};
public:
void Clear();
static TType StringToType(const char* c_szType);
static TType Type();
void Load();
void Reload();
int ConvertPathName(const char * c_szPathName, char * pszRetPathName, int retLen);
virtual bool CreateDeviceObjects();
virtual void DestroyDeviceObjects();
public:
CResource(const char* c_szFileName);
virtual ~CResource();
static void SetDeleteImmediately(bool isSet = false);
// is loaded?
bool IsData() const;
bool IsEmpty() const;
bool IsType(TType type);
DWORD GetLoadCostMilliSecond() { return m_dwLoadCostMiliiSecond; }
//const char * GetFileName() const { return m_pszFileName; }
const char * GetFileName() const { return m_stFileName.c_str(); }
const std::string& GetFileNameString() const { return m_stFileName; }
virtual bool OnLoad(int iSize, const void * c_pvBuf) = 0;
protected:
void SetFileName(const char* c_szFileName);
virtual void OnClear() = 0;
virtual bool OnIsEmpty() const = 0;
virtual bool OnIsType(TType type) = 0;
virtual void OnConstruct();
virtual void OnSelfDestruct();
protected:
std::string m_stFileName;
//char * m_pszFileName;
DWORD m_dwLoadCostMiliiSecond;
EState me_state;
protected:
static bool ms_bDeleteImmediately;
};