From e416d47df464a32c71123607ba1025534484e9f9 Mon Sep 17 00:00:00 2001 From: njohnson Date: Sun, 7 Sep 2025 23:11:54 -0400 Subject: [PATCH] Update XGfxImage parsing logic --- libs/xassets/xgfximage.cpp | 75 ++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/libs/xassets/xgfximage.cpp b/libs/xassets/xgfximage.cpp index a3d6ed1..58e0ebb 100644 --- a/libs/xassets/xgfximage.cpp +++ b/libs/xassets/xgfximage.cpp @@ -28,44 +28,47 @@ XGfxImage::~XGfxImage() void XGfxImage::ParseData(QDataStream *aStream) { - *aStream >> mMapType; - - mTexture.ParseData(aStream); - - *aStream >> mSemantic; - - aStream->skipRawData(3); - - mCardMemory.ParseData(aStream); - - qint32 pixelsPtr; - *aStream - >> mWidth - >> mHeight - >> mDepth - >> mCategory - >> mDelayLoadPixels - >> pixelsPtr - >> mBaseSize - >> mStreamSlot - >> mStreaming; - - aStream->skipRawData(1); - - mName.ParsePtr(aStream); - - int variableSkip = 5; - if (mDelayLoadPixels) + if (GetPtr() == -1) { - variableSkip = 2; + *aStream >> mMapType; + + mTexture.ParseData(aStream); + + *aStream >> mSemantic; + + aStream->skipRawData(3); + + mCardMemory.ParseData(aStream); + + qint32 pixelsPtr; + *aStream + >> mWidth + >> mHeight + >> mDepth + >> mCategory + >> mDelayLoadPixels + >> pixelsPtr + >> mBaseSize + >> mStreamSlot + >> mStreaming; + + aStream->skipRawData(1); + + mName.ParsePtr(aStream); + + int variableSkip = 5; + if (mDelayLoadPixels) + { + variableSkip = 2; + } + aStream->skipRawData(variableSkip); + if (pixelsPtr) + { + aStream->readRawData(mPixels.data(), mCardMemory.GetPlatform()); + } + // TODO: This is wrong + mTexture.ParseData(aStream); } - aStream->skipRawData(variableSkip); - if (pixelsPtr) - { - aStream->readRawData(mPixels.data(), mCardMemory.GetPlatform()); - } - // TODO: This is wrong - mTexture.ParseData(aStream); } void XGfxImage::Clear()