Decode GPS route element records

This commit is contained in:
2026-06-20 13:43:55 -05:00
parent 56a451a7cb
commit b34f2e2dee
2 changed files with 55 additions and 47 deletions
+37 -30
View File
@@ -908,42 +908,51 @@ void AppendGpsResultElementArraySummary(std::ostringstream& aLine, const char* a
return;
}
const auto rawSize = std::min<size_t>(0x80, static_cast<size_t>(count) * sizeof(void*));
AppendBytesPointer(aLine, (prefix + "_ptr28_ptrsRaw").c_str(), data, rawSize);
constexpr uintptr_t kRouteRecordStride = 0x28;
const auto rawSize = std::min<size_t>(0xA0, static_cast<size_t>(count) * kRouteRecordStride);
AppendBytesPointer(aLine, (prefix + "_ptr28_rec40raw").c_str(), data, rawSize);
const auto appendElement = [&](uint32_t aIndex, const char* aLabel) {
auto* element = ReadPointerField(data, static_cast<uintptr_t>(aIndex) * sizeof(void*));
const auto elementPrefix = prefix + "_ptr28_" + aLabel;
AppendPointerWithRva(aLine, elementPrefix.c_str(), element);
if (!element || reinterpret_cast<uintptr_t>(element) < 0x10000)
const auto flags = aLine.flags();
const auto fill = aLine.fill();
aLine << " " << prefix << "_ptr28_rec40=[";
for (uint32_t index = 0; index < count; ++index)
{
const auto recordAddress = reinterpret_cast<uintptr_t>(data) + static_cast<uintptr_t>(index) * kRouteRecordStride;
const auto* record = reinterpret_cast<const void*>(recordAddress);
uint64_t h00 = 0;
uint32_t u08 = 0;
uint32_t u0c = 0;
uint32_t u10 = 0;
uint32_t u14 = 0;
uint64_t h18 = 0;
uint64_t h20 = 0;
const auto hasRecord = TryReadMemory(record, h00) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x08), u08) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x0C), u0c) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x10), u10) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x14), u14) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x18), h18) &&
TryReadMemory(reinterpret_cast<const void*>(recordAddress + 0x20), h20);
if (index > 0)
{
return;
aLine << ";";
}
AppendPointerField(aLine, (elementPrefix + "_f68").c_str(), element, 0x68);
AppendUint32Field(aLine, (elementPrefix + "_u74").c_str(), element, 0x74);
AppendPointerField(aLine, (elementPrefix + "_f90").c_str(), element, 0x90);
AppendUint32Field(aLine, (elementPrefix + "_u98").c_str(), element, 0x98);
uint32_t sampleCount = 0;
auto* samples = ReadPointerField(element, 0x68);
TryReadMemory(reinterpret_cast<const void*>(reinterpret_cast<uintptr_t>(element) + 0x74), sampleCount);
if (samples && reinterpret_cast<uintptr_t>(samples) >= 0x10000 && sampleCount > 0 && sampleCount <= 4096)
aLine << index << ":";
if (!hasRecord)
{
const auto sampleRawSize = std::min<size_t>(0x20, static_cast<size_t>(sampleCount) * 0x08);
AppendBytesPointer(aLine, (elementPrefix + "_f68raw").c_str(), samples, sampleRawSize);
aLine << "<unreadable>";
continue;
}
};
const auto firstLimit = std::min<uint32_t>(count, 4);
for (uint32_t index = 0; index < firstLimit; ++index)
{
appendElement(index, ("elem" + std::to_string(index)).c_str());
}
if (count > firstLimit)
{
appendElement(count - 1, "last");
aLine << std::hex << h00 << "," << std::dec << u08 << "," << u0c << "," << u10 << "," << u14 << ","
<< std::hex << h18 << "," << h20 << std::dec;
}
aLine << "]";
aLine.flags(flags);
aLine.fill(fill);
}
void AppendGpsResultObjectSummary(std::ostringstream& aLine, const char* aPrefix, void* aResultObject)
@@ -958,8 +967,6 @@ void AppendGpsResultObjectSummary(std::ostringstream& aLine, const char* aPrefix
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);