From d32ed302d1cb012d78e653b50bc0abfa4067ba9e Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 25 Feb 2023 17:39:39 +0800 Subject: [PATCH] update layout --- Documents/ClassOffset.fods | 1367 ------- Documents/IDAExportAddrConv.py | 12 + Documents/Recorder.txt | 18 + Documents/VTables.fods | 3239 ----------------- LibCmo/CKDefines.hpp | 38 + LibCmo/{VTConstants.hpp => CKEnums.hpp} | 26 +- LibCmo/CKFile.cpp | 94 + LibCmo/CKFile.hpp | 258 ++ LibCmo/CKFileReader.cpp | 684 ++++ LibCmo/CKFileWriter.cpp | 7 + LibCmo/CKGlobals.cpp | 38 + LibCmo/CKGlobals.hpp | 8 + LibCmo/{VTStateChunk.cpp => CKStateChunk.cpp} | 89 +- LibCmo/CKStateChunk.hpp | 50 + LibCmo/LibCmo.vcxproj | 19 +- LibCmo/LibCmo.vcxproj.filters | 52 +- LibCmo/ObjsImpl/CKObject.cpp | 15 + LibCmo/VTObjects.hpp | 122 + LibCmo/VTReader.cpp | 501 --- LibCmo/VTStruct.hpp | 205 -- LibCmo/VTUtils.hpp | 8 +- .../{VTStruct.cpp => VxMemoryMappedFile.cpp} | 89 +- LibCmo/VxMemoryMappedFile.hpp | 42 + Unvirt/AccessibleValue.hpp | 4 +- Unvirt/CmdHelper.hpp | 1 - Unvirt/StructFormatter.hpp | 2 +- Unvirt/Unvirt.cpp | 11 +- VirtoolsProbe/main.cpp | 4 +- 28 files changed, 1489 insertions(+), 5514 deletions(-) delete mode 100644 Documents/ClassOffset.fods create mode 100644 Documents/IDAExportAddrConv.py delete mode 100644 Documents/VTables.fods create mode 100644 LibCmo/CKDefines.hpp rename LibCmo/{VTConstants.hpp => CKEnums.hpp} (92%) create mode 100644 LibCmo/CKFile.cpp create mode 100644 LibCmo/CKFile.hpp create mode 100644 LibCmo/CKFileReader.cpp create mode 100644 LibCmo/CKFileWriter.cpp create mode 100644 LibCmo/CKGlobals.cpp create mode 100644 LibCmo/CKGlobals.hpp rename LibCmo/{VTStateChunk.cpp => CKStateChunk.cpp} (70%) create mode 100644 LibCmo/CKStateChunk.hpp create mode 100644 LibCmo/ObjsImpl/CKObject.cpp create mode 100644 LibCmo/VTObjects.hpp delete mode 100644 LibCmo/VTReader.cpp delete mode 100644 LibCmo/VTStruct.hpp rename LibCmo/{VTStruct.cpp => VxMemoryMappedFile.cpp} (55%) create mode 100644 LibCmo/VxMemoryMappedFile.hpp diff --git a/Documents/ClassOffset.fods b/Documents/ClassOffset.fods deleted file mode 100644 index 72ce6b7..0000000 --- a/Documents/ClassOffset.fods +++ /dev/null @@ -1,1367 +0,0 @@ - - - - Tad William2015-06-05T18:17:202023-02-16T14:33:05.107000000PT2H10M40SLibreOffice/7.3.7.2$Windows_X86_64 LibreOffice_project/e114eadc50a9ff8d8c8a0567d6da8f454beeb84f1316.0300 - - - 0 - 0 - 18463 - 12171 - - - view1 - - - 2 - 3 - 2 - 0 - 0 - 0 - 0 - 0 - 100 - 60 - true - false - - - 2 - 13 - 2 - 0 - 0 - 0 - 0 - 0 - 100 - 60 - true - false - - - 2 - 17 - 2 - 0 - 0 - 0 - 0 - 0 - 100 - 60 - true - false - - - CKStateChunk - 1855 - 0 - 100 - 60 - false - true - true - true - 12632256 - true - true - true - true - false - false - false - 1000 - 1000 - 1 - 1 - true - false - - - - - true - true - true - 0 - true - true - false - true - false - 12632256 - true - true - false - false - true - true - false - 3 - false - Microsoft XPS Document Writer - false - YQX+/01pY3Jvc29mdCBYUFMgRG9jdW1lbnQgV3JpdGVyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATWljcm9zb2Z0IFhQUyBEb2N1bWVudCBXcml0ZXIgdgAWAAEAfgQAAAAAAAAEAAhSAAAEdAAAM1ROVwAAAAAKAE0AaQBjAHIAbwBzAG8AZgB0ACAAWABQAFMAIABEAG8AYwB1AG0AZQBuAHQAIABXAHIAaQB0AGUAcgAAAAAAAAABBAMG3ACYAwOvAAABAAkAmgs0CGQAAQAPAFgCAgABAFgCAwAAAEEANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAABAAAA/////0dJUzQAAAAAAAAAAAAAAABESU5VIgAgAXwDHADK0vZyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAEAAFNNVEoAAAAAEAAQAXsAMABGADQAMQAzADAARABEAC0AMQA5AEMANwAtADcAYQBiADYALQA5ADkAQQAxAC0AOQA4ADAARgAwADMAQgAyAEUARQA0AEUAfQAAAElucHV0QmluAEZPUk1TT1VSQ0UAUkVTRExMAFVuaXJlc0RMTABJbnRlcmxlYXZpbmcAT0ZGAEltYWdlVHlwZQBKUEVHTWVkAE9yaWVudGF0aW9uAFBPUlRSQUlUAENvbGxhdGUAT0ZGAFJlc29sdXRpb24AT3B0aW9uMQBQYXBlclNpemUATEVUVEVSAENvbG9yTW9kZQAyNGJwcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAFY0RE0BAAAAAAAAAAAAAAAAAAAAAAAAABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3du - false - 1000 - 1000 - 1 - 1 - true - false - true - true - true - true - 2 - true - - - 工作表1 - - - CKBufferParser - - - CKStateChunk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¥- - - - - - - - - - - ¥- - - - - - - - - - ¥- - - - - - - - - - - ¥- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - - - - : - - : - - - - - - - : - - - - - : - - : - - - - - - - - - - - - - : - - - - $ - - - - - ($ - - ) - - - - $ - - - - - - ($ - - ) - - - - $ - - - - - ($ - - ) - - - - $ - - - - - - ($ - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - - : - - : - - - - - : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - offset - - - type - - - meaning - - - - - - 16 - - - field - - - header zero - - - - - - 17 - - - field - - - header version - - - - - - 18 - - - field - - - header flags - - - - - - 19 - - - field - - - header plugin1 - - - - - - 20 - - - field - - - header date - - - - - - 21 - - - field - - - opened compressed file buffer size - - - - - - 22 - - - field - - - header components count - - - - - - 23 - - - field - - - header addpath - - - - - - 24 - - - field - - - header objects count - - - - - - 25 - - - field - - - header crc - - - - - - 26 - - - field - - - header components compressed size - - - - - - 27 - - - field - - - header components decompressed size - - - - - - 28 - - - field - - - header objects compressed size - - - - - - 29 - - - field - - - header objects decompressed size - - - - - - 33 - - - field - - - load flag CK_LOAD_FLAGS - - - - - - 34 - - - field - - - opened virtools file name - - - - - - 36 - - - field - - - opened compressed file buffer - - - - - - 0 - - - field - - - objects count - - - - - - 1 - - - field - - - components list header(unit 44) - - - - - - 2 - - - field - - - components list tail - - - - - - 7 - - - field - - - components extra list header(unit 24, internal cell 8) - - - - - - 8 - - - field - - - components extra list tail - - - - - - 4 - - - field - - - components addpath list header(unit 12) - - - - - - 5 - - - field - - - components addpath list tail - - - - - - 37 - - - field - - - vt file (memeory mapped file) - - - - - - 35 - - - field - - - ckcontext - - - - - - - - - - - - - - - - - offset - - - type - - - meaning - - - - - - 0 - - - char* - - - reader ptr - - - - - - 1 - - - DWORD - - - read counter - - - - - - 2 - - - DWORD - - - need_free_manuall - - - - - - 3 - - - DWORD - - - buffer size - - - - - - - - - - - - - - - - - - - offset - - - type - - - meaning - - - - - - 0 - - - CK_CLASSID - - - the class identifier - - - - - - 1 - - - int - - - data size in DWORD (*4 for byte) - - - - - - 2 - - - DWORD* - - - pointer of data - - - - - - 3.0 - - - WORD - - - data version, LowWord. HIGH BYTE served for CK_CLASSID. - - - - - - 3.1 - - - WORD - - - chunk bersion, HighWord. HIGH BYTE served for PropFlags - - - - - - 4 - - - CKStateChunkParser* - - - pointer to parser (0xCh) - - - - - - 5 - - - XArray* like - - - WriteObjectID use this - - - - - - 6 - - - XArray* like - - - WriteSubChunk use this - - - - - - 7 - - - XArray* like - - - WriteManagerInt use this - - - - - - 8 - - - CKFile* - - - related ck file - - - - - - 9 - - - - - - - - - - CKStateChunkArray - - - - - - - offset - - - type - - - meaning - - - - - - 0 - - - DWORD - - - the size of this array - - - - - - 1 - - - DWORD - - - allocated size - - - - - - 2 - - - DWORD* - - - data buffer - - - - - - - - - CKStateChunkParser - - - - - - - 0 - - - DWORD - - - the current position of this buffer. - - - - - - 1 - - - DWORD - - - the size of this buffer - - - - - - 2 - - - DWORD - - - previous identifier position - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Documents/IDAExportAddrConv.py b/Documents/IDAExportAddrConv.py new file mode 100644 index 0000000..a2fea1f --- /dev/null +++ b/Documents/IDAExportAddrConv.py @@ -0,0 +1,12 @@ +def Conv(strl: str): + if len(strl) & 3 != 0: + print('Invalid length!') + return + + idaBytes = tuple(strl[i:i+2] for i in range(0, len(strl), 2)) + for i in range(0, len(idaBytes), 4): + print(idaBytes[i+3] + idaBytes[i+2] + idaBytes[i+1] + idaBytes[i]) + +while True: + Conv(input("data> ")) + diff --git a/Documents/Recorder.txt b/Documents/Recorder.txt index 26b6b3a..f15ec27 100644 --- a/Documents/Recorder.txt +++ b/Documents/Recorder.txt @@ -1,6 +1,24 @@ CKFile in VT21: 0xC8, 200, count50; in VT25: 0xE0, 224, count 56 lost 24 byte, 6 fields or 2 lists + + +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 + + + m_FileName in VT21 +34, 136 in VT25 +31, 124 diff --git a/Documents/VTables.fods b/Documents/VTables.fods deleted file mode 100644 index 02eae2a..0000000 --- a/Documents/VTables.fods +++ /dev/null @@ -1,3239 +0,0 @@ - - - - 2023-02-24T14:09:41.553000000PT1H19M46S6LibreOffice/7.3.7.2$Windows_X86_64 LibreOffice_project/e114eadc50a9ff8d8c8a0567d6da8f454beeb84f - - - 0 - 0 - 79356 - 22578 - - - view1 - - - 10 - 41 - 2 - 0 - 0 - 0 - 0 - 0 - 100 - 60 - true - false - - - VTables - 1855 - 0 - 100 - 60 - false - true - true - true - 12632256 - true - true - true - true - false - false - false - 1000 - 1000 - 1 - 1 - true - false - - - - - true - true - true - 0 - true - true - false - true - false - 12632256 - true - true - false - false - true - true - false - 3 - false - Microsoft XPS Document Writer - false - YQX+/01pY3Jvc29mdCBYUFMgRG9jdW1lbnQgV3JpdGVyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATWljcm9zb2Z0IFhQUyBEb2N1bWVudCBXcml0ZXIgdgAWAAEAfgQAAAAAAAAEAAhSAAAEdAAAM1ROVwAAAAAKAE0AaQBjAHIAbwBzAG8AZgB0ACAAWABQAFMAIABEAG8AYwB1AG0AZQBuAHQAIABXAHIAaQB0AGUAcgAAAAAAAAABBAMG3ACYAwOvAAABAAkAmgs0CGQAAQAPAFgCAgABAFgCAwAAAEEANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAABAAAA/////0dJUzQAAAAAAAAAAAAAAABESU5VIgAgAXwDHADK0vZyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAEAAFNNVEoAAAAAEAAQAXsAMABGADQAMQAzADAARABEAC0AMQA5AEMANwAtADcAYQBiADYALQA5ADkAQQAxAC0AOQA4ADAARgAwADMAQgAyAEUARQA0AEUAfQAAAElucHV0QmluAEZPUk1TT1VSQ0UAUkVTRExMAFVuaXJlc0RMTABJbnRlcmxlYXZpbmcAT0ZGAEltYWdlVHlwZQBKUEVHTWVkAE9yaWVudGF0aW9uAFBPUlRSQUlUAENvbGxhdGUAT0ZGAFJlc29sdXRpb24AT3B0aW9uMQBQYXBlclNpemUATEVUVEVSAENvbG9yTW9kZQAyNGJwcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAFY0RE0BAAAAAAAAAAAAAAAAAAAAAAAAABIAQ09NUEFUX0RVUExFWF9NT0RFEwBEdXBsZXhNb2RlOjpVbmtub3du - false - 1000 - 1000 - 1 - 1 - true - false - true - true - true - true - 7 - true - - - 工作表1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ??? - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Class Name - - - Class Id - - - Show() - - - IsHiddenByParent() - - - CanBeHide() - - - IsVisible() - - - ~dtor() - - - GetClassID() - - - PreSave() - - - Save() - - - Load() - - - PostLoad() - - - PreDelete() - - - CheckPreDeletion() - - - CheckPostDeletion() - - - GetMemoryOccupation() - - - IsObjectUsed() - - - PrepareDependencies() - - - RemapDependencies() - - - Copy() - - - - - CKCID_OBJECT - - - 1 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240022E8 - - - CK2.dll::24020F96 - - - CK2.dll::240210BE - - - CK2.dll::24020FC0 - - - CK2.dll::24021053 - - - CK2.dll::2402141A - - - CK2.dll::2402109D - - - CK2.dll::240210B9 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - CKCID_PARAMETERIN - - - 2 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24008E42 - - - CK2.dll::240093A7 - - - CK2.dll::24008F10 - - - CK2.dll::24008F35 - - - CK2.dll::24009005 - - - CK2.dll::2402141A - - - CK2.dll::24008E69 - - - CK2.dll::24008EDA - - - CK2.dll::2402141A - - - CK2.dll::24006AE0 - - - CK2.dll::24008EF5 - - - CK2.dll::24009418 - - - CK2.dll::2400943C - - - CK2.dll::2400946F - - - - - CKCID_PARAMETEROPERATION - - - 4 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24009BE8 - - - CK2.dll::24009C40 - - - CK2.dll::24009C4B - - - CK2.dll::24009C86 - - - CK2.dll::24009F98 - - - CK2.dll::24009C46 - - - CK2.dll::24009C0F - - - CK2.dll::2402141A - - - CK2.dll::2400A1FC - - - CK2.dll::2400A205 - - - CK2.dll::2400A276 - - - CK2.dll::2400A2C2 - - - CK2.dll::2400A316 - - - - - CKCID_STATE - - - 5 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240263A2 - - - CK2.dll::240263D6 - - - CK2.dll::240210BE - - - CK2.dll::240263DC - - - CK2.dll::2402645D - - - CK2.dll::2402141A - - - CK2.dll::24026498 - - - CK2.dll::240210B9 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - CKCID_BEHAVIORLINK - - - 6 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24006C53 - - - CK2.dll::24006CD9 - - - CK2.dll::240210BE - - - CK2.dll::24006D23 - - - CK2.dll::24006DD5 - - - CK2.dll::24006D08 - - - CK2.dll::24006C7A - - - CK2.dll::2402141A - - - CK2.dll::24006CDF - - - CK2.dll::24006CE8 - - - CK2.dll::2402116F - - - CK2.dll::24006EF4 - - - CK2.dll::24006F37 - - - - - CKCID_BEHAVIOR - - - 8 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2400429A - - - CK2.dll::24004D34 - - - CK2.dll::24004D3A - - - CK2.dll::24004E1E - - - CK2.dll::24005232 - - - CK2.dll::2400597F - - - CK2.dll::24004395 - - - CK2.dll::2402141A - - - CK2.dll::240057BE - - - CK2.dll::24005842 - - - CK2.dll::240063E3 - - - CK2.dll::240064AA - - - CK2.dll::240065D5 - - - - - CKCID_BEHAVIORIO - - - 9 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24006868 - - - CK2.dll::24006A89 - - - CK2.dll::240210BE - - - CK2.dll::240069A6 - - - CK2.dll::24006A49 - - - CK2.dll::2402141A - - - CK2.dll::240068C8 - - - CK2.dll::2402141A - - - CK2.dll::24006AE0 - - - CK2.dll::240210B9 - - - CK2.dll::2402116F - - - CK2.dll::24006B35 - - - CK2.dll::24006B5A - - - - - CKCID_RENDERCONTEXT - - - 12 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1006EC00 - - - CK2_3D.dll::1006DA5F - - - CK2_3D.dll::1007D054 - - - CK2_3D.dll::1007D06C - - - CK2_3D.dll::1007D084 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1006D885 - - - CK2_3D.dll::1006D89B - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1006D90B - - - CK2_3D.dll::1006D9B5 - - - CK2_3D.dll::1006DB0C - - - CK2_3D.dll::1007D090 - - - CK2_3D.dll::1007D096 - - - - - CKCID_KINEMATICCHAIN - - - 13 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::10056110 - - - CK2_3D.dll::10054BF8 - - - CK2_3D.dll::1007D054 - - - CK2_3D.dll::10055E51 - - - CK2_3D.dll::10055F05 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007D04E - - - CK2_3D.dll::10054C08 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10054C57 - - - CK2_3D.dll::10054C86 - - - CK2_3D.dll::1007D042 - - - CK2_3D.dll::10056062 - - - CK2_3D.dll::100560B7 - - - - - CKCID_SCENEOBJECT - - - 11 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2400237E - - - CK2.dll::240215DD - - - CK2.dll::240210BE - - - CK2.dll::24020FC0 - - - CK2.dll::24021053 - - - CK2.dll::2402141A - - - CK2.dll::2402175E - - - CK2.dll::240210B9 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - CKCID_OBJECTANIMATION - - - 15 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1005C450 - - - CK2_3D.dll::1005859A - - - CK2_3D.dll::1007D054 - - - CK2_3D.dll::100586B5 - - - CK2_3D.dll::10058C51 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007D04E - - - CK2_3D.dll::100585AA - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10058623 - - - CK2_3D.dll::10058662 - - - CK2_3D.dll::1005C2E1 - - - CK2_3D.dll::1005C31D - - - CK2_3D.dll::1005C387 - - - - - CKCID_ANIMATION - - - 16 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::10047FF0 - - - CK2_3D.dll::10047C64 - - - CK2_3D.dll::1007D054 - - - CK2_3D.dll::10047979 - - - CK2_3D.dll::10047ADC - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007D04E - - - CK2_3D.dll::10047904 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1004795B - - - CK2_3D.dll::1007D048 - - - CK2_3D.dll::1007D042 - - - CK2_3D.dll::10047D3A - - - CK2_3D.dll::10047D8F - - - - - CKCID_KEYEDANIMATION - - - 18 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1004A1B0 - - - CK2_3D.dll::10049B60 - - - CK2_3D.dll::10049C3B - - - CK2_3D.dll::10049C7C - - - CK2_3D.dll::10049E10 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007D04E - - - CK2_3D.dll::10049B70 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10049BCB - - - CK2_3D.dll::10049BFE - - - CK2_3D.dll::1004A0A0 - - - CK2_3D.dll::1004A0EB - - - CK2_3D.dll::1004A125 - - - - - CKCID_BEOBJECT - - - 19 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240023C9 - - - CK2.dll::2401C58E - - - CK2.dll::2401BC58 - - - CK2.dll::2401BCDA - - - CK2.dll::2401BF56 - - - CK2.dll::2402141A - - - CK2.dll::2401C635 - - - CK2.dll::2402141A - - - CK2.dll::2401C522 - - - CK2.dll::2401C556 - - - CK2.dll::2401C680 - - - CK2.dll::2401C77A - - - CK2.dll::2401C801 - - - - - CKCID_DATAARRAY - - - 52 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24029498 - - - CK2.dll::24029559 - - - CK2.dll::24029A21 - - - CK2.dll::24029A9C - - - CK2.dll::24029D04 - - - CK2.dll::24029764 - - - CK2.dll::2401C635 - - - CK2.dll::240297F9 - - - CK2.dll::24029942 - - - CK2.dll::2402955F - - - CK2.dll::240295B5 - - - CK2.dll::2402A138 - - - CK2.dll::2402A2AD - - - CK2.dll::2402A357 - - - - - CKCID_SCENE - - - 10 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2402DB65 - - - CK2.dll::2402DF3A - - - CK2.dll::2402E400 - - - CK2.dll::2402E44C - - - CK2.dll::2402E6B4 - - - CK2.dll::2402141A - - - CK2.dll::2402DC3F - - - CK2.dll::2402141A - - - CK2.dll::2402E36C - - - CK2.dll::2402E3A1 - - - CK2.dll::2402E3C2 - - - CK2.dll::2402F016 - - - CK2.dll::2402F098 - - - CK2.dll::2402F0CE - - - - - CKCID_LEVEL - - - 21 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2402C925 - - - CK2.dll::2402CB40 - - - CK2.dll::2402CC27 - - - CK2.dll::2402CC69 - - - CK2.dll::2402CE4A - - - CK2.dll::2402141A - - - CK2.dll::2401C635 - - - CK2.dll::2402CB46 - - - CK2.dll::2402CB5F - - - CK2.dll::2402CB9F - - - CK2.dll::2402CBC3 - - - CK2.dll::2402D244 - - - CK2.dll::2401C77A - - - CK2.dll::2401C801 - - - - - CKCID_PLACE - - - 22 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1003EF90 - - - CK2_3D.dll::1003E418 - - - CK2_3D.dll::1003E662 - - - CK2_3D.dll::1003E69E - - - CK2_3D.dll::1003E7F1 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1003E428 - - - CK2_3D.dll::1003E4A9 - - - CK2_3D.dll::1003E508 - - - CK2_3D.dll::1003E544 - - - CK2_3D.dll::1003ED64 - - - CK2_3D.dll::1003EE1F - - - CK2_3D.dll::1003EF05 - - - - - CKCID_GROUP - - - 23 - - - CK2.dll::2402BBF3 - - - CK2.dll::24018166 - - - CK2.dll::2402BB6F - - - CK2.dll::240067A7 - - - CK2.dll::2402BB53 - - - CK2.dll::2402BC89 - - - CK2.dll::2402BC8F - - - CK2.dll::2402BCDF - - - CK2.dll::2402BD8A - - - CK2.dll::2402BEA1 - - - CK2.dll::2402BBC7 - - - CK2.dll::2402BE2A - - - CK2.dll::2402141A - - - CK2.dll::2402BE44 - - - CK2.dll::2402BE5D - - - CK2.dll::2402BF93 - - - CK2.dll::2402C04D - - - CK2.dll::2402C090 - - - - - CKCID_SOUND - - - 24 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240186A9 - - - CK2.dll::24018701 - - - CK2.dll::2401BC58 - - - CK2.dll::24018710 - - - CK2.dll::240187DC - - - CK2.dll::2402141A - - - CK2.dll::2401C635 - - - CK2.dll::2402141A - - - CK2.dll::24018707 - - - CK2.dll::2401C556 - - - CK2.dll::2401C680 - - - CK2.dll::2401C77A - - - CK2.dll::2401C801 - - - - - CKCID_WAVESOUND - - - 25 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24019E74 - - - CK2.dll::24019F7D - - - CK2.dll::2401BC58 - - - CK2.dll::2401A056 - - - CK2.dll::2401A255 - - - CK2.dll::2402141A - - - CK2.dll::2401C635 - - - CK2.dll::2402141A - - - CK2.dll::24019F83 - - - CK2.dll::24019F9F - - - CK2.dll::2401C556 - - - CK2.dll::2401C680 - - - CK2.dll::2401ADB0 - - - CK2.dll::2401ADE6 - - - - - CKCID_MIDISOUND - - - 26 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240184C3 - - - CK2.dll::24018521 - - - CK2.dll::2401BC58 - - - CK2.dll::24018530 - - - CK2.dll::240185BD - - - CK2.dll::2402141A - - - CK2.dll::2401C635 - - - CK2.dll::2402141A - - - CK2.dll::24018527 - - - CK2.dll::2401C556 - - - CK2.dll::2401C680 - - - CK2.dll::2401C77A - - - CK2.dll::2401C801 - - - - - CKCID_MATERIAL - - - 30 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::100660C0 - - - CK2_3D.dll::10065169 - - - CK2_3D.dll::1006524B - - - CK2_3D.dll::100652CF - - - CK2_3D.dll::100655E1 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007CEFE - - - CK2_3D.dll::10065179 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1006522B - - - CK2_3D.dll::100651D6 - - - CK2_3D.dll::10065DE0 - - - CK2_3D.dll::10065EA0 - - - CK2_3D.dll::10065F34 - - - - - CKCID_TEXTURE - - - 31 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1007A730 - - - CK2_3D.dll::1007A35C - - - CK2_3D.dll::1007CDF6 - - - CK2_3D.dll::10079AF0 - - - CK2_3D.dll::10079D4D - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007CEFE - - - CK2_3D.dll::1007CF0A - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1007A36C - - - CK2_3D.dll::1007CDE4 - - - CK2_3D.dll::1007CEE6 - - - CK2_3D.dll::1007CEF8 - - - CK2_3D.dll::1007A488 - - - - - CKCID_MESH - - - 32 - - - CK2_3D.dll::1001CDC3 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1002AA10 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::100292F0 - - - CK2_3D.dll::10028AC8 - - - CK2_3D.dll::100272CA - - - CK2_3D.dll::10027385 - - - CK2_3D.dll::1002816A - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007CEFE - - - CK2_3D.dll::10026521 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10026678 - - - CK2_3D.dll::10026869 - - - CK2_3D.dll::10028C15 - - - CK2_3D.dll::10028D26 - - - CK2_3D.dll::10028E2B - - - - - CKCID_PATCHMESH - - - 53 - - - CK2_3D.dll::1001CDC3 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1002AA10 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1003CE40 - - - CK2_3D.dll::1003C3EA - - - CK2_3D.dll::1003C333 - - - CK2_3D.dll::1003AC69 - - - CK2_3D.dll::1003B208 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007CEFE - - - CK2_3D.dll::10026521 - - - CK2_3D.dll::1003AAB5 - - - CK2_3D.dll::1003ABB7 - - - CK2_3D.dll::10026869 - - - CK2_3D.dll::1003CB28 - - - CK2_3D.dll::1003CC29 - - - CK2_3D.dll::1003CD40 - - - - - CKCID_RENDEROBJECT - - - 47 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::1000D910 - - - CK2_3D.dll::1000D900 - - - CK2_3D.dll::1007CDF6 - - - CK2_3D.dll::1007CE62 - - - CK2_3D.dll::1007CEC2 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007CEFE - - - CK2_3D.dll::1007CF0A - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10076960 - - - CK2_3D.dll::1007CDE4 - - - CK2_3D.dll::1007CEE6 - - - CK2_3D.dll::1007CEF8 - - - CK2_3D.dll::1007CF10 - - - - - CKCID_3DENTITY - - - 33 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1000BC80 - - - CK2_3D.dll::1000B31F - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1000A2B2 - - - CK2_3D.dll::1000A7B9 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1000A0AC - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::1000B6DD - - - CK2_3D.dll::1000BA8B - - - - - CKCID_SPRITE - - - 28 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1005CA7F - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::10061CA0 - - - CK2_3D.dll::10061450 - - - CK2_3D.dll::1005EFA8 - - - CK2_3D.dll::1006147E - - - CK2_3D.dll::10061661 - - - CK2_3D.dll::1005F7B1 - - - CK2_3D.dll::1005C8E1 - - - CK2_3D.dll::1005F755 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10061460 - - - CK2_3D.dll::1007CDE4 - - - CK2_3D.dll::100619DD - - - CK2_3D.dll::10061A19 - - - CK2_3D.dll::10061C4C - - - - - CKCID_SPRITETEXT - - - 29 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1005CA7F - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000CE50 - - - CK2_3D.dll::100627B0 - - - CK2_3D.dll::10062519 - - - CK2_3D.dll::1005EFA8 - - - CK2_3D.dll::100621FF - - - CK2_3D.dll::10062547 - - - CK2_3D.dll::1005F7B1 - - - CK2_3D.dll::1005C8E1 - - - CK2_3D.dll::1005F755 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10062529 - - - CK2_3D.dll::1007CDE4 - - - CK2_3D.dll::100619DD - - - CK2_3D.dll::10061A19 - - - CK2_3D.dll::10062712 - - - - - CKCID_3DENTITY - - - 33 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1000BC80 - - - CK2_3D.dll::1000B31F - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1000A2B2 - - - CK2_3D.dll::1000A7B9 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1000A0AC - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::1000B6DD - - - CK2_3D.dll::1000BA8B - - - - - CKCID_GRID - - - 50 - - - CK2_3D.dll::10018DDA - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10019F70 - - - CK2_3D.dll::100196D3 - - - CK2_3D.dll::100197E1 - - - CK2_3D.dll::1001987D - - - CK2_3D.dll::10019A11 - - - CK2_3D.dll::100197AC - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::100196E3 - - - CK2_3D.dll::1001970B - - - CK2_3D.dll::1001976C - - - CK2_3D.dll::10019C98 - - - CK2_3D.dll::10019E09 - - - CK2_3D.dll::10019E7F - - - - - CKCID_CURVEPOINT - - - 36 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10017880 - - - CK2_3D.dll::10016ECC - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::10016EFA - - - CK2_3D.dll::1001701D - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::10016EDC - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::100176E4 - - - CK2_3D.dll::10017744 - - - - - CKCID_SPRITE3D - - - 37 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10043850 - - - CK2_3D.dll::100431CC - - - CK2_3D.dll::1004326A - - - CK2_3D.dll::1004329D - - - CK2_3D.dll::1004340F - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::100431DC - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1004321A - - - CK2_3D.dll::10043238 - - - CK2_3D.dll::100436BB - - - CK2_3D.dll::10043734 - - - CK2_3D.dll::10043780 - - - - - CKCID_CURVE - - - 43 - - - CK2_3D.dll::10014EF4 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10016810 - - - CK2_3D.dll::100160AC - - - CK2_3D.dll::10016165 - - - CK2_3D.dll::100161AA - - - CK2_3D.dll::10016342 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::100160BC - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::100160F0 - - - CK2_3D.dll::10016125 - - - CK2_3D.dll::100166A1 - - - CK2_3D.dll::1001670C - - - CK2_3D.dll::10016758 - - - - - CKCID_CAMERA - - - 34 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1000F800 - - - CK2_3D.dll::1000F65F - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1000F396 - - - CK2_3D.dll::1000F4A6 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1000F380 - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::1000B6DD - - - CK2_3D.dll::1000F72E - - - - - CKCID_TARGETCAMERA - - - 35 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10044150 - - - CK2_3D.dll::10043D39 - - - CK2_3D.dll::10043DD4 - - - CK2_3D.dll::10043E10 - - - CK2_3D.dll::10043EBC - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::10043D49 - - - CK2_3D.dll::10043D7F - - - CK2_3D.dll::10043D9D - - - CK2_3D.dll::1004404D - - - CK2_3D.dll::100440CA - - - CK2_3D.dll::10044107 - - - - - CKCID_LIGHT - - - 38 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1001B8F0 - - - CK2_3D.dll::1001B35B - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1001B389 - - - CK2_3D.dll::1001B50E - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1001B36B - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::1000B6DD - - - CK2_3D.dll::1001B873 - - - - - CKCID_TARGETLIGHT - - - 39 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::100447F0 - - - CK2_3D.dll::100443CC - - - CK2_3D.dll::10044467 - - - CK2_3D.dll::100444A3 - - - CK2_3D.dll::1004454F - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::100443DC - - - CK2_3D.dll::10044412 - - - CK2_3D.dll::10044430 - - - CK2_3D.dll::100446E0 - - - CK2_3D.dll::1004475D - - - CK2_3D.dll::1004479A - - - - - CKCID_CHARACTER - - - 40 - - - CK2_3D.dll::1000FCBE - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::10013200 - - - CK2_3D.dll::10012D18 - - - CK2_3D.dll::100125C7 - - - CK2_3D.dll::10012648 - - - CK2_3D.dll::10012824 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1001242F - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1001250A - - - CK2_3D.dll::10012558 - - - CK2_3D.dll::10012E79 - - - CK2_3D.dll::10012FE3 - - - CK2_3D.dll::100130AE - - - - - CKCID_3DOBJECT - - - 41 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1000E6C0 - - - CK2_3D.dll::1000E5E5 - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1000A2B2 - - - CK2_3D.dll::1000A7B9 - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1000A0AC - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000B4D5 - - - CK2_3D.dll::1000B6DD - - - CK2_3D.dll::1000BA8B - - - - - CKCID_BODYPART - - - 42 - - - CK2_3D.dll::10005494 - - - CK2_3D.dll::10005556 - - - CK2_3D.dll::1000D8F0 - - - CK2_3D.dll::1000552B - - - CK2_3D.dll::1000EE50 - - - CK2_3D.dll::1000EC59 - - - CK2_3D.dll::1000A1C2 - - - CK2_3D.dll::1000E9B1 - - - CK2_3D.dll::1000EA7A - - - CK2_3D.dll::1000A138 - - - CK2_3D.dll::1000B8BF - - - CK2_3D.dll::1000B994 - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1000E99B - - - CK2_3D.dll::1000A016 - - - CK2_3D.dll::1000ED38 - - - CK2_3D.dll::1000ED74 - - - CK2_3D.dll::1000EDD5 - - - - - CKCID_PARAMETER - - - 46 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24008383 - - - CK2.dll::24008406 - - - CK2.dll::2400840C - - - CK2.dll::24008498 - - - CK2.dll::2400867C - - - CK2.dll::2402141A - - - CK2.dll::240083F3 - - - CK2.dll::240089F3 - - - CK2.dll::24008A07 - - - CK2.dll::24008A6C - - - CK2.dll::24008B23 - - - CK2.dll::24008B8E - - - - - CKCID_PARAMETERLOCAL - - - 45 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::240094D5 - - - CK2.dll::24009739 - - - CK2.dll::2400840C - - - CK2.dll::2400963A - - - CK2.dll::240096E6 - - - CK2.dll::2402141A - - - CK2.dll::240094FC - - - CK2.dll::2402141A - - - CK2.dll::240083F3 - - - CK2.dll::24009635 - - - CK2.dll::24008A07 - - - CK2.dll::2400978A - - - CK2.dll::240097AE - - - CK2.dll::240097B3 - - - - - CKCID_PARAMETEROUT - - - 3 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2400A519 - - - CK2.dll::2400A63D - - - CK2.dll::2400A643 - - - CK2.dll::2400A685 - - - CK2.dll::2400A744 - - - CK2.dll::2402141A - - - CK2.dll::2400A579 - - - CK2.dll::2400A62C - - - CK2.dll::240083F3 - - - CK2.dll::2400A7C4 - - - CK2.dll::2400A7E8 - - - CK2.dll::2400A879 - - - CK2.dll::2400A89D - - - CK2.dll::2400A8BF - - - - - CKCID_INTERFACEOBJECTMANAGER - - - 48 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2400CD88 - - - CK2.dll::2400CE2F - - - CK2.dll::240210BE - - - CK2.dll::2400CF03 - - - CK2.dll::2400CFCD - - - CK2.dll::2402141A - - - CK2.dll::2402109D - - - CK2.dll::240210B9 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - CKCID_CRITICALSECTION - - - 49 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::2402621F - - - CK2.dll::24026282 - - - CK2.dll::240210BE - - - CK2.dll::24026288 - - - CK2.dll::24026312 - - - CK2.dll::2402141A - - - CK2.dll::2402634D - - - CK2.dll::24026498 - - - CK2.dll::24026364 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - CKCID_LAYER - - - 51 - - - CK2_3D.dll::1007CDB4 - - - CK2_3D.dll::1007CF16 - - - CK2_3D.dll::1007CF28 - - - CK2_3D.dll::1001A49B - - - CK2_3D.dll::1001AC20 - - - CK2_3D.dll::1001A4FE - - - CK2_3D.dll::1007D054 - - - CK2_3D.dll::1001A559 - - - CK2_3D.dll::1001A742 - - - CK2_3D.dll::1007CDEA - - - CK2_3D.dll::1007D04E - - - CK2_3D.dll::1001A50E - - - CK2_3D.dll::1007CDA8 - - - CK2_3D.dll::1001A53B - - - CK2_3D.dll::1007D048 - - - CK2_3D.dll::1007D042 - - - CK2_3D.dll::1001AABB - - - CK2_3D.dll::1001AAFB - - - - - CKCID_SYNCHRO - - - 20 - - - CK2.dll::24020F9C - - - CK2.dll::24018166 - - - CK2.dll::240067A7 - - - CK2.dll::24025F54 - - - CK2.dll::24026062 - - - CK2.dll::240210BE - - - CK2.dll::24026068 - - - CK2.dll::24026105 - - - CK2.dll::2402141A - - - CK2.dll::2402616C - - - CK2.dll::24026187 - - - CK2.dll::240261B4 - - - CK2.dll::2402116F - - - CK2.dll::240211E3 - - - CK2.dll::240211E8 - - - - - - - - - - - - - \ No newline at end of file diff --git a/LibCmo/CKDefines.hpp b/LibCmo/CKDefines.hpp new file mode 100644 index 0000000..3a3e97d --- /dev/null +++ b/LibCmo/CKDefines.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include +#include + +namespace LibCmo { + + using CKINT = int32_t; + using CK_ID = uint32_t; + using CKDWORD = uint32_t; + using CKWORD = uint16_t; + using CKBYTE = uint8_t; + using CKBOOL = int32_t; + using CKMUTSTRING = char*; + using CKSTRING = const char*; + + using XString = std::string; + using XBitArray = std::vector; + template + using XArray = std::vector; + using XIntArray = std::vector; + template + using XClassArray = std::vector; + //using CKObjectArray = std::vector; + + + struct CKGUID { + union { + struct { + CKDWORD d1, d2; + }; + CKDWORD d[2]; + }; + CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) { d[0] = gd1; d[1] = gd2; } + }; + + +} diff --git a/LibCmo/VTConstants.hpp b/LibCmo/CKEnums.hpp similarity index 92% rename from LibCmo/VTConstants.hpp rename to LibCmo/CKEnums.hpp index c806723..05cef5d 100644 --- a/LibCmo/VTConstants.hpp +++ b/LibCmo/CKEnums.hpp @@ -1,15 +1,13 @@ #pragma once +#include #include #include #include -#include -#include -#include namespace LibCmo { - namespace EnumHelper { + namespace EnumsHelper { template inline TEnum FlagEnumAdd(TEnum e, ...) { TEnum result = e; @@ -26,23 +24,6 @@ namespace LibCmo { } } - using CKINT = int32_t; - using CK_ID = uint32_t; - using CKDWORD = uint32_t; - using CKWORD = uint16_t; - using CKBOOL = int32_t; - using CKMUTSTRING = char*; - using CKSTRING = const char*; - - using XString = std::string; - using XBitArray = std::vector; - template - using XArray = std::vector; - using XIntArray = std::vector; - template - using XClassArray = std::vector; - //using CKObjectArray = std::vector; - enum class CK_CLASSID : uint32_t { CKCID_OBJECT = 1, CKCID_PARAMETERIN = 2, @@ -113,7 +94,7 @@ namespace LibCmo { CKCID_MAXCLASSID = 55, CKCID_MAXMAXCLASSID = 128 - }; + }; enum class CKERROR : int32_t { CKERR_OK = 0, @@ -237,4 +218,3 @@ namespace LibCmo { }; } - diff --git a/LibCmo/CKFile.cpp b/LibCmo/CKFile.cpp new file mode 100644 index 0000000..d9fa213 --- /dev/null +++ b/LibCmo/CKFile.cpp @@ -0,0 +1,94 @@ +#include "CKFile.hpp" +#include + +namespace LibCmo { + + +#pragma region CKMinContext + + CKMinContext::CKMinContext() { + + } + CKMinContext::~CKMinContext() { + + } + + void CKMinContext::Printf(CKSTRING fmt, ...) { + va_list argptr; + va_start(argptr, fmt); + vfprintf(stdout, fmt, argptr); + va_end(argptr); + } + +#pragma endregion + +#pragma region CKBufferParser + + CKBufferParser::CKBufferParser(void* ptr, size_t rsize, bool need_manual_free) : + m_MemBegin(static_cast(ptr)), + m_MemPos(0u), m_MemSize(rsize), + m_NeedManualFree(need_manual_free) { + ; + } + CKBufferParser::~CKBufferParser() { + if (this->m_NeedManualFree) delete[](this->m_MemBegin); + } + +#pragma endregion + +#pragma region CKFileObject + + LibCmo::CKFileObject::CKFileObject() : + Data(nullptr) { + ; + } + + LibCmo::CKFileObject::~CKFileObject() { + ; + } + +#pragma endregion + + +#pragma region ShallowDocument + + LibCmo::CKFileData::ShallowDocument::ShallowDocument() { + this->m_IndexByClassId.resize(static_cast(CK_CLASSID::CKCID_MAXCLASSID)); + } + + LibCmo::CKFileData::ShallowDocument::~ShallowDocument() { + + } + +#pragma endregion + +#pragma region DeepDocument + + LibCmo::CKFileData::DeepDocument::DeepDocument() { + this->m_IndexByClassId.resize(static_cast(CK_CLASSID::CKCID_MAXCLASSID)); + } + + LibCmo::CKFileData::DeepDocument::~DeepDocument() { + + } + +#pragma endregion + + +#pragma region CKFile Misc + + CKFile::CKFile(CKMinContext* ctx) : + m_MappedFile(nullptr), m_FileName(), + m_MinCtx(ctx) { + ; + } + + CKFile::~CKFile() { + } + + + +#pragma endregion + + +} diff --git a/LibCmo/CKFile.hpp b/LibCmo/CKFile.hpp new file mode 100644 index 0000000..de7e957 --- /dev/null +++ b/LibCmo/CKFile.hpp @@ -0,0 +1,258 @@ +#pragma once + +#include "CKDefines.hpp" +#include "CKEnums.hpp" + +#include "VxMemoryMappedFile.hpp" +#include "CKStateChunk.hpp" +#include "VTObjects.hpp" + +namespace LibCmo { + + class CKMinContext { + public: + CKMinContext(); + CKMinContext(const CKMinContext&) = delete; + CKMinContext& operator=(const CKMinContext&) = delete; + ~CKMinContext(); + + void Printf(CKSTRING fmt, ...); + + private: + + std::string NameEncoding; + std::string TempFolder; + }; + + class CKBufferParser { + private: + char* m_MemBegin; + size_t m_MemPos; + bool m_NeedManualFree; + size_t m_MemSize; + + public: + CKBufferParser(void* ptr, size_t rsize, bool need_manual_free); + CKBufferParser(const CKBufferParser&) = delete; + CKBufferParser& operator=(const CKBufferParser&) = delete; + ~CKBufferParser(); + + inline const void* GetPtr(void) { return (this->m_MemBegin + m_MemPos); } + inline void Read(void* data, size_t data_size) { + memcpy(data, (this->m_MemBegin + m_MemPos), data_size); + this->m_MemPos += data_size; + } + inline void Write(const void* data, size_t data_size) { + memcpy((this->m_MemBegin + m_MemPos), data, data_size); + this->m_MemPos += data_size; + } + inline void* GetBase(void) { return this->m_MemBegin; } + inline size_t GetSize(void) { return this->m_MemSize; } + inline size_t GetCursor(void) { return this->m_MemPos; } + inline void MoveCursor(size_t off) { this->m_MemPos += off; } + inline void SetCursor(size_t off) { this->m_MemPos = off; } + }; + +#pragma pack(push) +#pragma pack(1) + struct CKRawFileInfo { + CKBYTE NeMo[8]; + CKDWORD Crc; + CKDWORD CKVersion; + CKDWORD FileVersion; + CKDWORD Zero; + CKDWORD FileWriteMode; + CKDWORD Hdr1PackSize; + + CKDWORD DataPackSize; + CKDWORD DataUnPackSize; + CKDWORD ManagerCount; + CKDWORD ObjectCount; + CKDWORD MaxIDSaved; + CKDWORD ProductVersion; + CKDWORD ProductBuild; + CKDWORD Hdr1UnPackSize; + }; +#pragma pack(pop) + + class CKFileInfo { + public: + CKFileInfo(); + CKFileInfo(const CKFileInfo&) = delete; + CKFileInfo& operator=(const CKFileInfo&) = delete; + ~CKFileInfo(); + + CKDWORD ProductVersion; // Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION) + CKDWORD ProductBuild; // Virtools Build Number. + CK_FILE_WRITEMODE FileWriteMode; // Options used to save this file. (CK_FILE_WRITEMODE) + CKDWORD FileVersion; // Version of file format when file was saved. + CKDWORD CKVersion; // Version of CK when file was saved. + size_t FileSize; // Size of file in bytes. + CKDWORD ObjectCount; // Number of objects stored in the file. + CKDWORD ManagerCount; // Number of managers which saved data in the file. + CKDWORD MaxIDSaved; // Maximum Object identifier saved + CKDWORD Crc; // Crc of data + CKDWORD Hdr1PackSize; // Reserved + CKDWORD Hdr1UnPackSize; // Reserved + CKDWORD DataPackSize; // Reserved + CKDWORD DataUnPackSize; // Reserved + private: + + }; + + class CKFileObject { + public: + CKFileObject(); + CKFileObject(const CKFileObject&) = delete; + CKFileObject& operator=(const CKFileObject&) = delete; + ~CKFileObject(); + + CK_ID ObjectId; + CK_CLASSID ObjectCid; + std::string Name; + CKStateChunk* Data; + CKDWORD PostPackSize; + CKDWORD PrePackSize; + CKDWORD FileIndex; + private: + + }; + + class CKFileManagerData { + public: + CKFileManagerData(); + CKFileManagerData(const CKFileManagerData&) = delete; + CKFileManagerData& operator=(const CKFileManagerData&) = delete; + ~CKFileManagerData(); + + CKStateChunk* Data; + CKGUID Manager; + private: + + }; + + class CKFilePluginDependencies { + public: + CKFilePluginDependencies(); + CKFilePluginDependencies(const CKFilePluginDependencies&) = delete; + CKFilePluginDependencies& operator=(const CKFilePluginDependencies&) = delete; + ~CKFilePluginDependencies(); + + CK_PLUGIN_TYPE m_PluginCategory; + XArray m_Guids; + private: + + }; + + namespace CKFileData { + class ShallowDocument { + public: + ShallowDocument(); + ShallowDocument(const ShallowDocument&) = delete; + ShallowDocument& operator=(const ShallowDocument&) = delete; + ~ShallowDocument(); + + int32_t m_SaveIDMax; + CKFileInfo m_FileInfo; + + XArray m_FileObjects; + XArray m_FileManagersData; + XClassArray m_PluginDep; + XClassArray m_IndexByClassId; + XClassArray m_IncludedFiles; + + private: + + }; + + class DeepDocument { + public: + DeepDocument(); + DeepDocument(const DeepDocument&) = delete; + DeepDocument& operator=(const DeepDocument&) = delete; + ~DeepDocument(); + + int32_t m_SaveIDMax; + CKFileInfo m_FileInfo; + + XArray m_Objects; + XClassArray m_IndexByClassId; + XClassArray m_IncludedFiles; + private: + + }; + + class HybridDocument { + public: + HybridDocument(); + HybridDocument(const HybridDocument&) = delete; + HybridDocument& operator=(const HybridDocument&) = delete; + ~HybridDocument(); + + private: + + }; + + } + + class CKFile { + public: + CKFile(CKMinContext* ctx); + CKFile(const CKFile&) = delete; + CKFile& operator=(const CKFile&) = delete; + ~CKFile(); + + void ClearData(void); + + CKERROR ShallowLoad(CKSTRING u8_filename, CKFileData::ShallowDocument** out_doc); + CKERROR DeepLoad(CKSTRING u8_filename, CKFileData::DeepDocument** out_doc); + + CKERROR ShallowSave(CKSTRING u8_filename, CKFileData::ShallowDocument* in_doc); + CKERROR DeepSave(CKSTRING u8_filename, CKFileData::DeepDocument* out_doc); + CKERROR HybridSave(CKSTRING u8_filename, CKFileData::HybridDocument* out_doc); + + CKERROR DestroyDocument(CKFileData::ShallowDocument* in_doc); + CKERROR DestroyDocument(CKFileData::DeepDocument* in_doc); + CKERROR DestroyDocument(CKFileData::HybridDocument* in_doc); + + //CKERROR Load(CKSTRING u8_filename, /*CKObjectArray list, */ CK_LOAD_FLAGS flags); + //CKERROR OpenFile(CKSTRING u8_filename, CK_LOAD_FLAGS flags); + //CKERROR OpenMemory(void* MemoryBuffer, size_t BufferSize, CK_LOAD_FLAGS Flags); + //CKERROR ReadFileHeaders(CKBufferParser** ParserPtr); + //CKERROR ReadFileData(CKBufferParser** ParserPtr); + //CKERROR LoadFileData(void/*CKObjectArray list*/); + //CKERROR FinishLoading(/*CKObjectArray list, */CK_LOAD_FLAGS flags); + + //int32_t m_SaveIDMax; + //XArray m_FileObject; + //XArray m_ManagersData; + //XClassArray m_PluginDep; + //XClassArray m_IndexByClassId; + //XClassArray m_IncludedFiles; + + //CKFileInfo m_FileInfo; + + //CK_LOAD_FLAGS m_Flags; + + + //bool m_ReadFileDataDone; + + private: + // reader function and variables + CKERROR PrepareLoad(CKSTRING u8_filename); + CKERROR ReadFileHeader(CKBufferParser* ParserPtr); + CKERROR ReadFileData(CKBufferParser* ParserPtr); + + CKFileData::ShallowDocument* m_ShallowDoc; + CKFileData::DeepDocument* m_DeepDoc; + + // writer function and varibales + + // shared function and variables + std::string m_FileName; + VxMemoryMappedFile* m_MappedFile; + + CKMinContext* m_MinCtx; + }; + +} diff --git a/LibCmo/CKFileReader.cpp b/LibCmo/CKFileReader.cpp new file mode 100644 index 0000000..c0daaad --- /dev/null +++ b/LibCmo/CKFileReader.cpp @@ -0,0 +1,684 @@ +#include "CKFile.hpp" +#include "CKGlobals.hpp" +#include + +namespace LibCmo { + + /* + * NOTE: + * We onlt support read Virtools file with FileVersion >= 7. + * The file with FileVersion < 7 is older than NeMo 1.0 (CK 1.1). + * No need to support them. + */ + + CKERROR CKFile::PrepareLoad(CKSTRING u8_filename) { + // assign file name + this->m_FileName = u8_filename; + // create mapped file + this->m_MappedFile = new(std::nothrow) VxMemoryMappedFile(this->m_FileName.c_str()); + if (this->m_MappedFile == nullptr) { + this->m_MinCtx->Printf("Out of memory when creating Memory File."); + return CKERROR::CKERR_OUTOFMEMORY; + } + if (!this->m_MappedFile->IsValid()) { + this->m_MinCtx->Printf("Fail to create Memory File for \"%s\".", this->m_FileName.c_str()); + return CKERROR::CKERR_INVALIDFILE; + } + + return CKERROR::CKERR_OK; + } + + CKERROR CKFile::ShallowLoad(CKSTRING u8_filename, CKFileData::ShallowDocument** out_doc) { + // check file and open memory + if (u8_filename == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; + CKERROR err = PrepareLoad(u8_filename); + if (err != CKERROR::CKERR_OK) return err; + + // create document + this->m_ShallowDoc = new(std::nothrow) CKFileData::ShallowDocument(); + if (this->m_ShallowDoc == nullptr) return CKERROR::CKERR_OUTOFMEMORY; + + // create buffer and start loading + CKBufferParser parser(this->m_MappedFile->GetBase(), this->m_MappedFile->GetFileSize(), false); + err = this->ReadFileHeader(&parser); + if (err != CKERROR::CKERR_OK) return err; + err = this->ReadFileData(&parser); + if (err != CKERROR::CKERR_OK) return err; + + // free all data + this->ClearData(); + return CKERROR::CKERR_OK; + } + + CKERROR CKFile::ReadFileHeader(CKBufferParser* ParserPtr) { + std::unique_ptr parser(new(std::nothrow) CKBufferParser(ParserPtr->GetBase(), ParserPtr->GetSize(), false)); + + // ========== read header ========== + // check header size + if (parser->GetSize() < sizeof(CKRawFileInfo)) return CKERROR::CKERR_INVALIDFILE; + if (memcmp(parser->GetPtr(), "Nemo Fi", sizeof(CKRawFileInfo::NeMo))) return CKERROR::CKERR_INVALIDFILE; + // read header + CKRawFileInfo rawHeader; + parser->Read(&rawHeader, sizeof(CKRawFileInfo)); + + // ========== header checker ========== + // check zero flag? + if (rawHeader.Zero) return CKERROR::CKERR_INVALIDFILE; + // check file version + if (rawHeader.FileVersion > 9 || rawHeader.FileVersion < 7) return CKERROR::CKERR_OBSOLETEVIRTOOLS; + // force reset too big product ver? + if (rawHeader.ProductVersion >= 12u) { + rawHeader.ProductVersion = 0u; + rawHeader.ProductBuild = 0x01010000; + } + + // ========== assign value ========== + this->m_ShallowDoc->m_FileInfo.ProductVersion = rawHeader.ProductVersion; + this->m_ShallowDoc->m_FileInfo.ProductBuild = rawHeader.ProductBuild; + this->m_ShallowDoc->m_FileInfo.FileWriteMode = static_cast(rawHeader.FileWriteMode); + this->m_ShallowDoc->m_FileInfo.CKVersion = rawHeader.CKVersion; + this->m_ShallowDoc->m_FileInfo.FileVersion = rawHeader.FileVersion; + this->m_ShallowDoc->m_FileInfo.FileSize = parser->GetSize(); + this->m_ShallowDoc->m_FileInfo.ManagerCount = rawHeader.ManagerCount; + this->m_ShallowDoc->m_FileInfo.ObjectCount = rawHeader.ObjectCount; + this->m_ShallowDoc->m_FileInfo.MaxIDSaved = rawHeader.MaxIDSaved; + this->m_ShallowDoc->m_FileInfo.Hdr1PackSize = rawHeader.FileVersion >= 8 ? rawHeader.Hdr1PackSize : 0u; + this->m_ShallowDoc->m_FileInfo.Hdr1UnPackSize = rawHeader.FileVersion >= 8 ? rawHeader.Hdr1UnPackSize : 0u; + this->m_ShallowDoc->m_FileInfo.DataPackSize = rawHeader.DataPackSize; + this->m_ShallowDoc->m_FileInfo.DataUnPackSize = rawHeader.DataUnPackSize; + this->m_ShallowDoc->m_FileInfo.Crc = rawHeader.Crc; + + // ========== crc and body unpacker ========== + if (this->m_ShallowDoc->m_FileInfo.FileVersion >= 8) { + // crc checker for file ver >= 8 + // reset crc field of header + rawHeader.Crc = 0u; + + // compute crc + CKDWORD gotten_crc = CKComputeDataCRC(&rawHeader, sizeof(CKRawFileInfo), 0u); + parser->SetCursor(sizeof(CKRawFileInfo)); + gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_ShallowDoc->m_FileInfo.Hdr1PackSize, gotten_crc); + parser->MoveCursor(this->m_ShallowDoc->m_FileInfo.Hdr1PackSize); + gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_ShallowDoc->m_FileInfo.DataPackSize, gotten_crc); + + if (gotten_crc != this->m_ShallowDoc->m_FileInfo.Crc) return CKERROR::CKERR_FILECRCERROR; + + // reset cursor + parser->SetCursor(sizeof(CKRawFileInfo)); + + // compare size to decide wheher use compress feature + void* decomp_buffer = CKUnPackData(this->m_ShallowDoc->m_FileInfo.Hdr1UnPackSize, parser->GetPtr(), this->m_ShallowDoc->m_FileInfo.Hdr1PackSize); + if (decomp_buffer != nullptr) { + parser = std::unique_ptr(new(std::nothrow) CKBufferParser(decomp_buffer, this->m_ShallowDoc->m_FileInfo.Hdr1UnPackSize, true)); + if (parser == nullptr) { + delete[] decomp_buffer; + return CKERROR::CKERR_OUTOFMEMORY; + } + } + } + + // ========== object list read ========== + // file ver >= 7 have this features + if (this->m_ShallowDoc->m_FileInfo.FileVersion >= 7) { + // apply max id saved + this->m_ShallowDoc->m_SaveIDMax = this->m_ShallowDoc->m_FileInfo.MaxIDSaved; + // resize + this->m_ShallowDoc->m_FileObjects.resize(this->m_ShallowDoc->m_FileInfo.ObjectCount); + + // read data + for (auto& fileobj : this->m_ShallowDoc->m_FileObjects) { + // read basic fields + parser->Read(&(fileobj.ObjectId), sizeof(CK_ID)); + parser->Read(&(fileobj.ObjectCid), sizeof(CK_CLASSID)); + parser->Read(&(fileobj.FileIndex), sizeof(CKDWORD)); + + CKDWORD namelen; + parser->Read(&namelen, sizeof(CKDWORD)); + if (namelen != 0) { + fileobj.Name.resize(namelen); + parser->Read(fileobj.Name.data(), namelen); + } + } + } + + // ========== dep list read ========== + // file ver >= 8 have this feature + bool noDepLost = true; + if (this->m_ShallowDoc->m_FileInfo.FileVersion >= 8) { + // get size and resize + CKDWORD depSize; + parser->Read(&depSize, sizeof(CKDWORD)); + this->m_ShallowDoc->m_PluginDep.resize(depSize); + + CKDWORD guid_size; + for (auto& dep : this->m_ShallowDoc->m_PluginDep) { + // read category + parser->Read(&(dep.m_PluginCategory), sizeof(CK_PLUGIN_TYPE)); + // get size and resize + parser->Read(&guid_size, sizeof(CKDWORD)); + dep.m_Guids.resize(guid_size); + // read data + if (guid_size != 0) { + parser->Read(dep.m_Guids.data(), sizeof(CKGUID) * guid_size); + } + + } + } + + // ========== included file list read ========== + // file ver >= 8 have this feature + if (this->m_ShallowDoc->m_FileInfo.FileVersion >= 8) { + // MARK: i don't knwo what is this! + int32_t hasIncludedFile; + parser->Read(&hasIncludedFile, sizeof(int32_t)); + + if (hasIncludedFile > 0) { + // read included file size and resize + CKDWORD includedFileCount; + parser->Read(&includedFileCount, sizeof(CKDWORD)); + this->m_ShallowDoc->m_IncludedFiles.resize(includedFileCount); + + hasIncludedFile -= 4; + } + + // backward pos + parser->SetCursor(hasIncludedFile); + } + + return CKERROR::CKERR_OK; + } + + CKERROR CKFile::ReadFileData(CKBufferParser* ParserPtr) { + return CKERROR(); + } + + //CKERROR CKFile::Load(CKSTRING u8_filename, /*CKObjectArray list, */ CK_LOAD_FLAGS flags) { + // CKERROR result = this->OpenFile(u8_filename, flags); + // if (result == CKERROR::CKERR_OK || result == CKERROR::CKERR_PLUGINSMISSING) { + // result = this->LoadFileData(); + // } + + // return result; + //} + + //CKERROR CKFile::OpenFile(CKSTRING u8_filename, CK_LOAD_FLAGS flags) { + // this->ClearData(); + // if (u8_filename == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; + + // this->m_FileName = u8_filename; + // this->m_MappedFile = new(std::nothrow) VxMemoryMappedFile(this->m_FileName.c_str()); + // if (this->m_MappedFile == nullptr) return CKERROR::CKERR_OUTOFMEMORY; + // if (!this->m_MappedFile->IsValid()) return CKERROR::CKERR_INVALIDFILE; + + // // MARK: CKContext::SetLastCmoLoaded + // return this->OpenMemory(this->m_MappedFile->GetBase(), this->m_MappedFile->GetFileSize(), flags); + //} + + //CKERROR CKFile::OpenMemory(void* MemoryBuffer, size_t BufferSize, CK_LOAD_FLAGS Flags) { + // if (MemoryBuffer == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; + // // compare magic words + // if (BufferSize < 0x20 || memcmp(MemoryBuffer, "Nemo", 4u)) return CKERROR::CKERR_INVALIDFILE; + + // this->m_Parser = new(std::nothrow) CKBufferParser(MemoryBuffer, BufferSize, false); + // if (this->m_Parser == nullptr) return CKERROR::CKERR_OUTOFMEMORY; + // // MARK: eliminate check of m_Parser->m_ReaderBegin + + // // MARK: dword_2405F6C0 = 0; + // this->m_Flags = Flags; + // this->m_IndexByClassId.resize(static_cast(CK_CLASSID::CKCID_MAXCLASSID)); + // return this->ReadFileHeaders(&(this->m_Parser)); + //} + + //CKERROR CKFile::ReadFileHeaders(CKBufferParser** ParserPtr) { + // CKBufferParser* parser = *ParserPtr; + // this->m_IncludedFiles.clear(); + + // // ========== read header1 ========== + // CKDWORD fhdr1[8]; + // CKDWORD fhdr2[8]; + // if (parser->GetSize() < sizeof(fhdr1)) return CKERROR::CKERR_INVALIDFILE; + // parser->Read(fhdr1, sizeof(fhdr1)); + + // if (fhdr1[5]) { // it seems that there is a ZERO checker? + // memset(fhdr1, 0, sizeof(fhdr1)); + // } + // // check outdated + // if (fhdr1[4] > 9) return CKERROR::CKERR_OBSOLETEVIRTOOLS; + + // // ========== read header2 ========== + // // file ver < 5 do not have second header + // if (fhdr1[4] < 5) { + // memset(fhdr2, 0, sizeof(fhdr2)); + // } else { + // if (parser->GetSize() < sizeof(fhdr1) + sizeof(fhdr2)) return CKERROR::CKERR_INVALIDFILE; + // parser->Read(fhdr2, sizeof(fhdr2)); + // } + + // // forcely reset too big product ver + // if (fhdr2[5] >= 12) { + // fhdr2[5] = 0; + // fhdr2[6] = 0x1010000; + // } + + // // ========== assign value ========== + // this->m_FileInfo.ProductVersion = fhdr2[5]; + // this->m_FileInfo.ProductBuild = fhdr2[6]; + // this->m_FileInfo.FileWriteMode = static_cast(fhdr1[6]); + // this->m_FileInfo.CKVersion = fhdr1[3]; + // this->m_FileInfo.FileVersion = fhdr1[4]; + // this->m_FileInfo.FileSize = parser->GetSize(); + // this->m_FileInfo.ManagerCount = fhdr2[2]; + // this->m_FileInfo.ObjectCount = fhdr2[3]; + // this->m_FileInfo.MaxIDSaved = fhdr2[4]; + // this->m_FileInfo.Hdr1PackSize = fhdr1[7]; + // this->m_FileInfo.Hdr1UnPackSize = fhdr2[7]; + // this->m_FileInfo.DataPackSize = fhdr2[0]; + // this->m_FileInfo.DataUnPackSize = fhdr2[1]; + // this->m_FileInfo.Crc = fhdr1[2]; + + // // ========== crc and body unpacker ========== + // if (this->m_FileInfo.FileVersion >= 8) { + // // crc checker for file ver >= 8 + // // reset crc field of header + // fhdr1[2] = 0; + + // // compute crc + // CKDWORD gotten_crc = CKComputeDataCRC(&fhdr1, sizeof(fhdr1), 0u); + // parser->SetCursor(sizeof(fhdr1)); + // gotten_crc = CKComputeDataCRC(parser->GetPtr(), sizeof(fhdr2), gotten_crc); + // parser->MoveCursor(sizeof(fhdr2)); + // gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_FileInfo.Hdr1PackSize, gotten_crc); + // parser->MoveCursor(this->m_FileInfo.Hdr1PackSize); + // gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_FileInfo.DataPackSize, gotten_crc); + // parser->SetCursor(sizeof(fhdr1) + sizeof(fhdr2)); + + // if (gotten_crc != this->m_FileInfo.Crc) return CKERROR::CKERR_FILECRCERROR; + + // // compare size to decide wheher use compress feature + // void* decomp_buffer = CKUnPackData(this->m_FileInfo.Hdr1UnPackSize, parser->GetPtr(), this->m_FileInfo.Hdr1PackSize); + // if (decomp_buffer != nullptr) { + // parser = new(std::nothrow) CKBufferParser(decomp_buffer, this->m_FileInfo.Hdr1UnPackSize, true); + // if (parser == nullptr) { + // delete[] decomp_buffer; + // return CKERROR::CKERR_OUTOFMEMORY; + // } + // } + // } + + // // ========== object list read ========== + // // file ver >= 7 have this features + // if (this->m_FileInfo.FileVersion >= 7) { + // // apply max id saved + // this->m_SaveIDMax = this->m_FileInfo.MaxIDSaved; + // // resize + // this->m_FileObject.resize(this->m_FileInfo.ObjectCount); + + // // read data + // for (auto& fileobj : this->m_FileObject) { + // // setup useless fields + // fileobj.ObjPtr = nullptr; + // fileobj.Data = nullptr; + + // // read basic fields + // parser->Read(&(fileobj.Object), sizeof(CK_ID)); + // parser->Read(&(fileobj.ObjectCid), sizeof(CK_CLASSID)); + // parser->Read(&(fileobj.FileIndex), sizeof(CKDWORD)); + + // CKDWORD namelen; + // parser->Read(&namelen, sizeof(CKDWORD)); + // if (namelen != 0) { + // fileobj.Name.resize(namelen); + // parser->Read(fileobj.Name.data(), namelen); + // } + // } + // } + + // // ========== dep list read ========== + // // file ver >= 8 have this feature + // bool noDepLost = true; + // if (this->m_FileInfo.FileVersion >= 8) { + // // get size and resize + // CKDWORD depSize; + // parser->Read(&depSize, sizeof(CKDWORD)); + // this->m_PluginDep.resize(depSize); + + // CKDWORD guid_size; + // for (auto& dep : this->m_PluginDep) { + // // read category + // parser->Read(&(dep.m_PluginCategory), sizeof(CK_PLUGIN_TYPE)); + // // get size and resize + // parser->Read(&guid_size, sizeof(CKDWORD)); + // dep.m_Guids.resize(guid_size); + // dep.ValidGuids.resize(guid_size); + // // read data + // if (guid_size != 0) { + // parser->Read(dep.m_Guids.data(), sizeof(CKGUID) * guid_size); + // } + + // // extra load flag + // if (EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES)) { + // for (size_t i = 0u; i < dep.m_Guids.size(); ++i) { + // // MARK: CKPluginManager::FindComponent + // bool plgEntryIsNull = true; + // if (plgEntryIsNull) { + // noDepLost = false; + // dep.ValidGuids[i] = false; + // } else { + // dep.ValidGuids[i] = true; + // } + // } + // } + + // } + // } + + // // ========== included file list read ========== + // // file ver >= 8 have this feature + // if (this->m_FileInfo.FileVersion >= 8) { + // // MARK: i don't knwo what is this! + // int32_t hasIncludedFile; + // parser->Read(&hasIncludedFile, sizeof(int32_t)); + + // if (hasIncludedFile > 0) { + // // read included file size and resize + // CKDWORD includedFileCount; + // parser->Read(&includedFileCount, sizeof(CKDWORD)); + // this->m_IncludedFiles.resize(includedFileCount); + + // hasIncludedFile -= 4; + // } + + // // backward pos + // parser->SetCursor(hasIncludedFile); + // } + + // // ========== read data ========== + // // restore old parser if needed + // if (parser != *ParserPtr) { + // delete parser; + // parser = *ParserPtr; + // parser->MoveCursor(this->m_FileInfo.Hdr1PackSize); + // } + + // // MARK: dword_2405F6BC, dword_2405F6B8 set + + // if (!(EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES) && + // this->m_FileInfo.FileVersion < 8)) { + // // we have read all header. return result + // return noDepLost ? CKERROR::CKERR_OK : CKERROR::CKERR_PLUGINSMISSING; + // } // however, if we need check dep, and, we have not read dep list. continue read them. + + // return CKERROR::CKERR_OK; + //} + + //CKERROR CKFile::ReadFileData(CKBufferParser** ParserPtr) { + // CKBufferParser* parser = *ParserPtr; + // CKBufferParser* parserSrc = *ParserPtr; + + // // ========== compress feature process ========== + // if (EnumHelper::FlagEnumHas(this->m_FileInfo.FileWriteMode, CK_FILE_WRITEMODE::CKFILE_CHUNKCOMPRESSED_OLD) || + // EnumHelper::FlagEnumHas(this->m_FileInfo.FileWriteMode, CK_FILE_WRITEMODE::CKFILE_WHOLECOMPRESSED)) { + // void* decomp_buffer = CKUnPackData(this->m_FileInfo.DataUnPackSize, parser->GetPtr(), this->m_FileInfo.DataPackSize); + // parser->MoveCursor(this->m_FileInfo.DataPackSize); + + // if (decomp_buffer != nullptr) { + // parser = new(std::nothrow) CKBufferParser(decomp_buffer, this->m_FileInfo.DataUnPackSize, true); + // if (parser == nullptr) { + // delete[] decomp_buffer; + // return CKERROR::CKERR_OUTOFMEMORY; + // } + + // // sync to args + // *ParserPtr = parser; + // } + // } + + // // ========== old file crc and obj list read ========== + // // only file ver < 8 run this + // if (this->m_FileInfo.FileVersion < 8) { + // // very very old flag + // if (this->m_FileInfo.FileVersion < 2) { + // ; + // // MARK: dword_2405F6C0 setter + // } + + // // check crc + // CKDWORD gotten_crc = CKComputeDataCRC( + // parser->GetPtr(), + // parser->GetSize() - parser->GetCursor(), + // 0u + // ); + // if (gotten_crc != this->m_FileInfo.Crc) { + // // MARK: report crc error + // return CKERROR::CKERR_FILECRCERROR; + // } + + // // get save id max + // parser->Read(&this->m_SaveIDMax, sizeof(int32_t)); + // // get object count and resize + // parser->Read(&this->m_FileInfo.ObjectCount, sizeof(CKDWORD)); + // if (this->m_FileObject.empty()) { + // this->m_FileObject.resize(this->m_FileInfo.ObjectCount); + // // MARK: ZeroMemory removed. i think it is not necessary. + // } + // } + + // // ========== manager read ========== + // // only file ver >= 6 have this + // if (this->m_FileInfo.FileVersion >= 6 && this->m_FileInfo.ManagerCount != 0) { + // this->m_ManagersData.resize(this->m_FileInfo.ManagerCount); + // CKDWORD stateChunkLen = 0u; + // bool stateChkParseSuccess = false; + + // for (auto& mgr : this->m_ManagersData) { + // // read guid + // parser->Read(&(mgr.Manager), sizeof(CKGUID)); + + // // read statechunk len + // parser->Read(&stateChunkLen, sizeof(CKDWORD)); + // // check len + // if (stateChunkLen == 0) { + // mgr.Data = nullptr; + // continue; + // } + // // read statechunk + // mgr.Data = new(std::nothrow) CKStateChunk(); + // if (mgr.Data != nullptr) { + // stateChkParseSuccess = mgr.Data->ConvertFromBuffer(parser->GetPtr()); + // if (!stateChkParseSuccess) { + // delete mgr.Data; + // mgr.Data = nullptr; + // } + // } + // parser->MoveCursor(stateChunkLen); + // } + // } + + // // ========== object read ========== + // if (this->m_FileInfo.ObjectCount != 0) { + // if (this->m_FileInfo.FileVersion >= 4) { + // // new file reader section + // CKDWORD stateChunkLen = 0u; + // bool stateChkParseSuccess = false; + // for (auto& obj : this->m_FileObject) { + // if (this->m_FileInfo.FileVersion < 7) { + // // it seems that file ver < 7, ck id was stored first. + // parser->Read(&(obj.Object), sizeof(CK_ID)); + // } + // // get statechunk len + // parser->Read(&stateChunkLen, sizeof(CKDWORD)); + + // // if only load behavior and current loaded obj is not behavior, give up. + // // >= 7 is corresponding with obj header version requirement + // // so don't worry about this + // if (EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_ONLYBEHAVIORS) && + // this->m_FileInfo.FileVersion >= 7 && + // obj.ObjectCid != CK_CLASSID::CKCID_BEHAVIOR) { + // // move cursor for next one. + // parser->MoveCursor(stateChunkLen); + // continue; + // } + + // // check state chunk len + // if (stateChunkLen == 0) { + // obj.Data = nullptr; + // continue; + // } + // // read state chunk + // obj.Data = new(std::nothrow) CKStateChunk(); + // if (obj.Data != nullptr) { + // stateChkParseSuccess = obj.Data->ConvertFromBuffer(parser->GetPtr()); + // if (!stateChkParseSuccess) { + // delete obj.Data; + // obj.Data = nullptr; + // } else { + // // get data size and fill some fields + // obj.PostPackSize = obj.Data->GetDataSize(); + // obj.PrePackSize = obj.PostPackSize; + // } + // } + // parser->MoveCursor(stateChunkLen); + + // } + // } else { + // // old file read section + // for (auto& obj : this->m_FileObject) { + // // read CK_ID + // parser->Read(&(obj.Object), sizeof(CK_ID)); + // // get data len + // CKDWORD dataLen = 0u; + // parser->Read(&dataLen, sizeof(CKDWORD)); + + // // check state chunk len + // if (dataLen == 0) { + // obj.Data = nullptr; + // continue; + // } + + // // MARK: set dword_2405F6C0 + // + // // read class id + // CK_CLASSID clsid = CK_CLASSID::CKCID_OBJECT; + // parser->Read(&clsid, sizeof(CK_CLASSID)); + // if (static_cast(clsid) == UINT32_C(0)) { + // // invalid cid; + // return CKERROR::CKERR_INVALIDFILE; + // } + + // // read save flags + // parser->Read(&obj.SaveFlags, sizeof(CK_FILE_WRITEMODE)); + + // // read statechunk len + // CKDWORD oldBufLen = 0u; + // parser->Read(&oldBufLen, sizeof(CKDWORD)); + + // // setup state chunk and order parse it + // obj.Data = new(std::nothrow) CKStateChunk(clsid); + // if (obj.Data != nullptr) { + // if (!obj.Data->ConvertFromOldBuffer(parser->GetPtr(), oldBufLen, dataLen, obj.SaveFlags)) { + // delete obj.Data; + // obj.Data = nullptr; + // } + // } + // // move to next + // parser->MoveCursor(oldBufLen); + // } + + // // MARK: remove a weird assign: parserSrc = v46; it seems useless. + // } + // } + + // // ========== object name get ========== + // // only file ver < 7 need get it from statechunk + // if (this->m_FileInfo.FileVersion < 7) { + // for (auto& obj : this->m_FileObject) { + // if (obj.Data != nullptr) { + // // TODO: CK_STATESAVE_NAME + // if (obj.Data->SeekIdentifier(1u)) { + // obj.Data->ReadString(obj.Name); + // } + // } + // } + // } + + // // ========== included file get ========== + // // WARN: we use "parserSrc" to read, not "parser"!!! + // for (size_t i = 0; i < this->m_IncludedFiles.size(); ++i) { + // // get file name length and resize it + // CKDWORD filenamelen = 0u; + // parserSrc->Read(&filenamelen, sizeof(CKDWORD)); + // std::string filename; + // filename.resize(filenamelen); + + // // read filename + // if (filenamelen != 0) { + // parserSrc->Read(filename.data(), filenamelen); + // } + + // // todo: construct temp folder path + // // and regulate file name + + // // read file body length + // CKDWORD filebodylen = 0u; + // parserSrc->Read(&filebodylen, sizeof(CKDWORD)); + + // // todo: read file body + // parserSrc->MoveCursor(filebodylen); + // } + + // // ========== free parser ========== + // if (parserSrc != parser && parserSrc != nullptr) { + // // WARN: we should free parserSrc! not free parser + // // because "parser" has synced with ParserPtr and will be freed from outside. + // delete parserSrc; + + // } + + // return CKERROR::CKERR_OK; + //} + + //CKERROR CKFile::LoadFileData(void/*CKObjectArray list*/) { + // if (!this->m_Parser && !this->m_ReadFileDataDone) { + // return CKERROR::CKERR_INVALIDFILE; + // } + + // // MARK: sub_240372EA, ctx + 193 = 1 + + // // if file data has not been read. read it + // CKERROR err = CKERROR::CKERR_OK; + // CKBufferParser** ParserPtr = &this->m_Parser; + // if (!this->m_ReadFileDataDone) { + // err = this->ReadFileData(ParserPtr); + // } + + // // MARK: i assume FinishLoading do not calling mapped file anymore + // // free file data + // if (*ParserPtr != nullptr) { + // delete *ParserPtr; + // *ParserPtr = nullptr; + // } + // if (this->m_MappedFile != nullptr) { + // delete this->m_MappedFile; + // this->m_MappedFile = nullptr; + // } + + // // if no error, do finish loading + // if (err == CKERROR::CKERR_OK) { + // this->FinishLoading(this->m_Flags); + + // // MARK: dword_2405F6C0 old vt ver output + // } + // // MARK: CKContext::SetAutomaticLoadMode + // // MARK:CKContext::SetUserLoadCallback + + // // MARK: sub_24037360 + // // MARK: ctx + 193 = 0 + + // return err; + //} + + //CKERROR CKFile::FinishLoading(/*CKObjectArray list, */CK_LOAD_FLAGS flags) { + // return CKERROR::CKERR_OK; + //} + +} diff --git a/LibCmo/CKFileWriter.cpp b/LibCmo/CKFileWriter.cpp new file mode 100644 index 0000000..d741acd --- /dev/null +++ b/LibCmo/CKFileWriter.cpp @@ -0,0 +1,7 @@ +#include "CKFile.hpp" + +namespace LibCmo { + + + +} \ No newline at end of file diff --git a/LibCmo/CKGlobals.cpp b/LibCmo/CKGlobals.cpp new file mode 100644 index 0000000..2fa5284 --- /dev/null +++ b/LibCmo/CKGlobals.cpp @@ -0,0 +1,38 @@ +#include "VTUtils.hpp" +#if defined(LIBCMO_OS_WIN32) +#define ZLIB_WINAPI +#include +#endif + +#include "CKDefines.hpp" +#include "CKGlobals.hpp" +#include + +namespace LibCmo { + + + void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) { + char* DestBuffer = new(std::nothrow) char[DestSize]; + if (DestBuffer == nullptr) return nullptr; + + uLongf cache = DestSize; + if (uncompress( + reinterpret_cast(DestBuffer), &cache, + reinterpret_cast(SrcBuffer), SrcSize) != Z_OK) { + delete[] DestBuffer; + return nullptr; + } + + return DestBuffer; + } + + CKDWORD LibCmo::CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC) { + return static_cast(adler32( + static_cast(PreviousCRC), + reinterpret_cast(data), + static_cast(size) + )); + } + + +} diff --git a/LibCmo/CKGlobals.hpp b/LibCmo/CKGlobals.hpp new file mode 100644 index 0000000..e029e00 --- /dev/null +++ b/LibCmo/CKGlobals.hpp @@ -0,0 +1,8 @@ +#pragma once + +namespace LibCmo { + + void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize); + CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0); + +} diff --git a/LibCmo/VTStateChunk.cpp b/LibCmo/CKStateChunk.cpp similarity index 70% rename from LibCmo/VTStateChunk.cpp rename to LibCmo/CKStateChunk.cpp index 2db429b..7c85516 100644 --- a/LibCmo/VTStateChunk.cpp +++ b/LibCmo/CKStateChunk.cpp @@ -5,7 +5,7 @@ #endif #include -#include "VTStruct.hpp" +#include "CKStateChunk.hpp" namespace LibCmo { @@ -30,33 +30,6 @@ namespace LibCmo { delete[] this->m_pData; } - bool CKStateChunk::ConvertFromOldBuffer(const void* buf, CKDWORD buf_size, CKDWORD blk_size, CK_FILE_WRITEMODE mode) { - // if not use compress or 2 size is equal, it mean that this buffer is raw. - // assign it directly - if (!EnumHelper::FlagEnumHas(mode, CK_FILE_WRITEMODE::CKFILE_CHUNKCOMPRESSED_OLD) || - buf_size == blk_size) { - - this->m_DataDwSize = buf_size / sizeof(CKDWORD); - this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; - if (this->m_pData != nullptr) { - memcpy(this->m_pData, buf, this->m_DataDwSize * sizeof(CKDWORD)); - } - - return true; - - } else { - // otherwise, we need UnPack - // prepare UnPack requirement - this->m_DataDwSize = buf_size; // NOTE: store as BYTE length!!! - this->m_pData = reinterpret_cast(new(std::nothrow) char[buf_size]); - if (this->m_pData == nullptr) return false; - memcpy(this->m_pData, buf, buf_size); - - // call UnPack - return UnPack(blk_size); - } - } - bool CKStateChunk::ConvertFromBuffer(const void* buf) { if (buf == nullptr) return false; @@ -154,23 +127,23 @@ namespace LibCmo { memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize); bufpos += this->m_DataDwSize; } - if (EnumHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_FILE)) { + if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_FILE)) { // MARK: set ckfile = nullptr; ; } - if (EnumHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_IDS)) { + if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_IDS)) { this->m_ObjectList.resize(dwbuf[bufpos]); bufpos += 1u; memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size()); bufpos += this->m_ObjectList.size(); } - if (EnumHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_CHN)) { + if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_CHN)) { this->m_ChunkList.resize(dwbuf[bufpos]); bufpos += 1u; memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size()); bufpos += this->m_ChunkList.size(); } - if (EnumHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_MAN)) { + if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_MAN)) { this->m_ManagerList.resize(dwbuf[bufpos]); bufpos += 1u; memcpy(this->m_ManagerList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ManagerList.size()); @@ -190,34 +163,34 @@ namespace LibCmo { return 0u; } - bool CKStateChunk::UnPack(CKDWORD DestSize) { - // NOTE: in UnPack. pData store the compressed buffer, and - // dwSize store the length of compressed buffer as CHAR size, not DWORD size! + //bool CKStateChunk::UnPack(CKDWORD DestSize) { + // // NOTE: in UnPack. pData store the compressed buffer, and + // // dwSize store the length of compressed buffer as CHAR size, not DWORD size! - // create a enough buffer - char* buffer = new(std::nothrow) char[DestSize]; - if (buffer == nullptr) return false; - uLongf destSize = DestSize; - // uncompress it - auto err = uncompress( - reinterpret_cast(buffer), &destSize, - reinterpret_cast(this->m_pData), static_cast(this->m_DataDwSize) - ); - // if no error, assign data - if (err == Z_OK) { - // get dw size and copy it to remove useless blank data - this->m_DataDwSize = static_cast(destSize) / sizeof(CKDWORD); + // // create a enough buffer + // char* buffer = new(std::nothrow) char[DestSize]; + // if (buffer == nullptr) return false; + // uLongf destSize = DestSize; + // // uncompress it + // auto err = uncompress( + // reinterpret_cast(buffer), &destSize, + // reinterpret_cast(this->m_pData), static_cast(this->m_DataDwSize) + // ); + // // if no error, assign data + // if (err == Z_OK) { + // // get dw size and copy it to remove useless blank data + // this->m_DataDwSize = static_cast(destSize) / sizeof(CKDWORD); - delete[] this->m_pData; - this->m_pData = nullptr; - this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; - if (this->m_pData != nullptr) { - memcpy(this->m_pData, buffer, this->m_DataDwSize * sizeof(CKDWORD)); - } - } - delete[] buffer; - return true; - } + // delete[] this->m_pData; + // this->m_pData = nullptr; + // this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; + // if (this->m_pData != nullptr) { + // memcpy(this->m_pData, buffer, this->m_DataDwSize * sizeof(CKDWORD)); + // } + // } + // delete[] buffer; + // return true; + //} CKDWORD CKStateChunk::GetDataSize(void) { return sizeof(CKDWORD) * this->m_DataDwSize; diff --git a/LibCmo/CKStateChunk.hpp b/LibCmo/CKStateChunk.hpp new file mode 100644 index 0000000..5991ce2 --- /dev/null +++ b/LibCmo/CKStateChunk.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "CKDefines.hpp" +#include "CKEnums.hpp" + +namespace LibCmo { + + class CKStateChunk { + public: + CKStateChunk(); + CKStateChunk(CK_CLASSID clsid); + CKStateChunk(const CKStateChunk&) = delete; + CKStateChunk& operator=(const CKStateChunk&) = delete; + ~CKStateChunk(); + + bool ConvertFromOldBuffer(const void* buf, CKDWORD buf_size, CKDWORD blk_size, CK_FILE_WRITEMODE mode); + bool ConvertFromBuffer(const void* buf); + CKDWORD ConvertToBuffer(void* buf); + + bool UnPack(CKDWORD DestSize); + CKDWORD GetDataSize(void); + + bool SeekIdentifier(CKDWORD identifier); + + void ReadString(std::string& strl); + + private: + CK_CLASSID m_ClassId; + CKDWORD m_DataDwSize; + CKDWORD* m_pData; + + CK_STATECHUNK_DATAVERSION m_DataVersion; + CK_STATECHUNK_CHUNKVERSION m_ChunkVersion; + + struct { + CKDWORD m_CurrentPos; + CKDWORD m_DataSize; + CKDWORD m_PrevIdentifierPos; + }m_Parser; + + std::vector m_ObjectList; + std::vector m_ChunkList; + std::vector m_ManagerList; + + private: + void _EnsureEnoughSpace(CKDWORD size); + + }; + +} diff --git a/LibCmo/LibCmo.vcxproj b/LibCmo/LibCmo.vcxproj index 2096c66..62863ee 100644 --- a/LibCmo/LibCmo.vcxproj +++ b/LibCmo/LibCmo.vcxproj @@ -171,16 +171,25 @@ + + + + - - - + + + - + + + + + - + + diff --git a/LibCmo/LibCmo.vcxproj.filters b/LibCmo/LibCmo.vcxproj.filters index fb0ce14..126597a 100644 --- a/LibCmo/LibCmo.vcxproj.filters +++ b/LibCmo/LibCmo.vcxproj.filters @@ -13,33 +13,63 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {a8cd2188-b552-478c-9801-a6286b3d48a0} + - - Sources - - + Sources Sources - + + Sources + + + Sources + + + Sources + + + Sources\ObjsImpl + + + Sources + + Sources - - Headers - - - Headers - Headers Headers + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + \ No newline at end of file diff --git a/LibCmo/ObjsImpl/CKObject.cpp b/LibCmo/ObjsImpl/CKObject.cpp new file mode 100644 index 0000000..e8bd577 --- /dev/null +++ b/LibCmo/ObjsImpl/CKObject.cpp @@ -0,0 +1,15 @@ +#include "../VTObjects.hpp" + +namespace LibCmo { + namespace ObjsImpl { + + CKObject::CKObject() { + + } + + CKObject::~CKObject() { + + } + + } +} \ No newline at end of file diff --git a/LibCmo/VTObjects.hpp b/LibCmo/VTObjects.hpp new file mode 100644 index 0000000..de245b5 --- /dev/null +++ b/LibCmo/VTObjects.hpp @@ -0,0 +1,122 @@ +#pragma once + +#include "CKDefines.hpp" +#include "CKEnums.hpp" +#include "CKStateChunk.hpp" + +namespace LibCmo { + namespace ObjsImpl { + + class CKObject { + public: + CKObject(); + CKObject(const CKObject&) = delete; + CKObject& operator=(const CKObject&) = delete; + virtual ~CKObject(); + + private: + + }; + + class CKSceneObject : public CKObject { + public: + CKSceneObject(); + CKSceneObject(const CKSceneObject&) = delete; + CKSceneObject& operator=(const CKSceneObject&) = delete; + virtual ~CKSceneObject(); + + private: + + }; + + class CKBeObject : public CKSceneObject { + public: + CKBeObject(); + CKBeObject(const CKBeObject&) = delete; + CKBeObject& operator=(const CKBeObject&) = delete; + virtual ~CKBeObject(); + + private: + + }; + + class CKGroup : public CKBeObject { + public: + CKGroup(); + CKGroup(const CKGroup&) = delete; + CKGroup& operator=(const CKGroup&) = delete; + virtual ~CKGroup(); + + private: + + }; + + class CKMesh : public CKBeObject { + public: + CKMesh(); + CKMesh(const CKMesh&) = delete; + CKMesh& operator=(const CKMesh&) = delete; + virtual ~CKMesh(); + + private: + + }; + + class CKTexture : public CKBeObject { + public: + CKTexture(); + CKTexture(const CKTexture&) = delete; + CKTexture& operator=(const CKTexture&) = delete; + virtual ~CKTexture(); + + private: + + }; + + class CKMaterial : public CKBeObject { + public: + CKMaterial(); + CKMaterial(const CKMaterial&) = delete; + CKMaterial& operator=(const CKMaterial&) = delete; + virtual ~CKMaterial(); + + private: + + }; + + class CKRenderObject : public CKBeObject { + public: + CKRenderObject(); + CKRenderObject(const CKRenderObject&) = delete; + CKRenderObject& operator=(const CKRenderObject&) = delete; + ~CKRenderObject(); + + private: + + }; + + class CK3dEntity : public CKBeObject { + public: + CK3dEntity(); + CK3dEntity(const CK3dEntity&) = delete; + CK3dEntity& operator=(const CK3dEntity&) = delete; + virtual ~CK3dEntity(); + + private: + + }; + + class CK3dObject :public CK3dEntity { + public: + CK3dObject(); + CK3dObject(const CK3dObject&) = delete; + CK3dObject& operator=(const CK3dObject&) = delete; + ~CK3dObject(); + + private: + + }; + + + } +} diff --git a/LibCmo/VTReader.cpp b/LibCmo/VTReader.cpp deleted file mode 100644 index d469067..0000000 --- a/LibCmo/VTReader.cpp +++ /dev/null @@ -1,501 +0,0 @@ -#include "VTUtils.hpp" -#if defined(LIBCMO_OS_WIN32) -#define ZLIB_WINAPI -#include "zconf.h" -#endif - -#include "VTStruct.hpp" -#include - -namespace LibCmo { - - CKERROR CKFile::Load(CKSTRING u8_filename, /*CKObjectArray list, */ CK_LOAD_FLAGS flags) { - CKERROR result = this->OpenFile(u8_filename, flags); - if (result == CKERROR::CKERR_OK || result == CKERROR::CKERR_PLUGINSMISSING) { - result = this->LoadFileData(); - } - - return result; - } - - CKERROR CKFile::OpenFile(CKSTRING u8_filename, CK_LOAD_FLAGS flags) { - this->ClearData(); - if (u8_filename == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; - - this->m_FileName = u8_filename; - this->m_MappedFile = new(std::nothrow) VxMemoryMappedFile(this->m_FileName.c_str()); - if (this->m_MappedFile == nullptr) return CKERROR::CKERR_OUTOFMEMORY; - if (!this->m_MappedFile->IsValid()) return CKERROR::CKERR_INVALIDFILE; - - // MARK: CKContext::SetLastCmoLoaded - return this->OpenMemory(this->m_MappedFile->GetBase(), this->m_MappedFile->GetFileSize(), flags); - } - - CKERROR CKFile::OpenMemory(void* MemoryBuffer, size_t BufferSize, CK_LOAD_FLAGS Flags) { - if (MemoryBuffer == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; - // compare magic words - if (BufferSize < 0x20 || memcmp(MemoryBuffer, "Nemo", 4u)) return CKERROR::CKERR_INVALIDFILE; - - this->m_Parser = new(std::nothrow) CKBufferParser(MemoryBuffer, BufferSize, false); - if (this->m_Parser == nullptr) return CKERROR::CKERR_OUTOFMEMORY; - // MARK: eliminate check of m_Parser->m_ReaderBegin - - // MARK: dword_2405F6C0 = 0; - this->m_Flags = Flags; - this->m_IndexByClassId.resize(static_cast(CK_CLASSID::CKCID_MAXCLASSID)); - return this->ReadFileHeaders(&(this->m_Parser)); - } - - CKERROR CKFile::ReadFileHeaders(CKBufferParser** ParserPtr) { - CKBufferParser* parser = *ParserPtr; - this->m_IncludedFiles.clear(); - - // ========== read header1 ========== - CKDWORD fhdr1[8]; - CKDWORD fhdr2[8]; - if (parser->GetSize() < sizeof(fhdr1)) return CKERROR::CKERR_INVALIDFILE; - parser->Read(fhdr1, sizeof(fhdr1)); - - if (fhdr1[5]) { // it seems that there is a ZERO checker? - memset(fhdr1, 0, sizeof(fhdr1)); - } - // check outdated - if (fhdr1[4] > 9) return CKERROR::CKERR_OBSOLETEVIRTOOLS; - - // ========== read header2 ========== - // file ver < 5 do not have second header - if (fhdr1[4] < 5) { - memset(fhdr2, 0, sizeof(fhdr2)); - } else { - if (parser->GetSize() < sizeof(fhdr1) + sizeof(fhdr2)) return CKERROR::CKERR_INVALIDFILE; - parser->Read(fhdr2, sizeof(fhdr2)); - } - - // forcely reset too big product ver - if (fhdr2[5] >= 12) { - fhdr2[5] = 0; - fhdr2[6] = 0x1010000; - } - - // ========== assign value ========== - this->m_FileInfo.ProductVersion = fhdr2[5]; - this->m_FileInfo.ProductBuild = fhdr2[6]; - this->m_FileInfo.FileWriteMode = static_cast(fhdr1[6]); - this->m_FileInfo.CKVersion = fhdr1[3]; - this->m_FileInfo.FileVersion = fhdr1[4]; - this->m_FileInfo.FileSize = parser->GetSize(); - this->m_FileInfo.ManagerCount = fhdr2[2]; - this->m_FileInfo.ObjectCount = fhdr2[3]; - this->m_FileInfo.MaxIDSaved = fhdr2[4]; - this->m_FileInfo.Hdr1PackSize = fhdr1[7]; - this->m_FileInfo.Hdr1UnPackSize = fhdr2[7]; - this->m_FileInfo.DataPackSize = fhdr2[0]; - this->m_FileInfo.DataUnPackSize = fhdr2[1]; - this->m_FileInfo.Crc = fhdr1[2]; - - // ========== crc and body unpacker ========== - if (this->m_FileInfo.FileVersion >= 8) { - // crc checker for file ver >= 8 - // reset crc field of header - fhdr1[2] = 0; - - // compute crc - CKDWORD gotten_crc = CKComputeDataCRC(&fhdr1, sizeof(fhdr1), 0u); - parser->SetCursor(sizeof(fhdr1)); - gotten_crc = CKComputeDataCRC(parser->GetPtr(), sizeof(fhdr2), gotten_crc); - parser->MoveCursor(sizeof(fhdr2)); - gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_FileInfo.Hdr1PackSize, gotten_crc); - parser->MoveCursor(this->m_FileInfo.Hdr1PackSize); - gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_FileInfo.DataPackSize, gotten_crc); - parser->SetCursor(sizeof(fhdr1) + sizeof(fhdr2)); - - if (gotten_crc != this->m_FileInfo.Crc) return CKERROR::CKERR_FILECRCERROR; - - // compare size to decide wheher use compress feature - void* decomp_buffer = CKUnPackData(this->m_FileInfo.Hdr1UnPackSize, parser->GetPtr(), this->m_FileInfo.Hdr1PackSize); - if (decomp_buffer != nullptr) { - parser = new(std::nothrow) CKBufferParser(decomp_buffer, this->m_FileInfo.Hdr1UnPackSize, true); - if (parser == nullptr) { - delete[] decomp_buffer; - return CKERROR::CKERR_OUTOFMEMORY; - } - } - } - - // ========== object list read ========== - // file ver >= 7 have this features - if (this->m_FileInfo.FileVersion >= 7) { - // apply max id saved - this->m_SaveIDMax = this->m_FileInfo.MaxIDSaved; - // resize - this->m_FileObject.resize(this->m_FileInfo.ObjectCount); - - // read data - for (auto& fileobj : this->m_FileObject) { - // setup useless fields - fileobj.ObjPtr = nullptr; - fileobj.Data = nullptr; - - // read basic fields - parser->Read(&(fileobj.Object), sizeof(CK_ID)); - parser->Read(&(fileobj.ObjectCid), sizeof(CK_CLASSID)); - parser->Read(&(fileobj.FileIndex), sizeof(CKDWORD)); - - CKDWORD namelen; - parser->Read(&namelen, sizeof(CKDWORD)); - if (namelen != 0) { - fileobj.Name.resize(namelen); - parser->Read(fileobj.Name.data(), namelen); - } - } - } - - // ========== dep list read ========== - // file ver >= 8 have this feature - bool noDepLost = true; - if (this->m_FileInfo.FileVersion >= 8) { - // get size and resize - CKDWORD depSize; - parser->Read(&depSize, sizeof(CKDWORD)); - this->m_PluginDep.resize(depSize); - - CKDWORD guid_size; - for (auto& dep : this->m_PluginDep) { - // read category - parser->Read(&(dep.m_PluginCategory), sizeof(CK_PLUGIN_TYPE)); - // get size and resize - parser->Read(&guid_size, sizeof(CKDWORD)); - dep.m_Guids.resize(guid_size); - dep.ValidGuids.resize(guid_size); - // read data - if (guid_size != 0) { - parser->Read(dep.m_Guids.data(), sizeof(CKGUID) * guid_size); - } - - // extra load flag - if (EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES)) { - for (size_t i = 0u; i < dep.m_Guids.size(); ++i) { - // MARK: CKPluginManager::FindComponent - bool plgEntryIsNull = true; - if (plgEntryIsNull) { - noDepLost = false; - dep.ValidGuids[i] = false; - } else { - dep.ValidGuids[i] = true; - } - } - } - - } - } - - // ========== included file list read ========== - // file ver >= 8 have this feature - if (this->m_FileInfo.FileVersion >= 8) { - // MARK: i don't knwo what is this! - int32_t hasIncludedFile; - parser->Read(&hasIncludedFile, sizeof(int32_t)); - - if (hasIncludedFile > 0) { - // read included file size and resize - CKDWORD includedFileCount; - parser->Read(&includedFileCount, sizeof(CKDWORD)); - this->m_IncludedFiles.resize(includedFileCount); - - hasIncludedFile -= 4; - } - - // backward pos - parser->SetCursor(hasIncludedFile); - } - - // ========== read data ========== - // restore old parser if needed - if (parser != *ParserPtr) { - delete parser; - parser = *ParserPtr; - parser->MoveCursor(this->m_FileInfo.Hdr1PackSize); - } - - // MARK: dword_2405F6BC, dword_2405F6B8 set - - if (!(EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES) && - this->m_FileInfo.FileVersion < 8)) { - // we have read all header. return result - return noDepLost ? CKERROR::CKERR_OK : CKERROR::CKERR_PLUGINSMISSING; - } // however, if we need check dep, and, we have not read dep list. continue read them. - - return CKERROR::CKERR_OK; - } - - CKERROR CKFile::ReadFileData(CKBufferParser** ParserPtr) { - CKBufferParser* parser = *ParserPtr; - CKBufferParser* parserSrc = *ParserPtr; - - // ========== compress feature process ========== - if (EnumHelper::FlagEnumHas(this->m_FileInfo.FileWriteMode, CK_FILE_WRITEMODE::CKFILE_CHUNKCOMPRESSED_OLD) || - EnumHelper::FlagEnumHas(this->m_FileInfo.FileWriteMode, CK_FILE_WRITEMODE::CKFILE_WHOLECOMPRESSED)) { - void* decomp_buffer = CKUnPackData(this->m_FileInfo.DataUnPackSize, parser->GetPtr(), this->m_FileInfo.DataPackSize); - parser->MoveCursor(this->m_FileInfo.DataPackSize); - - if (decomp_buffer != nullptr) { - parser = new(std::nothrow) CKBufferParser(decomp_buffer, this->m_FileInfo.DataUnPackSize, true); - if (parser == nullptr) { - delete[] decomp_buffer; - return CKERROR::CKERR_OUTOFMEMORY; - } - - // sync to args - *ParserPtr = parser; - } - } - - // ========== old file crc and obj list read ========== - // only file ver < 8 run this - if (this->m_FileInfo.FileVersion < 8) { - // very very old flag - if (this->m_FileInfo.FileVersion < 2) { - ; - // MARK: dword_2405F6C0 setter - } - - // check crc - CKDWORD gotten_crc = CKComputeDataCRC( - parser->GetPtr(), - parser->GetSize() - parser->GetCursor(), - 0u - ); - if (gotten_crc != this->m_FileInfo.Crc) { - // MARK: report crc error - return CKERROR::CKERR_FILECRCERROR; - } - - // get save id max - parser->Read(&this->m_SaveIDMax, sizeof(int32_t)); - // get object count and resize - parser->Read(&this->m_FileInfo.ObjectCount, sizeof(CKDWORD)); - if (this->m_FileObject.empty()) { - this->m_FileObject.resize(this->m_FileInfo.ObjectCount); - // MARK: ZeroMemory removed. i think it is not necessary. - } - } - - // ========== manager read ========== - // only file ver >= 6 have this - if (this->m_FileInfo.FileVersion >= 6 && this->m_FileInfo.ManagerCount != 0) { - this->m_ManagersData.resize(this->m_FileInfo.ManagerCount); - CKDWORD stateChunkLen = 0u; - bool stateChkParseSuccess = false; - - for (auto& mgr : this->m_ManagersData) { - // read guid - parser->Read(&(mgr.Manager), sizeof(CKGUID)); - - // read statechunk len - parser->Read(&stateChunkLen, sizeof(CKDWORD)); - // check len - if (stateChunkLen == 0) { - mgr.Data = nullptr; - continue; - } - // read statechunk - mgr.Data = new(std::nothrow) CKStateChunk(); - if (mgr.Data != nullptr) { - stateChkParseSuccess = mgr.Data->ConvertFromBuffer(parser->GetPtr()); - if (!stateChkParseSuccess) { - delete mgr.Data; - mgr.Data = nullptr; - } - } - parser->MoveCursor(stateChunkLen); - } - } - - // ========== object read ========== - if (this->m_FileInfo.ObjectCount != 0) { - if (this->m_FileInfo.FileVersion >= 4) { - // new file reader section - CKDWORD stateChunkLen = 0u; - bool stateChkParseSuccess = false; - for (auto& obj : this->m_FileObject) { - if (this->m_FileInfo.FileVersion < 7) { - // it seems that file ver < 7, ck id was stored first. - parser->Read(&(obj.Object), sizeof(CK_ID)); - } - // get statechunk len - parser->Read(&stateChunkLen, sizeof(CKDWORD)); - - // if only load behavior and current loaded obj is not behavior, give up. - // >= 7 is corresponding with obj header version requirement - // so don't worry about this - if (EnumHelper::FlagEnumHas(this->m_Flags, CK_LOAD_FLAGS::CK_LOAD_ONLYBEHAVIORS) && - this->m_FileInfo.FileVersion >= 7 && - obj.ObjectCid != CK_CLASSID::CKCID_BEHAVIOR) { - // move cursor for next one. - parser->MoveCursor(stateChunkLen); - continue; - } - - // check state chunk len - if (stateChunkLen == 0) { - obj.Data = nullptr; - continue; - } - // read state chunk - obj.Data = new(std::nothrow) CKStateChunk(); - if (obj.Data != nullptr) { - stateChkParseSuccess = obj.Data->ConvertFromBuffer(parser->GetPtr()); - if (!stateChkParseSuccess) { - delete obj.Data; - obj.Data = nullptr; - } else { - // get data size and fill some fields - obj.PostPackSize = obj.Data->GetDataSize(); - obj.PrePackSize = obj.PostPackSize; - } - } - parser->MoveCursor(stateChunkLen); - - } - } else { - // old file read section - for (auto& obj : this->m_FileObject) { - // read CK_ID - parser->Read(&(obj.Object), sizeof(CK_ID)); - // get data len - CKDWORD dataLen = 0u; - parser->Read(&dataLen, sizeof(CKDWORD)); - - // check state chunk len - if (dataLen == 0) { - obj.Data = nullptr; - continue; - } - - // MARK: set dword_2405F6C0 - - // read class id - CK_CLASSID clsid = CK_CLASSID::CKCID_OBJECT; - parser->Read(&clsid, sizeof(CK_CLASSID)); - if (static_cast(clsid) == UINT32_C(0)) { - // invalid cid; - return CKERROR::CKERR_INVALIDFILE; - } - - // read save flags - parser->Read(&obj.SaveFlags, sizeof(CK_FILE_WRITEMODE)); - - // read statechunk len - CKDWORD oldBufLen = 0u; - parser->Read(&oldBufLen, sizeof(CKDWORD)); - - // setup state chunk and order parse it - obj.Data = new(std::nothrow) CKStateChunk(clsid); - if (obj.Data != nullptr) { - if (!obj.Data->ConvertFromOldBuffer(parser->GetPtr(), oldBufLen, dataLen, obj.SaveFlags)) { - delete obj.Data; - obj.Data = nullptr; - } - } - // move to next - parser->MoveCursor(oldBufLen); - } - - // MARK: remove a weird assign: parserSrc = v46; it seems useless. - } - } - - // ========== object name get ========== - // only file ver < 7 need get it from statechunk - if (this->m_FileInfo.FileVersion < 7) { - for (auto& obj : this->m_FileObject) { - if (obj.Data != nullptr) { - // TODO: CK_STATESAVE_NAME - if (obj.Data->SeekIdentifier(1u)) { - obj.Data->ReadString(obj.Name); - } - } - } - } - - // ========== included file get ========== - // WARN: we use "parserSrc" to read, not "parser"!!! - for (size_t i = 0; i < this->m_IncludedFiles.size(); ++i) { - // get file name length and resize it - CKDWORD filenamelen = 0u; - parserSrc->Read(&filenamelen, sizeof(CKDWORD)); - std::string filename; - filename.resize(filenamelen); - - // read filename - if (filenamelen != 0) { - parserSrc->Read(filename.data(), filenamelen); - } - - // todo: construct temp folder path - // and regulate file name - - // read file body length - CKDWORD filebodylen = 0u; - parserSrc->Read(&filebodylen, sizeof(CKDWORD)); - - // todo: read file body - parserSrc->MoveCursor(filebodylen); - } - - // ========== free parser ========== - if (parserSrc != parser && parserSrc != nullptr) { - // WARN: we should free parserSrc! not free parser - // because "parser" has synced with ParserPtr and will be freed from outside. - delete parserSrc; - - } - - return CKERROR::CKERR_OK; - } - - CKERROR CKFile::LoadFileData(void/*CKObjectArray list*/) { - if (!this->m_Parser && !this->m_ReadFileDataDone) { - return CKERROR::CKERR_INVALIDFILE; - } - - // MARK: sub_240372EA, ctx + 193 = 1 - - // if file data has not been read. read it - CKERROR err = CKERROR::CKERR_OK; - CKBufferParser** ParserPtr = &this->m_Parser; - if (!this->m_ReadFileDataDone) { - err = this->ReadFileData(ParserPtr); - } - - // MARK: i assume FinishLoading do not calling mapped file anymore - // free file data - if (*ParserPtr != nullptr) { - delete *ParserPtr; - *ParserPtr = nullptr; - } - if (this->m_MappedFile != nullptr) { - delete this->m_MappedFile; - this->m_MappedFile = nullptr; - } - - // if no error, do finish loading - if (err == CKERROR::CKERR_OK) { - this->FinishLoading(this->m_Flags); - - // MARK: dword_2405F6C0 old vt ver output - } - // MARK: CKContext::SetAutomaticLoadMode - // MARK:CKContext::SetUserLoadCallback - - // MARK: sub_24037360 - // MARK: ctx + 193 = 0 - - return err; - } - - CKERROR CKFile::FinishLoading(/*CKObjectArray list, */CK_LOAD_FLAGS flags) { - return CKERROR::CKERR_OK; - } - -} diff --git a/LibCmo/VTStruct.hpp b/LibCmo/VTStruct.hpp deleted file mode 100644 index c26453b..0000000 --- a/LibCmo/VTStruct.hpp +++ /dev/null @@ -1,205 +0,0 @@ -#pragma once - -#include "VTUtils.hpp" -#include "VTConstants.hpp" -#include "VTEncoding.hpp" -#include - -#if defined(LIBCMO_OS_WIN32) -#include -#else -#include -#endif - -namespace LibCmo { - - void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize); - CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0); - - struct CKGUID { - union { - struct { - CKDWORD d1, d2; - }; - CKDWORD d[2]; - }; - CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) { d[0] = gd1; d[1] = gd2; } - }; - - class VxMemoryMappedFile { - private: - -#if defined(LIBCMO_OS_WIN32) - std::wstring m_szFilePath; - HANDLE m_hFile; - DWORD m_dwFileSizeLow, m_dwFileSizeHigh; - HANDLE m_hFileMapping; - LPVOID m_hFileMapView; -#else - std::string m_szFilePath; -#error NO IMPLEMENTATION FOR LINUX MMAP! -#endif - - void* m_pMemoryMappedFileBase; - size_t m_cbFile; - bool m_bIsValid; - public: - VxMemoryMappedFile(const char* u8_filepath); - VxMemoryMappedFile(const VxMemoryMappedFile&) = delete; - VxMemoryMappedFile& operator=(const VxMemoryMappedFile&) = delete; - ~VxMemoryMappedFile(void); - - inline void* GetBase(void) { return this->m_pMemoryMappedFileBase; } - inline size_t GetFileSize(void) { return this->m_cbFile; } - inline bool IsValid(void) { return this->m_bIsValid; } - }; - - class CKBufferParser { - private: - char* m_MemBegin; - size_t m_MemPos; - bool m_NeedManualFree; - size_t m_MemSize; - - public: - CKBufferParser(void* ptr, size_t rsize, bool need_manual_free); - CKBufferParser(const CKBufferParser&) = delete; - CKBufferParser& operator=(const CKBufferParser&) = delete; - ~CKBufferParser(); - - inline const void* GetPtr(void) { return (this->m_MemBegin + m_MemPos); } - inline void Read(void* data, size_t data_size) { - memcpy(data, (this->m_MemBegin + m_MemPos), data_size); - this->m_MemPos += data_size; - } - inline void Write(const void* data, size_t data_size) { - memcpy((this->m_MemBegin + m_MemPos), data, data_size); - this->m_MemPos += data_size; - } - inline size_t GetSize(void) { return this->m_MemSize; } - inline size_t GetCursor(void) { return this->m_MemPos; } - inline void MoveCursor(size_t off) { this->m_MemPos += off; } - inline void SetCursor(size_t off) { this->m_MemPos = off; } - }; - - class CKStateChunk { - public: - CKStateChunk(); - CKStateChunk(CK_CLASSID clsid); - CKStateChunk(const CKStateChunk&) = delete; - CKStateChunk& operator=(const CKStateChunk&) = delete; - ~CKStateChunk(); - - bool ConvertFromOldBuffer(const void* buf, CKDWORD buf_size, CKDWORD blk_size, CK_FILE_WRITEMODE mode); - bool ConvertFromBuffer(const void* buf); - CKDWORD ConvertToBuffer(void* buf); - - bool UnPack(CKDWORD DestSize); - CKDWORD GetDataSize(void); - - bool SeekIdentifier(CKDWORD identifier); - - void ReadString(std::string& strl); - - private: - CK_CLASSID m_ClassId; - CKDWORD m_DataDwSize; - CKDWORD* m_pData; - - CK_STATECHUNK_DATAVERSION m_DataVersion; - CK_STATECHUNK_CHUNKVERSION m_ChunkVersion; - - struct { - CKDWORD m_CurrentPos; - CKDWORD m_DataSize; - CKDWORD m_PrevIdentifierPos; - }m_Parser; - - std::vector m_ObjectList; - std::vector m_ChunkList; - std::vector m_ManagerList; - - private: - void _EnsureEnoughSpace(CKDWORD size); - - }; - - struct CKFileInfo { - CKDWORD ProductVersion; // Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION) - CKDWORD ProductBuild; // Virtools Build Number. - CK_FILE_WRITEMODE FileWriteMode; // Options used to save this file. (CK_FILE_WRITEMODE) - CKDWORD FileVersion; // Version of file format when file was saved. - CKDWORD CKVersion; // Version of CK when file was saved. - size_t FileSize; // Size of file in bytes. - CKDWORD ObjectCount; // Number of objects stored in the file. - CKDWORD ManagerCount; // Number of managers which saved data in the file. - CKDWORD MaxIDSaved; // Maximum Object identifier saved - CKDWORD Crc; // Crc of data - CKDWORD Hdr1PackSize; // Reserved - CKDWORD Hdr1UnPackSize; // Reserved - CKDWORD DataPackSize; // Reserved - CKDWORD DataUnPackSize; // Reserved - }; - - struct CKFileObject { - CK_ID Object; - CK_ID CreatedObject; - CK_CLASSID ObjectCid; - void* ObjPtr; - std::string Name; - CKStateChunk* Data; - CKDWORD PostPackSize; - CKDWORD PrePackSize; - CK_FO_OPTIONS Options; - CKDWORD FileIndex; - CK_FILE_WRITEMODE SaveFlags; - }; - - struct CKFileManagerData { - CKStateChunk* Data; - CKGUID Manager; - }; - - struct CKFilePluginDependencies { - CK_PLUGIN_TYPE m_PluginCategory; - XArray m_Guids; - XBitArray ValidGuids; - }; - - class CKFile { - public: - CKFile(const Utils::VirtoolsEnvironment& cfg); - CKFile(const CKFile&) = delete; - CKFile& operator=(const CKFile&) = delete; - ~CKFile(); - - void ClearData(void); - CKERROR Load(CKSTRING u8_filename, /*CKObjectArray list, */ CK_LOAD_FLAGS flags); - CKERROR OpenFile(CKSTRING u8_filename, CK_LOAD_FLAGS flags); - CKERROR OpenMemory(void* MemoryBuffer, size_t BufferSize, CK_LOAD_FLAGS Flags); - CKERROR ReadFileHeaders(CKBufferParser** ParserPtr); - CKERROR ReadFileData(CKBufferParser** ParserPtr); - CKERROR LoadFileData(void/*CKObjectArray list*/); - CKERROR FinishLoading(/*CKObjectArray list, */CK_LOAD_FLAGS flags); - - int32_t m_SaveIDMax; - XArray m_FileObject; - XArray m_ManagersData; - XClassArray m_PluginDep; - XClassArray m_IndexByClassId; - XClassArray m_IncludedFiles; - - CKFileInfo m_FileInfo; - - CK_LOAD_FLAGS m_Flags; - std::string m_FileName; - CKBufferParser* m_Parser; - VxMemoryMappedFile* m_MappedFile; - - bool m_ReadFileDataDone; - - private: - Utils::VirtoolsEnvironment m_UserCfg; - }; - -} diff --git a/LibCmo/VTUtils.hpp b/LibCmo/VTUtils.hpp index 008fba2..efa5282 100644 --- a/LibCmo/VTUtils.hpp +++ b/LibCmo/VTUtils.hpp @@ -1,7 +1,5 @@ #pragma once -#include - /* // https://stackoverflow.com/questions/2164827/explicitly-exporting-shared-library-functions-in-linux // generate import export macro @@ -46,11 +44,7 @@ namespace LibCmo { namespace Utils { - struct VirtoolsEnvironment { - std::string NameEncoding; - std::string TempFolder; - }; + } - } diff --git a/LibCmo/VTStruct.cpp b/LibCmo/VxMemoryMappedFile.cpp similarity index 55% rename from LibCmo/VTStruct.cpp rename to LibCmo/VxMemoryMappedFile.cpp index d0fd625..f06ff33 100644 --- a/LibCmo/VTStruct.cpp +++ b/LibCmo/VxMemoryMappedFile.cpp @@ -1,44 +1,8 @@ -#include "VTUtils.hpp" -#if defined(LIBCMO_OS_WIN32) -#define ZLIB_WINAPI -#include -#endif - -#include "VTStruct.hpp" -#include -#include +#include "VxMemoryMappedFile.hpp" +#include "VTEncoding.hpp" namespace LibCmo { -#pragma region CKZLib Func - - void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) { - char* DestBuffer = new(std::nothrow) char[DestSize]; - if (DestBuffer == nullptr) return nullptr; - - uLongf cache = DestSize; - if (uncompress( - reinterpret_cast(DestBuffer), &cache, - reinterpret_cast(SrcBuffer), SrcSize) != Z_OK) { - delete[] DestBuffer; - return nullptr; - } - - return DestBuffer; - } - - CKDWORD LibCmo::CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC) { - return static_cast(adler32( - static_cast(PreviousCRC), - reinterpret_cast(data), - static_cast(size) - )); - } - -#pragma endregion - -#pragma region VxMemoryMappedFile - VxMemoryMappedFile::VxMemoryMappedFile(const char* u8_filepath) : // init members #if defined(LIBCMO_OS_WIN32) @@ -136,54 +100,5 @@ namespace LibCmo { } } -#pragma endregion - -#pragma region CKBufferParser - - CKBufferParser::CKBufferParser(void* ptr, size_t rsize, bool need_manual_free) : - m_MemBegin(static_cast(ptr)), - m_MemPos(0u), m_MemSize(rsize), - m_NeedManualFree(need_manual_free) { - ; - } - CKBufferParser::~CKBufferParser() { - if (this->m_NeedManualFree) delete[](this->m_MemBegin); - } - -#pragma endregion - -#pragma region CKFile Misc - - CKFile::CKFile(const Utils::VirtoolsEnvironment& cfg) : - m_Parser(nullptr), m_MappedFile(nullptr), - m_UserCfg(cfg) { - ; - } - - CKFile::~CKFile() { - } - - - void CKFile::ClearData(void) { - m_SaveIDMax = 0; - m_FileObject.clear(); - m_PluginDep.clear(); - - memset(&m_FileInfo, 0, sizeof(CKFileInfo)); - - m_Flags = CK_LOAD_FLAGS::CK_LOAD_DEFAULT; - m_FileName.clear(); - if (m_Parser != nullptr) { - delete m_Parser; - m_Parser = nullptr; - } - if (m_MappedFile != nullptr) { - delete m_MappedFile; - m_MappedFile = nullptr; - } - } - -#pragma endregion - } diff --git a/LibCmo/VxMemoryMappedFile.hpp b/LibCmo/VxMemoryMappedFile.hpp new file mode 100644 index 0000000..d7cbaa4 --- /dev/null +++ b/LibCmo/VxMemoryMappedFile.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include "VTUtils.hpp" +#if defined(LIBCMO_OS_WIN32) +#include +#else +#include +#endif + +#include + +namespace LibCmo { + + class VxMemoryMappedFile { + private: + +#if defined(LIBCMO_OS_WIN32) + std::wstring m_szFilePath; + HANDLE m_hFile; + DWORD m_dwFileSizeLow, m_dwFileSizeHigh; + HANDLE m_hFileMapping; + LPVOID m_hFileMapView; +#else + std::string m_szFilePath; +#error NO IMPLEMENTATION FOR LINUX MMAP! +#endif + + void* m_pMemoryMappedFileBase; + size_t m_cbFile; + bool m_bIsValid; + public: + VxMemoryMappedFile(const char* u8_filepath); + VxMemoryMappedFile(const VxMemoryMappedFile&) = delete; + VxMemoryMappedFile& operator=(const VxMemoryMappedFile&) = delete; + ~VxMemoryMappedFile(void); + + inline void* GetBase(void) { return this->m_pMemoryMappedFileBase; } + inline size_t GetFileSize(void) { return this->m_cbFile; } + inline bool IsValid(void) { return this->m_bIsValid; } + }; + +} diff --git a/Unvirt/AccessibleValue.hpp b/Unvirt/AccessibleValue.hpp index 82f8127..d858ddf 100644 --- a/Unvirt/AccessibleValue.hpp +++ b/Unvirt/AccessibleValue.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include @@ -42,7 +42,7 @@ namespace Unvirt { } // check flag match - if (LibCmo::EnumHelper::FlagEnumHas(val, (*it).first)) { + if (LibCmo::EnumsHelper::FlagEnumHas(val, (*it).first)) { // matched, add it if (strl.size() != 0u) strl += ", "; strl += (*it).second; diff --git a/Unvirt/CmdHelper.hpp b/Unvirt/CmdHelper.hpp index 03b5c18..f6ecd59 100644 --- a/Unvirt/CmdHelper.hpp +++ b/Unvirt/CmdHelper.hpp @@ -7,7 +7,6 @@ #include #include #include "VTUtils.hpp" -#include "VTStruct.hpp" /* diff --git a/Unvirt/StructFormatter.hpp b/Unvirt/StructFormatter.hpp index 6e3c245..3690e5e 100644 --- a/Unvirt/StructFormatter.hpp +++ b/Unvirt/StructFormatter.hpp @@ -1,6 +1,6 @@ #pragma once -#include "VTStruct.hpp" +#include namespace Unvirt { namespace StructFormatter { diff --git a/Unvirt/Unvirt.cpp b/Unvirt/Unvirt.cpp index 605f410..eb4cb99 100644 --- a/Unvirt/Unvirt.cpp +++ b/Unvirt/Unvirt.cpp @@ -1,7 +1,7 @@ #include "AccessibleValue.hpp" #include "TerminalHelper.hpp" #include "StructFormatter.hpp" -#include "VTStruct.hpp" +#include "CKFile.hpp" #include #include @@ -9,11 +9,12 @@ int main(int argc, char* argv[]) { Unvirt::TerminalHelper::EnsureTerminalColor(); Unvirt::TerminalHelper::EnsureTerminalEncoding(); - LibCmo::Utils::VirtoolsEnvironment vtctx; - LibCmo::CKFile vtfile(vtctx); - LibCmo::CKERROR err = vtfile.Load("vt2obj.nms", LibCmo::CK_LOAD_FLAGS::CK_LOAD_DEFAULT); + LibCmo::CKMinContext vtctx; + LibCmo::CKFile vtfile(&vtctx); + LibCmo::CKFileData::ShallowDocument* doc; + LibCmo::CKERROR err = vtfile.ShallowLoad("Language.old.nmo", &doc); - Unvirt::StructFormatter::PrintCKFileInfo(vtfile.m_FileInfo); + Unvirt::StructFormatter::PrintCKFileInfo(doc->m_FileInfo); return 0; } diff --git a/VirtoolsProbe/main.cpp b/VirtoolsProbe/main.cpp index c0e7729..6cc5914 100644 --- a/VirtoolsProbe/main.cpp +++ b/VirtoolsProbe/main.cpp @@ -116,7 +116,7 @@ int main() { CKCID_MESH, CKCID_PATCHMESH, CKCID_RENDEROBJECT, - CKCID_3DENTITY, + CKCID_2DENTITY, CKCID_SPRITE, CKCID_SPRITETEXT, CKCID_3DENTITY, @@ -169,7 +169,7 @@ int main() { "CKCID_MESH", "CKCID_PATCHMESH", "CKCID_RENDEROBJECT", - "CKCID_3DENTITY", + "CKCID_2DENTITY", "CKCID_SPRITE", "CKCID_SPRITETEXT", "CKCID_3DENTITY",