fix saving issue

- fix CKStateChunk resize memory error.
- fix wrong CKBitmapHandler free position in CKBitmapData writer.
- fix init value error of CKFileWriter::m_DisableAddingFile when copying from reader.
- fix ReadString, WriteString error in CKStateChunk (forget NULL terminal)
- change CKPathManager resolve path order. Resolve temp path first, then resources folder.
- fix mixdata combine error when writing CKTexture.
This commit is contained in:
2023-09-30 16:01:39 +08:00
parent abea66d6f0
commit ee4b621cac
10 changed files with 62 additions and 36 deletions

View File

@ -164,10 +164,9 @@ namespace LibCmo::CK2::ObjImpls {
chunk->ReadStruct(m_ZOrder);
}
} else {
// MARK: compatibility code removed because I don't need them
return false;
}
}
// MARK: compatibility alternative core data read code removed because I don't need them
// MARK: skin and bone are skipped.

View File

@ -87,23 +87,23 @@ namespace LibCmo::CK2::ObjImpls {
// prepare mix data. see Read for more info about the struct of this mix data
CKDWORD mixdata = 0;
// save options
mixdata &= static_cast<CKDWORD>(m_ImageHost.GetSaveOptions()) & 0xFF;
mixdata |= static_cast<CKDWORD>(m_ImageHost.GetSaveOptions()) & 0xFF;
mixdata <<= 8;
// mix flags
CKDWORD mixflags = 0;
if (m_ImageHost.IsTransparent()) {
mixflags &= 0x1;
mixflags |= 0x1;
}
if (m_VideoFormat != VxMath::VX_PIXELFORMAT::UNKNOWN_PF) {
mixflags &= 0x2;
mixflags |= 0x2;
}
if (m_ImageHost.IsCubeMap()) {
mixflags &= 0x4;
mixflags |= 0x4;
}
mixdata &= mixflags & 0xFF;
mixdata |= mixflags & 0xFF;
mixdata <<= 8;
// mipmap
mixdata &= (IsUseMipmap() ? 0xFF : 0);
mixdata |= (IsUseMipmap() ? 0xFF : 0);
// write mix data
chunk->WriteStruct(mixdata);