update shit

This commit is contained in:
yyc12345 2023-02-28 14:04:38 +08:00
parent 1a959a4c55
commit 0242cb60c4
16 changed files with 941 additions and 46 deletions

View File

@ -86,6 +86,8 @@ namespace LibCmo {
CKGUID& operator=(const CKGUID& rhs) {
this->d1 = rhs.d1;
this->d2 = rhs.d2;
return *this;
}
bool operator ==(const CKGUID& rhs) const {

View File

@ -6,6 +6,8 @@
namespace LibCmo::CK2 {
constexpr const CKDWORD CKVERSION = 0x05082002;
namespace PredefinedGuids {
constexpr const CKDWORD OBJECT_MANAGER_GUID1 = 0x7cbb3b91;

View File

@ -21,7 +21,38 @@ namespace LibCmo::CK2 {
#pragma region CKFileInfo
CKFileInfo::CKFileInfo() {
CKFileInfo::CKFileInfo() :
ProductVersion(0u), ProductBuild(0x01010000u), FileWriteMode(CK_FILE_WRITEMODE::CKFILE_UNCOMPRESSED),
FileVersion(8u), CKVersion(CKVERSION), FileSize(0u),
ObjectCount(0u), ManagerCount(0u), MaxIDSaved(0u), Crc(0u),
Hdr1PackSize(0u), Hdr1UnPackSize(0u), DataPackSize(0u), DataUnPackSize(0u) {
}
CKFileInfo::CKFileInfo(const CKFileInfo& rhs) :
ProductVersion(rhs.ProductVersion), ProductBuild(rhs.ProductBuild), FileWriteMode(rhs.FileWriteMode),
FileVersion(rhs.FileVersion), CKVersion(rhs.CKVersion), FileSize(rhs.FileSize),
ObjectCount(rhs.ObjectCount), ManagerCount(rhs.ManagerCount), MaxIDSaved(rhs.MaxIDSaved), Crc(rhs.Crc),
Hdr1PackSize(rhs.Hdr1PackSize), Hdr1UnPackSize(rhs.Hdr1UnPackSize),
DataPackSize(rhs.DataPackSize), DataUnPackSize(rhs.DataUnPackSize) {
}
CKFileInfo& CKFileInfo::operator=(const CKFileInfo& rhs) {
this->ProductVersion = rhs.ProductVersion;
this->ProductBuild = rhs.ProductBuild;
this->FileWriteMode = rhs.FileWriteMode;
this->FileVersion = rhs.FileVersion;
this->CKVersion = rhs.CKVersion;
this->FileSize = rhs.FileSize;
this->ObjectCount = rhs.ObjectCount;
this->ManagerCount = rhs.ManagerCount;
this->MaxIDSaved = rhs.MaxIDSaved;
this->Crc = rhs.Crc;
this->Hdr1PackSize = rhs.Hdr1PackSize;
this->Hdr1UnPackSize = rhs.Hdr1UnPackSize;
this->DataPackSize = rhs.DataPackSize;
this->DataUnPackSize = rhs.DataUnPackSize;
return *this;
}
CKFileInfo::~CKFileInfo() {
@ -32,8 +63,32 @@ namespace LibCmo::CK2 {
#pragma region CKFileObject
CKFileObject::CKFileObject() :
Data(nullptr) {
;
ObjectId(0u), ObjectCid(CK_CLASSID::CKCID_OBJECT), Name(),
Data(nullptr), FileIndex(0u) {
}
CKFileObject::CKFileObject(const CKFileObject& rhs) :
ObjectId(rhs.ObjectId), ObjectCid(rhs.ObjectCid), Name(rhs.Name),
Data(rhs.Data), FileIndex(rhs.FileIndex) {
if (this->Data != nullptr) {
this->Data = new(std::nothrow) CKStateChunk(*(rhs.Data));
}
}
CKFileObject& CKFileObject::operator=(const CKFileObject& rhs) {
this->ObjectId = rhs.ObjectId;
this->ObjectCid = rhs.ObjectCid;
this->Name = rhs.Name;
this->FileIndex = rhs.FileIndex;
this->Data = rhs.Data;
if (this->Data != nullptr) {
this->Data = new(std::nothrow) CKStateChunk(*(rhs.Data));
}
return *this;
}
CKFileObject::~CKFileObject() {
@ -45,7 +100,27 @@ namespace LibCmo::CK2 {
#pragma region CKFileManagerData
CKFileManagerData::CKFileManagerData() :
Data(nullptr) {
Data(nullptr), Manager(0u, 0u) {
}
CKFileManagerData::CKFileManagerData(const CKFileManagerData& rhs) :
Data(rhs.Data), Manager(rhs.Manager) {
if (this->Data != nullptr) {
this->Data = new(std::nothrow) CKStateChunk(*(rhs.Data));
}
}
CKFileManagerData& CKFileManagerData::operator=(const CKFileManagerData& rhs) {
this->Manager = rhs.Manager;
this->Data = rhs.Data;
if (this->Data != nullptr) {
this->Data = new(std::nothrow) CKStateChunk(*(rhs.Data));
}
return *this;
}
CKFileManagerData::~CKFileManagerData() {
@ -56,7 +131,19 @@ namespace LibCmo::CK2 {
#pragma region CKFilePluginDependencies
CKFilePluginDependencies::CKFilePluginDependencies() {
CKFilePluginDependencies::CKFilePluginDependencies() :
m_PluginCategory(CK_PLUGIN_TYPE::CKPLUGIN_MANAGER_DLL), m_Guids() {
}
CKFilePluginDependencies::CKFilePluginDependencies(const CKFilePluginDependencies& rhs) :
m_PluginCategory(rhs.m_PluginCategory), m_Guids(rhs.m_Guids) {
}
CKFilePluginDependencies& CKFilePluginDependencies::operator=(const CKFilePluginDependencies& rhs) {
this->m_PluginCategory = rhs.m_PluginCategory;
this->m_Guids = rhs.m_Guids;
return *this;
}
CKFilePluginDependencies::~CKFilePluginDependencies() {

View File

@ -59,8 +59,8 @@ namespace LibCmo::CK2 {
class CKFileInfo {
public:
CKFileInfo();
CKFileInfo(const CKFileInfo&) = delete;
CKFileInfo& operator=(const CKFileInfo&) = delete;
CKFileInfo(const CKFileInfo&);
CKFileInfo& operator=(const CKFileInfo&);
~CKFileInfo();
CKDWORD ProductVersion; // Virtools Version (Dev/Creation). (CK_VIRTOOLS_VERSION)
@ -84,8 +84,8 @@ namespace LibCmo::CK2 {
class CKFileObject {
public:
CKFileObject();
//CKFileObject(const CKFileObject&) = delete;
//CKFileObject& operator=(const CKFileObject&) = delete;
CKFileObject(const CKFileObject&);
CKFileObject& operator=(const CKFileObject&);
~CKFileObject();
CK_ID ObjectId;
@ -100,8 +100,8 @@ namespace LibCmo::CK2 {
class CKFileManagerData {
public:
CKFileManagerData();
//CKFileManagerData(const CKFileManagerData&) = delete;
//CKFileManagerData& operator=(const CKFileManagerData&) = delete;
CKFileManagerData(const CKFileManagerData&);
CKFileManagerData& operator=(const CKFileManagerData&);
~CKFileManagerData();
CKStateChunk* Data;
@ -113,8 +113,8 @@ namespace LibCmo::CK2 {
class CKFilePluginDependencies {
public:
CKFilePluginDependencies();
//CKFilePluginDependencies(const CKFilePluginDependencies&) = delete;
//CKFilePluginDependencies& operator=(const CKFilePluginDependencies&) = delete;
CKFilePluginDependencies(const CKFilePluginDependencies&);
CKFilePluginDependencies& operator=(const CKFilePluginDependencies&);
~CKFilePluginDependencies();
CK_PLUGIN_TYPE m_PluginCategory;

View File

@ -71,7 +71,7 @@ namespace LibCmo::CK2 {
// force reset too big product ver?
if (rawHeader.ProductVersion >= 12u) {
rawHeader.ProductVersion = 0u;
rawHeader.ProductBuild = 0x01010000;
rawHeader.ProductBuild = 0x01010000u;
}
// ========== assign value ==========
@ -393,7 +393,9 @@ namespace LibCmo::CK2 {
// todo: special treat for CK_LEVEL
// try parsing data
obj.Data->StartRead();
CKERROR err = createdObjs[index]->Load(obj.Data, shallowDoc.get());
obj.Data->StopRead();
if (err != CKERROR::CKERR_OK) {
delete (createdObjs[index]);
createdObjs[index] = nullptr;

736
LibCmo/CKIdentifiers.hpp Normal file
View File

@ -0,0 +1,736 @@
#pragma once
#include "CKDefines.hpp"
#include <cinttypes>
#include <cstdint>
namespace LibCmo::CK2::Identifiers {
constexpr const CKDWORD CK_STATESAVE_ALL = 0xFFFFFFFF;
//------------------------------------------------
// Object
enum class CK_STATESAVEFLAGS_OBJECT : uint32_t {
CK_STATESAVE_NAME = 0x00000001, // Obsolete
CK_STATESAVE_ID = 0x00000002, // Obsolete
CK_STATESAVE_OBJECTHIDDEN = 0x00000004, // The object is hidden
CK_STATESAVE_OBJECTHIERAHIDDEN = 0x00000018, // The object is hidden hierarchically
CK_STATESAVE_OBJECTALL = 0x0000000F
};
//------------------------------------------------
// Be Object
enum class CK_STATESAVEFLAGS_BEOBJECT : uint32_t {
CK_STATESAVE_ATTRIBUTES = 0x00000010, // Obsolete
CK_STATESAVE_NEWATTRIBUTES = 0x00000011, // Save Attributes
CK_STATESAVE_GROUPS = 0x00000020, // Obsolete
CK_STATESAVE_DATAS = 0x00000040, // Save Flags and (Waiting for message) status
CK_STATESAVE_SOUNDS = 0x00000080, // Obsolete
CK_STATESAVE_BEHAVIORS = 0x00000100, // Obsolete
CK_STATESAVE_PARAMETERS = 0x00000200, // Obsolete
CK_STATESAVE_SINGLEACTIVITY = 0x00000400, // SINGLE ACTIVITY
CK_STATESAVE_SCRIPTS = 0x00000800, // Obsolete
CK_STATESAVE_BEOBJECTONLY = 0x00000FF0, // Save only BeObject specific datas
CK_STATESAVE_BEOBJECTALL = 0x00000FFF // Save All datas
};
//------------------------------------------------
// 3dEntity
enum class CK_STATESAVEFLAGS_3DENTITY : uint32_t {
CK_STATESAVE_3DENTITYSKINDATANORMALS = 0x00001000, // Save Skin normals
CK_STATESAVE_ANIMATION = 0x00002000, // Obsolete
CK_STATESAVE_MESHS = 0x00004000, // Save List of mesh
CK_STATESAVE_PARENT = 0x00008000, // Save Parent
CK_STATESAVE_3DENTITYFLAGS = 0x00010000, // Save Flags
CK_STATESAVE_3DENTITYMATRIX = 0x00020000, // Save Position/orientation/Scale
CK_STATESAVE_3DENTITYHIERARCHY = 0x00040000, // obsolete
CK_STATESAVE_3DENTITYPLACE = 0x00080000, // Save Place in which the Entity is referenced
CK_STATESAVE_3DENTITYNDATA = 0x00100000, // Reserved for future use
CK_STATESAVE_3DENTITYSKINDATA = 0x00200000, // Save Skin data
CK_STATESAVE_3DENTITYONLY = 0x003FF000, // Save only 3dEntity specific datas
CK_STATESAVE_3DENTITYALL = 0x003FFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Light
enum class CK_STATESAVEFLAGS_LIGHT : uint32_t {
CK_STATESAVE_LIGHTDATA = 0x00400000, // Save Color,Type,Attenuation,Range and cone
CK_STATESAVE_LIGHTDATA2 = 0x00800000, // Reserved for future use
CK_STATESAVE_LIGHTRESERVED1 = 0x01000000, // Reserved for future use
CK_STATESAVE_LIGHTRESERVED2 = 0x02000000, // Reserved for future use
CK_STATESAVE_LIGHTRESERVED3 = 0x04000000, // Reserved for future use
CK_STATESAVE_LIGHTRESERVED4 = 0x08000000, // Reserved for future use
CK_STATESAVE_LIGHTONLY = 0x0FC00000, // Save only Light specific datas
CK_STATESAVE_LIGHTALL = 0x0FFFFFFF, // Save All datas for sub-classes
// Target Light
CK_STATESAVE_TLIGHTTARGET = 0x80000000, // Save Light Target
CK_STATESAVE_TLIGHTRESERVED0 = 0x10000000, // Reserved for future use
CK_STATESAVE_TLIGHTRESERVED1 = 0x20000000, // Reserved for future use
CK_STATESAVE_TLIGHTRESERVED2 = 0x40000000, // Reserved for future use
CK_STATESAVE_TLIGHTONLY = 0xF0000000, // Save only Target Light specific datas
CK_STATESAVE_TLIGHTALL = 0xFFFFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// Camera
enum class CK_STATESAVEFLAGS_CAMERA : uint32_t {
CK_STATESAVE_CAMERAFOV = 0x00400000, // Save Camera Field of View
CK_STATESAVE_CAMERAPROJTYPE = 0x00800000, // Save Camera projection type
CK_STATESAVE_CAMERAOTHOZOOM = 0x01000000, // Save Camera orhographic zoom
CK_STATESAVE_CAMERAASPECT = 0x02000000, // Save Camera aspect ration
CK_STATESAVE_CAMERAPLANES = 0x04000000, // Save Camera near and far clip planes
CK_STATESAVE_CAMERARESERVED2 = 0x08000000, // Reserved for future use
CK_STATESAVE_CAMERAONLY = 0x0FC00000, // Save only camera specific datas
CK_STATESAVE_CAMERAALL = 0x0FFFFFFF, // Save All datas for sub-classes
// Target Camera
CK_STATESAVE_TCAMERATARGET = 0x10000000, // Save camera Target
CK_STATESAVE_TCAMERARESERVED1 = 0x20000000, // Reserved for future use
CK_STATESAVE_TCAMERARESERVED2 = 0x40000000, // Reserved for future use
CK_STATESAVE_TCAMERAONLY = 0x70000000, // Save only Target camera specific datas
CK_STATESAVE_TCAMERAALL = 0x7FFFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// Sprite3D
enum class CK_STATESAVEFLAGS_SPRITE3D : uint32_t {
CK_STATESAVE_SPRITE3DDATA = 0x00400000, // Save offset,mapping,size and material
CK_STATESAVE_SPRITE3DRESERVED0 = 0x00800000, // Reserved for future use
CK_STATESAVE_SPRITE3DRESERVED1 = 0x01000000, // Reserved for future use
CK_STATESAVE_SPRITE3DRESERVED2 = 0x02000000, // Reserved for future use
CK_STATESAVE_SPRITE3DRESERVED3 = 0x04000000, // Reserved for future use
CK_STATESAVE_SPRITE3DRESERVED4 = 0x08000000, // Reserved for future use
CK_STATESAVE_SPRITE3DONLY = 0x0FC00000, // Save only Sprite3D specific datas
CK_STATESAVE_SPRITE3DALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// Object 3D
enum class CK_STATESAVEFLAGS_3DOBJECT : uint32_t {
CK_STATESAVE_3DOBJECTATTRIBUTES = 0x00400000, // Obsolete
CK_STATESAVE_3DOBJECTRESERVED = 0x00800000, // Reserved for future use
CK_STATESAVE_3DOBJECTRONLY = 0x00C00000, // Save only 3dObject specific datas
CK_STATESAVE_3DOBJECTALL = 0x03FFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// BodyPart
enum class CK_STATESAVEFLAGS_BODYPART : uint32_t {
CK_STATESAVE_BODYPARTROTJOINT = 0x01000000, // Save rotation joint data
CK_STATESAVE_BODYPARTPOSJOINT = 0x02000000, // Save position joint data
CK_STATESAVE_BODYPARTCHARACTER = 0x04000000, // Save character owning this bodypart
CK_STATESAVE_BODYPARTRESERVED1 = 0x08000000, // Reserved for future use
CK_STATESAVE_BODYPARTRESERVED2 = 0x10000000, // Reserved for future use
CK_STATESAVE_BODYPARTRESERVED3 = 0x20000000, // Reserved for future use
CK_STATESAVE_BODYPARTRESERVED4 = 0x40000000, // Reserved for future use
CK_STATESAVE_BODYPARTONLY = 0x7F000000, // Save only bodypart specific datas
CK_STATESAVE_BODYPARTALL = 0x7FFFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// Character
enum class CK_STATESAVEFLAGS_CHARACTER : uint32_t {
CK_STATESAVE_CHARACTERBODYPARTS = 0x00400000, // Obsolete
CK_STATESAVE_CHARACTERKINECHAINS = 0x00800000, // Obsolete
CK_STATESAVE_CHARACTERANIMATIONS = 0x01000000, // Obsolete
CK_STATESAVE_CHARACTERROOT = 0x02000000, // Obsolete
CK_STATESAVE_CHARACTERSAVEANIMS = 0x04000000, // Save current and next active animations
CK_STATESAVE_CHARACTERSAVECHAINS = 0x08000000, // Obsolete
CK_STATESAVE_CHARACTERSAVEPARTS = 0x10000000, // Save sub bodyparts and sub-bodyparts data (saved with flag :CK_STATESAVE_BODYPARTALL)
CK_STATESAVE_CHARACTERFLOORREF = 0x20000000, // Save Character floor reference object
CK_STATESAVE_CHARACTERRESERVED2 = 0x40000000, // Reserved for future use
CK_STATESAVE_CHARACTERRESERVED3 = 0x80000000, // Reserved for future use
CK_STATESAVE_CHARACTERONLY = 0xFFC00000, // Save only character specific datas
CK_STATESAVE_CHARACTERALL = 0xFFFFFFFF // Save All datas for sub-classes
};
//--------------------------------------------------
// CURVE
// && Curve Point
enum class CK_STATESAVEFLAGS_CURVE : uint32_t {
CK_STATESAVE_CURVEFITCOEFF = 0x00400000, // Save fitting coef
CK_STATESAVE_CURVECONTROLPOINT = 0x00800000, // Save list of control points
CK_STATESAVE_CURVESTEPS = 0x01000000, // Save number of step setting
CK_STATESAVE_CURVEOPEN = 0x02000000, // Save Open/Close flag
CK_STATESAVE_CURVERESERVED1 = 0x04000000, // Reserved for future use
CK_STATESAVE_CURVERESERVED2 = 0x08000000, // Reserved for future use
// Control points
CK_STATESAVE_CURVEPOINTDEFAULTDATA = 0x10000000, // Save Control point setting and position
CK_STATESAVE_CURVEPOINTTCB = 0x20000000, // Save Control point tcb settings
CK_STATESAVE_CURVEPOINTTANGENTS = 0x40000000, // Save Control point tangents
CK_STATESAVE_CURVEPOINTCURVEPOS = 0x80000000, // Save Control point position in curve
CK_STATESAVE_CURVESAVEPOINTS = 0xFF000000, // Save control points data
CK_STATESAVE_CURVEONLY = 0xFFC00000, // Save only curve specific data
CK_STATESAVE_CURVEALL = 0xFFFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// 2dEntity
enum class CK_STATESAVEFLAGS_2DENTITY : uint32_t {
CK_STATESAVE_2DENTITYSRCSIZE = 0x00001000, // Save source size
CK_STATESAVE_2DENTITYSIZE = 0x00002000, // Save size
CK_STATESAVE_2DENTITYFLAGS = 0x00004000, // Save Flags
CK_STATESAVE_2DENTITYPOS = 0x00008000, // Save position
CK_STATESAVE_2DENTITYZORDER = 0x00100000, // Save Z order
CK_STATESAVE_2DENTITYONLY = 0x0010F000, // Save only 2dEntity specific data
CK_STATESAVE_2DENTITYMATERIAL = 0x00200000, // Save Material
CK_STATESAVE_2DENTITYHIERARCHY = 0x00400000, // Save Material
CK_STATESAVE_2DENTITYALL = 0x0070FFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Sprite
enum class CK_STATESAVEFLAGS_SPRITE : uint32_t {
CK_STATESAVE_SPRITECURRENTIMAGE = 0x00010000, // Save current image
CK_STATESAVE_SPRITETRANSPARENT = 0x00020000, // Save transparency settings
CK_STATESAVE_SPRITEBITMAPS = 0x00040000, // Obsolete
CK_STATESAVE_SPRITESHARED = 0x00080000, // Save shared sprite
CK_STATESAVE_SPRITEDONOTUSE = 0x00100000, // Reseved by CK_STATESAVEFLAGS_2DENTITY
CK_STATESAVE_SPRITEAVIFILENAME = 0x00200000, // Obsolete
CK_STATESAVE_SPRITEFILENAMES = 0x00400000, // Obsolete
CK_STATESAVE_SPRITECOMPRESSED = 0x00800000, // Obsolete
CK_STATESAVE_SPRITEREADER = 0x10000000, // Reserved for future use
CK_STATESAVE_SPRITEFORMAT = 0x20000000, // Reserved for future use
CK_STATESAVE_SPRITEVIDEOFORMAT = 0x40000000, // Video Format
CK_STATESAVE_SPRITESYSTEMCACHING = 0x80000000, // System Memory Caching
CK_STATESAVE_SPRITERENDEROPTIONS = 0x80800000, // Render options if any...
CK_STATESAVE_SPRITEONLY = 0xF0EF0000, // Save only sprite specific data
CK_STATESAVE_SPRITEALL = 0x70FFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Sprite Text
enum class CK_STATESAVEFLAGS_SPRITETEXT : uint32_t {
CK_STATESAVE_SPRITETEXT = 0x01000000, // Save text
CK_STATESAVE_SPRITEFONT = 0x02000000, // Save font settings
CK_STATESAVE_SPRITETEXTCOLOR = 0x04000000, // Save text color
CK_STATESAVE_SPRITETEXTRESERVED = 0x08000000, // Reserved for future use
CK_STATESAVE_SPRITETEXTDOTNOTUSE = 0x10000000, // Reserved by CK_STATESAVE_SPRITEREADER
CK_STATESAVE_SPRITETEXTDONOTUSED2 = 0x20000000, // Reserved by CK_STATESAVE_SPRITEFORMAT
CK_STATESAVE_SPRITETEXTONLY = 0x0F000000, // Save only SpriteText specific data
CK_STATESAVE_SPRITETEXTALL = 0x3FFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Sound
enum class CK_STATESAVEFLAGS_SOUND : uint32_t {
CK_STATESAVE_SOUNDFILENAME = 0x00001000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED1 = 0x00002000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED2 = 0x00004000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED3 = 0x00008000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED4 = 0x00010000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED5 = 0x00020000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED6 = 0x00040000, // Reserved for future use
CK_STATESAVE_SOUNDRESERVED7 = 0x00080000, // Reserved for future use
CK_STATESAVE_SOUNDONLY = 0x000FF000, // Save only Sound specific data
CK_STATESAVE_SOUNDALL = 0x000FFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Wave Sound
enum class CK_STATESAVEFLAGS_WAVSOUND : uint32_t {
CK_STATESAVE_WAVSOUNDFILE = 0x00100000, // Save sound filename
CK_STATESAVE_WAVSOUNDDATA = 0x00200000, // Obsolete
CK_STATESAVE_WAVSOUNDDATA2 = 0x00400000, // Save sound properties (3D/2D,pitch,gain,streaming,loop,etc..)
CK_STATESAVE_WAVSOUNDDURATION = 0x00800000, // Sound Length (in case it cannot be calculated latter)
CK_STATESAVE_WAVSOUNDRESERVED4 = 0x01000000, // Reserved for future use
CK_STATESAVE_WAVSOUNDRESERVED5 = 0x02000000, // Reserved for future use
CK_STATESAVE_WAVSOUNDRESERVED6 = 0x04000000, // Reserved for future use
CK_STATESAVE_WAVSOUNDRESERVED7 = 0x08000000, // Reserved for future use
CK_STATESAVE_WAVSOUNDONLY = 0x0FF00000, // Save All datas for sub-classes
CK_STATESAVE_WAVSOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Wave Sound
enum class CK_STATESAVEFLAGS_MIDISOUND : uint32_t {
CK_STATESAVE_MIDISOUNDFILE = 0x00100000, // Save sound filename
CK_STATESAVE_MIDISOUNDDATA = 0x00200000, // Save midi data
CK_STATESAVE_MIDISOUNDRESERVED2 = 0x00400000, // Reserved for future use
CK_STATESAVE_MIDISOUNDRESERVED3 = 0x00800000, // Reserved for future use
CK_STATESAVE_MIDISOUNDRESERVED4 = 0x01000000, // Reserved for future use
CK_STATESAVE_MIDISOUNDRESERVED5 = 0x02000000, // Reserved for future use
CK_STATESAVE_MIDISOUNDRESERVED6 = 0x04000000, // Reserved for future use
CK_STATESAVE_MIDISOUNDRESERVED7 = 0x08000000, // Reserved for future use
CK_STATESAVE_MIDISOUNDONLY = 0x0FF00000,
CK_STATESAVE_MIDISOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Place
enum class CK_STATESAVEFLAGS_PLACE : uint32_t {
CK_STATESAVE_PLACEPORTALS = 0x00001000, // Save level using the place
CK_STATESAVE_PLACECAMERA = 0x00002000, // Save attached camera
CK_STATESAVE_PLACEREFERENCES = 0x00004000, // Save list of objects in the place
CK_STATESAVE_PLACELEVEL = 0x00008000, // Save level using the place
CK_STATESAVE_PLACEALL = 0x0000FFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Level
// CKSaveObjectState will not save any data
enum class CK_STATESAVEFLAGS_LEVEL : uint32_t {
CK_STATESAVE_LEVELRESERVED0 = 0x00001000, // Reserved for future use
CK_STATESAVE_LEVELINACTIVEMAN = 0x00002000, // Reserved for future use
CK_STATESAVE_LEVELDUPLICATEMAN = 0x00004000, // Reserved for future use
CK_STATESAVE_LEVELDEFAULTDATA = 0x20000000, // Save Places,Scenes and Objects
CK_STATESAVE_LEVELSCENE = 0x80000000, // Default and active scene
CK_STATESAVE_LEVELALL = 0xFFFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// GROUP
enum class CK_STATESAVEFLAGS_GROUP : uint32_t {
CK_STATESAVE_GROUPDATA = 0x00001000, // Save list of objects in the group
CK_STATESAVE_GROUPRESERVED1 = 0x00002000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED2 = 0x00004000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED3 = 0x00008000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED4 = 0x00010000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED5 = 0x00020000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED6 = 0x00040000, // Reserved for future use
CK_STATESAVE_GROUPRESERVED7 = 0x00080000, // Reserved for future use
CK_STATESAVE_GROUPALL = 0x000FFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// MESH
// CKSaveOjectSave will save all data and does not take flags into account
enum class CK_STATESAVEFLAGS_MESH : uint32_t {
CK_STATESAVE_MESHRESERVED0 = 0x00001000, // Reserved for future use
CK_STATESAVE_MESHFLAGS = 0x00002000, // Save flags
CK_STATESAVE_MESHCHANNELS = 0x00004000, // Save Channels
CK_STATESAVE_MESHFACECHANMASK = 0x00008000, // Save face channel Mask
CK_STATESAVE_MESHFACES = 0x00010000, // Save face data
CK_STATESAVE_MESHVERTICES = 0x00020000, // Save geometry
CK_STATESAVE_MESHLINES = 0x00040000, // Save line data
CK_STATESAVE_MESHWEIGHTS = 0x00080000, // Save Vertex Weight info
CK_STATESAVE_MESHMATERIALS = 0x00100000, // Reserved for future use
CK_STATESAVE_MESHRESERVED1 = 0x00200000, // Reserved for future use
CK_STATESAVE_MESHRESERVED2 = 0x00400000, // Reserved for future use
CK_STATESAVE_PROGRESSIVEMESH = 0x00800000, // Save All datas for sub-classes
CK_STATESAVE_MESHONLY = 0x00FFF000, // Save All datas for sub-classes
CK_STATESAVE_MESHALL = 0x00FFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// PATCH MESH
// CKSaveOjectSave will save all data and does not take flags into account
enum class CK_STATESAVEFLAGS_PATCHMESH : uint32_t {
CK_STATESAVE_PATCHMESHDATA = 0x00800000, // Obsolete
CK_STATESAVE_PATCHMESHDATA2 = 0x01000000, // Obsolete
CK_STATESAVE_PATCHMESHSMOOTH = 0x02000000, // Obsolete
CK_STATESAVE_PATCHMESHMATERIALS = 0x04000000, // Obsolete
CK_STATESAVE_PATCHMESHDATA3 = 0x08000000, // Save Patch Data
CK_STATESAVE_PATCHMESHONLY = 0x0FF00000, // Save All datas for sub-classes
CK_STATESAVE_PATCHMESHALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//-------------------------------------------------
// Material
enum class CK_STATESAVEFLAGS_MATERIAL : uint32_t {
CK_STATESAVE_MATDATA = 0x00001000, // Save colors,blending modes,shade modes,fill modes etc...
CK_STATESAVE_MATDATA2 = 0x00002000, // Additional texture objects...
CK_STATESAVE_MATDATA3 = 0x00004000, // Effect Alone
CK_STATESAVE_MATDATA4 = 0x00008000, // none
CK_STATESAVE_MATDATA5 = 0x00010000, // Effect + parameter
CK_STATESAVE_MATRESERVED5 = 0x00020000, // Reserved for future use
CK_STATESAVE_MATRESERVED6 = 0x00040000, // Reserved for future use
CK_STATESAVE_MATRESERVED7 = 0x00080000, // Reserved for future use
CK_STATESAVE_MATERIALONLY = 0x000FF000, // Save All datas for sub-classes
CK_STATESAVE_MATERIALALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// Texture
// CKSaveOjectSave will save all relevant data and does not take flags into account
enum class CK_STATESAVEFLAGS_TEXTURE : uint32_t {
CK_STATESAVE_TEXAVIFILENAME = 0x00001000, // Save movie file name
CK_STATESAVE_TEXCURRENTIMAGE = 0x00002000, // Save current slot
CK_STATESAVE_TEXBITMAPS = 0x00004000, // Obsolete
CK_STATESAVE_TEXTRANSPARENT = 0x00008000, // Save transparency data
CK_STATESAVE_TEXFILENAMES = 0x00010000, // Save texture slot filenames
CK_STATESAVE_TEXCOMPRESSED = 0x00020000, // Save raw texture data
CK_STATESAVE_TEXVIDEOFORMAT = 0x00040000, // Save chosen video format
CK_STATESAVE_TEXSAVEFORMAT = 0x00080000, // Save chosen save format
CK_STATESAVE_TEXREADER = 0x00100000, // Save texture data using a specific BitmapReader
CK_STATESAVE_PICKTHRESHOLD = 0x00200000, // Save pick threshold
CK_STATESAVE_USERMIPMAP = 0x00400000, // User mipmap levels
CK_STATESAVE_TEXSYSTEMCACHING = 0x00800000, // System Memory Caching
CK_STATESAVE_OLDTEXONLY = 0x002FF000, // Kept for compatibility
CK_STATESAVE_TEXONLY = 0x00FFF000, // Save Only Texture Data (Dot NOT MODIFY ! Texture loading/saving relies on this value)
CK_STATESAVE_TEXALL = 0x002FFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// 2d CURVE
// && 2d Curve Point
enum class CK_STATESAVEFLAGS_2DCURVE : uint32_t {
CK_STATESAVE_2DCURVERESERVED0 = 0x00000010, // Reserved for future use
CK_STATESAVE_2DCURVERESERVED4 = 0x00000020, // Reserved for future use
CK_STATESAVE_2DCURVEFITCOEFF = 0x00000040, // Obsolete
CK_STATESAVE_2DCURVECONTROLPOINT = 0x00000080, // Obsolete
CK_STATESAVE_2DCURVENEWDATA = 0x00000100, // Save All relevant data
CK_STATESAVE_2DCURVERESERVED2 = 0x00000200, // Obsolete
CK_STATESAVE_2DCURVERESERVED3 = 0x00000400, // Obsolete
CK_STATESAVE_2DCURVEPOINTTCB = 0x00000800, // Obsolete
CK_STATESAVE_2DCURVEPOINTTANGENTS = 0x00001000, // Obsolete
CK_STATESAVE_2DCURVEPOINT2DCURVEPOS = 0x00002000, // Obsolete
CK_STATESAVE_2DCURVEPOINTDEFAULTDATA = 0x00004000, // Obsolete
CK_STATESAVE_2DCURVEPOINTNEWDATA = 0x00008000, // Save All relevant data
CK_STATESAVE_2DCURVEPOINTRESERVED1 = 0x00010000, // Reserved for future use
CK_STATESAVE_2DCURVEPOINTRESERVED2 = 0x00020000, // Reserved for future use
CK_STATESAVE_2DCURVESAVEPOINTS = 0x0003F800, // Obsolete
CK_STATESAVE_2DCURVEALL = 0x0007FFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// Kinematic Chain
enum class CK_STATESAVEFLAGS_KINEMATICCHAIN : uint32_t {
CK_STATESAVE_KINEMATICCHAINDATA = 0x00000010, // Save chain data
CK_STATESAVE_KINEMATICCHAINRESERVED1 = 0x00000020, // Reserved for future use
CK_STATESAVE_KINEMATICCHAINRESERVED2 = 0x00000040, // Reserved for future use
CK_STATESAVE_KINEMATICCHAINRESERVED3 = 0x00000080, // Reserved for future use
CK_STATESAVE_KINEMATICCHAINALL = 0x000000FF // Save All datas for sub-classes
};
//---------------------------------------------------
// Animation
enum class CK_STATESAVEFLAGS_ANIMATION : uint32_t {
CK_STATESAVE_ANIMATIONDATA = 0x00000010, // Save Flags & Framerate data
CK_STATESAVE_ANIMATIONRESERVED1 = 0x00000020, // Reserved for future use
CK_STATESAVE_ANIMATIONLENGTH = 0x00000040, // Save animation Length
CK_STATESAVE_ANIMATIONBODYPARTS = 0x00000080, // Save root & list of bodypart
CK_STATESAVE_ANIMATIONCHARACTER = 0x00000100, // Save character
CK_STATESAVE_ANIMATIONCURRENTSTEP = 0x00000200, // Save current step
CK_STATESAVE_ANIMATIONRESERVED5 = 0x00000400, // Reserved for future use
CK_STATESAVE_ANIMATIONRESERVED6 = 0x00000800, // Reserved for future use
CK_STATESAVE_ANIMATIONALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// Keyed Anim
enum class CK_STATESAVEFLAGS_KEYEDANIMATION : uint32_t {
CK_STATESAVE_KEYEDANIMANIMLIST = 0x00001000, // Save list of object animations
CK_STATESAVE_KEYEDANIMLENGTH = 0x00002000, // Obsolete
CK_STATESAVE_KEYEDANIMPOSKEYS = 0x00004000, // Obsolete
CK_STATESAVE_KEYEDANIMROTKEYS = 0x00008000, // Obsolete
CK_STATESAVE_KEYEDANIMMORPHKEYS = 0x00010000, // Obsolete
CK_STATESAVE_KEYEDANIMSCLKEYS = 0x00020000, // Obsolete
CK_STATESAVE_KEYEDANIMFLAGS = 0x00040000, // Obsolete
CK_STATESAVE_KEYEDANIMENTITY = 0x00080000, // Obsolete
CK_STATESAVE_KEYEDANIMMERGE = 0x00100000, // Save merged animations
CK_STATESAVE_KEYEDANIMSUBANIMS = 0x00200000, // Save object animations data (using same flags than CKSaveObjectState)
CK_STATESAVE_KEYEDANIMRESERVED0 = 0x00400000, // Reserved for future use
CK_STATESAVE_KEYEDANIMRESERVED1 = 0x00800000, // Reserved for future use
CK_STATESAVE_KEYEDANIMRESERVED2 = 0x01000000, // Reserved for future use
CK_STATESAVE_KEYEDANIMRESERVED3 = 0x02000000 // Reserved for future use
};
//---------------------------------------------------
// Object Animation
// CKSaveOjectSave will save all relevant data and does not take flags into account
enum class CK_STATESAVEFLAGS_OBJECTANIMATION : uint32_t {
CK_STATESAVE_OBJANIMNEWDATA = 0x00001000, // Save all relevant data
CK_STATESAVE_OBJANIMLENGTH = 0x00002000, // Not used
CK_STATESAVE_OBJANIMPOSKEYS = 0x00004000, // Not used
CK_STATESAVE_OBJANIMROTKEYS = 0x00008000, // Not used
CK_STATESAVE_OBJANIMMORPHKEYS = 0x00010000, // Not used
CK_STATESAVE_OBJANIMSCLKEYS = 0x00020000, // Not used
CK_STATESAVE_OBJANIMFLAGS = 0x00040000, // Not used
CK_STATESAVE_OBJANIMENTITY = 0x00080000, // Not used
CK_STATESAVE_OBJANIMMERGE = 0x00100000, // Not used
CK_STATESAVE_OBJANIMMORPHKEYS2 = 0x00200000, // Not used
CK_STATESAVE_OBJANIMNEWSAVE1 = 0x00400000, // Not used
CK_STATESAVE_OBJANIMMORPHNORMALS = 0x00800000, // Not used (Virtools 1.1)
CK_STATESAVE_OBJANIMMORPHCOMP = 0x01000000, // Not used (Virtools 1.1)
CK_STATESAVE_OBJANIMSHARED = 0x02000000, // Save Data for a shared animation
CK_STATESAVE_OBJANIMCONTROLLERS = 0x04000000, // (Virtools 1.5) Save All Controller information
CK_STATESAVE_OBJANIMONLY = 0x07FFF000,
CK_STATESAVE_OBJANIMALL = 0x07FFFFFF,
CK_STATESAVE_KEYEDANIMONLY = 0x03FFF000, // Save All datas for sub-classes
CK_STATESAVE_KEYEDANIMALL = 0x03FFFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// IK Animation
enum class CK_STATESAVEFLAGS_IKANIMATION : uint32_t {
CK_STATESAVE_IKANIMATIONDATA = 0x00001000, // Save IK data
CK_STATESAVE_IKANIMATIONRESERVED2 = 0x00002000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED3 = 0x00004000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED4 = 0x00008000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED5 = 0x00010000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED6 = 0x00020000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED7 = 0x00040000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED8 = 0x00100000, // Reserved for future use
CK_STATESAVE_IKANIMATIONRESERVED9 = 0x00200000, // Reserved for future use
CK_STATESAVE_IKANIMATIONALL = 0x003FFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// BehaviorLink
enum class CK_STATESAVEFLAGS_BEHAV_LINK : uint32_t {
CK_STATESAVE_BEHAV_LINK_CURDELAY = 0x00000004, // Obsolete
CK_STATESAVE_BEHAV_LINK_IOS = 0x00000008, // Obsolete
CK_STATESAVE_BEHAV_LINK_DELAY = 0x00000010, // Obsolete
CK_STATESAVE_BEHAV_LINK_NEWDATA = 0x00000020, // Save all relevant data (In,Out,Activation delay)
CK_STATESAVE_BEHAV_LINKRESERVED5 = 0x00000040, // Reserved for future use
CK_STATESAVE_BEHAV_LINKRESERVED6 = 0x00000080, // Reserved for future use
CK_STATESAVE_BEHAV_LINKONLY = 0x000000F0, //
CK_STATESAVE_BEHAV_LINKALL = 0x000000FF // Save All datas for sub-classes
};
//---------------------------------------------------
// BehaviorIO
enum class CK_STATESAVEFLAGS_BEHAV_IO : uint32_t {
CK_STATESAVE_BEHAV_IOFLAGS = 0x00000008, // Save IO flags
CK_STATESAVE_BEHAV_IORESERVED3 = 0x00000010, // Reserved for future use
CK_STATESAVE_BEHAV_IORESERVED4 = 0x00000020, // Reserved for future use
CK_STATESAVE_BEHAV_IORESERVED5 = 0x00000040, // Reserved for future use
CK_STATESAVE_BEHAV_IORESERVED6 = 0x00000080, // Reserved for future use
CK_STATESAVE_BEHAVIOONLY = 0x000000F0, //
CK_STATESAVE_BEHAVIOALL = 0x000000FF // Save All datas for sub-classes
};
//---------------------------------------------------
// BehaviorPrototype
enum class CK_STATESAVEFLAGS_PROTOTYPE : uint32_t {
CK_STATESAVE_PROTORESERVED0 = 0x00000010, // Reserved for future use
CK_STATESAVE_PROTORESERVED1 = 0x00000020, // Reserved for future use
CK_STATESAVE_PROTOFLAGS = 0x00000040, // Save Flags
CK_STATESAVE_PROTOSUBPROTOS = 0x00000080, // Save sub prototypes
CK_STATESAVE_PROTOLINKS = 0x00000100, // Save links
CK_STATESAVE_PROTOBEHAVFLAG = 0x00000200, // Save behavior flags
CK_STATESAVE_PROTOGUID = 0x00000400, // Save GUID
CK_STATESAVE_PROTOINPUTS = 0x00000800, // Save inputs
CK_STATESAVE_PROTOOUTPUTS = 0x00001000, // Save outputs
CK_STATESAVE_PROTOINPARAMS = 0x00002000, // Save input parameters
CK_STATESAVE_PROTOOUTPARAMS = 0x00004000, // Save output parameters
CK_STATESAVE_PROTOLOCALPARAMS = 0x00008000, // Save local parameters
CK_STATESAVE_PROTOOPERATIONS = 0x00010000, // Save parameter operations
CK_STATESAVE_PROTOPARAMETERLINKS = 0x00020000, // Save parameter links
CK_STATESAVE_PROTOAPPLYTO = 0x00040000, // Save ClassID of object to which it applies
CK_STATESAVE_PROTORESERVED14 = 0x00080000, // Reserved for future use
CK_STATESAVE_PROTOALL = 0x000FFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// Behavior
enum class CK_STATESAVEFLAGS_BEHAVIOR : uint32_t {
CK_STATESAVE_BEHAVIORRESERVED0 = 0x00000010, // Reserved for internal use
CK_STATESAVE_BEHAVIORNEWDATA = 0x00000020, // not used
CK_STATESAVE_BEHAVIORFLAGS = 0x00000040, // not used
CK_STATESAVE_BEHAVIORCOMPATIBLECID = 0x00000080, // not used
CK_STATESAVE_BEHAVIORSUBBEHAV = 0x00000100, // Save Sub-Behaviors
CK_STATESAVE_BEHAVIORINPARAMS = 0x00000200, // not used
CK_STATESAVE_BEHAVIOROUTPARAMS = 0x00000400, // not used
CK_STATESAVE_BEHAVIORINPUTS = 0x00000800, // not used
CK_STATESAVE_BEHAVIOROUTPUTS = 0x00001000, // not used
CK_STATESAVE_BEHAVIORINFO = 0x00002000, // not used
CK_STATESAVE_BEHAVIOROPERATIONS = 0x00004000, // not used
CK_STATESAVE_BEHAVIORTYPE = 0x00008000, // not used
CK_STATESAVE_BEHAVIOROWNER = 0x00010000, // not used
CK_STATESAVE_BEHAVIORLOCALPARAMS = 0x00020000, // Save local parameters
CK_STATESAVE_BEHAVIORPROTOGUID = 0x00040000, // not used
CK_STATESAVE_BEHAVIORSUBLINKS = 0x00080000, // not used
CK_STATESAVE_BEHAVIORACTIVESUBLINKS = 0x00100000, // not used
CK_STATESAVE_BEHAVIORSINGLEACTIVITY = 0x00200000, // SINGLE ACTIVITY
CK_STATESAVE_BEHAVIORSCRIPTDATA = 0x00400000, // not used
CK_STATESAVE_BEHAVIORPRIORITY = 0x00800000, // not used
CK_STATESAVE_BEHAVIORTARGET = 0x01000000, // not used
CK_STATESAVE_BEHAVIORONLY = 0x01FFFFF0,
CK_STATESAVE_BEHAVIORALL = 0x01FFFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// SCENE
// CKSaveOjectSave will save all relevant data and does not take flags into account
enum class CK_STATESAVEFLAGS_SCENE : uint32_t {
CK_STATESAVE_SCENERESERVED0 = 0x00001000, // Reserved for future use
CK_STATESAVE_SCENERESERVED8 = 0x00002000, // Reserved for future use
CK_STATESAVE_SCENEFLAGS = 0x00004000,
CK_STATESAVE_SCENELEVEL = 0x00008000,
CK_STATESAVE_SCENEOBJECTS = 0x00010000,
CK_STATESAVE_SCENENEWDATA = 0x00020000, // every object description and initial conditions
CK_STATESAVE_SCENELAUNCHED = 0x00040000, // Scene was already launched once
CK_STATESAVE_SCENERENDERSETTINGS = 0x00080000, // Background Color, Fog Color etc..
CK_STATESAVE_SCENERESERVED1 = 0x00100000, // Reserved for future use
CK_STATESAVE_SCENERESERVED2 = 0x00200000, // Reserved for future use
CK_STATESAVE_SCENERESERVED3 = 0x00400000, // Reserved for future use
CK_STATESAVE_SCENERESERVED4 = 0x00800000, // Reserved for future use
CK_STATESAVE_SCENERESERVED5 = 0x01000000, // Reserved for future use
CK_STATESAVE_SCENERESERVED12 = 0x02000000, // Reserved for future use
CK_STATESAVE_SCENERESERVED13 = 0x04000000, // Reserved for future use
CK_STATESAVE_SCENERESERVED14 = 0x08000000, // Reserved for future use
CK_STATESAVE_SCENEALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// ParameterIn
enum class CK_STATESAVEFLAGS_PARAMETERIN : uint32_t {
CK_STATESAVE_PARAMETERIN_RESERVED4 = 0x00000010, // Reserved for future use
CK_STATESAVE_PARAMETERIN_RESERVED0 = 0x00000020, // Reserved for future use
CK_STATESAVE_PARAMETERIN_RESERVED1 = 0x00000040, // Reserved for future use
CK_STATESAVE_PARAMETERIN_OWNER = 0x00000080, // Obsolete
CK_STATESAVE_PARAMETERIN_INSHARED = 0x00000100, // Obsolete
CK_STATESAVE_PARAMETERIN_OUTSOURCE = 0x00000200, // Obsolete
CK_STATESAVE_PARAMETERIN_DEFAULTDATA = 0x00000400, // Obsolete
CK_STATESAVE_PARAMETERIN_DATASHARED = 0x00000800, // Save reference to shared inparameter
CK_STATESAVE_PARAMETERIN_DATASOURCE = 0x00001000, // Save reference to source outparameter
CK_STATESAVE_PARAMETERIN_DISABLED = 0x00002000, // The parameter was disabled
CK_STATESAVE_PARAMETERIN_ALL = 0x0000FFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// ParameterLocal et ParameterOut
enum class CK_STATESAVEFLAGS_PARAMETEROUT : uint32_t {
CK_STATESAVE_PARAMETEROUT_RESERVED0 = 0x00000010, // Reserved for future use
CK_STATESAVE_PARAMETEROUT_DESTINATIONS = 0x00000020, // Save destinations
CK_STATESAVE_PARAMETEROUT_VAL = 0x00000040, // Save value
CK_STATESAVE_PARAMETEROUT_OWNER = 0x00000080, // Save Owner
CK_STATESAVE_PARAMETEROUT_MYSELF = 0x00000200, //
CK_STATESAVE_PARAMETEROUT_ISSETTING = 0x00000400, // Reserved for future use
CK_STATESAVE_PARAMETEROUT_ALL = 0x0000FFFF // Save All datas for sub-classes
};
//---------------------------------------------------
// Parameter Operation
enum class CK_STATESAVEFLAGS_OPERATION : uint32_t {
CK_STATESAVE_OPERATIONRESERVED0 = 0x00000010, // Reserved for future use
CK_STATESAVE_OPERATIONRESERVED1 = 0x00000020, // Reserved for future use
CK_STATESAVE_OPERATIONINPUTS = 0x00000040,
CK_STATESAVE_OPERATIONOUTPUT = 0x00000080,
CK_STATESAVE_OPERATIONOP = 0x00000100,
CK_STATESAVE_OPERATIONDEFAULTDATA = 0x00000200,
CK_STATESAVE_OPERATIONNEWDATA = 0x00000400,
CK_STATESAVE_OPERATIONALL = 0x000007FF // Save All datas for sub-classes
};
//---------------------------------------------------
// Synchro Object
// CKSaveOjectSave will save all relevant data and does not take flags into account
enum class CK_STATESAVEFLAGS_SYNCHRO : uint32_t {
CK_STATESAVE_SYNCHRODATA = 0x00000010, // Save data
CK_STATESAVE_SYNCHRORESERVED0 = 0x00000040, // Reserved for future use
CK_STATESAVE_SYNCHRORESERVED1 = 0x00000080, // Reserved for future use
CK_STATESAVE_SYNCHRORESERVED2 = 0x00000100, // Reserved for future use
CK_STATESAVE_SYNCHRORESERVED3 = 0x00000200, // Reserved for future use
CK_STATESAVE_SYNCHRONALL = 0x000003FF // Save All datas for sub-classes
};
//------------------------------------------------
// Grid
enum class CK_STATESAVEFLAGS_GRID : uint32_t {
CK_STATESAVE_GRIDDATA = 0x00400000, // Save Grid Data
CK_STATESAVE_GRIDRESERVED0 = 0x00800000, // Reserved for future use
CK_STATESAVE_GRIDRESERVED1 = 0x01000000, // Reserved for future use
CK_STATESAVE_GRIDRESERVED2 = 0x02000000, // Reserved for future use
CK_STATESAVE_GRIDRESERVED3 = 0x04000000, // Reserved for future use
CK_STATESAVE_GRIDRESERVED4 = 0x08000000, // Reserved for future use
CK_STATESAVE_GRIDONLY = 0x0FC00000, //
CK_STATESAVE_GRIDALL = 0x0FFFFFFF // Save All datas for sub-classes
};
//------------------------------------------------
// Layer (For Grids)
enum class CK_STATESAVEFLAGS_LAYER : uint32_t {
CK_STATESAVE_LAYERDATA = 0x00000010, // Save Layer Data
CK_STATESAVE_LAYERRESERVED0 = 0x00800020, // Reserved for future use
CK_STATESAVE_LAYERRESERVED1 = 0x00000040, // Reserved for future use
CK_STATESAVE_LAYERRESERVED2 = 0x00000080, // Reserved for future use
CK_STATESAVE_LAYERRESERVED3 = 0x00000100, // Reserved for future use
CK_STATESAVE_LAYERRESERVED4 = 0x00000200, // Reserved for future use
CK_STATESAVE_LAYERONLY = 0x000003F0, //
CK_STATESAVE_LAYERALL = 0x000003FF // Save All datas for sub-classes
};
//------------------------------------------------
// DataArray
// CKSaveOjectSave will save all relevant data and does not take flags into account
enum class CK_STATESAVEFLAGS_DATAARRAY : uint32_t {
CK_STATESAVE_DATAARRAYFORMAT = 0x00001000, // Save format
CK_STATESAVE_DATAARRAYDATA = 0x00002000, // Save array data
CK_STATESAVE_DATAARRAYMEMBERS = 0x00004000, // Save members
CK_STATESAVE_DATAARRAYALL = 0x0000FFFF // Save All datas for sub-classes
};
//------------------------------------------------
// SceneObjectDesc
enum class CK_STATESAVEFLAGS_SCENEOBJECTDESC : uint32_t {
CK_STATESAVE_SCENEOBJECTDESC = 0x00000010,
CK_STATESAVE_SCENEOBJECTRES1 = 0x00000020, // Reserved for future use
CK_STATESAVE_SCENEOBJECTRES2 = 0x00000040, // Reserved for future use
CK_STATESAVE_SCENEOBJECTRES3 = 0x00000080, // Reserved for future use
CK_STATESAVE_SCENEOBJECTDESCALL = 0x000000FF // Save All datas for sub-classes
};
}

View File

@ -9,6 +9,13 @@ namespace LibCmo::CK2::CKManagerImplements {
}
CKERROR CKBaseManager::LoadData(CKStateChunk* statechunk, CKFileData::ShallowDocument* doc) {
return CKERROR::CKERR_OK;
}
CKStateChunk* CKBaseManager::SaveData(CKFileData::ShallowDocument* doc) {
return nullptr;
}
CKAttributeManager::CKAttributeManager(CKMinContext* ctx, CK_ID ckid) : CKBaseManager(ctx, ckid) {

View File

@ -1,4 +1,7 @@
#include "../CKObjects.hpp"
#include "../CKStateChunk.hpp"
#include "../CKIdentifiers.hpp"
#include "../VTUtils.hpp"
namespace LibCmo::CK2::CKObjectImplements {
@ -14,6 +17,32 @@ namespace LibCmo::CK2::CKObjectImplements {
}
CKERROR CKObject::Load(CKStateChunk* chunk, const CKFileData::ShallowDocument* doc) {
if (chunk->SeekIdentifier(Identifiers::CK_STATESAVEFLAGS_OBJECT::CK_STATESAVE_OBJECTHIDDEN)) {
EnumsHelper::FlagEnumRm(this->m_ObjectFlags,
{ CK_OBJECT_FLAGS::CK_OBJECT_VISIBLE,
CK_OBJECT_FLAGS::CK_OBJECT_HIERACHICALHIDE }
);
} else {
if (chunk->SeekIdentifier(Identifiers::CK_STATESAVEFLAGS_OBJECT::CK_STATESAVE_OBJECTHIERAHIDDEN)) {
// != 0
EnumsHelper::FlagEnumRm(this->m_ObjectFlags,
{ CK_OBJECT_FLAGS::CK_OBJECT_VISIBLE, }
);
EnumsHelper::FlagEnumAdd(this->m_ObjectFlags,
{ CK_OBJECT_FLAGS::CK_OBJECT_HIERACHICALHIDE, }
);
} else {
// == 0
EnumsHelper::FlagEnumAdd(this->m_ObjectFlags,
{ CK_OBJECT_FLAGS::CK_OBJECT_VISIBLE, }
);
EnumsHelper::FlagEnumRm(this->m_ObjectFlags,
{ CK_OBJECT_FLAGS::CK_OBJECT_HIERACHICALHIDE, }
);
}
}
return CKERROR::CKERR_OK;
}
CKStateChunk* CKObject::Save(CKFileData::ShallowDocument* doc) {

View File

@ -6,6 +6,12 @@
namespace LibCmo::CK2::CKObjectImplements {
class CKObject {
protected:
CK_ID m_ID;
std::string m_Name;
CK_OBJECT_FLAGS m_ObjectFlags;
CKMinContext* m_Context;
public:
CKObject(CKMinContext* ctx, CK_ID ckid, CKSTRING name);
CKObject(const CKObject&) = delete;
@ -13,7 +19,7 @@ namespace LibCmo::CK2::CKObjectImplements {
virtual ~CKObject();
CK_ID GetID(void) { return this->m_ID; }
CKSTRING GetName(void) { (this->m_Name.empty()) ? (nullptr) : (this->m_Name.c_str()); }
CKSTRING GetName(void) { return (this->m_Name.empty() ? nullptr : this->m_Name.c_str()); }
void SetName(CKSTRING u8_name) { this->m_Name = (u8_name == nullptr ? "" : u8_name); }
CK_OBJECT_FLAGS GetObjectFlags(void) { return this->m_ObjectFlags; }
void SetObjectFlags(CK_OBJECT_FLAGS flags) { this->m_ObjectFlags = flags; }
@ -21,11 +27,6 @@ namespace LibCmo::CK2::CKObjectImplements {
virtual CK_CLASSID GetClassID(void) { return CK_CLASSID::CKCID_OBJECT; }
virtual CKERROR Load(CKStateChunk* chunk, const 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 {

View File

@ -344,12 +344,12 @@ namespace LibCmo::CK2 {
this->m_Parser.m_Status = CKStateChunkStatus::READ;
}
bool CKStateChunk::SeekIdentifier(CKDWORD identifier) {
bool CKStateChunk::SeekIdentifierDword(CKDWORD identifier) {
CKDWORD cache;
return SeekIdentifierAndReturnSize(identifier, &cache);
return SeekIdentifierDwordAndReturnSize(identifier, &cache);
}
bool CKStateChunk::SeekIdentifierAndReturnSize(CKDWORD identifier, CKDWORD* out_size) {
bool CKStateChunk::SeekIdentifierDwordAndReturnSize(CKDWORD identifier, CKDWORD* out_size) {
if (this->m_Parser.m_Status != CKStateChunkStatus::READ) return false;
CKDWORD pos = 0u;

View File

@ -62,9 +62,17 @@ namespace LibCmo::CK2 {
public:
void StartRead(void);
bool SeekIdentifier(CKDWORD identifier);
bool SeekIdentifierAndReturnSize(CKDWORD identifier, CKDWORD* out_size);
CKERROR ReadString(std::string& strl);
bool SeekIdentifierDword(CKDWORD identifier);
bool SeekIdentifierDwordAndReturnSize(CKDWORD identifier, CKDWORD* out_size);
template<typename TEnum>
inline bool SeekIdentifier(TEnum enum_v) {
return SeekIdentifierDword(static_cast<CKDWORD>(enum_v));
}
template<typename TEnum>
inline bool SeekIdentifierAndReturnSize(TEnum enum_v, CKDWORD* out_size) {
return SeekIdentifierDwordAndReturnSize(static_cast<CKDWORD>(enum_v), out_size);
}
/*
* Read Struct
Primitive type: ReadInt, ReadByte, ReadWord, ReadDword, ReadFloat, etc...
@ -89,15 +97,17 @@ namespace LibCmo::CK2 {
inline CKERROR ReadStructRef(T& data) {
return ReadStructPtr(&data);
}
/*
* Read Enum Data
A wrapper for ReadStructPtr.
All Enum read redirect to this.
*/
template<typename T>
inline CKERROR ReadEnum(T& data) {
return ReadStructPtr(reinterpret_cast<std::underlying_type_t<T>*>(&data));
}
///*
//* Read Enum Data
//A wrapper for ReadStructPtr.
//All Enum read redirect to this.
//*/
//template<typename T>
//inline CKERROR ReadEnum(T& data) {
// return ReadStructPtr(reinterpret_cast<std::underlying_type_t<T>*>(&data));
//}
CKERROR ReadString(std::string& strl);
CKERROR ReadBuffer(void* allocatedBuf);
CKERROR ReadNoSizeBuffer(CKDWORD size, void* allocatedBuf);

View File

@ -192,6 +192,7 @@
<ClInclude Include="CKEnums.hpp" />
<ClInclude Include="CKFile.hpp" />
<ClInclude Include="CKGlobals.hpp" />
<ClInclude Include="CKIdentifiers.hpp" />
<ClInclude Include="CKManagers.hpp" />
<ClInclude Include="CKMinContext.hpp" />
<ClInclude Include="CKStateChunk.hpp" />

View File

@ -89,5 +89,8 @@
<ClInclude Include="CKManagers.hpp">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="CKIdentifiers.hpp">
<Filter>Headers</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -45,19 +45,34 @@
#include <type_traits>
#include <cinttypes>
#include <cstdint>
#include <cstdarg>
namespace LibCmo {
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;
inline TEnum FlagEnumMerge(std::initializer_list<TEnum> il) {
std::underlying_type_t<TEnum> result = 0u;
for (auto it = il.begin(); it != il.end(); ++it) {
result |= static_cast<std::underlying_type_t<TEnum>>(*it);
}
return static_cast<TEnum>(result);
}
template<typename TEnum>
inline TEnum FlagEnumInv(TEnum e) {
return static_cast<TEnum>(~(static_cast<std::underlying_type_t<TEnum>>(e)));
}
template<typename TEnum>
inline void FlagEnumRm(TEnum& e, std::initializer_list<TEnum> il) {
auto mask = FlagEnumInv(FlagEnumMerge(il));
e = static_cast<TEnum>(static_cast<std::underlying_type_t<TEnum>>(e) & static_cast<std::underlying_type_t<TEnum>>(mask));
}
template<typename TEnum>
inline void FlagEnumAdd(TEnum& e, std::initializer_list<TEnum> il) {
auto mask = FlagEnumMerge(il);
e = static_cast<TEnum>(static_cast<std::underlying_type_t<TEnum>>(e) | static_cast<std::underlying_type_t<TEnum>>(mask));
}
template<typename TEnum>

View File

@ -11,8 +11,8 @@ namespace Unvirt {
std::string container;
fputs(UNVIRT_TERMCOL_LIGHT_YELLOW(("CKFileInfo\n")), fout);
fprintf(fout, "Version (File / CK): %" PRIu32 " / %02" PRIX32 "/%02" PRIX32 "/%04" PRIX32 "\n",
fileinfo.FileVersion,
fprintf(fout, "FileVersion: %" PRIu32 "\n", fileinfo.FileVersion);
fprintf(fout, "CKVersion: %02" PRIX32 "/%02" PRIX32 "/%04" PRIX32 "\n",
(fileinfo.CKVersion >> 24) & 0xFF,
(fileinfo.CKVersion >> 16) & 0xFF,
(fileinfo.CKVersion >> 0) & 0xFFFF

View File

@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
LibCmo::CK2::CKFile vtfile(&vtctx);
LibCmo::CK2::CKFileData::DeepDocument* doc;
LibCmo::CK2::CKERROR err = vtfile.DeepLoad("Language.old.nmo", &doc);
LibCmo::CK2::CKERROR err = vtfile.DeepLoad("Level_01.NMO", &doc);
if (doc)
Unvirt::StructFormatter::PrintCKFileInfo(doc->m_FileInfo);