Fix: Improve Data Parsing and Debug Logging
This commit addresses an issue in the `XAsset` class's data parsing logic, specifically within the `ParsePtr` method. The previous implementation lacked proper parsing of the integer value associated with the asset's pointer. Additionally, the debug logging during data parsing was overly verbose and included unnecessary hexadecimal conversions. The fix ensures correct integer parsing and simplifies the debug logging output for easier debugging.
This commit is contained in:
parent
7e408d2c2e
commit
0545bfe642
@ -19,8 +19,6 @@
|
|||||||
#include "xstringtable.h"
|
#include "xstringtable.h"
|
||||||
#include "xweapondef.h"
|
#include "xweapondef.h"
|
||||||
|
|
||||||
XAsset::
|
|
||||||
|
|
||||||
XAsset::XAsset()
|
XAsset::XAsset()
|
||||||
: mPtr(0)
|
: mPtr(0)
|
||||||
, mType(ASSET_TYPE_NONE)
|
, mType(ASSET_TYPE_NONE)
|
||||||
@ -29,11 +27,6 @@ XAsset::XAsset()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XAsset::~XAsset()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void XAsset::SetPtr(qint32 aPtr) {
|
void XAsset::SetPtr(qint32 aPtr) {
|
||||||
mPtr = aPtr;
|
mPtr = aPtr;
|
||||||
}
|
}
|
||||||
@ -83,20 +76,9 @@ void XAsset::Clear()
|
|||||||
mType = ASSET_TYPE_NONE;
|
mType = ASSET_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XAsset::ParsePtr(QDataStream *aStream, bool aDataFlag) {
|
void XAsset::ParsePtr(XDataStream *aStream, bool aDataFlag) {
|
||||||
*aStream >> mPtr;
|
|
||||||
if (mDebug)
|
|
||||||
{
|
|
||||||
// Always treat as unsigned when displaying in hex
|
|
||||||
quint64 raw = static_cast<quint64>(static_cast<quint32>(mPtr));
|
|
||||||
|
|
||||||
QString hexPtr = QString("0x%1")
|
|
||||||
.arg(raw, 8, 16, QLatin1Char('0'))
|
|
||||||
.toUpper();
|
|
||||||
|
|
||||||
qDebug() << QString("[%1] Parsed %2 ptr %3 (%4)").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName()).arg(mPtr).arg(hexPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
mPtr = aStream->ParseInt32(QString("%1 ptr").arg(GetName()));
|
||||||
if (aDataFlag && mPtr == -1)
|
if (aDataFlag && mPtr == -1)
|
||||||
{
|
{
|
||||||
ParseData(aStream);
|
ParseData(aStream);
|
||||||
@ -105,10 +87,6 @@ void XAsset::ParsePtr(QDataStream *aStream, bool aDataFlag) {
|
|||||||
|
|
||||||
XAsset* XAsset::Create(XAssetType aAssetType)
|
XAsset* XAsset::Create(XAssetType aAssetType)
|
||||||
{
|
{
|
||||||
if (mDebug)
|
|
||||||
{
|
|
||||||
qDebug() << QString("Creating XAsset with type %1").arg(XAssetTypeToString(aAssetType));
|
|
||||||
}
|
|
||||||
switch (aAssetType)
|
switch (aAssetType)
|
||||||
{
|
{
|
||||||
case ASSET_TYPE_XANIMPARTS:
|
case ASSET_TYPE_XANIMPARTS:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user