summaryrefslogtreecommitdiff
path: root/ZAPD/ZDisplayList.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-05-26 22:32:39 -0400
committerGitHub <noreply@github.com>2021-05-26 22:32:39 -0400
commitcd3e9527b185190c5f7826766bf2b4760bd12d5f (patch)
treebb01e372abc6a72511130adcee1d5e27127a5f49 /ZAPD/ZDisplayList.cpp
parent4410b554e835ab7844c8eb78fd54fa3842d50f16 (diff)
A few Limbs, Skel and CurveAnimation fixes (#144)
* Detect if a limb is pointing to the middle of a dlist * Fix limbs names being ignored in some cases * Check if pointing past the object's size * Remove unnecesary pointers * Don't try to extract the skel offset declared in a CurveAnimation * Final cleanup * Use GetDeclarationRanged * Always set the rangeEnd to the filesize by default * Revert "Always set the rangeEnd to the filesize by default" This reverts commit f5c135c39a1df3f545c97c0a0becf7808115e06f.
Diffstat (limited to 'ZAPD/ZDisplayList.cpp')
-rw-r--r--ZAPD/ZDisplayList.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp
index 745442d..de041f1 100644
--- a/ZAPD/ZDisplayList.cpp
+++ b/ZAPD/ZDisplayList.cpp
@@ -56,6 +56,8 @@ void ZDisplayList::ExtractFromXML(tinyxml2::XMLElement* reader,
dlistRawData.assign(nRawData.data() + rawDataIndex,
nRawData.data() + rawDataIndex + rawDataSize);
ParseRawData();
+
+ DeclareVar("", "");
}
ZDisplayList::ZDisplayList(std::vector<uint8_t> nRawData, uint32_t nRawDataIndex,
@@ -81,6 +83,12 @@ void ZDisplayList::ParseRawData()
instructions.push_back(BitConverter::ToUInt64BE(dlistRawData, (i * 8)));
}
+Declaration* ZDisplayList::DeclareVar(const std::string& prefix, const std::string& bodyStr)
+{
+ return parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align8, GetRawDataSize(),
+ GetSourceTypeName(), name, 0, bodyStr, true);
+}
+
void ZDisplayList::ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int32_t i, std::string prefix,
char* line)
{
@@ -1849,9 +1857,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix)
if (parent != nullptr)
{
- Declaration* decl = parent->AddDeclarationArray(
- rawDataIndex, DeclarationAlignment::None, GetRawDataSize(), "Gfx",
- StringHelper::Sprintf("%s", name.c_str()), 0, sourceOutput, true);
+ Declaration* decl = DeclareVar("", sourceOutput);
decl->references = references;
// return "";
// return sourceOutput;