Decode GPS result point array

This commit is contained in:
2026-06-20 13:24:32 -05:00
parent 701d85e81e
commit aaf319e1b4
2 changed files with 61 additions and 5 deletions
+52
View File
@@ -743,6 +743,27 @@ struct Vector4Value
float w;
};
struct Vector3Value
{
float x;
float y;
float z;
};
void AppendVector3Pointer(std::ostringstream& aLine, const char* aLabel, const void* aVector)
{
Vector3Value value{};
aLine << " " << aLabel << "=";
if (aVector && TryReadMemory(aVector, value))
{
aLine << "(" << value.x << "," << value.y << "," << value.z << ")";
}
else
{
aLine << "<unreadable>";
}
}
void AppendVector4Pointer(std::ostringstream& aLine, const char* aLabel, const void* aVector)
{
Vector4Value value{};
@@ -768,6 +789,32 @@ void AppendVector4Field(std::ostringstream& aLine, const char* aLabel, void* aOb
AppendVector4Pointer(aLine, aLabel, reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(aObject) + aOffset));
}
void AppendVector3ListCandidate(std::ostringstream& aLine, const char* aPrefix, void* aObject, uintptr_t aDataOffset,
uintptr_t aCountOffset, uintptr_t aStride)
{
uint32_t count = 0;
auto* data = ReadPointerField(aObject, aDataOffset);
TryReadMemory(reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(aObject) + aCountOffset), count);
const auto dataLabel = std::string(aPrefix) + "_data";
const auto countLabel = std::string(aPrefix) + "_count";
AppendPointerWithRva(aLine, dataLabel.c_str(), data);
aLine << " " << countLabel << "=" << count;
if (!data || reinterpret_cast<uintptr_t>(data) < 0x10000 || count == 0 || count > 10000)
{
return;
}
AppendVector3Pointer(aLine, (std::string(aPrefix) + "_first3").c_str(), data);
if (count > 1)
{
AppendVector3Pointer(aLine, (std::string(aPrefix) + "_last3").c_str(),
reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(data) +
static_cast<uintptr_t>(count - 1) * aStride));
}
}
void AppendVectorListCandidate(std::ostringstream& aLine, const char* aPrefix, void* aObject, uintptr_t aDataOffset,
uintptr_t aCountOffset, uintptr_t aStride)
{
@@ -832,6 +879,11 @@ void AppendGpsResultObjectSummary(std::ostringstream& aLine, const char* aPrefix
}
AppendBytesField(aLine, (std::string(aPrefix) + "_bytes20").c_str(), aResultObject, 0x20, 0x40);
AppendUint32Field(aLine, (std::string(aPrefix) + "_u20").c_str(), aResultObject, 0x20);
AppendUint32Field(aLine, (std::string(aPrefix) + "_u24").c_str(), aResultObject, 0x24);
AppendPointerField(aLine, (std::string(aPrefix) + "_ptr28").c_str(), aResultObject, 0x28);
AppendVector3ListCandidate(aLine, (std::string(aPrefix) + "_vec28s12").c_str(), aResultObject, 0x28, 0x30, 12);
AppendVectorListCandidate(aLine, (std::string(aPrefix) + "_vec28s16").c_str(), aResultObject, 0x28, 0x30, 16);
AppendVectorListCandidate(aLine, (std::string(aPrefix) + "_vec20").c_str(), aResultObject, 0x20, 0x2C, 12);
AppendVectorListCandidate(aLine, (std::string(aPrefix) + "_vec20s16").c_str(), aResultObject, 0x20, 0x2C, 16);
AppendUint32Field(aLine, (std::string(aPrefix) + "_u2c").c_str(), aResultObject, 0x2C);