add more info display

This commit is contained in:
2023-08-29 10:42:13 +08:00
parent 0887cd6d86
commit 763c6e84f9
8 changed files with 150 additions and 62 deletions

View File

@ -126,7 +126,7 @@ namespace LibCmo::CK2 {
//CKINT PostPackSize; /**< When compressed chunk by chunk : size of Data after compression */
//CKINT PrePackSize; /**< When compressed chunk by chunk : size of Data before compression */
CK_FO_OPTIONS Options; /**< When loading an object it may be renamed , use to replace another object */
CKINT FileIndex; /**< Position of the object data inside uncompressed file buffer */
CKDWORD FileIndex; /**< Position of the object data inside uncompressed file buffer */
CKDWORD SaveFlags; /**< Flags used when this object was saved. */
};

View File

@ -253,25 +253,26 @@ namespace LibCmo::CK2 {
#pragma region CKFileVisitor
CKFileVisitor::CKFileVisitor(CKFileReader* reader) :
m_IsReader(CKTRUE), m_Reader(reader), m_Writer(nullptr) {
m_IsReader(CKTRUE), m_Reader(reader), m_Writer(nullptr), m_Ctx(reader->m_Ctx) {
if (reader == nullptr) LIBPANIC("Reader is nullptr.");
}
CKFileVisitor::CKFileVisitor(CKFileWriter* writer) :
m_IsReader(false), m_Reader(nullptr), m_Writer(nullptr) {
m_IsReader(false), m_Reader(nullptr), m_Writer(writer), m_Ctx(writer->m_Ctx) {
if (writer == nullptr) LIBPANIC("Writer is nullptr.");
}
CKFileVisitor::CKFileVisitor(const CKFileVisitor& rhs) :
m_IsReader(rhs.m_IsReader), m_Reader(rhs.m_Reader), m_Writer(rhs.m_Writer) {}
m_IsReader(rhs.m_IsReader), m_Reader(rhs.m_Reader), m_Writer(rhs.m_Writer), m_Ctx(rhs.m_Ctx) {}
CKFileVisitor::CKFileVisitor(CKFileVisitor&& rhs) :
m_IsReader(rhs.m_IsReader), m_Reader(rhs.m_Reader), m_Writer(rhs.m_Writer) {}
m_IsReader(rhs.m_IsReader), m_Reader(rhs.m_Reader), m_Writer(rhs.m_Writer), m_Ctx(rhs.m_Ctx) {}
CKFileVisitor& CKFileVisitor::operator=(const CKFileVisitor& rhs) {
this->m_IsReader = rhs.m_IsReader;
this->m_Reader = rhs.m_Reader;
this->m_Writer = rhs.m_Writer;
this->m_Ctx = rhs.m_Ctx;
return *this;
}
@ -280,6 +281,7 @@ namespace LibCmo::CK2 {
this->m_IsReader = rhs.m_IsReader;
this->m_Reader = rhs.m_Reader;
this->m_Writer = rhs.m_Writer;
this->m_Ctx = rhs.m_Ctx;
return *this;
}

View File

@ -110,6 +110,26 @@ namespace LibCmo::CK2 {
#pragma region Misc Funcs
const ChunkProfile CKStateChunk::GetStateChunkProfile() {
ChunkProfile profile;
profile.m_ClassId = this->m_ClassId;
profile.m_DataDwSize = this->m_DataDwSize;
profile.m_pData = this->m_pData;
profile.m_DataVersion = this->m_DataVersion;
profile.m_ChunkVersion = this->m_ChunkVersion;
profile.m_ObjectListSize = this->m_ObjectList.size();
profile.m_ChunkListSize = this->m_ChunkList.size();
profile.m_ManagerListSize = this->m_ManagerList.size();
profile.m_BindFile = this->m_BindFile;
profile.m_BindContext = this->m_BindContext;
return profile;
}
void CKStateChunk::Clear(void) {
this->m_ClassId = CK_CLASSID::CKCID_OBJECT;
this->m_DataVersion = CK_STATECHUNK_DATAVERSION::CHUNK_DEV_2_1;
@ -505,7 +525,7 @@ namespace LibCmo::CK2 {
return true;
}
XContainer::XArray<IdentifierProfile> CKStateChunk::GetIdentifierProfile() {
const XContainer::XArray<IdentifierProfile> CKStateChunk::GetIdentifierProfile() {
XContainer::XArray<IdentifierProfile> collection;
if (this->m_Parser.m_Status != CKStateChunkStatus::READ) return collection;
@ -550,7 +570,7 @@ namespace LibCmo::CK2 {
return true;
} else {
// failed, report to context
m_BindContext->OutputToConsoleEx("CKStateChunk read length error at %" PRIckDWORD ".", this->m_Parser.m_CurrentPos);
m_BindContext->OutputToConsoleEx("CKStateChunk read length error at %" PRIuCKDWORD ".", this->m_Parser.m_CurrentPos);
return false;
}
}

View File

@ -73,6 +73,8 @@ namespace LibCmo::CK2 {
#pragma region Misc Functions
public:
const ChunkProfile GetStateChunkProfile();
//bool UnPack(CKDWORD DestSize);
void Clear(void);
CKDWORD GetDataSize(void);
@ -112,7 +114,7 @@ namespace LibCmo::CK2 {
inline bool SeekIdentifierAndReturnSize(TEnum enum_v, CKDWORD* out_size) {
return SeekIdentifierDwordAndReturnSize(static_cast<CKDWORD>(enum_v), out_size);
}
XContainer::XArray<IdentifierProfile> GetIdentifierProfile();
const XContainer::XArray<IdentifierProfile> GetIdentifierProfile();
/* ========== Basic Data Read Functions ==========*/

View File

@ -183,10 +183,20 @@ namespace LibCmo::CK2 {
using CKAttributeCategory = int32_t;
// type print style define
#define PRIckBYTE PRIu8
#define PRIckDWORD PRIu32
#define PRIckWORD PRIu16
#define PRIckINT PRIi32
#define PRIuCKID PRIu32
#define PRIiCKERROR PRIi32
#define PRIiCLASSID PRIi32
#define PRIuCKBYTE PRIu8
#define PRIuCKDWORD PRIu32
#define PRIuCKWORD PRIu16
#define PRIxCKBYTE PRIx8
#define PRIxCKDWORD PRIx32
#define PRIxCKWORD PRIx16
#define PRIXCKBYTE PRIX8
#define PRIXCKDWORD PRIX32
#define PRIXCKWORD PRIX16
#define PRIiCKINT PRIi32
// ========== Class List ==========
// Objects and derivated classes