refactor project

This commit is contained in:
yyc12345 2023-02-26 21:48:03 +08:00
parent e450fa532d
commit 0519a557b8
32 changed files with 846 additions and 618 deletions

View File

@ -68,3 +68,45 @@ enum CK_STATECHUNK_CHUNKOPTIONS
CHNK_DONTDELETE_PTR = 0x40, // Data buffer stored in m_Buffer is not owned by CKStateChunk , it must not be deleted... CHNK_DONTDELETE_PTR = 0x40, // Data buffer stored in m_Buffer is not owned by CKStateChunk , it must not be deleted...
CHNK_DONTDELETE_PARSER = 0x80, // m_Parser Ptr is not owned by CKStateChunk , it must not be deleted... CHNK_DONTDELETE_PARSER = 0x80, // m_Parser Ptr is not owned by CKStateChunk , it must not be deleted...
enum !CK_OBJECT_FLAGS
CK_OBJECT_INTERFACEOBJ = 0x00000001, // Reserved for Inteface Use
CK_OBJECT_PRIVATE = 0x00000002, // The object must not be displayed in interface (Lists,Level view,etc...),nor should it be saved. (CKObject::IsPrivate()
CK_OBJECT_INTERFACEMARK = 0x00000004,
CK_OBJECT_FREEID = 0x00000008, // ID of this object can be released safely and is free to be reused by future CKobjects.
CK_OBJECT_TOBEDELETED = 0x00000010, // This object is being deleted
CK_OBJECT_NOTTOBESAVED = 0x00000020, // This object must not be saved
CK_OBJECT_VISIBLE = 0x00000040, // This object is visible (CKObject::Show)
CK_OBJECT_NAMESHARED = 0x00000080, // This object has its name from another entity
CK_OBJECT_DYNAMIC = 0x00000108, // This object may be created or deleted at run-time, it also contails CK_OBJECT_FREEID. (CKObject::IsDynamic,CKContext::CreateObject)
CK_OBJECT_HIERACHICALHIDE = 0x00000200, // This object hides all its hierarchy (CKObject::Show)
CK_OBJECT_UPTODATE = 0x00000400, // (Camera,etc..)
CK_OBJECT_TEMPMARKER = 0x00000800,
CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000,
CK_OBJECT_NOTTOBEDELETED = 0x00002000, // This object must not be deleted in a clear all
CK_OBJECT_APPDATA = 0x00004000, // This object has app data
CK_OBJECT_SINGLEACTIVITY = 0x00008000, // this object has an information of single activity
CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000, // When loading this object the CKBeObject part should be skipped
CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023, // Combination of Private and Not To Be Saved
// The following flags are specific to parameters (they are stored here for object's size purposes )
CK_PARAMETEROUT_SETTINGS = 0x00400000,
CK_PARAMETEROUT_PARAMOP = 0x00800000, // This parameter is the output of a CKParameterOperation (Automatically set by Engine)
CK_PARAMETERIN_DISABLED = 0x01000000, // Parameter In or Out is disabled (CKBehavior::EnableInputParameter,CKBehavior::DisableInputParameter)
CK_PARAMETERIN_THIS = 0x02000000, // Special parameter type : its value and type are always equal to its owner (CKParameter::SetAsMyselfParameter)
CK_PARAMETERIN_SHARED = 0x04000000,
CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000, // When adding parameters to CKMessage, they can be automatically deleted when message is released (CKMessage::AddParameter)
CK_OBJECT_PARAMMASK = 0x0FC00000, // Mask for options specific to parameters
// The Following flags are specific for Behavior ios (CKBehaviorIO)
CK_BEHAVIORIO_IN = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
CK_BEHAVIORIO_OUT = 0x20000000, // This BehaviorIO is a behavior output (CKBehaviorIO::SetType)
CK_BEHAVIORIO_ACTIVE = 0x40000000, // This BehaviorIO is a currently active (CKBehaviorIO::Activate}
CK_OBJECT_IOTYPEMASK = 0x30000000,
CK_OBJECT_IOMASK = 0xF0000000,
// The Following flags are specific for Behavior ios (CKBehaviorIO)
CKBEHAVIORLINK_RESERVED = 0x10000000, // This BehaviorIO is a behavior input (CKBehaviorIO::SetType}
CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000, // This link had been activated last frame
CK_OBJECT_BEHAVIORLINKMASK = 0x30000000,

View File

@ -4,13 +4,18 @@
#include <vector> #include <vector>
namespace LibCmo { namespace LibCmo {
namespace CK2 {
// some important type define
using CKINT = int32_t;
using CK_ID = uint32_t; using CK_ID = uint32_t;
using CKDWORD = uint32_t; using CKDWORD = uint32_t;
using CKWORD = uint16_t; using CKWORD = uint16_t;
using CKBYTE = uint8_t; using CKBYTE = uint8_t;
using CKBOOL = int32_t; using CKBOOL = int32_t;
using CKINT = int32_t;
using CKMUTSTRING = char*; using CKMUTSTRING = char*;
using CKSTRING = const char*; using CKSTRING = const char*;
@ -23,6 +28,51 @@ namespace LibCmo {
using XClassArray = std::vector<T>; using XClassArray = std::vector<T>;
//using CKObjectArray = std::vector<CKObject*>; //using CKObjectArray = std::vector<CKObject*>;
// forward decl for some CKObjects
namespace CKObjectImplements {
class CKObject;
class CKParameterIn;
class CKParameter;
class CKParameterOut;
class CKParameterLocal;
class CKParameterOperation;
class CKBehaviorLink;
class CKBehaviorIO;
class CKSceneObject;
class CKBehavior;
class CKBeObject;
class CKScene;
class CKLevel;
class CKPlace;
class CKGroup;
class CKMaterial;
class CKTexture;
class CKMesh;
class CKDataArray;
class CKRenderObject;
class CK3dEntity;
class CK3dObject;
}
// forward decl for some CKManagers
namespace CKManagerImplements {
class CKBaseManager;
class CKAttributeManager;
}
// forward decl for some important CK2 classes
class CKMinContext;
class CKStateChunk;
class CKFile;
namespace CKFileData {
class ShallowDocument;
class DeepDocument;
class HybridDocument;
}
// useful struct define
struct CKGUID { struct CKGUID {
union { union {
struct { struct {
@ -35,3 +85,52 @@ namespace LibCmo {
} }
namespace VxMath {
// forward decl for some important VxMath classes
class VxMemoryMappedFile;
struct VxVector {
union {
struct {
float x, y, z;
};
float v[3];
};
VxVector() : x(0.0f), y(0.0f), z(0.0f) { ; }
VxVector(float f) : x(f), y(f), z(f) { ; }
VxVector(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { ; }
VxVector(const float f[3]) : x(f[0]), y(f[1]), z(f[2]) { ; }
};
struct VxQuaternion {
union {
struct {
VxVector axis;
float angle;
};
struct {
float x, y, z, w;
};
float v[4];
};
VxQuaternion() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) { ; }
VxQuaternion(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { ; }
};
struct VxMatrix {
float m_Data[4][4];
VxMatrix() : m_Data() {
memset(m_Data, 0, sizeof(m_Data));
m_Data[0][0] = m_Data[1][1] = m_Data[2][2] = m_Data[3][3] = 1.0f;
}
VxMatrix(float m[4][4]) : m_Data() { std::memcpy(m_Data, m, sizeof(m_Data)); }
};
}
}

View File

@ -1,28 +1,9 @@
#pragma once #pragma once
#include <type_traits>
#include <cinttypes> #include <cinttypes>
#include <cstdint> #include <cstdint>
#include <cstdarg>
namespace LibCmo { namespace LibCmo::CK2 {
namespace EnumsHelper {
template<typename TEnum>
inline TEnum FlagEnumAdd(TEnum e, ...) {
TEnum result = e;
va_list argptr;
va_start(argptr, e);
result = static_cast<TEnum>(static_cast<std::underlying_type_t<TEnum>>(result) | static_cast<std::underlying_type_t<TEnum>>(va_arg(argptr, TEnum)));
va_end(argptr);
return result;
}
template<typename TEnum>
inline bool FlagEnumHas(TEnum e, TEnum probe) {
return static_cast<bool>(static_cast<std::underlying_type_t<TEnum>>(e) & static_cast<std::underlying_type_t<TEnum>>(probe));
}
}
enum class CK_CLASSID : uint32_t { enum class CK_CLASSID : uint32_t {
CKCID_OBJECT = 1, CKCID_OBJECT = 1,
@ -150,14 +131,14 @@ namespace LibCmo {
CKERR_INVALIDANIMATION = -123 CKERR_INVALIDANIMATION = -123
}; };
enum class CK_FILE_WRITEMODE : int32_t { enum class CK_FILE_WRITEMODE : uint32_t {
CKFILE_UNCOMPRESSED = 0, CKFILE_UNCOMPRESSED = 0,
CKFILE_CHUNKCOMPRESSED_OLD = 1, CKFILE_CHUNKCOMPRESSED_OLD = 1,
CKFILE_EXTERNALTEXTURES_OLD = 2, CKFILE_EXTERNALTEXTURES_OLD = 2,
CKFILE_FORVIEWER = 4, CKFILE_FORVIEWER = 4,
CKFILE_WHOLECOMPRESSED = 8 CKFILE_WHOLECOMPRESSED = 8
}; };
enum class CK_LOAD_FLAGS : int32_t { enum class CK_LOAD_FLAGS : uint32_t {
CK_LOAD_ANIMATION = 1 << 0, CK_LOAD_ANIMATION = 1 << 0,
CK_LOAD_GEOMETRY = 1 << 1, CK_LOAD_GEOMETRY = 1 << 1,
CK_LOAD_DEFAULT = CK_LOAD_GEOMETRY | CK_LOAD_ANIMATION, CK_LOAD_DEFAULT = CK_LOAD_GEOMETRY | CK_LOAD_ANIMATION,
@ -169,13 +150,13 @@ namespace LibCmo {
CK_LOAD_CHECKDEPENDENCIES = 1 << 7, CK_LOAD_CHECKDEPENDENCIES = 1 << 7,
CK_LOAD_ONLYBEHAVIORS = 1 << 8 CK_LOAD_ONLYBEHAVIORS = 1 << 8
}; };
enum class CK_FO_OPTIONS : int32_t { enum class CK_FO_OPTIONS : uint32_t {
CK_FO_DEFAULT = 0, CK_FO_DEFAULT = 0,
CK_FO_RENAMEOBJECT, CK_FO_RENAMEOBJECT,
CK_FO_REPLACEOBJECT, CK_FO_REPLACEOBJECT,
CK_FO_DONTLOADOBJECT CK_FO_DONTLOADOBJECT
}; };
enum class CK_PLUGIN_TYPE : int32_t { enum class CK_PLUGIN_TYPE : uint32_t {
CKPLUGIN_BITMAP_READER = 0, CKPLUGIN_BITMAP_READER = 0,
CKPLUGIN_SOUND_READER = 1, CKPLUGIN_SOUND_READER = 1,
CKPLUGIN_MODEL_READER = 2, CKPLUGIN_MODEL_READER = 2,
@ -185,7 +166,7 @@ namespace LibCmo {
CKPLUGIN_MOVIE_READER = 6, CKPLUGIN_MOVIE_READER = 6,
CKPLUGIN_EXTENSION_DLL = 7 CKPLUGIN_EXTENSION_DLL = 7
}; };
enum class CK_STATECHUNK_DATAVERSION : int32_t { enum class CK_STATECHUNK_DATAVERSION : uint32_t {
CHUNKDATA_OLDVERSION = 0, CHUNKDATA_OLDVERSION = 0,
CHUNKDATA_BASEVERSION = 1, CHUNKDATA_BASEVERSION = 1,
CHUNK_WAVESOUND_VERSION2 = 2, CHUNK_WAVESOUND_VERSION2 = 2,
@ -199,14 +180,14 @@ namespace LibCmo {
CHUNK_DEV_2_1 = 10, CHUNK_DEV_2_1 = 10,
CHUNKDATA_CURRENTVERSION = CHUNK_DEV_2_1 CHUNKDATA_CURRENTVERSION = CHUNK_DEV_2_1
}; };
enum class CK_STATECHUNK_CHUNKVERSION : int32_t { enum class CK_STATECHUNK_CHUNKVERSION : uint32_t {
CHUNK_VERSIONBASE = 0, CHUNK_VERSIONBASE = 0,
CHUNK_VERSION1 = 4, CHUNK_VERSION1 = 4,
CHUNK_VERSION2 = 5, CHUNK_VERSION2 = 5,
CHUNK_VERSION3 = 6, CHUNK_VERSION3 = 6,
CHUNK_VERSION4 = 7 CHUNK_VERSION4 = 7
}; };
enum class CK_STATECHUNK_CHUNKOPTIONS : int32_t { enum class CK_STATECHUNK_CHUNKOPTIONS : uint32_t {
CHNK_OPTION_IDS = 0x01, CHNK_OPTION_IDS = 0x01,
CHNK_OPTION_MAN = 0x02, CHNK_OPTION_MAN = 0x02,
CHNK_OPTION_CHN = 0x04, CHNK_OPTION_CHN = 0x04,
@ -216,5 +197,40 @@ namespace LibCmo {
CHNK_DONTDELETE_PTR = 0x40, CHNK_DONTDELETE_PTR = 0x40,
CHNK_DONTDELETE_PARSER = 0x80 CHNK_DONTDELETE_PARSER = 0x80
}; };
enum class CK_OBJECT_FLAGS : uint32_t {
CK_OBJECT_INTERFACEOBJ = 0x00000001,
CK_OBJECT_PRIVATE = 0x00000002,
CK_OBJECT_INTERFACEMARK = 0x00000004,
CK_OBJECT_FREEID = 0x00000008,
CK_OBJECT_TOBEDELETED = 0x00000010,
CK_OBJECT_NOTTOBESAVED = 0x00000020,
CK_OBJECT_VISIBLE = 0x00000040,
CK_OBJECT_NAMESHARED = 0x00000080,
CK_OBJECT_DYNAMIC = 0x00000108,
CK_OBJECT_HIERACHICALHIDE = 0x00000200,
CK_OBJECT_UPTODATE = 0x00000400,
CK_OBJECT_TEMPMARKER = 0x00000800,
CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000,
CK_OBJECT_NOTTOBEDELETED = 0x00002000,
CK_OBJECT_APPDATA = 0x00004000,
CK_OBJECT_SINGLEACTIVITY = 0x00008000,
CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000,
CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023,
CK_PARAMETEROUT_SETTINGS = 0x00400000,
CK_PARAMETEROUT_PARAMOP = 0x00800000,
CK_PARAMETERIN_DISABLED = 0x01000000,
CK_PARAMETERIN_THIS = 0x02000000,
CK_PARAMETERIN_SHARED = 0x04000000,
CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000,
CK_OBJECT_PARAMMASK = 0x0FC00000,
CK_BEHAVIORIO_IN = 0x10000000,
CK_BEHAVIORIO_OUT = 0x20000000,
CK_BEHAVIORIO_ACTIVE = 0x40000000,
CK_OBJECT_IOTYPEMASK = 0x30000000,
CK_OBJECT_IOMASK = 0xF0000000,
CKBEHAVIORLINK_RESERVED = 0x10000000,
CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000,
CK_OBJECT_BEHAVIORLINKMASK = 0x30000000
};
} }

View File

@ -1,7 +1,9 @@
#include "CKFile.hpp" #include "CKFile.hpp"
#include "CKStateChunk.hpp"
#include "CKMinContext.hpp"
#include <cstdarg> #include <cstdarg>
namespace LibCmo { namespace LibCmo::CK2 {
#pragma region CKBufferParser #pragma region CKBufferParser
@ -29,12 +31,12 @@ namespace LibCmo {
#pragma region CKFileObject #pragma region CKFileObject
LibCmo::CKFileObject::CKFileObject() : CKFileObject::CKFileObject() :
Data(nullptr) { Data(nullptr) {
; ;
} }
LibCmo::CKFileObject::~CKFileObject() { CKFileObject::~CKFileObject() {
; ;
} }
@ -60,13 +62,15 @@ namespace LibCmo {
#pragma endregion #pragma endregion
namespace CKFileData {
#pragma region ShallowDocument #pragma region ShallowDocument
LibCmo::CKFileData::ShallowDocument::ShallowDocument() { ShallowDocument::ShallowDocument() {
this->m_IndexByClassId.resize(static_cast<size_t>(CK_CLASSID::CKCID_MAXCLASSID)); this->m_IndexByClassId.resize(static_cast<size_t>(CK_CLASSID::CKCID_MAXCLASSID));
} }
LibCmo::CKFileData::ShallowDocument::~ShallowDocument() { ShallowDocument::~ShallowDocument() {
} }
@ -74,16 +78,18 @@ namespace LibCmo {
#pragma region DeepDocument #pragma region DeepDocument
LibCmo::CKFileData::DeepDocument::DeepDocument() { DeepDocument::DeepDocument() {
this->m_IndexByClassId.resize(static_cast<size_t>(CK_CLASSID::CKCID_MAXCLASSID)); this->m_IndexByClassId.resize(static_cast<size_t>(CK_CLASSID::CKCID_MAXCLASSID));
} }
LibCmo::CKFileData::DeepDocument::~DeepDocument() { DeepDocument::~DeepDocument() {
} }
#pragma endregion #pragma endregion
}
#pragma region CKFile Misc #pragma region CKFile Misc
CKFile::CKFile(CKMinContext* ctx) : CKFile::CKFile(CKMinContext* ctx) :

View File

@ -3,11 +3,7 @@
#include "CKDefines.hpp" #include "CKDefines.hpp"
#include "CKEnums.hpp" #include "CKEnums.hpp"
#include "VxMemoryMappedFile.hpp" namespace LibCmo::CK2 {
#include "CKStateChunk.hpp"
#include "CKMinContext.hpp"
namespace LibCmo {
class CKBufferParser { class CKBufferParser {
private: private:
@ -24,11 +20,11 @@ namespace LibCmo {
inline const void* GetPtr(void) { return (this->m_MemBegin + m_MemPos); } inline const void* GetPtr(void) { return (this->m_MemBegin + m_MemPos); }
inline void Read(void* data, size_t data_size) { inline void Read(void* data, size_t data_size) {
memcpy(data, (this->m_MemBegin + m_MemPos), data_size); std::memcpy(data, (this->m_MemBegin + m_MemPos), data_size);
this->m_MemPos += data_size; this->m_MemPos += data_size;
} }
inline void Write(const void* data, size_t data_size) { inline void Write(const void* data, size_t data_size) {
memcpy((this->m_MemBegin + m_MemPos), data, data_size); std::memcpy((this->m_MemBegin + m_MemPos), data, data_size);
this->m_MemPos += data_size; this->m_MemPos += data_size;
} }
inline void* GetBase(void) { return this->m_MemBegin; } inline void* GetBase(void) { return this->m_MemBegin; }
@ -158,7 +154,7 @@ namespace LibCmo {
int32_t m_SaveIDMax; int32_t m_SaveIDMax;
CKFileInfo m_FileInfo; CKFileInfo m_FileInfo;
XArray<ObjsImpl::CKObject*> m_Objects; XArray<CKObjectImplements::CKObject*> m_Objects;
XClassArray<XIntArray> m_IndexByClassId; XClassArray<XIntArray> m_IndexByClassId;
XClassArray<XString> m_IncludedFiles; XClassArray<XString> m_IncludedFiles;
private: private:

View File

@ -1,8 +1,11 @@
#include "CKFile.hpp" #include "CKFile.hpp"
#include "CKGlobals.hpp" #include "CKGlobals.hpp"
#include "CKStateChunk.hpp"
#include "VxMemoryMappedFile.hpp"
#include "CKMinContext.hpp"
#include <memory> #include <memory>
namespace LibCmo { namespace LibCmo::CK2 {
/* /*
* NOTE: * NOTE:
@ -17,7 +20,7 @@ namespace LibCmo {
// check file and open memory // check file and open memory
if (u8_filename == nullptr) return CKERROR::CKERR_INVALIDPARAMETER; if (u8_filename == nullptr) return CKERROR::CKERR_INVALIDPARAMETER;
std::unique_ptr<VxMemoryMappedFile> mappedFile(new(std::nothrow) VxMemoryMappedFile(u8_filename)); std::unique_ptr<VxMath::VxMemoryMappedFile> mappedFile(new(std::nothrow) VxMath::VxMemoryMappedFile(u8_filename));
if (mappedFile == nullptr) { if (mappedFile == nullptr) {
this->m_MinCtx->Printf("Out of memory when creating Memory File."); this->m_MinCtx->Printf("Out of memory when creating Memory File.");
return CKERROR::CKERR_OUTOFMEMORY; return CKERROR::CKERR_OUTOFMEMORY;
@ -54,7 +57,7 @@ namespace LibCmo {
// ========== read header ========== // ========== read header ==========
// check header size // check header size
if (parser->GetSize() < sizeof(CKRawFileInfo)) return CKERROR::CKERR_INVALIDFILE; if (parser->GetSize() < sizeof(CKRawFileInfo)) return CKERROR::CKERR_INVALIDFILE;
if (memcmp(parser->GetPtr(), "Nemo Fi", sizeof(CKRawFileInfo::NeMo))) return CKERROR::CKERR_INVALIDFILE; if (std::memcmp(parser->GetPtr(), "Nemo Fi", sizeof(CKRawFileInfo::NeMo))) return CKERROR::CKERR_INVALIDFILE;
// read header // read header
CKRawFileInfo rawHeader; CKRawFileInfo rawHeader;
parser->Read(&rawHeader, sizeof(CKRawFileInfo)); parser->Read(&rawHeader, sizeof(CKRawFileInfo));
@ -138,7 +141,7 @@ namespace LibCmo {
if (namelen != 0) { if (namelen != 0) {
name_conv.resize(namelen); name_conv.resize(namelen);
parser->Read(name_conv.data(), namelen); parser->Read(name_conv.data(), namelen);
m_MinCtx->GetUtf8ObjectName(name_conv, fileobj.Name); m_MinCtx->GetUtf8String(name_conv, fileobj.Name);
} }
} }
} }
@ -325,7 +328,7 @@ namespace LibCmo {
// read filename // read filename
if (filenamelen != 0) { if (filenamelen != 0) {
parser->Read(name_conv.data(), filenamelen); parser->Read(name_conv.data(), filenamelen);
m_MinCtx->GetUtf8ObjectName(name_conv, file); m_MinCtx->GetUtf8String(name_conv, file);
} }
// read file body length // read file body length
@ -335,7 +338,7 @@ namespace LibCmo {
// read file body // read file body
FILE* fp = m_MinCtx->OpenTempFile(file.c_str(), false); FILE* fp = m_MinCtx->OpenTempFile(file.c_str(), false);
if (fp != nullptr) { if (fp != nullptr) {
Utils::CopyStream(parser->GetPtr(), fp, filebodylen); StreamHelper::CopyStream(parser->GetPtr(), fp, filebodylen);
fclose(fp); fclose(fp);
} }

View File

@ -4,12 +4,10 @@
#include <zconf.h> #include <zconf.h>
#endif #endif
#include "CKDefines.hpp"
#include "CKGlobals.hpp" #include "CKGlobals.hpp"
#include <zlib.h> #include <zlib.h>
namespace LibCmo { namespace LibCmo::CK2 {
void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) { void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) {
char* DestBuffer = new(std::nothrow) char[DestSize]; char* DestBuffer = new(std::nothrow) char[DestSize];
@ -26,7 +24,7 @@ namespace LibCmo {
return DestBuffer; return DestBuffer;
} }
CKDWORD LibCmo::CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC) { CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC) {
return static_cast<CKDWORD>(adler32( return static_cast<CKDWORD>(adler32(
static_cast<uLong>(PreviousCRC), static_cast<uLong>(PreviousCRC),
reinterpret_cast<const Bytef*>(data), reinterpret_cast<const Bytef*>(data),
@ -34,5 +32,4 @@ namespace LibCmo {
)); ));
} }
} }

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
namespace LibCmo { #include "CKDefines.hpp"
namespace LibCmo::CK2 {
void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize); void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize);
CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0); CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0);

32
LibCmo/CKManagers.hpp Normal file
View File

@ -0,0 +1,32 @@
#pragma once
#include "CKDefines.hpp"
#include "CKEnums.hpp"
namespace LibCmo::CK2::CKManagerImplements {
class CKBaseManager {
public:
CKBaseManager();
CKBaseManager(const CKBaseManager&) = delete;
CKBaseManager& operator=(const CKBaseManager&) = delete;
virtual ~CKBaseManager();
virtual CKERROR LoadData(CKStateChunk* statechunk, CKFileData::ShallowDocument* doc);
virtual CKStateChunk* SaveData(CKFileData::ShallowDocument* doc);
private:
};
class CKAttributeManager {
public:
CKAttributeManager();
CKAttributeManager(const CKAttributeManager&) = delete;
CKAttributeManager& operator=(const CKAttributeManager&) = delete;
virtual ~CKAttributeManager();
private:
};
}

View File

@ -1,7 +1,7 @@
#include "VTUtils.hpp" #include "VTUtils.hpp"
#include "CKMinContext.hpp" #include "CKMinContext.hpp"
namespace LibCmo { namespace LibCmo::CK2 {
#if defined(LIBCMO_OS_WIN32) #if defined(LIBCMO_OS_WIN32)
static wchar_t g_UniqueFolder[] = L"LibCmo"; static wchar_t g_UniqueFolder[] = L"LibCmo";
@ -11,53 +11,69 @@ namespace LibCmo {
CKMinContext::CKMinContext() : CKMinContext::CKMinContext() :
NameEncoding(), NameEncodingToken(Encoding::ENCODING_TOKEN_DEFAULT), m_NameEncoding(), m_NameEncodingToken(EncodingHelper::ENCODING_TOKEN_DEFAULT),
TempFolder() m_TempFolder(),
m_PrintCallback(nullptr)
{ {
// preset for temp folder // preset for temp folder
TempFolder = std::filesystem::temp_directory_path(); m_TempFolder = std::filesystem::temp_directory_path();
TempFolder /= g_UniqueFolder; m_TempFolder /= g_UniqueFolder;
std::filesystem::create_directory(TempFolder); std::filesystem::create_directory(m_TempFolder);
} }
CKMinContext::~CKMinContext() { CKMinContext::~CKMinContext() {
} }
void CKMinContext::Printf(CKSTRING fmt, ...) { void CKMinContext::Printf(CKSTRING fmt, ...) {
if (m_PrintCallback == nullptr) return;
va_list argptr; va_list argptr;
va_start(argptr, fmt); va_start(argptr, fmt);
vfprintf(stdout, fmt, argptr);
std::string result;
int count = std::vsnprintf(nullptr, 0, fmt, argptr);
result.resize(count);
int write_result = std::vsnprintf(result.data(), count, fmt, argptr);
if (write_result < 0 || write_result > count) return;
va_end(argptr); va_end(argptr);
m_PrintCallback(result);
} }
void CKMinContext::GetUtf8ObjectName(std::string& native_name, std::string& u8_name) { void CKMinContext::SetPrintCallback(PrintCallback cb) {
Encoding::GetUtf8VirtoolsName(native_name, u8_name, this->NameEncodingToken); m_PrintCallback = cb;
} }
void CKMinContext::GetNativeObjectName(std::string& u8_name, std::string& native_name) { void CKMinContext::GetUtf8String(std::string& native_name, std::string& u8_name) {
Encoding::GetNativeVirtoolsName(u8_name, native_name, this->NameEncodingToken); EncodingHelper::GetUtf8VirtoolsName(native_name, u8_name, this->m_NameEncodingToken);
}
void CKMinContext::GetNativeString(std::string& u8_name, std::string& native_name) {
EncodingHelper::GetNativeVirtoolsName(u8_name, native_name, this->m_NameEncodingToken);
} }
void CKMinContext::SetEncoding(CKSTRING encoding) { void CKMinContext::SetEncoding(CKSTRING encoding) {
this->NameEncoding = encoding; this->m_NameEncoding = encoding;
this->RefetchEncodingToken(); this->RefetchEncodingToken();
} }
void CKMinContext::SetTempPath(CKSTRING u8_temp) { void CKMinContext::SetTempPath(CKSTRING u8_temp) {
Encoding::SetStdPathFromU8Path(this->TempFolder, u8_temp); EncodingHelper::SetStdPathFromU8Path(this->m_TempFolder, u8_temp);
} }
FILE* CKMinContext::OpenTempFile(CKSTRING u8_filename, bool is_read) { FILE* CKMinContext::OpenTempFile(CKSTRING u8_filename, bool is_read) {
std::filesystem::path stdfilename; std::filesystem::path stdfilename;
Encoding::SetStdPathFromU8Path(stdfilename, u8_filename); EncodingHelper::SetStdPathFromU8Path(stdfilename, u8_filename);
auto realfile = this->TempFolder / stdfilename; auto realfile = this->m_TempFolder / stdfilename;
return Encoding::OpenStdPathFile(realfile, is_read); return EncodingHelper::OpenStdPathFile(realfile, is_read);
} }
void CKMinContext::RefetchEncodingToken(void) { void CKMinContext::RefetchEncodingToken(void) {
Encoding::DestroyEncodingToken(this->NameEncodingToken); EncodingHelper::DestroyEncodingToken(this->m_NameEncodingToken);
this->NameEncodingToken = Encoding::CreateEncodingToken(this->NameEncoding); this->m_NameEncodingToken = EncodingHelper::CreateEncodingToken(this->m_NameEncoding);
} }
} }

View File

@ -1,12 +1,11 @@
#pragma once #pragma once
#include "CKDefines.hpp" #include "CKDefines.hpp"
#include "CKEnums.hpp" #include "CKObjects.hpp"
#include "VTEncoding.hpp" #include "VTEncoding.hpp"
#include "VTObjects.hpp"
#include <filesystem> #include <filesystem>
namespace LibCmo { namespace LibCmo::CK2 {
class CKMinContext { class CKMinContext {
public: public:
@ -15,13 +14,20 @@ namespace LibCmo {
CKMinContext& operator=(const CKMinContext&) = delete; CKMinContext& operator=(const CKMinContext&) = delete;
~CKMinContext(); ~CKMinContext();
using PrintCallback = void (*)(std::string&);
void Printf(CKSTRING fmt, ...); void Printf(CKSTRING fmt, ...);
void SetPrintCallback(PrintCallback cb);
ObjsImpl::CKObject* CreateObject(CK_ID id, CK_CLASSID cls, CKSTRING name); CKObjectImplements::CKObject* CreateCKObject(CK_ID id, CK_CLASSID cls, CKSTRING name);
void DestroyObject(ObjsImpl::CKObject* obj); CKObjectImplements::CKObject* GetCKObject(CK_ID id);
void DestroyCKObject(CKObjectImplements::CKObject* obj);
void GetUtf8ObjectName(std::string& native_name, std::string& u8_name); CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid);
void GetNativeObjectName(std::string& u8_name, std::string& native_name); CKManagerImplements::CKBaseManager* GetCKManager(CKGUID guid);
void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr);
void GetUtf8String(std::string& native_name, std::string& u8_name);
void GetNativeString(std::string& u8_name, std::string& native_name);
void SetEncoding(CKSTRING encoding); void SetEncoding(CKSTRING encoding);
void SetTempPath(CKSTRING u8_temp); void SetTempPath(CKSTRING u8_temp);
@ -31,9 +37,10 @@ namespace LibCmo {
private: private:
void RefetchEncodingToken(void); void RefetchEncodingToken(void);
std::string NameEncoding; std::string m_NameEncoding;
Encoding::ENCODING_TOKEN NameEncodingToken; EncodingHelper::ENCODING_TOKEN m_NameEncodingToken;
std::filesystem::path TempFolder; std::filesystem::path m_TempFolder;
PrintCallback m_PrintCallback;
}; };
} }

View File

@ -0,0 +1,13 @@
#include "../CKObjects.hpp"
namespace LibCmo::CK2::CKObjectImplements {
CKObject::CKObject() {
}
CKObject::~CKObject() {
}
}

140
LibCmo/CKObjects.hpp Normal file
View File

@ -0,0 +1,140 @@
#pragma once
#include "CKDefines.hpp"
#include "CKEnums.hpp"
namespace LibCmo::CK2::CKObjectImplements {
class CKObject {
public:
CKObject();
CKObject(const CKObject&) = delete;
CKObject& operator=(const CKObject&) = delete;
virtual ~CKObject();
CK_ID GetID(void) { return this->m_ID; }
CKSTRING GetName(void) { return this->m_Name.c_str(); }
void SetName(CKSTRING u8_name) { this->m_Name = u8_name; }
CK_OBJECT_FLAGS GetObjectFlags(void) { return this->m_ObjectFlags; }
void SetObjectFlags(CK_OBJECT_FLAGS flags) { this->m_ObjectFlags = flags; }
virtual CK_CLASSID GetClassID(void) { return CK_CLASSID::CKCID_OBJECT; }
virtual CKERROR Load(CKStateChunk* chunk, CKFileData::ShallowDocument* doc);
virtual CKStateChunk* Save(CKFileData::ShallowDocument* doc);
protected:
CK_ID m_ID;
std::string m_Name;
CK_OBJECT_FLAGS m_ObjectFlags;
CKMinContext* m_Context;
};
class CKSceneObject : public CKObject {
public:
CKSceneObject();
CKSceneObject(const CKSceneObject&) = delete;
CKSceneObject& operator=(const CKSceneObject&) = delete;
virtual ~CKSceneObject();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_SCENEOBJECT; }
protected:
XBitArray m_Scenes;
};
class CKBeObject : public CKSceneObject {
public:
CKBeObject();
CKBeObject(const CKBeObject&) = delete;
CKBeObject& operator=(const CKBeObject&) = delete;
virtual ~CKBeObject();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_BEOBJECT; }
protected:
};
class CKGroup : public CKBeObject {
public:
CKGroup();
CKGroup(const CKGroup&) = delete;
CKGroup& operator=(const CKGroup&) = delete;
virtual ~CKGroup();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_GROUP; }
protected:
};
class CKMesh : public CKBeObject {
public:
CKMesh();
CKMesh(const CKMesh&) = delete;
CKMesh& operator=(const CKMesh&) = delete;
virtual ~CKMesh();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_MESH; }
protected:
};
class CKTexture : public CKBeObject {
public:
CKTexture();
CKTexture(const CKTexture&) = delete;
CKTexture& operator=(const CKTexture&) = delete;
virtual ~CKTexture();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_TEXTURE; }
protected:
};
class CKMaterial : public CKBeObject {
public:
CKMaterial();
CKMaterial(const CKMaterial&) = delete;
CKMaterial& operator=(const CKMaterial&) = delete;
virtual ~CKMaterial();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_MATERIAL; }
protected:
};
class CKRenderObject : public CKBeObject {
public:
CKRenderObject();
CKRenderObject(const CKRenderObject&) = delete;
CKRenderObject& operator=(const CKRenderObject&) = delete;
~CKRenderObject();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_RENDEROBJECT; }
protected:
};
class CK3dEntity : public CKBeObject {
public:
CK3dEntity();
CK3dEntity(const CK3dEntity&) = delete;
CK3dEntity& operator=(const CK3dEntity&) = delete;
virtual ~CK3dEntity();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_3DENTITY; }
protected:
};
class CK3dObject :public CK3dEntity {
public:
CK3dObject();
CK3dObject(const CK3dObject&) = delete;
CK3dObject& operator=(const CK3dObject&) = delete;
~CK3dObject();
virtual CK_CLASSID GetClassID(void) override { return CK_CLASSID::CKCID_3DOBJECT; }
protected:
};
}

View File

@ -1,13 +1,7 @@
#include "VTUtils.hpp" #include "VTUtils.hpp"
#if defined(LIBCMO_OS_WIN32)
#define ZLIB_WINAPI
#include <zconf.h>
#endif
#include <zlib.h>
#include "CKStateChunk.hpp" #include "CKStateChunk.hpp"
namespace LibCmo { namespace LibCmo::CK2 {
#pragma region Ctor Dtor #pragma region Ctor Dtor
@ -29,7 +23,7 @@ namespace LibCmo {
if (rhs.m_pData != nullptr) { if (rhs.m_pData != nullptr) {
this->m_pData = new(std::nothrow) CKDWORD[rhs.m_DataDwSize]; this->m_pData = new(std::nothrow) CKDWORD[rhs.m_DataDwSize];
if (this->m_pData != nullptr) { if (this->m_pData != nullptr) {
memcpy(this->m_pData, rhs.m_pData, sizeof(CKDWORD) * rhs.m_DataDwSize); std::memcpy(this->m_pData, rhs.m_pData, sizeof(CKDWORD) * rhs.m_DataDwSize);
} }
} }
} }
@ -50,7 +44,7 @@ namespace LibCmo {
if (rhs.m_pData != nullptr) { if (rhs.m_pData != nullptr) {
this->m_pData = new(std::nothrow) CKDWORD[rhs.m_DataDwSize]; this->m_pData = new(std::nothrow) CKDWORD[rhs.m_DataDwSize];
if (this->m_pData != nullptr) { if (this->m_pData != nullptr) {
memcpy(this->m_pData, rhs.m_pData, sizeof(CKDWORD) * rhs.m_DataDwSize); std::memcpy(this->m_pData, rhs.m_pData, sizeof(CKDWORD) * rhs.m_DataDwSize);
} }
} }
this->m_DataDwSize = rhs.m_DataDwSize; this->m_DataDwSize = rhs.m_DataDwSize;
@ -90,7 +84,7 @@ namespace LibCmo {
return sizeof(CKDWORD) * this->m_DataDwSize; return sizeof(CKDWORD) * this->m_DataDwSize;
} }
void LibCmo::CKStateChunk::_EnsureWriteSpace(CKDWORD size) { void CKStateChunk::_EnsureWriteSpace(CKDWORD size) {
; ;
} }
@ -129,15 +123,15 @@ namespace LibCmo {
this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize];
if (m_pData == nullptr) return false; if (m_pData == nullptr) return false;
memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize); std::memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize);
bufpos += this->m_DataDwSize; bufpos += this->m_DataDwSize;
} }
if (!this->m_ObjectList.empty()) { if (!this->m_ObjectList.empty()) {
memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size()); std::memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size());
bufpos += this->m_ObjectList.size(); bufpos += this->m_ObjectList.size();
} }
if (!this->m_ChunkList.empty()) { if (!this->m_ChunkList.empty()) {
memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size()); std::memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size());
bufpos += this->m_ChunkList.size(); bufpos += this->m_ChunkList.size();
} }
@ -156,19 +150,19 @@ namespace LibCmo {
this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize];
if (m_pData == nullptr) return false; if (m_pData == nullptr) return false;
memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize); std::memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize);
bufpos += this->m_DataDwSize; bufpos += this->m_DataDwSize;
} }
if (!this->m_ObjectList.empty()) { if (!this->m_ObjectList.empty()) {
memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size()); std::memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size());
bufpos += this->m_ObjectList.size(); bufpos += this->m_ObjectList.size();
} }
if (!this->m_ChunkList.empty()) { if (!this->m_ChunkList.empty()) {
memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size()); std::memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size());
bufpos += this->m_ChunkList.size(); bufpos += this->m_ChunkList.size();
} }
if (!this->m_ManagerList.empty()) { if (!this->m_ManagerList.empty()) {
memcpy(this->m_ManagerList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ManagerList.size()); std::memcpy(this->m_ManagerList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ManagerList.size());
bufpos += this->m_ManagerList.size(); bufpos += this->m_ManagerList.size();
} }
@ -193,7 +187,7 @@ namespace LibCmo {
this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize];
if (m_pData == nullptr) return false; if (m_pData == nullptr) return false;
memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize); std::memcpy(this->m_pData, dwbuf + bufpos, sizeof(CKDWORD) * this->m_DataDwSize);
bufpos += this->m_DataDwSize; bufpos += this->m_DataDwSize;
} }
if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_FILE)) { if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_FILE)) {
@ -203,19 +197,19 @@ namespace LibCmo {
if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_IDS)) { if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_IDS)) {
this->m_ObjectList.resize(dwbuf[bufpos]); this->m_ObjectList.resize(dwbuf[bufpos]);
bufpos += 1u; bufpos += 1u;
memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size()); std::memcpy(this->m_ObjectList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ObjectList.size());
bufpos += this->m_ObjectList.size(); bufpos += this->m_ObjectList.size();
} }
if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_CHN)) { if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_CHN)) {
this->m_ChunkList.resize(dwbuf[bufpos]); this->m_ChunkList.resize(dwbuf[bufpos]);
bufpos += 1u; bufpos += 1u;
memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size()); std::memcpy(this->m_ChunkList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ChunkList.size());
bufpos += this->m_ChunkList.size(); bufpos += this->m_ChunkList.size();
} }
if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_MAN)) { if (EnumsHelper::FlagEnumHas(options, CK_STATECHUNK_CHUNKOPTIONS::CHNK_OPTION_MAN)) {
this->m_ManagerList.resize(dwbuf[bufpos]); this->m_ManagerList.resize(dwbuf[bufpos]);
bufpos += 1u; bufpos += 1u;
memcpy(this->m_ManagerList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ManagerList.size()); std::memcpy(this->m_ManagerList.data(), dwbuf + bufpos, sizeof(CKDWORD) * this->m_ManagerList.size());
bufpos += this->m_ManagerList.size(); bufpos += this->m_ManagerList.size();
} }
@ -257,7 +251,7 @@ namespace LibCmo {
// this->m_pData = nullptr; // this->m_pData = nullptr;
// this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize]; // this->m_pData = new(std::nothrow) CKDWORD[this->m_DataDwSize];
// if (this->m_pData != nullptr) { // if (this->m_pData != nullptr) {
// memcpy(this->m_pData, buffer, this->m_DataDwSize * sizeof(CKDWORD)); // std::memcpy(this->m_pData, buffer, this->m_DataDwSize * sizeof(CKDWORD));
// } // }
// } // }
// delete[] buffer; // delete[] buffer;

View File

@ -3,7 +3,7 @@
#include "CKDefines.hpp" #include "CKDefines.hpp"
#include "CKEnums.hpp" #include "CKEnums.hpp"
namespace LibCmo { namespace LibCmo::CK2 {
class CKStateChunk { class CKStateChunk {
public: public:

View File

@ -103,6 +103,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -121,6 +122,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -139,6 +141,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -159,6 +162,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -175,7 +179,7 @@
<ClCompile Include="CKFileWriter.cpp" /> <ClCompile Include="CKFileWriter.cpp" />
<ClCompile Include="CKGlobals.cpp" /> <ClCompile Include="CKGlobals.cpp" />
<ClCompile Include="CKMinContext.cpp" /> <ClCompile Include="CKMinContext.cpp" />
<ClCompile Include="ObjsImpl\CKObject.cpp" /> <ClCompile Include="CKObjectImplements\CKObject.cpp" />
<ClCompile Include="VTEncoding.cpp" /> <ClCompile Include="VTEncoding.cpp" />
<ClCompile Include="CKFileReader.cpp" /> <ClCompile Include="CKFileReader.cpp" />
<ClCompile Include="CKStateChunk.cpp" /> <ClCompile Include="CKStateChunk.cpp" />
@ -187,11 +191,11 @@
<ClInclude Include="CKEnums.hpp" /> <ClInclude Include="CKEnums.hpp" />
<ClInclude Include="CKFile.hpp" /> <ClInclude Include="CKFile.hpp" />
<ClInclude Include="CKGlobals.hpp" /> <ClInclude Include="CKGlobals.hpp" />
<ClInclude Include="CKManagers.hpp" />
<ClInclude Include="CKMinContext.hpp" /> <ClInclude Include="CKMinContext.hpp" />
<ClInclude Include="CKStateChunk.hpp" /> <ClInclude Include="CKStateChunk.hpp" />
<ClInclude Include="VTEncoding.hpp" /> <ClInclude Include="VTEncoding.hpp" />
<ClInclude Include="VTManagers.hpp" /> <ClInclude Include="CKObjects.hpp" />
<ClInclude Include="VTObjects.hpp" />
<ClInclude Include="VTUtils.hpp" /> <ClInclude Include="VTUtils.hpp" />
<ClInclude Include="VxMemoryMappedFile.hpp" /> <ClInclude Include="VxMemoryMappedFile.hpp" />
</ItemGroup> </ItemGroup>

View File

@ -13,9 +13,12 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="Sources\ObjsImpl"> <Filter Include="Sources\CKObjectImplements">
<UniqueIdentifier>{a8cd2188-b552-478c-9801-a6286b3d48a0}</UniqueIdentifier> <UniqueIdentifier>{a8cd2188-b552-478c-9801-a6286b3d48a0}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Sources\CKManagerImplements">
<UniqueIdentifier>{784282d9-4adb-40ca-bbac-902c74e9a2e5}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="CKFileReader.cpp"> <ClCompile Include="CKFileReader.cpp">
@ -33,8 +36,8 @@
<ClCompile Include="CKFileWriter.cpp"> <ClCompile Include="CKFileWriter.cpp">
<Filter>Sources</Filter> <Filter>Sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ObjsImpl\CKObject.cpp"> <ClCompile Include="CKObjectImplements\CKObject.cpp">
<Filter>Sources\ObjsImpl</Filter> <Filter>Sources\CKObjectImplements</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CKGlobals.cpp"> <ClCompile Include="CKGlobals.cpp">
<Filter>Sources</Filter> <Filter>Sources</Filter>
@ -56,7 +59,7 @@
<ClInclude Include="VTEncoding.hpp"> <ClInclude Include="VTEncoding.hpp">
<Filter>Headers</Filter> <Filter>Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="VTObjects.hpp"> <ClInclude Include="CKObjects.hpp">
<Filter>Headers</Filter> <Filter>Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CKDefines.hpp"> <ClInclude Include="CKDefines.hpp">
@ -80,7 +83,7 @@
<ClInclude Include="CKMinContext.hpp"> <ClInclude Include="CKMinContext.hpp">
<Filter>Headers</Filter> <Filter>Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="VTManagers.hpp"> <ClInclude Include="CKManagers.hpp">
<Filter>Headers</Filter> <Filter>Headers</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View File

@ -1,15 +0,0 @@
#include "../VTObjects.hpp"
namespace LibCmo {
namespace ObjsImpl {
CKObject::CKObject() {
}
CKObject::~CKObject() {
}
}
}

View File

@ -1,7 +1,6 @@
#include "VTEncoding.hpp" #include "VTEncoding.hpp"
namespace LibCmo { namespace LibCmo::EncodingHelper {
namespace Encoding {
#pragma region assist functions #pragma region assist functions
@ -148,5 +147,4 @@ namespace LibCmo {
#pragma endregion #pragma endregion
} }
}

View File

@ -11,8 +11,7 @@
#include <iconv.h> #include <iconv.h>
#endif #endif
namespace LibCmo { namespace LibCmo::EncodingHelper {
namespace Encoding {
#pragma region assist functions #pragma region assist functions
@ -70,4 +69,3 @@ namespace LibCmo {
#pragma endregion #pragma endregion
} }
}

View File

@ -1,26 +0,0 @@
#pragma once
#include "CKDefines.hpp"
#include "CKEnums.hpp"
namespace LibCmo {
// forward decl to rm recursive reference
class CKMinContext;
class CKStateChunk;
namespace MgrsImpl {
class CKBaseManager {
public:
CKBaseManager();
CKBaseManager(const CKBaseManager&) = delete;
CKBaseManager& operator=(const CKBaseManager&) = delete;
virtual ~CKBaseManager();
private:
};
}
}

View File

@ -1,126 +0,0 @@
#pragma once
#include "CKDefines.hpp"
#include "CKEnums.hpp"
namespace LibCmo {
// forward decl to rm recursive reference
class CKMinContext;
class CKStateChunk;
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:
};
}
}

View File

@ -1,8 +1,7 @@
#include "VTUtils.hpp" #include "VTUtils.hpp"
namespace LibCmo { namespace LibCmo {
namespace Utils { namespace StreamHelper {
static constexpr const size_t CHUNK_SIZE = 10240; static constexpr const size_t CHUNK_SIZE = 10240;
void CopyStream(const void* src, FILE* dest, size_t len) { void CopyStream(const void* src, FILE* dest, size_t len) {

View File

@ -42,9 +42,31 @@
#endif #endif
#include <cstdio> #include <cstdio>
#include <type_traits>
#include <cinttypes>
#include <cstdint>
#include <cstdarg>
namespace LibCmo { namespace LibCmo {
namespace Utils {
namespace EnumsHelper {
template<typename TEnum>
inline TEnum FlagEnumAdd(TEnum e, ...) {
TEnum result = e;
va_list argptr;
va_start(argptr, e);
result = static_cast<TEnum>(static_cast<std::underlying_type_t<TEnum>>(result) | static_cast<std::underlying_type_t<TEnum>>(va_arg(argptr, TEnum)));
va_end(argptr);
return result;
}
template<typename TEnum>
inline bool FlagEnumHas(TEnum e, TEnum probe) {
return static_cast<bool>(static_cast<std::underlying_type_t<TEnum>>(e) & static_cast<std::underlying_type_t<TEnum>>(probe));
}
}
namespace StreamHelper {
void CopyStream(const void* src, FILE* dest, size_t len); void CopyStream(const void* src, FILE* dest, size_t len);
void CopyStream(FILE* src, void* dest, size_t len); void CopyStream(FILE* src, void* dest, size_t len);

View File

@ -1,7 +1,7 @@
#include "VxMemoryMappedFile.hpp" #include "VxMemoryMappedFile.hpp"
#include "VTEncoding.hpp" #include "VTEncoding.hpp"
namespace LibCmo { namespace LibCmo::VxMath {
VxMemoryMappedFile::VxMemoryMappedFile(const char* u8_filepath) : VxMemoryMappedFile::VxMemoryMappedFile(const char* u8_filepath) :
// init members // init members
@ -16,7 +16,7 @@ namespace LibCmo {
// save file path // save file path
#if defined(LIBCMO_OS_WIN32) #if defined(LIBCMO_OS_WIN32)
Encoding::SetStdPathFromU8Path(m_szFilePath, u8_filepath); EncodingHelper::SetStdPathFromU8Path(m_szFilePath, u8_filepath);
#else #else
this->m_szFilePath = u8_filepath; this->m_szFilePath = u8_filepath;
#endif #endif

View File

@ -10,7 +10,7 @@
#include <string> #include <string>
#include <filesystem> #include <filesystem>
namespace LibCmo { namespace LibCmo::VxMath {
class VxMemoryMappedFile { class VxMemoryMappedFile {
private: private:

View File

@ -11,40 +11,40 @@ namespace Unvirt {
const char c_InvalidEnumName[] = "[undefined]"; const char c_InvalidEnumName[] = "[undefined]";
namespace EnumDesc { namespace EnumDesc {
const EnumDescPairArray<LibCmo::CK_FILE_WRITEMODE> CK_FILE_WRITEMODE{ const EnumDescPairArray<LibCmo::CK2::CK_FILE_WRITEMODE> CK_FILE_WRITEMODE{
{ LibCmo::CK_FILE_WRITEMODE::CKFILE_UNCOMPRESSED, "CKFILE_UNCOMPRESSED" }, { LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_UNCOMPRESSED, "CKFILE_UNCOMPRESSED" },
{ LibCmo::CK_FILE_WRITEMODE::CKFILE_CHUNKCOMPRESSED_OLD, "CKFILE_CHUNKCOMPRESSED_OLD" }, { LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_CHUNKCOMPRESSED_OLD, "CKFILE_CHUNKCOMPRESSED_OLD" },
{ LibCmo::CK_FILE_WRITEMODE::CKFILE_EXTERNALTEXTURES_OLD, "CKFILE_EXTERNALTEXTURES_OLD" }, { LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_EXTERNALTEXTURES_OLD, "CKFILE_EXTERNALTEXTURES_OLD" },
{ LibCmo::CK_FILE_WRITEMODE::CKFILE_FORVIEWER, "CKFILE_FORVIEWER" }, { LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_FORVIEWER, "CKFILE_FORVIEWER" },
{ LibCmo::CK_FILE_WRITEMODE::CKFILE_WHOLECOMPRESSED, "CKFILE_WHOLECOMPRESSED" } { LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_WHOLECOMPRESSED, "CKFILE_WHOLECOMPRESSED" }
}; };
const EnumDescPairArray<LibCmo::CK_LOAD_FLAGS> CK_LOAD_FLAGS{ const EnumDescPairArray<LibCmo::CK2::CK_LOAD_FLAGS> CK_LOAD_FLAGS{
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_ANIMATION, "CK_LOAD_ANIMATION" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_ANIMATION, "CK_LOAD_ANIMATION" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_GEOMETRY, "CK_LOAD_GEOMETRY" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_GEOMETRY, "CK_LOAD_GEOMETRY" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_DEFAULT, "CK_LOAD_DEFAULT" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_DEFAULT, "CK_LOAD_DEFAULT" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_ASCHARACTER, "CK_LOAD_ASCHARACTER" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_ASCHARACTER, "CK_LOAD_ASCHARACTER" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_DODIALOG, "CK_LOAD_DODIALOG" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_DODIALOG, "CK_LOAD_DODIALOG" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_AS_DYNAMIC_OBJECT, "CK_LOAD_AS_DYNAMIC_OBJECT" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_AS_DYNAMIC_OBJECT, "CK_LOAD_AS_DYNAMIC_OBJECT" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_AUTOMATICMODE, "CK_LOAD_AUTOMATICMODE" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_AUTOMATICMODE, "CK_LOAD_AUTOMATICMODE" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_CHECKDUPLICATES, "CK_LOAD_CHECKDUPLICATES" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_CHECKDUPLICATES, "CK_LOAD_CHECKDUPLICATES" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES, "CK_LOAD_CHECKDEPENDENCIES" }, { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_CHECKDEPENDENCIES, "CK_LOAD_CHECKDEPENDENCIES" },
{ LibCmo::CK_LOAD_FLAGS::CK_LOAD_ONLYBEHAVIORS, "CK_LOAD_ONLYBEHAVIORS" } { LibCmo::CK2::CK_LOAD_FLAGS::CK_LOAD_ONLYBEHAVIORS, "CK_LOAD_ONLYBEHAVIORS" }
}; };
const EnumDescPairArray<LibCmo::CK_FO_OPTIONS> CK_FO_OPTIONS{ const EnumDescPairArray<LibCmo::CK2::CK_FO_OPTIONS> CK_FO_OPTIONS{
{ LibCmo::CK_FO_OPTIONS::CK_FO_DEFAULT, "CK_FO_DEFAULT" }, { LibCmo::CK2::CK_FO_OPTIONS::CK_FO_DEFAULT, "CK_FO_DEFAULT" },
{ LibCmo::CK_FO_OPTIONS::CK_FO_RENAMEOBJECT, "CK_FO_RENAMEOBJECT" }, { LibCmo::CK2::CK_FO_OPTIONS::CK_FO_RENAMEOBJECT, "CK_FO_RENAMEOBJECT" },
{ LibCmo::CK_FO_OPTIONS::CK_FO_REPLACEOBJECT, "CK_FO_REPLACEOBJECT" }, { LibCmo::CK2::CK_FO_OPTIONS::CK_FO_REPLACEOBJECT, "CK_FO_REPLACEOBJECT" },
{ LibCmo::CK_FO_OPTIONS::CK_FO_DONTLOADOBJECT, "CK_FO_DONTLOADOBJECT" } { LibCmo::CK2::CK_FO_OPTIONS::CK_FO_DONTLOADOBJECT, "CK_FO_DONTLOADOBJECT" }
}; };
const EnumDescPairArray<LibCmo::CK_PLUGIN_TYPE> CK_PLUGIN_TYPE{ const EnumDescPairArray<LibCmo::CK2::CK_PLUGIN_TYPE> CK_PLUGIN_TYPE{
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_BITMAP_READER, "CKPLUGIN_BITMAP_READER" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_BITMAP_READER, "CKPLUGIN_BITMAP_READER" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_SOUND_READER, "CKPLUGIN_SOUND_READER" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_SOUND_READER, "CKPLUGIN_SOUND_READER" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_MODEL_READER, "CKPLUGIN_MODEL_READER" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_MODEL_READER, "CKPLUGIN_MODEL_READER" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_MANAGER_DLL, "CKPLUGIN_MANAGER_DLL" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_MANAGER_DLL, "CKPLUGIN_MANAGER_DLL" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_BEHAVIOR_DLL, "CKPLUGIN_BEHAVIOR_DLL" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_BEHAVIOR_DLL, "CKPLUGIN_BEHAVIOR_DLL" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_RENDERENGINE_DLL, "CKPLUGIN_RENDERENGINE_DLL" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_RENDERENGINE_DLL, "CKPLUGIN_RENDERENGINE_DLL" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_MOVIE_READER, "CKPLUGIN_MOVIE_READER" }, { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_MOVIE_READER, "CKPLUGIN_MOVIE_READER" },
{ LibCmo::CK_PLUGIN_TYPE::CKPLUGIN_EXTENSION_DLL, "CKPLUGIN_EXTENSION_DLL" } { LibCmo::CK2::CK_PLUGIN_TYPE::CKPLUGIN_EXTENSION_DLL, "CKPLUGIN_EXTENSION_DLL" }
}; };
} }
@ -61,62 +61,62 @@ namespace Unvirt {
return nullptr; return nullptr;
} }
static const std::vector<std::pair<LibCmo::CKERROR, std::array<const char*, 2>>> _CkErrorData{ static const std::vector<std::pair<LibCmo::CK2::CKERROR, std::array<const char*, 2>>> _CkErrorData{
{ LibCmo::CKERROR::CKERR_OK, { "CKERR_OK", "Operation successful" } }, { LibCmo::CK2::CKERROR::CKERR_OK, { "CKERR_OK", "Operation successful" } },
{ LibCmo::CKERROR::CKERR_INVALIDPARAMETER, {"CKERR_INVALIDPARAMETER", "One of the parameter passed to the function was invalid"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDPARAMETER, {"CKERR_INVALIDPARAMETER", "One of the parameter passed to the function was invalid"} },
{ LibCmo::CKERROR::CKERR_INVALIDPARAMETERTYPE, {"CKERR_INVALIDPARAMETERTYPE", "One of the parameter passed to the function was invalid"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDPARAMETERTYPE, {"CKERR_INVALIDPARAMETERTYPE", "One of the parameter passed to the function was invalid"} },
{ LibCmo::CKERROR::CKERR_INVALIDSIZE, {"CKERR_INVALIDSIZE", "The parameter size was invalid"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDSIZE, {"CKERR_INVALIDSIZE", "The parameter size was invalid"} },
{ LibCmo::CKERROR::CKERR_INVALIDOPERATION, {"CKERR_INVALIDOPERATION", "The operation type didn't exist"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDOPERATION, {"CKERR_INVALIDOPERATION", "The operation type didn't exist"} },
{ LibCmo::CKERROR::CKERR_OPERATIONNOTIMPLEMENTED, {"CKERR_OPERATIONNOTIMPLEMENTED", "The function used to execute the operation is not yet implemented"} }, { LibCmo::CK2::CKERROR::CKERR_OPERATIONNOTIMPLEMENTED, {"CKERR_OPERATIONNOTIMPLEMENTED", "The function used to execute the operation is not yet implemented"} },
{ LibCmo::CKERROR::CKERR_OUTOFMEMORY, {"CKERR_OUTOFMEMORY", "There was not enough memory to perform the action"} }, { LibCmo::CK2::CKERROR::CKERR_OUTOFMEMORY, {"CKERR_OUTOFMEMORY", "There was not enough memory to perform the action"} },
{ LibCmo::CKERROR::CKERR_NOTIMPLEMENTED, {"CKERR_NOTIMPLEMENTED", "The function is not yet implemented"} }, { LibCmo::CK2::CKERROR::CKERR_NOTIMPLEMENTED, {"CKERR_NOTIMPLEMENTED", "The function is not yet implemented"} },
{ LibCmo::CKERROR::CKERR_NOTFOUND, {"CKERR_NOTFOUND", "There was an attempt to remove something not present"} }, { LibCmo::CK2::CKERROR::CKERR_NOTFOUND, {"CKERR_NOTFOUND", "There was an attempt to remove something not present"} },
{ LibCmo::CKERROR::CKERR_NOLEVEL, {"CKERR_NOLEVEL", "There is no level currently created"} }, { LibCmo::CK2::CKERROR::CKERR_NOLEVEL, {"CKERR_NOLEVEL", "There is no level currently created"} },
{ LibCmo::CKERROR::CKERR_CANCREATERENDERCONTEXT, {"CKERR_CANCREATERENDERCONTEXT", ""} }, { LibCmo::CK2::CKERROR::CKERR_CANCREATERENDERCONTEXT, {"CKERR_CANCREATERENDERCONTEXT", ""} },
{ LibCmo::CKERROR::CKERR_NOTIFICATIONNOTHANDLED, {"CKERR_NOTIFICATIONNOTHANDLED", "The notification message was not used"} }, { LibCmo::CK2::CKERROR::CKERR_NOTIFICATIONNOTHANDLED, {"CKERR_NOTIFICATIONNOTHANDLED", "The notification message was not used"} },
{ LibCmo::CKERROR::CKERR_ALREADYPRESENT, {"CKERR_ALREADYPRESENT", "Attempt to add an item that was already present"} }, { LibCmo::CK2::CKERROR::CKERR_ALREADYPRESENT, {"CKERR_ALREADYPRESENT", "Attempt to add an item that was already present"} },
{ LibCmo::CKERROR::CKERR_INVALIDRENDERCONTEXT, {"CKERR_INVALIDRENDERCONTEXT", "the render context is not valid"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDRENDERCONTEXT, {"CKERR_INVALIDRENDERCONTEXT", "the render context is not valid"} },
{ LibCmo::CKERROR::CKERR_RENDERCONTEXTINACTIVE, {"CKERR_RENDERCONTEXTINACTIVE", "the render context is not activated for rendering"} }, { LibCmo::CK2::CKERROR::CKERR_RENDERCONTEXTINACTIVE, {"CKERR_RENDERCONTEXTINACTIVE", "the render context is not activated for rendering"} },
{ LibCmo::CKERROR::CKERR_NOLOADPLUGINS, {"CKERR_NOLOADPLUGINS", "there was no plugins to load this kind of file"} }, { LibCmo::CK2::CKERROR::CKERR_NOLOADPLUGINS, {"CKERR_NOLOADPLUGINS", "there was no plugins to load this kind of file"} },
{ LibCmo::CKERROR::CKERR_NOSAVEPLUGINS, {"CKERR_NOSAVEPLUGINS", "there was no plugins to save this kind of file"} }, { LibCmo::CK2::CKERROR::CKERR_NOSAVEPLUGINS, {"CKERR_NOSAVEPLUGINS", "there was no plugins to save this kind of file"} },
{ LibCmo::CKERROR::CKERR_INVALIDFILE, {"CKERR_INVALIDFILE", "attempt to load an invalid file"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDFILE, {"CKERR_INVALIDFILE", "attempt to load an invalid file"} },
{ LibCmo::CKERROR::CKERR_INVALIDPLUGIN, {"CKERR_INVALIDPLUGIN", "attempt to load with an invalid plugin"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDPLUGIN, {"CKERR_INVALIDPLUGIN", "attempt to load with an invalid plugin"} },
{ LibCmo::CKERROR::CKERR_NOTINITIALIZED, {"CKERR_NOTINITIALIZED", "attempt use an object that wasnt initialized"} }, { LibCmo::CK2::CKERROR::CKERR_NOTINITIALIZED, {"CKERR_NOTINITIALIZED", "attempt use an object that wasnt initialized"} },
{ LibCmo::CKERROR::CKERR_INVALIDMESSAGE, {"CKERR_INVALIDMESSAGE", "attempt use a message type that wasn't registred"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDMESSAGE, {"CKERR_INVALIDMESSAGE", "attempt use a message type that wasn't registred"} },
{ LibCmo::CKERROR::CKERR_INVALIDPROTOTYPE, {"CKERR_INVALIDPROTOTYPE", "attempt use an invalid prototype"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDPROTOTYPE, {"CKERR_INVALIDPROTOTYPE", "attempt use an invalid prototype"} },
{ LibCmo::CKERROR::CKERR_NODLLFOUND, {"CKERR_NODLLFOUND", "No dll file found in the parse directory"} }, { LibCmo::CK2::CKERROR::CKERR_NODLLFOUND, {"CKERR_NODLLFOUND", "No dll file found in the parse directory"} },
{ LibCmo::CKERROR::CKERR_ALREADYREGISTREDDLL, {"CKERR_ALREADYREGISTREDDLL", "this dll has already been registred"} }, { LibCmo::CK2::CKERROR::CKERR_ALREADYREGISTREDDLL, {"CKERR_ALREADYREGISTREDDLL", "this dll has already been registred"} },
{ LibCmo::CKERROR::CKERR_INVALIDDLL, {"CKERR_INVALIDDLL", "this dll does not contain information to create the prototype"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDDLL, {"CKERR_INVALIDDLL", "this dll does not contain information to create the prototype"} },
{ LibCmo::CKERROR::CKERR_INVALIDOBJECT, {"CKERR_INVALIDOBJECT", "Invalid Object (attempt to Get an object from an invalid ID)"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDOBJECT, {"CKERR_INVALIDOBJECT", "Invalid Object (attempt to Get an object from an invalid ID)"} },
{ LibCmo::CKERROR::CKERR_INVALIDCONDSOLEWINDOW, {"CKERR_INVALIDCONDSOLEWINDOW", "Invalid window was provided as console window"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDCONDSOLEWINDOW, {"CKERR_INVALIDCONDSOLEWINDOW", "Invalid window was provided as console window"} },
{ LibCmo::CKERROR::CKERR_INVALIDKINEMATICCHAIN, {"CKERR_INVALIDKINEMATICCHAIN", "Invalid kinematic chain ( end and start effector may not be part of the same hierarchy )"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDKINEMATICCHAIN, {"CKERR_INVALIDKINEMATICCHAIN", "Invalid kinematic chain ( end and start effector may not be part of the same hierarchy )"} },
{ LibCmo::CKERROR::CKERR_NOKEYBOARD, {"CKERR_NOKEYBOARD", "Keyboard not attached or not working properly"} }, { LibCmo::CK2::CKERROR::CKERR_NOKEYBOARD, {"CKERR_NOKEYBOARD", "Keyboard not attached or not working properly"} },
{ LibCmo::CKERROR::CKERR_NOMOUSE, {"CKERR_NOMOUSE", "Mouse not attached or not working properly"} }, { LibCmo::CK2::CKERROR::CKERR_NOMOUSE, {"CKERR_NOMOUSE", "Mouse not attached or not working properly"} },
{ LibCmo::CKERROR::CKERR_NOJOYSTICK, {"CKERR_NOJOYSTICK", "Joystick not attached or not working properly"} }, { LibCmo::CK2::CKERROR::CKERR_NOJOYSTICK, {"CKERR_NOJOYSTICK", "Joystick not attached or not working properly"} },
{ LibCmo::CKERROR::CKERR_INCOMPATIBLEPARAMETERS, {"CKERR_INCOMPATIBLEPARAMETERS", "Try to link imcompatible Parameters"} }, { LibCmo::CK2::CKERROR::CKERR_INCOMPATIBLEPARAMETERS, {"CKERR_INCOMPATIBLEPARAMETERS", "Try to link imcompatible Parameters"} },
{ LibCmo::CKERROR::CKERR_NORENDERENGINE, {"CKERR_NORENDERENGINE", "There is no render engine dll"} }, { LibCmo::CK2::CKERROR::CKERR_NORENDERENGINE, {"CKERR_NORENDERENGINE", "There is no render engine dll"} },
{ LibCmo::CKERROR::CKERR_NOCURRENTLEVEL, {"CKERR_NOCURRENTLEVEL", "There is no current level (use CKSetCurrentLevel )"} }, { LibCmo::CK2::CKERROR::CKERR_NOCURRENTLEVEL, {"CKERR_NOCURRENTLEVEL", "There is no current level (use CKSetCurrentLevel )"} },
{ LibCmo::CKERROR::CKERR_SOUNDDISABLED, {"CKERR_SOUNDDISABLED", "Sound Management has been disabled"} }, { LibCmo::CK2::CKERROR::CKERR_SOUNDDISABLED, {"CKERR_SOUNDDISABLED", "Sound Management has been disabled"} },
{ LibCmo::CKERROR::CKERR_DINPUTDISABLED, {"CKERR_DINPUTDISABLED", "DirectInput Management has been disabled"} }, { LibCmo::CK2::CKERROR::CKERR_DINPUTDISABLED, {"CKERR_DINPUTDISABLED", "DirectInput Management has been disabled"} },
{ LibCmo::CKERROR::CKERR_INVALIDGUID, {"CKERR_INVALIDGUID", "Guid is already in use or invalid"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDGUID, {"CKERR_INVALIDGUID", "Guid is already in use or invalid"} },
{ LibCmo::CKERROR::CKERR_NOTENOUGHDISKPLACE, {"CKERR_NOTENOUGHDISKPLACE", "There was no more free space on disk when trying to save a file"} }, { LibCmo::CK2::CKERROR::CKERR_NOTENOUGHDISKPLACE, {"CKERR_NOTENOUGHDISKPLACE", "There was no more free space on disk when trying to save a file"} },
{ LibCmo::CKERROR::CKERR_CANTWRITETOFILE, {"CKERR_CANTWRITETOFILE", "Impossible to write to file (write-protection ?)"} }, { LibCmo::CK2::CKERROR::CKERR_CANTWRITETOFILE, {"CKERR_CANTWRITETOFILE", "Impossible to write to file (write-protection ?)"} },
{ LibCmo::CKERROR::CKERR_BEHAVIORADDDENIEDBYCB, {"CKERR_BEHAVIORADDDENIEDBYCB", "The behavior cannnot be added to this entity"} }, { LibCmo::CK2::CKERROR::CKERR_BEHAVIORADDDENIEDBYCB, {"CKERR_BEHAVIORADDDENIEDBYCB", "The behavior cannnot be added to this entity"} },
{ LibCmo::CKERROR::CKERR_INCOMPATIBLECLASSID, {"CKERR_INCOMPATIBLECLASSID", "The behavior cannnot be added to this entity"} }, { LibCmo::CK2::CKERROR::CKERR_INCOMPATIBLECLASSID, {"CKERR_INCOMPATIBLECLASSID", "The behavior cannnot be added to this entity"} },
{ LibCmo::CKERROR::CKERR_MANAGERALREADYEXISTS, {"CKERR_MANAGERALREADYEXISTS", "A manager was registered more than once"} }, { LibCmo::CK2::CKERROR::CKERR_MANAGERALREADYEXISTS, {"CKERR_MANAGERALREADYEXISTS", "A manager was registered more than once"} },
{ LibCmo::CKERROR::CKERR_PAUSED, {"CKERR_PAUSED", "CKprocess or TimeManager process while CK is paused will fail"} }, { LibCmo::CK2::CKERROR::CKERR_PAUSED, {"CKERR_PAUSED", "CKprocess or TimeManager process while CK is paused will fail"} },
{ LibCmo::CKERROR::CKERR_PLUGINSMISSING, {"CKERR_PLUGINSMISSING", "Some plugins were missing whileloading a file"} }, { LibCmo::CK2::CKERROR::CKERR_PLUGINSMISSING, {"CKERR_PLUGINSMISSING", "Some plugins were missing whileloading a file"} },
{ LibCmo::CKERROR::CKERR_OBSOLETEVIRTOOLS, {"CKERR_OBSOLETEVIRTOOLS", "Virtools version too old to load this file"} }, { LibCmo::CK2::CKERROR::CKERR_OBSOLETEVIRTOOLS, {"CKERR_OBSOLETEVIRTOOLS", "Virtools version too old to load this file"} },
{ LibCmo::CKERROR::CKERR_FILECRCERROR, {"CKERR_FILECRCERROR", "CRC Error while loading file"} }, { LibCmo::CK2::CKERROR::CKERR_FILECRCERROR, {"CKERR_FILECRCERROR", "CRC Error while loading file"} },
{ LibCmo::CKERROR::CKERR_ALREADYFULLSCREEN, {"CKERR_ALREADYFULLSCREEN", "A Render context is already in Fullscreen Mode"} }, { LibCmo::CK2::CKERROR::CKERR_ALREADYFULLSCREEN, {"CKERR_ALREADYFULLSCREEN", "A Render context is already in Fullscreen Mode"} },
{ LibCmo::CKERROR::CKERR_CANCELLED, {"CKERR_CANCELLED", "Operation was cancelled by user"} }, { LibCmo::CK2::CKERROR::CKERR_CANCELLED, {"CKERR_CANCELLED", "Operation was cancelled by user"} },
{ LibCmo::CKERROR::CKERR_NOANIMATIONKEY, {"CKERR_NOANIMATIONKEY", "there were no animation key at the given index"} }, { LibCmo::CK2::CKERROR::CKERR_NOANIMATIONKEY, {"CKERR_NOANIMATIONKEY", "there were no animation key at the given index"} },
{ LibCmo::CKERROR::CKERR_INVALIDINDEX, {"CKERR_INVALIDINDEX", "attemp to acces an animation key with an invalid index"} }, { LibCmo::CK2::CKERROR::CKERR_INVALIDINDEX, {"CKERR_INVALIDINDEX", "attemp to acces an animation key with an invalid index"} },
{ LibCmo::CKERROR::CKERR_INVALIDANIMATION, {"CKERR_INVALIDANIMATION", "the animation is invalid (no entity associated or zero length)"} } { LibCmo::CK2::CKERROR::CKERR_INVALIDANIMATION, {"CKERR_INVALIDANIMATION", "the animation is invalid (no entity associated or zero length)"} }
}; };
void GetCkErrorName(std::string& strl, LibCmo::CKERROR err) { void GetCkErrorName(std::string& strl, LibCmo::CK2::CKERROR err) {
const std::array<const char*, 2>* pErrDesc = GetEnumData<LibCmo::CKERROR, std::array<const char*, 2>>( const std::array<const char*, 2>* pErrDesc = GetEnumData<LibCmo::CK2::CKERROR, std::array<const char*, 2>>(
_CkErrorData, err _CkErrorData, err
); );
@ -127,8 +127,8 @@ namespace Unvirt {
} }
} }
void GetCkErrorDescription(std::string& strl, LibCmo::CKERROR err) { void GetCkErrorDescription(std::string& strl, LibCmo::CK2::CKERROR err) {
const std::array<const char*, 2>* pErrDesc = GetEnumData<LibCmo::CKERROR, std::array<const char*, 2>>( const std::array<const char*, 2>* pErrDesc = GetEnumData<LibCmo::CK2::CKERROR, std::array<const char*, 2>>(
_CkErrorData, err _CkErrorData, err
); );
@ -139,78 +139,78 @@ namespace Unvirt {
} }
} }
static const std::vector<std::pair<LibCmo::CK_CLASSID, std::vector<const char*>>> _CkClassHierarchy{ static const std::vector<std::pair<LibCmo::CK2::CK_CLASSID, std::vector<const char*>>> _CkClassHierarchy{
{ LibCmo::CK_CLASSID::CKCID_OBJECT, {"CKCID_OBJECT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_OBJECT, {"CKCID_OBJECT"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETERIN, {"CKCID_OBJECT", "CKCID_PARAMETERIN"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETERIN, {"CKCID_OBJECT", "CKCID_PARAMETERIN"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETEROPERATION, {"CKCID_OBJECT", "CKCID_PARAMETEROPERATION"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETEROPERATION, {"CKCID_OBJECT", "CKCID_PARAMETEROPERATION"} },
{ LibCmo::CK_CLASSID::CKCID_STATE, {"CKCID_OBJECT", "CKCID_STATE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_STATE, {"CKCID_OBJECT", "CKCID_STATE"} },
{ LibCmo::CK_CLASSID::CKCID_BEHAVIORLINK, {"CKCID_OBJECT", "CKCID_BEHAVIORLINK"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BEHAVIORLINK, {"CKCID_OBJECT", "CKCID_BEHAVIORLINK"} },
{ LibCmo::CK_CLASSID::CKCID_BEHAVIOR, {"CKCID_OBJECT", "CKCID_BEHAVIOR"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BEHAVIOR, {"CKCID_OBJECT", "CKCID_BEHAVIOR"} },
{ LibCmo::CK_CLASSID::CKCID_BEHAVIORIO, {"CKCID_OBJECT", "CKCID_BEHAVIORIO"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BEHAVIORIO, {"CKCID_OBJECT", "CKCID_BEHAVIORIO"} },
{ LibCmo::CK_CLASSID::CKCID_RENDERCONTEXT, {"CKCID_OBJECT", "CKCID_RENDERCONTEXT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_RENDERCONTEXT, {"CKCID_OBJECT", "CKCID_RENDERCONTEXT"} },
{ LibCmo::CK_CLASSID::CKCID_KINEMATICCHAIN, {"CKCID_OBJECT", "CKCID_KINEMATICCHAIN"} }, { LibCmo::CK2::CK_CLASSID::CKCID_KINEMATICCHAIN, {"CKCID_OBJECT", "CKCID_KINEMATICCHAIN"} },
{ LibCmo::CK_CLASSID::CKCID_SCENEOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SCENEOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT"} },
{ LibCmo::CK_CLASSID::CKCID_OBJECTANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_OBJECTANIMATION"} }, { LibCmo::CK2::CK_CLASSID::CKCID_OBJECTANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_OBJECTANIMATION"} },
{ LibCmo::CK_CLASSID::CKCID_ANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_ANIMATION"} }, { LibCmo::CK2::CK_CLASSID::CKCID_ANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_ANIMATION"} },
{ LibCmo::CK_CLASSID::CKCID_KEYEDANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_ANIMATION", "CKCID_KEYEDANIMATION"} }, { LibCmo::CK2::CK_CLASSID::CKCID_KEYEDANIMATION, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_ANIMATION", "CKCID_KEYEDANIMATION"} },
{ LibCmo::CK_CLASSID::CKCID_BEOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BEOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT"} },
{ LibCmo::CK_CLASSID::CKCID_DATAARRAY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_DATAARRAY"} }, { LibCmo::CK2::CK_CLASSID::CKCID_DATAARRAY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_DATAARRAY"} },
{ LibCmo::CK_CLASSID::CKCID_SCENE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SCENE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SCENE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SCENE"} },
{ LibCmo::CK_CLASSID::CKCID_LEVEL, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_LEVEL"} }, { LibCmo::CK2::CK_CLASSID::CKCID_LEVEL, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_LEVEL"} },
{ LibCmo::CK_CLASSID::CKCID_PLACE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_PLACE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PLACE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_PLACE"} },
{ LibCmo::CK_CLASSID::CKCID_GROUP, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_GROUP"} }, { LibCmo::CK2::CK_CLASSID::CKCID_GROUP, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_GROUP"} },
{ LibCmo::CK_CLASSID::CKCID_SOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND"} },
{ LibCmo::CK_CLASSID::CKCID_WAVESOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND", "CKCID_WAVESOUND"} }, { LibCmo::CK2::CK_CLASSID::CKCID_WAVESOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND", "CKCID_WAVESOUND"} },
{ LibCmo::CK_CLASSID::CKCID_MIDISOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND", "CKCID_MIDISOUND"} }, { LibCmo::CK2::CK_CLASSID::CKCID_MIDISOUND, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_SOUND", "CKCID_MIDISOUND"} },
{ LibCmo::CK_CLASSID::CKCID_MATERIAL, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MATERIAL"} }, { LibCmo::CK2::CK_CLASSID::CKCID_MATERIAL, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MATERIAL"} },
{ LibCmo::CK_CLASSID::CKCID_TEXTURE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_TEXTURE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_TEXTURE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_TEXTURE"} },
{ LibCmo::CK_CLASSID::CKCID_MESH, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MESH"} }, { LibCmo::CK2::CK_CLASSID::CKCID_MESH, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MESH"} },
{ LibCmo::CK_CLASSID::CKCID_PATCHMESH, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MESH", "CKCID_PATCHMESH"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PATCHMESH, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_MESH", "CKCID_PATCHMESH"} },
{ LibCmo::CK_CLASSID::CKCID_RENDEROBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_RENDEROBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT"} },
{ LibCmo::CK_CLASSID::CKCID_2DENTITY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY"} }, { LibCmo::CK2::CK_CLASSID::CKCID_2DENTITY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY"} },
{ LibCmo::CK_CLASSID::CKCID_SPRITE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY", "CKCID_SPRITE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SPRITE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY", "CKCID_SPRITE"} },
{ LibCmo::CK_CLASSID::CKCID_SPRITETEXT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY", "CKCID_SPRITETEXT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SPRITETEXT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_RENDEROBJECT", "CKCID_2DENTITY", "CKCID_SPRITETEXT"} },
{ LibCmo::CK_CLASSID::CKCID_3DENTITY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY"} }, { LibCmo::CK2::CK_CLASSID::CKCID_3DENTITY, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY"} },
{ LibCmo::CK_CLASSID::CKCID_GRID, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_GRID"} }, { LibCmo::CK2::CK_CLASSID::CKCID_GRID, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_GRID"} },
{ LibCmo::CK_CLASSID::CKCID_CURVEPOINT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CURVEPOINT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CURVEPOINT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CURVEPOINT"} },
{ LibCmo::CK_CLASSID::CKCID_SPRITE3D, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_SPRITE3D"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SPRITE3D, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_SPRITE3D"} },
{ LibCmo::CK_CLASSID::CKCID_CURVE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CURVE"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CURVE, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CURVE"} },
{ LibCmo::CK_CLASSID::CKCID_CAMERA, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CAMERA"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CAMERA, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CAMERA"} },
{ LibCmo::CK_CLASSID::CKCID_TARGETCAMERA, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CAMERA", "CKCID_TARGETCAMERA"} }, { LibCmo::CK2::CK_CLASSID::CKCID_TARGETCAMERA, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CAMERA", "CKCID_TARGETCAMERA"} },
{ LibCmo::CK_CLASSID::CKCID_LIGHT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_LIGHT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_LIGHT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_LIGHT"} },
{ LibCmo::CK_CLASSID::CKCID_TARGETLIGHT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_LIGHT", "CKCID_TARGETLIGHT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_TARGETLIGHT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_LIGHT", "CKCID_TARGETLIGHT"} },
{ LibCmo::CK_CLASSID::CKCID_CHARACTER, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CHARACTER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CHARACTER, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_CHARACTER"} },
{ LibCmo::CK_CLASSID::CKCID_3DOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_3DOBJECT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_3DOBJECT, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_3DOBJECT"} },
{ LibCmo::CK_CLASSID::CKCID_BODYPART, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_3DOBJECT", "CKCID_BODYPART"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BODYPART, {"CKCID_OBJECT", "CKCID_SCENEOBJECT", "CKCID_BEOBJECT", "CKCID_3DENTITY", "CKCID_3DOBJECT", "CKCID_BODYPART"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETER, {"CKCID_OBJECT", "CKCID_PARAMETER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETER, {"CKCID_OBJECT", "CKCID_PARAMETER"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETERLOCAL, {"CKCID_OBJECT", "CKCID_PARAMETER", "CKCID_PARAMETERLOCAL"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETERLOCAL, {"CKCID_OBJECT", "CKCID_PARAMETER", "CKCID_PARAMETERLOCAL"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETEROUT, {"CKCID_OBJECT", "CKCID_PARAMETER", "CKCID_PARAMETEROUT"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETEROUT, {"CKCID_OBJECT", "CKCID_PARAMETER", "CKCID_PARAMETEROUT"} },
{ LibCmo::CK_CLASSID::CKCID_INTERFACEOBJECTMANAGER, {"CKCID_OBJECT", "CKCID_INTERFACEOBJECTMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_INTERFACEOBJECTMANAGER, {"CKCID_OBJECT", "CKCID_INTERFACEOBJECTMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_CRITICALSECTION, {"CKCID_OBJECT", "CKCID_CRITICALSECTION"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CRITICALSECTION, {"CKCID_OBJECT", "CKCID_CRITICALSECTION"} },
{ LibCmo::CK_CLASSID::CKCID_LAYER, {"CKCID_OBJECT", "CKCID_LAYER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_LAYER, {"CKCID_OBJECT", "CKCID_LAYER"} },
{ LibCmo::CK_CLASSID::CKCID_PROGRESSIVEMESH, {"CKCID_OBJECT", "CKCID_PROGRESSIVEMESH"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PROGRESSIVEMESH, {"CKCID_OBJECT", "CKCID_PROGRESSIVEMESH"} },
{ LibCmo::CK_CLASSID::CKCID_SYNCHRO, {"CKCID_OBJECT", "CKCID_SYNCHRO"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SYNCHRO, {"CKCID_OBJECT", "CKCID_SYNCHRO"} },
{ LibCmo::CK_CLASSID::CKCID_OBJECTARRAY, {"CKCID_OBJECTARRAY"} }, { LibCmo::CK2::CK_CLASSID::CKCID_OBJECTARRAY, {"CKCID_OBJECTARRAY"} },
{ LibCmo::CK_CLASSID::CKCID_SCENEOBJECTDESC, {"CKCID_SCENEOBJECTDESC"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SCENEOBJECTDESC, {"CKCID_SCENEOBJECTDESC"} },
{ LibCmo::CK_CLASSID::CKCID_ATTRIBUTEMANAGER, {"CKCID_ATTRIBUTEMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_ATTRIBUTEMANAGER, {"CKCID_ATTRIBUTEMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_MESSAGEMANAGER, {"CKCID_MESSAGEMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_MESSAGEMANAGER, {"CKCID_MESSAGEMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_COLLISIONMANAGER, {"CKCID_COLLISIONMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_COLLISIONMANAGER, {"CKCID_COLLISIONMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_OBJECTMANAGER, {"CKCID_OBJECTMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_OBJECTMANAGER, {"CKCID_OBJECTMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_FLOORMANAGER, {"CKCID_FLOORMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_FLOORMANAGER, {"CKCID_FLOORMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_RENDERMANAGER, {"CKCID_RENDERMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_RENDERMANAGER, {"CKCID_RENDERMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_BEHAVIORMANAGER, {"CKCID_BEHAVIORMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_BEHAVIORMANAGER, {"CKCID_BEHAVIORMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_INPUTMANAGER, {"CKCID_INPUTMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_INPUTMANAGER, {"CKCID_INPUTMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_PARAMETERMANAGER, {"CKCID_PARAMETERMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_PARAMETERMANAGER, {"CKCID_PARAMETERMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_GRIDMANAGER, {"CKCID_GRIDMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_GRIDMANAGER, {"CKCID_GRIDMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_SOUNDMANAGER, {"CKCID_SOUNDMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_SOUNDMANAGER, {"CKCID_SOUNDMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_TIMEMANAGER, {"CKCID_TIMEMANAGER"} }, { LibCmo::CK2::CK_CLASSID::CKCID_TIMEMANAGER, {"CKCID_TIMEMANAGER"} },
{ LibCmo::CK_CLASSID::CKCID_CUIKBEHDATA, {"CKCID_CUIKBEHDATA"} }, { LibCmo::CK2::CK_CLASSID::CKCID_CUIKBEHDATA, {"CKCID_CUIKBEHDATA"} },
{ LibCmo::CK_CLASSID::CKCID_MAXCLASSID, {"CKCID_MAXCLASSID"} }, { LibCmo::CK2::CK_CLASSID::CKCID_MAXCLASSID, {"CKCID_MAXCLASSID"} },
{ LibCmo::CK_CLASSID::CKCID_MAXMAXCLASSID, {"CKCID_MAXMAXCLASSID"} } { LibCmo::CK2::CK_CLASSID::CKCID_MAXMAXCLASSID, {"CKCID_MAXMAXCLASSID"} }
}; };
void GetClassIdName(std::string& strl, LibCmo::CK_CLASSID cls) { void GetClassIdName(std::string& strl, LibCmo::CK2::CK_CLASSID cls) {
const std::vector<const char*>* pHierarchy = GetEnumData<LibCmo::CK_CLASSID, std::vector<const char*>>( const std::vector<const char*>* pHierarchy = GetEnumData<LibCmo::CK2::CK_CLASSID, std::vector<const char*>>(
_CkClassHierarchy, cls _CkClassHierarchy, cls
); );
@ -221,8 +221,8 @@ namespace Unvirt {
} }
} }
void GetClassIdHierarchy(std::string& strl, LibCmo::CK_CLASSID cls) { void GetClassIdHierarchy(std::string& strl, LibCmo::CK2::CK_CLASSID cls) {
const std::vector<const char*>* pHierarchy = GetEnumData<LibCmo::CK_CLASSID, std::vector<const char*>>( const std::vector<const char*>* pHierarchy = GetEnumData<LibCmo::CK2::CK_CLASSID, std::vector<const char*>>(
_CkClassHierarchy, cls _CkClassHierarchy, cls
); );

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <CKEnums.hpp> #include <CKEnums.hpp>
#include <VTUtils.hpp>
#include <vector> #include <vector>
#include <string> #include <string>
@ -15,10 +16,10 @@ namespace Unvirt {
using EnumDescPairArray = std::vector<std::pair<TEnum, const char*>>; using EnumDescPairArray = std::vector<std::pair<TEnum, const char*>>;
namespace EnumDesc { namespace EnumDesc {
extern const EnumDescPairArray<LibCmo::CK_FILE_WRITEMODE> CK_FILE_WRITEMODE; extern const EnumDescPairArray<LibCmo::CK2::CK_FILE_WRITEMODE> CK_FILE_WRITEMODE;
extern const EnumDescPairArray<LibCmo::CK_LOAD_FLAGS> CK_LOAD_FLAGS; extern const EnumDescPairArray<LibCmo::CK2::CK_LOAD_FLAGS> CK_LOAD_FLAGS;
extern const EnumDescPairArray<LibCmo::CK_FO_OPTIONS> CK_FO_OPTIONS; extern const EnumDescPairArray<LibCmo::CK2::CK_FO_OPTIONS> CK_FO_OPTIONS;
extern const EnumDescPairArray<LibCmo::CK_PLUGIN_TYPE> CK_PLUGIN_TYPE; extern const EnumDescPairArray<LibCmo::CK2::CK_PLUGIN_TYPE> CK_PLUGIN_TYPE;
} }
template<typename TEnum> template<typename TEnum>
@ -57,10 +58,10 @@ namespace Unvirt {
#pragma endregion #pragma endregion
void GetClassIdName(std::string& strl, LibCmo::CK_CLASSID cls); void GetClassIdName(std::string& strl, LibCmo::CK2::CK_CLASSID cls);
void GetCkErrorName(std::string& strl, LibCmo::CKERROR err); void GetCkErrorName(std::string& strl, LibCmo::CK2::CKERROR err);
void GetClassIdHierarchy(std::string& strl, LibCmo::CK_CLASSID cls); void GetClassIdHierarchy(std::string& strl, LibCmo::CK2::CK_CLASSID cls);
void GetCkErrorDescription(std::string& strl, LibCmo::CKERROR err); void GetCkErrorDescription(std::string& strl, LibCmo::CK2::CKERROR err);
void GetAccessibleFileSize(std::string& strl, uint64_t size); void GetAccessibleFileSize(std::string& strl, uint64_t size);

View File

@ -7,7 +7,7 @@ namespace Unvirt {
static FILE* fout = stdout; static FILE* fout = stdout;
void PrintCKFileInfo(const LibCmo::CKFileInfo& fileinfo) { void PrintCKFileInfo(const LibCmo::CK2::CKFileInfo& fileinfo) {
std::string container; std::string container;
fputs(UNVIRT_TERMCOL_LIGHT_YELLOW(("CKFileInfo\n")), fout); fputs(UNVIRT_TERMCOL_LIGHT_YELLOW(("CKFileInfo\n")), fout);
@ -18,7 +18,7 @@ namespace Unvirt {
(fileinfo.CKVersion >> 0) & 0xFFFF (fileinfo.CKVersion >> 0) & 0xFFFF
); );
LibCmo::CKDWORD product_series[4]{ LibCmo::CK2::CKDWORD product_series[4]{
(fileinfo.ProductBuild >> 24) & 0xFF, (fileinfo.ProductBuild >> 24) & 0xFF,
(fileinfo.ProductBuild >> 16) & 0xFF, (fileinfo.ProductBuild >> 16) & 0xFF,
(fileinfo.ProductBuild >> 8) & 0xFF, (fileinfo.ProductBuild >> 8) & 0xFF,
@ -28,7 +28,7 @@ namespace Unvirt {
fileinfo.ProductVersion, product_series[0], product_series[1], product_series[2], product_series[3] fileinfo.ProductVersion, product_series[0], product_series[1], product_series[2], product_series[3]
); );
Unvirt::AccessibleValue::GetFlagEnumName<LibCmo::CK_FILE_WRITEMODE>( Unvirt::AccessibleValue::GetFlagEnumName<LibCmo::CK2::CK_FILE_WRITEMODE>(
Unvirt::AccessibleValue::EnumDesc::CK_FILE_WRITEMODE, container, fileinfo.FileWriteMode Unvirt::AccessibleValue::EnumDesc::CK_FILE_WRITEMODE, container, fileinfo.FileWriteMode
); );
fprintf(fout, "Save Flags: %s\n", container.c_str()); fprintf(fout, "Save Flags: %s\n", container.c_str());

View File

@ -5,7 +5,7 @@
namespace Unvirt { namespace Unvirt {
namespace StructFormatter { namespace StructFormatter {
void PrintCKFileInfo(const LibCmo::CKFileInfo& fileinfo); void PrintCKFileInfo(const LibCmo::CK2::CKFileInfo& fileinfo);
} }
} }

View File

@ -1,7 +1,10 @@
#include "AccessibleValue.hpp" #include "AccessibleValue.hpp"
#include "TerminalHelper.hpp" #include "TerminalHelper.hpp"
#include "StructFormatter.hpp" #include "StructFormatter.hpp"
#include "CKMinContext.hpp"
#include "CKFile.hpp" #include "CKFile.hpp"
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
@ -9,13 +12,13 @@ int main(int argc, char* argv[]) {
Unvirt::TerminalHelper::EnsureTerminalColor(); Unvirt::TerminalHelper::EnsureTerminalColor();
Unvirt::TerminalHelper::EnsureTerminalEncoding(); Unvirt::TerminalHelper::EnsureTerminalEncoding();
LibCmo::CKMinContext vtctx; LibCmo::CK2::CKMinContext vtctx;
vtctx.SetTempPath("Temp"); vtctx.SetTempPath("Temp");
vtctx.SetEncoding("850"); vtctx.SetEncoding("850");
LibCmo::CKFile vtfile(&vtctx); LibCmo::CK2::CKFile vtfile(&vtctx);
LibCmo::CKFileData::ShallowDocument* doc; LibCmo::CK2::CKFileData::ShallowDocument* doc;
LibCmo::CKERROR err = vtfile.ShallowLoad("Language.old.nmo", &doc); LibCmo::CK2::CKERROR err = vtfile.ShallowLoad("Language.old.nmo", &doc);
if (doc) if (doc)
Unvirt::StructFormatter::PrintCKFileInfo(doc->m_FileInfo); Unvirt::StructFormatter::PrintCKFileInfo(doc->m_FileInfo);

View File

@ -103,6 +103,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -122,6 +123,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -141,6 +143,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -160,6 +163,7 @@
<AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ZLIB_PATH);../LibCmo;$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>