2023-02-04 22:21:18 +08:00
CKFile in VT21: 0xC8, 200, count50; in VT25: 0xE0, 224, count 56
lost 24 byte, 6 fields or 2 lists
2023-02-25 17:39:39 +08:00
Important CK Class size
CKObject no change. 0x14(20)
CKSceneObject no change 0x1C(28), share Load/Save with CKObject
CKBeObject 0x50(80) count 20
CKGroup 0x68(104) count 26
CKMaterial 0xF0(240) count 90
CKTexture 0x94(148) count 52
CKMesh 0x104(260) count 65
CKRenderObject 0x58(88) count 22, share Load/Save with CKBeObject
CK3dEntity 0x1A8(424) count 106
CK3dObject 0x1A8(424) count 106 same as CK3dEntity
2023-02-04 22:21:18 +08:00
m_FileName
in VT21 +34, 136
in VT25 +31, 124
m_MappedFile
in VT21 +37, 148
in VT25 +34, 136
m_Context
in VT21 +35, 140
in VT25 +32, 128
VxMemoryMappedFile and CKFileInfo seems no change
CKFileObject still no change
CKFilePluginDependencies still no change
2023-02-15 21:03:26 +08:00
CKFileManagerData no change (12)
2023-02-04 22:21:18 +08:00
CKStateChunk is 0x28u black box
CKBufferParser also is 0x10u black box
struct CKGUID {
DWORD d1,d2;
};
struct XBaseString {
// the string
char* m_Buffer;
// the length of the string
WORD m_Length;
// the allocated size
WORD m_Allocated;
};
struct XArray {
// elements start {secret}
DWORD* m_Begin;
// elements end {secret}
DWORD* m_End;
// reserved end {secret}
DWORD* m_AllocatedEnd;
2023-02-16 16:12:53 +08:00
};
struct XIntArray {
int* m_Begin;
int* m_End;
int* m_AllocatedEnd;
};
2023-02-04 22:21:18 +08:00
struct XClassArray {
DWORD* m_Begin;
DWORD* m_End;
DWORD* m_AllocatedEnd;
2023-02-16 16:12:53 +08:00
};
2023-02-04 22:21:18 +08:00
struct XSArray {
DWORD* m_Begin;
DWORD* m_End;
};
struct XBitArray {
DWORD m_Data_Flags;
DWORD m_Size;
};
2023-02-15 21:03:26 +08:00
// <T, K> = <int, CK_ID>
typedef struct XFileObjectsTable::Entry {
CK_ID key;
int data;
struct Entry* next;
} *XFileObjectsTable::pEntry;
struct XFileObjectsTable {
struct XFileObjectsTable::XSArray_pEntry_ {
XFileObjectsTable::pEntry* m_Begin;
XFileObjectsTable::pEntry* m_End;
}m_Table;
struct XFileObjectsTable::XClassArray_pEntry_ {
XFileObjectsTable::pEntry* m_Begin;
XFileObjectsTable::pEntry* m_End;
XFileObjectsTable::pEntry* m_AllocatedEnd;
}m_Pool;
};
2023-02-04 22:21:18 +08:00
struct CKFileInfo
{
DWORD ProductVersion; // Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION)
DWORD ProductBuild; // Virtools Build Number.
DWORD FileWriteMode; // Options used to save this file. (CK_FILE_WRITEMODE)
DWORD FileVersion; // Version of file format when file was saved.
DWORD CKVersion; // Version of CK when file was saved.
DWORD FileSize; // Size of file in bytes.
DWORD ObjectCount; // Number of objects stored in the file.
DWORD ManagerCount; // Number of managers which saved data in the file.
DWORD MaxIDSaved; // Maximum Object identifier saved
DWORD Crc; // Crc of data
DWORD Hdr1PackSize; // Reserved
DWORD Hdr1UnPackSize; // Reserved
DWORD DataPackSize; // Reserved
DWORD DataUnPackSize; // Reserved
};
struct CKFileObject {
CK_ID Object; // ID of the object being load/saved (as it will be/was saved in the file)
CK_ID CreatedObject; // ID of the object being created
CK_CLASSID ObjectCid; // Class Identifier of the object
CKObject* ObjPtr; // A pointer to the object itself (as CreatedObject when loading)
CKSTRING Name; // Name of the Object
CKStateChunk* Data; // A CKStateChunk that contains object information
int PostPackSize; // When compressed chunk by chunk : size of Data after compression
int PrePackSize; // When compressed chunk by chunk : size of Data before compression
CK_FO_OPTIONS Options; // When loading an object it may be renamed , use to replace another object
int FileIndex; // Position of the object data inside uncompressed file buffer
CKDWORD SaveFlags; // Flags used when this object was saved.
};
2023-02-15 21:03:26 +08:00
struct CKFileManagerData {
CKStateChunk *data;
CKGUID Manager;
}
2023-02-04 22:21:18 +08:00
struct CKFilePluginDependencies{
int m_PluginCategory;
XArray/*<CKGUID>*/ m_Guids;
XBitArray ValidGuids;
};
struct VxMemoryMappedFile {
void* m_hFile;
void* m_hFileMapping; // Handle of memory mapped file
void* m_pMemoryMappedFileBase;
DWORD m_cbFile;
DWORD m_errCode;
};
2023-02-16 16:12:53 +08:00
struct CKStateChunkParser {
DWORD m_CurrentPos;
DWORD m_DataSize;
DWORD m_PrevIdentifierPos;
};
struct IntListStruct {
DWORD m_Count;
DWORD m_Allocated;
DWORD* m_pData;
};
struct CKStateChunkProp {
WORD m_DataVersion;
WORD m_ChunkVersion;
};
struct CKStateChunk {
CK_CLASSID m_ClassId;
DWORD m_DataDwordSize;
DWORD* m_pData;
CKStateChunkProp m_ChunkProps;
CKStateChunkParser* m_Parser;
IntListStruct* m_ObjectIdList;
IntListStruct* m_SubChunkList;
IntListStruct* m_ManagerIntList;
CKFile* m_BindFile;
DWORD m_unknow;
};
2023-02-04 22:21:18 +08:00
struct CKBufferParser {
2023-02-16 16:12:53 +08:00
char* m_MemBegin;
DWORD m_MemPos;
2023-02-04 22:21:18 +08:00
CKBOOL m_NeedManualFree;
2023-02-16 16:12:53 +08:00
DWORD m_MemSize;
};
struct XArray_CKFileObject_ {
CKFileObject* m_Begin;
CKFileObject* m_End;
CKFileObject* m_AllocatedEnd;
};
struct XArray_CKFileManagerData_ {
CKFileManagerData* m_Begin;
CKFileManagerData* m_End;
CKFileManagerData* m_AllocatedEnd;
};
struct XClassArray_CKFilePluginDependencies_ {
CKFilePluginDependencies* m_Begin;
CKFilePluginDependencies* m_End;
CKFilePluginDependencies* m_AllocatedEnd;
};
struct XClassArray_XIntArray_ {
XIntArray* m_Begin;
XIntArray* m_End;
XIntArray* m_AllocatedEnd;
};
struct XClassArray_XString_ {
XString* m_Begin;
XString* m_End;
XString* m_AllocatedEnd;
2023-02-04 22:21:18 +08:00
};
struct CKFile {
// 0
int m_SaveIDMax; // Maximum CK_ID found when saving or loading objects {secret}
2023-02-16 16:12:53 +08:00
XArray_CKFileObject_ m_FileObjects; // List of objects being saved / loaded {secret}
XArray_CKFileManagerData_ m_ManagersData; // Manager Data loaded {secret}
XClassArray_CKFilePluginDependencies_ m_PluginsDep; // Plugins dependencies for this file {secret}
XClassArray_XIntArray_ m_IndexByClassId; // List of index in the m_FileObjects table sorted by ClassID {secret}
XClassArray_XString_ m_IncludedFiles; // List of files that should be inserted in the CMO file. {secret}
2023-02-04 22:21:18 +08:00
// 16
CKFileInfo m_FileInfo; // Headers summary {secret}
// 16 + 14 = 30
// guess
DWORD unknow_fields;
XBitArray m_AlreadySavedMask; // BitArray of IDs already saved {secret}
// 30 + 3 = 33
2023-02-16 16:12:53 +08:00
CKDWORD m_Flags; // Flags used to save file {secret} CK_LOAD_FLAGS
2023-02-04 22:21:18 +08:00
CKSTRING m_FileName; // Current file name {secret}
CKContext* m_Context; // CKContext on which file is loaded/Saved {secret}
CKBufferParser* m_Parser;
VxMemoryMappedFile* m_MappedFile;
// 33 + 5 = 38
// guess
2023-02-15 21:03:26 +08:00
XFileObjectsTable m_ObjectsHashTable;
2023-02-04 22:21:18 +08:00
// 38 + 5 = 43
//[guess]
CKBOOL m_SceneSaved;
CKBOOL m_ReadFileDataDone;
// 43 + 2 = 45
XBitArray m_AlreadyReferencedMask; // BitArray of IDs already referenced {secret}
XObjectPointerArray m_ReferencedObjects;
// 45 + 2 + 3 = 50
};
VxTimeProfiler m_Chrono;
XFileObjectsTable m_ObjectsHashTable;
//#ifdef USECHUNKTABLE
XClassArray/*<CKFileChunk>*/ m_FileChunks; // Instead of allocating chunk per chunk a whole memory buffer is allocated to store all chunks and their readers
CKFileChunk* m_ObjectChunks;
CKFileChunk* m_ManagersChunks;
VxMemoryPool m_ChunkBuffers; // Store all decompressed file buffer in memory so that all chunks directly points to it...
// can only work for recent files ( > 2.0)
BYTE* m_CurrentChunkBufferPtr;
//#endif
CKBOOL m_ReadFileDataDone;
CKBOOL m_SceneSaved;
//-----------
XIntArray m_DuplicateNameFounds; // A List of file object index for which a existing object with the same name has been
// found, this list is build if the load option contains CK_LOAD_AUTOMATICMODE or CK_LOAD_DODIALOG
//-----
XBitArray m_AlreadySavedMask; // BitArray of IDs already saved {secret}
XBitArray m_AlreadyReferencedMask; // BitArray of IDs already referenced {secret}
XObjectPointerArray m_ReferencedObjects;
};