summaryrefslogtreecommitdiff
path: root/ZAPD/ZPointer.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2022-01-11 21:55:18 -0300
committerGitHub <noreply@github.com>2022-01-11 19:55:18 -0500
commitbf16ff7c4c409358a53793b72260b1d8e474cf0c (patch)
treefa4d2d0169b5485f990112642df9b57b388af14b /ZAPD/ZPointer.cpp
parent16b53763423c6830a6fecef5579a2013c54abbd1 (diff)
ZPointer (#232)
* ZPointer * Add docs * format * jenkins file for mm * whoops * Rewrite as a switch * a
Diffstat (limited to 'ZAPD/ZPointer.cpp')
-rw-r--r--ZAPD/ZPointer.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/ZAPD/ZPointer.cpp b/ZAPD/ZPointer.cpp
new file mode 100644
index 0000000..6e6945c
--- /dev/null
+++ b/ZAPD/ZPointer.cpp
@@ -0,0 +1,57 @@
+#include "ZPointer.h"
+
+#include "Globals.h"
+#include "Utils/BitConverter.h"
+#include "Utils/StringHelper.h"
+#include "WarningHandler.h"
+#include "ZFile.h"
+
+REGISTER_ZFILENODE(Pointer, ZPointer);
+
+ZPointer::ZPointer(ZFile* nParent) : ZResource(nParent)
+{
+ RegisterRequiredAttribute("Type");
+}
+
+void ZPointer::ParseXML(tinyxml2::XMLElement* reader)
+{
+ ZResource::ParseXML(reader);
+
+ type = registeredAttributes.at("Type").value;
+}
+
+void ZPointer::ParseRawData()
+{
+ auto& rawData = parent->GetRawData();
+
+ ptr = BitConverter::ToUInt32BE(rawData, rawDataIndex);
+}
+
+std::string ZPointer::GetBodySourceCode() const
+{
+ std::string ptrName;
+
+ Globals::Instance->GetSegmentedPtrName(ptr, parent, "", ptrName);
+
+ return ptrName;
+}
+
+bool ZPointer::DoesSupportArray() const
+{
+ return true;
+}
+
+std::string ZPointer::GetSourceTypeName() const
+{
+ return type + "*";
+}
+
+ZResourceType ZPointer::GetResourceType() const
+{
+ return ZResourceType::Pointer;
+}
+
+size_t ZPointer::GetRawDataSize() const
+{
+ return 0x04;
+}