preparing Context creation function
This commit is contained in:
parent
00a7e041c6
commit
95cb1f7c30
|
@ -89,6 +89,39 @@ struct XBitArray {
|
||||||
DWORD m_Size;
|
DWORD m_Size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct VxImageDescEx {
|
||||||
|
int Size; // Size of the structure
|
||||||
|
DWORD Flags; // Reserved for special formats (such as compressed ) 0 otherwise
|
||||||
|
|
||||||
|
int Width; // Width in pixel of the image
|
||||||
|
int Height; // Height in pixel of the image
|
||||||
|
union {
|
||||||
|
int BytesPerLine; // Pitch (width in bytes) of the image
|
||||||
|
int TotalImageSize; // For compressed image (DXT1...) the total size of the image
|
||||||
|
};
|
||||||
|
int BitsPerPixel; // Number of bits per pixel
|
||||||
|
union {
|
||||||
|
DWORD RedMask; // Mask for Red component
|
||||||
|
DWORD BumpDuMask; // Mask for Bump Du component
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
DWORD GreenMask; // Mask for Green component
|
||||||
|
DWORD BumpDvMask; // Mask for Bump Dv component
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
DWORD BlueMask; // Mask for Blue component
|
||||||
|
DWORD BumpLumMask; // Mask for Luminance component
|
||||||
|
|
||||||
|
};
|
||||||
|
DWORD AlphaMask; // Mask for Alpha component
|
||||||
|
|
||||||
|
short BytesPerColorEntry; // ColorMap Stride
|
||||||
|
short ColorMapEntries; // If other than 0 image is palletized
|
||||||
|
|
||||||
|
BYTE* ColorMap; // Palette colors
|
||||||
|
BYTE* Image; // Image
|
||||||
|
};
|
||||||
|
|
||||||
// <T, K> = <int, CK_ID>
|
// <T, K> = <int, CK_ID>
|
||||||
typedef struct XFileObjectsTable::Entry {
|
typedef struct XFileObjectsTable::Entry {
|
||||||
CK_ID key;
|
CK_ID key;
|
||||||
|
|
|
@ -81,7 +81,47 @@ namespace LibCmo {
|
||||||
};
|
};
|
||||||
CKDWORD d[2];
|
CKDWORD d[2];
|
||||||
};
|
};
|
||||||
CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) { d[0] = gd1; d[1] = gd2; }
|
constexpr CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) : d1(gd1), d2(gd2) {}
|
||||||
|
CKGUID(const CKGUID& rhs) : d1(rhs.d1), d2(rhs.d2) {}
|
||||||
|
CKGUID& operator=(const CKGUID& rhs) {
|
||||||
|
this->d1 = rhs.d1;
|
||||||
|
this->d2 = rhs.d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator ==(const CKGUID& rhs) const {
|
||||||
|
return ((this->d1 == rhs.d1) && (this->d2 == rhs.d2));
|
||||||
|
}
|
||||||
|
bool operator !=(const CKGUID& rhs) const {
|
||||||
|
return ((this->d1 != rhs.d1) || (this->d2 != rhs.d2));
|
||||||
|
}
|
||||||
|
bool operator <(const CKGUID& rhs) const {
|
||||||
|
if (this->d1 < rhs.d1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->d1 == rhs.d1) {
|
||||||
|
return (this->d2 < rhs.d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool operator <=(const CKGUID& rhs) const {
|
||||||
|
return (this->d1 <= rhs.d1);
|
||||||
|
}
|
||||||
|
bool operator >(const CKGUID& rhs) const {
|
||||||
|
if (this->d1 > rhs.d1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->d1 == rhs.d1) {
|
||||||
|
return (this->d2 > rhs.d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool operator >=(const CKGUID& rhs) const {
|
||||||
|
return (this->d1 >= rhs.d1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,49 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "CKDefines.hpp"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace LibCmo::CK2 {
|
namespace LibCmo::CK2 {
|
||||||
|
|
||||||
|
namespace PredefinedGuids {
|
||||||
|
|
||||||
|
constexpr const CKDWORD OBJECT_MANAGER_GUID1 = 0x7cbb3b91;
|
||||||
|
constexpr const CKDWORD ATTRIBUTE_MANAGER_GUID1 = 0x3d242466;
|
||||||
|
constexpr const CKDWORD MESSAGE_MANAGER_GUID1 = 0x466a0fac;
|
||||||
|
constexpr const CKDWORD FLOOR_MANAGER_GUID1 = 0x420936f9;
|
||||||
|
constexpr const CKDWORD COLLISION_MANAGER_GUID1 = 0x38244712;
|
||||||
|
constexpr const CKDWORD GRID_MANAGER_GUID1 = 0x7f004791;
|
||||||
|
constexpr const CKDWORD TIME_MANAGER_GUID1 = 0x89ce7b32;
|
||||||
|
constexpr const CKDWORD BEHAVIOR_MANAGER_GUID1 = 0x58d621ae;
|
||||||
|
constexpr const CKDWORD INPUT_MANAGER_GUID1 = 0xf787c904;
|
||||||
|
constexpr const CKDWORD SOUND_MANAGER_GUID1 = 0xdce135f6;
|
||||||
|
constexpr const CKDWORD MIDI_MANAGER_GUID1 = 0x594154a6;
|
||||||
|
constexpr const CKDWORD INTERFACE_MANAGER_GUID1 = 0x9a4b8e3d;
|
||||||
|
constexpr const CKDWORD RENDER_MANAGER_GUID1 = 0xa213c8d5;
|
||||||
|
constexpr const CKDWORD PARAMETER_MANAGER_GUID1 = 0x9ce57ab6;
|
||||||
|
constexpr const CKDWORD PATH_MANAGER_GUID1 = 0x15fd54b9;
|
||||||
|
constexpr const CKDWORD VARIABLE_MANAGER_GUID1 = 0x98cc3cc9;
|
||||||
|
|
||||||
|
constexpr const CKGUID OBJECT_MANAGER_GUID{ OBJECT_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID ATTRIBUTE_MANAGER_GUID{ ATTRIBUTE_MANAGER_GUID1, 0 };
|
||||||
|
constexpr const CKGUID MESSAGE_MANAGER_GUID{ MESSAGE_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID TIME_MANAGER_GUID{ TIME_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID SOUND_MANAGER_GUID{ SOUND_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID MIDI_MANAGER_GUID{ MIDI_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID INPUT_MANAGER_GUID{ INPUT_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID BEHAVIOR_MANAGER_GUID{ BEHAVIOR_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID FLOOR_MANAGER_GUID{ FLOOR_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID COLLISION_MANAGER_GUID{ COLLISION_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID GRID_MANAGER_GUID{ GRID_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID INTERFACE_MANAGER_GUID{ INTERFACE_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID RENDER_MANAGER_GUID{ RENDER_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID PARAMETER_MANAGER_GUID{ PARAMETER_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID PATH_MANAGER_GUID{ PATH_MANAGER_GUID1 ,0 };
|
||||||
|
constexpr const CKGUID VARIABLE_MANAGER_GUID{ VARIABLE_MANAGER_GUID1 ,0 };
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
enum class CK_CLASSID : uint32_t {
|
enum class CK_CLASSID : uint32_t {
|
||||||
CKCID_OBJECT = 1,
|
CKCID_OBJECT = 1,
|
||||||
CKCID_PARAMETERIN = 2,
|
CKCID_PARAMETERIN = 2,
|
||||||
|
|
20
LibCmo/CKManagerImplements/CKBaseManager.cpp
Normal file
20
LibCmo/CKManagerImplements/CKBaseManager.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include "../CKManagers.hpp"
|
||||||
|
|
||||||
|
namespace LibCmo::CK2::CKManagerImplements {
|
||||||
|
|
||||||
|
CKBaseManager::CKBaseManager(CKMinContext* ctx, CK_ID ckid) {
|
||||||
|
|
||||||
|
}
|
||||||
|
CKBaseManager::~CKBaseManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CKAttributeManager::CKAttributeManager(CKMinContext* ctx, CK_ID ckid) : CKBaseManager(ctx, ckid) {
|
||||||
|
|
||||||
|
}
|
||||||
|
CKAttributeManager::~CKAttributeManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,20 +7,21 @@ namespace LibCmo::CK2::CKManagerImplements {
|
||||||
|
|
||||||
class CKBaseManager {
|
class CKBaseManager {
|
||||||
public:
|
public:
|
||||||
CKBaseManager();
|
CKBaseManager(CKMinContext* ctx, CK_ID ckid);
|
||||||
CKBaseManager(const CKBaseManager&) = delete;
|
CKBaseManager(const CKBaseManager&) = delete;
|
||||||
CKBaseManager& operator=(const CKBaseManager&) = delete;
|
CKBaseManager& operator=(const CKBaseManager&) = delete;
|
||||||
virtual ~CKBaseManager();
|
virtual ~CKBaseManager();
|
||||||
|
|
||||||
virtual CKERROR LoadData(CKStateChunk* statechunk, CKFileData::ShallowDocument* doc);
|
virtual CKERROR LoadData(CKStateChunk* statechunk, CKFileData::ShallowDocument* doc);
|
||||||
virtual CKStateChunk* SaveData(CKFileData::ShallowDocument* doc);
|
virtual CKStateChunk* SaveData(CKFileData::ShallowDocument* doc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CKAttributeManager {
|
class CKAttributeManager : public CKBaseManager {
|
||||||
public:
|
public:
|
||||||
CKAttributeManager();
|
CKAttributeManager(CKMinContext* ctx, CK_ID ckid);
|
||||||
CKAttributeManager(const CKAttributeManager&) = delete;
|
CKAttributeManager(const CKAttributeManager&) = delete;
|
||||||
CKAttributeManager& operator=(const CKAttributeManager&) = delete;
|
CKAttributeManager& operator=(const CKAttributeManager&) = delete;
|
||||||
virtual ~CKAttributeManager();
|
virtual ~CKAttributeManager();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "VTUtils.hpp"
|
#include "VTUtils.hpp"
|
||||||
#include "CKMinContext.hpp"
|
#include "CKMinContext.hpp"
|
||||||
|
#include "CKObjects.hpp"
|
||||||
|
#include "CKManagers.hpp"
|
||||||
|
|
||||||
namespace LibCmo::CK2 {
|
namespace LibCmo::CK2 {
|
||||||
|
|
||||||
|
@ -13,7 +15,24 @@ namespace LibCmo::CK2 {
|
||||||
CKMinContext::CKMinContext() :
|
CKMinContext::CKMinContext() :
|
||||||
m_NameEncoding(), m_NameEncodingToken(EncodingHelper::ENCODING_TOKEN_DEFAULT),
|
m_NameEncoding(), m_NameEncodingToken(EncodingHelper::ENCODING_TOKEN_DEFAULT),
|
||||||
m_TempFolder(),
|
m_TempFolder(),
|
||||||
m_PrintCallback(nullptr)
|
m_PrintCallback(nullptr),
|
||||||
|
// register CKObjects
|
||||||
|
m_ObjectsCreationMap{
|
||||||
|
{CK_CLASSID::CKCID_OBJECT, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKObject(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_SCENEOBJECT, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKSceneObject(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_BEOBJECT, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKBeObject(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_GROUP, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKGroup(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_MESH, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKMesh(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_TEXTURE, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKTexture(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_MATERIAL, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKMaterial(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_RENDEROBJECT, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CKRenderObject(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_3DENTITY, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CK3dEntity(ctx, id, name); })},
|
||||||
|
{CK_CLASSID::CKCID_3DOBJECT, ([](CKMinContext* ctx, CK_ID id, CKSTRING name) ->CKObjectImplements::CKObject* { return new(std::nothrow) CKObjectImplements::CK3dObject(ctx, id, name); })}
|
||||||
|
},
|
||||||
|
// register CKBaseManagers
|
||||||
|
m_ManagersCreationMap{
|
||||||
|
{PredefinedGuids::ATTRIBUTE_MANAGER_GUID, ([](CKMinContext* ctx, CK_ID id) ->CKManagerImplements::CKBaseManager* { return new(std::nothrow) CKManagerImplements::CKAttributeManager(ctx, id); })},
|
||||||
|
}
|
||||||
{
|
{
|
||||||
// preset for temp folder
|
// preset for temp folder
|
||||||
m_TempFolder = std::filesystem::temp_directory_path();
|
m_TempFolder = std::filesystem::temp_directory_path();
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CKDefines.hpp"
|
#include "CKDefines.hpp"
|
||||||
#include "CKObjects.hpp"
|
#include "CKEnums.hpp"
|
||||||
#include "VTEncoding.hpp"
|
#include "VTEncoding.hpp"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <map>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace LibCmo::CK2 {
|
namespace LibCmo::CK2 {
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ namespace LibCmo::CK2 {
|
||||||
void DestroyCKObject(CKObjectImplements::CKObject* obj);
|
void DestroyCKObject(CKObjectImplements::CKObject* obj);
|
||||||
|
|
||||||
CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid);
|
CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid);
|
||||||
CKManagerImplements::CKBaseManager* GetCKManager(CKGUID guid);
|
CKManagerImplements::CKBaseManager* GetCKManager(CK_ID guid);
|
||||||
void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr);
|
void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr);
|
||||||
|
|
||||||
void GetUtf8String(std::string& native_name, std::string& u8_name);
|
void GetUtf8String(std::string& native_name, std::string& u8_name);
|
||||||
|
@ -37,6 +39,12 @@ namespace LibCmo::CK2 {
|
||||||
private:
|
private:
|
||||||
void RefetchEncodingToken(void);
|
void RefetchEncodingToken(void);
|
||||||
|
|
||||||
|
std::map<CK_ID, CKObjectImplements::CKObject*> m_ObjectsList;
|
||||||
|
std::map<CK_ID, CKManagerImplements::CKBaseManager*> m_ManagersList;
|
||||||
|
|
||||||
|
std::map<CK_CLASSID, std::function<CKObjectImplements::CKObject* (CKMinContext*, CK_ID, CKSTRING)>> m_ObjectsCreationMap;
|
||||||
|
std::map<CKGUID, std::function<CKManagerImplements::CKBaseManager* (CKMinContext*, CK_ID)>> m_ManagersCreationMap;
|
||||||
|
|
||||||
std::string m_NameEncoding;
|
std::string m_NameEncoding;
|
||||||
EncodingHelper::ENCODING_TOKEN m_NameEncodingToken;
|
EncodingHelper::ENCODING_TOKEN m_NameEncodingToken;
|
||||||
std::filesystem::path m_TempFolder;
|
std::filesystem::path m_TempFolder;
|
||||||
|
|
|
@ -2,12 +2,55 @@
|
||||||
|
|
||||||
namespace LibCmo::CK2::CKObjectImplements {
|
namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
CKObject::CKObject() {
|
CKObject::CKObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name) :
|
||||||
|
m_ID(ckid), m_Context(ctx),
|
||||||
|
m_Name(name == nullptr ? "" : name), m_HasName(name != nullptr),
|
||||||
|
m_ObjectFlags(CK_OBJECT_FLAGS::CK_PARAMETERIN_DISABLED) {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
CKObject::~CKObject() {
|
CKObject::~CKObject() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CKSceneObject::CKSceneObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKSceneObject::~CKSceneObject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CKBeObject::CKBeObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKSceneObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKBeObject::~CKBeObject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CKGroup::CKGroup(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKBeObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKGroup::~CKGroup() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CKMesh::CKMesh(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKBeObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKMesh::~CKMesh() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CKTexture::CKTexture(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKBeObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKMaterial::~CKMaterial() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CKRenderObject::CKRenderObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKBeObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CKRenderObject::~CKRenderObject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CK3dEntity::CK3dEntity(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CKRenderObject(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CK3dEntity::~CK3dEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
CK3dObject::CK3dObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name) : CK3dEntity(ctx, ckid, name) {
|
||||||
|
}
|
||||||
|
CK3dObject::~CK3dObject() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,14 +7,18 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKObject {
|
class CKObject {
|
||||||
public:
|
public:
|
||||||
CKObject();
|
CKObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKObject(const CKObject&) = delete;
|
CKObject(const CKObject&) = delete;
|
||||||
CKObject& operator=(const CKObject&) = delete;
|
CKObject& operator=(const CKObject&) = delete;
|
||||||
virtual ~CKObject();
|
virtual ~CKObject();
|
||||||
|
|
||||||
CK_ID GetID(void) { return this->m_ID; }
|
CK_ID GetID(void) { return this->m_ID; }
|
||||||
CKSTRING GetName(void) { return this->m_Name.c_str(); }
|
CKSTRING GetName(void) { return m_HasName ? this->m_Name.c_str() : nullptr; }
|
||||||
void SetName(CKSTRING u8_name) { this->m_Name = u8_name; }
|
void SetName(CKSTRING u8_name) {
|
||||||
|
this->m_HasName = u8_name != nullptr;
|
||||||
|
if (this->m_HasName) this->m_Name = u8_name;
|
||||||
|
else this->m_Name.clear();
|
||||||
|
}
|
||||||
CK_OBJECT_FLAGS GetObjectFlags(void) { return this->m_ObjectFlags; }
|
CK_OBJECT_FLAGS GetObjectFlags(void) { return this->m_ObjectFlags; }
|
||||||
void SetObjectFlags(CK_OBJECT_FLAGS flags) { this->m_ObjectFlags = flags; }
|
void SetObjectFlags(CK_OBJECT_FLAGS flags) { this->m_ObjectFlags = flags; }
|
||||||
|
|
||||||
|
@ -24,13 +28,14 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
protected:
|
protected:
|
||||||
CK_ID m_ID;
|
CK_ID m_ID;
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
|
bool m_HasName;
|
||||||
CK_OBJECT_FLAGS m_ObjectFlags;
|
CK_OBJECT_FLAGS m_ObjectFlags;
|
||||||
CKMinContext* m_Context;
|
CKMinContext* m_Context;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CKSceneObject : public CKObject {
|
class CKSceneObject : public CKObject {
|
||||||
public:
|
public:
|
||||||
CKSceneObject();
|
CKSceneObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKSceneObject(const CKSceneObject&) = delete;
|
CKSceneObject(const CKSceneObject&) = delete;
|
||||||
CKSceneObject& operator=(const CKSceneObject&) = delete;
|
CKSceneObject& operator=(const CKSceneObject&) = delete;
|
||||||
virtual ~CKSceneObject();
|
virtual ~CKSceneObject();
|
||||||
|
@ -42,7 +47,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKBeObject : public CKSceneObject {
|
class CKBeObject : public CKSceneObject {
|
||||||
public:
|
public:
|
||||||
CKBeObject();
|
CKBeObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKBeObject(const CKBeObject&) = delete;
|
CKBeObject(const CKBeObject&) = delete;
|
||||||
CKBeObject& operator=(const CKBeObject&) = delete;
|
CKBeObject& operator=(const CKBeObject&) = delete;
|
||||||
virtual ~CKBeObject();
|
virtual ~CKBeObject();
|
||||||
|
@ -54,7 +59,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKGroup : public CKBeObject {
|
class CKGroup : public CKBeObject {
|
||||||
public:
|
public:
|
||||||
CKGroup();
|
CKGroup(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKGroup(const CKGroup&) = delete;
|
CKGroup(const CKGroup&) = delete;
|
||||||
CKGroup& operator=(const CKGroup&) = delete;
|
CKGroup& operator=(const CKGroup&) = delete;
|
||||||
virtual ~CKGroup();
|
virtual ~CKGroup();
|
||||||
|
@ -66,7 +71,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKMesh : public CKBeObject {
|
class CKMesh : public CKBeObject {
|
||||||
public:
|
public:
|
||||||
CKMesh();
|
CKMesh(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKMesh(const CKMesh&) = delete;
|
CKMesh(const CKMesh&) = delete;
|
||||||
CKMesh& operator=(const CKMesh&) = delete;
|
CKMesh& operator=(const CKMesh&) = delete;
|
||||||
virtual ~CKMesh();
|
virtual ~CKMesh();
|
||||||
|
@ -78,7 +83,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKTexture : public CKBeObject {
|
class CKTexture : public CKBeObject {
|
||||||
public:
|
public:
|
||||||
CKTexture();
|
CKTexture(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKTexture(const CKTexture&) = delete;
|
CKTexture(const CKTexture&) = delete;
|
||||||
CKTexture& operator=(const CKTexture&) = delete;
|
CKTexture& operator=(const CKTexture&) = delete;
|
||||||
virtual ~CKTexture();
|
virtual ~CKTexture();
|
||||||
|
@ -90,7 +95,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKMaterial : public CKBeObject {
|
class CKMaterial : public CKBeObject {
|
||||||
public:
|
public:
|
||||||
CKMaterial();
|
CKMaterial(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKMaterial(const CKMaterial&) = delete;
|
CKMaterial(const CKMaterial&) = delete;
|
||||||
CKMaterial& operator=(const CKMaterial&) = delete;
|
CKMaterial& operator=(const CKMaterial&) = delete;
|
||||||
virtual ~CKMaterial();
|
virtual ~CKMaterial();
|
||||||
|
@ -102,7 +107,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CKRenderObject : public CKBeObject {
|
class CKRenderObject : public CKBeObject {
|
||||||
public:
|
public:
|
||||||
CKRenderObject();
|
CKRenderObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CKRenderObject(const CKRenderObject&) = delete;
|
CKRenderObject(const CKRenderObject&) = delete;
|
||||||
CKRenderObject& operator=(const CKRenderObject&) = delete;
|
CKRenderObject& operator=(const CKRenderObject&) = delete;
|
||||||
~CKRenderObject();
|
~CKRenderObject();
|
||||||
|
@ -112,9 +117,9 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CK3dEntity : public CKBeObject {
|
class CK3dEntity : public CKRenderObject {
|
||||||
public:
|
public:
|
||||||
CK3dEntity();
|
CK3dEntity(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CK3dEntity(const CK3dEntity&) = delete;
|
CK3dEntity(const CK3dEntity&) = delete;
|
||||||
CK3dEntity& operator=(const CK3dEntity&) = delete;
|
CK3dEntity& operator=(const CK3dEntity&) = delete;
|
||||||
virtual ~CK3dEntity();
|
virtual ~CK3dEntity();
|
||||||
|
@ -126,7 +131,7 @@ namespace LibCmo::CK2::CKObjectImplements {
|
||||||
|
|
||||||
class CK3dObject :public CK3dEntity {
|
class CK3dObject :public CK3dEntity {
|
||||||
public:
|
public:
|
||||||
CK3dObject();
|
CK3dObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
|
||||||
CK3dObject(const CK3dObject&) = delete;
|
CK3dObject(const CK3dObject&) = delete;
|
||||||
CK3dObject& operator=(const CK3dObject&) = delete;
|
CK3dObject& operator=(const CK3dObject&) = delete;
|
||||||
~CK3dObject();
|
~CK3dObject();
|
||||||
|
|
|
@ -132,11 +132,13 @@ namespace LibCmo::CK2 {
|
||||||
needed = dwsize + this->m_Parser.m_CurrentPos;
|
needed = dwsize + this->m_Parser.m_CurrentPos;
|
||||||
|
|
||||||
// try resizing it
|
// try resizing it
|
||||||
this->ResizeBuffer(needed);
|
if (!this->ResizeBuffer(needed)) return false;
|
||||||
|
|
||||||
// update size
|
// update size
|
||||||
this->m_Parser.m_DataSize = needed;
|
this->m_Parser.m_DataSize = needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CKStateChunk::Skip(CKDWORD DwordCount) {
|
bool CKStateChunk::Skip(CKDWORD DwordCount) {
|
||||||
|
@ -392,6 +394,8 @@ namespace LibCmo::CK2 {
|
||||||
std::memcpy(strl.data(), this->m_pData + this->m_Parser.m_CurrentPos, strByteSize);
|
std::memcpy(strl.data(), this->m_pData + this->m_Parser.m_CurrentPos, strByteSize);
|
||||||
this->m_Parser.m_CurrentPos += strDwordSize;
|
this->m_Parser.m_CurrentPos += strDwordSize;
|
||||||
} else strl.clear();
|
} else strl.clear();
|
||||||
|
|
||||||
|
return CKERROR::CKERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
<ClCompile Include="CKFile.cpp" />
|
<ClCompile Include="CKFile.cpp" />
|
||||||
<ClCompile Include="CKFileWriter.cpp" />
|
<ClCompile Include="CKFileWriter.cpp" />
|
||||||
<ClCompile Include="CKGlobals.cpp" />
|
<ClCompile Include="CKGlobals.cpp" />
|
||||||
|
<ClCompile Include="CKManagerImplements\CKBaseManager.cpp" />
|
||||||
<ClCompile Include="CKMinContext.cpp" />
|
<ClCompile Include="CKMinContext.cpp" />
|
||||||
<ClCompile Include="CKObjectImplements\CKObject.cpp" />
|
<ClCompile Include="CKObjectImplements\CKObject.cpp" />
|
||||||
<ClCompile Include="VTEncoding.cpp" />
|
<ClCompile Include="VTEncoding.cpp" />
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
<ClCompile Include="VTUtils.cpp">
|
<ClCompile Include="VTUtils.cpp">
|
||||||
<Filter>Sources</Filter>
|
<Filter>Sources</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CKManagerImplements\CKBaseManager.cpp">
|
||||||
|
<Filter>Sources\CKManagerImplements</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="VTUtils.hpp">
|
<ClInclude Include="VTUtils.hpp">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user