mirror of
https://github.com/zeldaret/oot
synced 2026-09-11 04:13:38 -04:00
Updated to use latest version of ZAPD (#777)
* Updated config file * Added missing files * Temporarily removed asm_processor changes. * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "96ffc1e62" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "96ffc1e62" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "179af7d11" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "179af7d11" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Cleanup and fixes. * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "50ad2fe78" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "50ad2fe78" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Makefile fix * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "b9120803e" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "b9120803e" git-subrepo: version: "0.4.3" origin: "???" commit: "???" Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6e58354c71
commit
0432011bd9
+28
-21
@@ -6,23 +6,32 @@
|
||||
#include "StringHelper.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
ZVector::ZVector() : ZResource()
|
||||
REGISTER_ZFILENODE(Vector, ZVector);
|
||||
|
||||
ZVector::ZVector(ZFile* nParent) : ZResource(nParent)
|
||||
{
|
||||
scalars = std::vector<ZScalar*>();
|
||||
this->scalarType = ZSCALAR_NONE;
|
||||
this->dimensions = 0;
|
||||
}
|
||||
|
||||
ZVector* ZVector::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
|
||||
const int rawDataIndex, const std::string& nRelPath)
|
||||
ZVector::~ZVector()
|
||||
{
|
||||
ZVector* vector = new ZVector();
|
||||
vector->rawData = nRawData;
|
||||
vector->rawDataIndex = rawDataIndex;
|
||||
vector->ParseXML(reader);
|
||||
vector->ParseRawData();
|
||||
ClearScalars();
|
||||
}
|
||||
|
||||
return vector;
|
||||
void ZVector::ClearScalars()
|
||||
{
|
||||
for (auto s : scalars)
|
||||
delete s;
|
||||
|
||||
scalars.clear();
|
||||
}
|
||||
|
||||
void ZVector::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
|
||||
const uint32_t nRawDataIndex, const std::string& nRelPath)
|
||||
{
|
||||
ZResource::ExtractFromXML(reader, nRawData, nRawDataIndex, nRelPath);
|
||||
}
|
||||
|
||||
void ZVector::ParseXML(tinyxml2::XMLElement* reader)
|
||||
@@ -38,13 +47,13 @@ void ZVector::ParseXML(tinyxml2::XMLElement* reader)
|
||||
|
||||
void ZVector::ParseRawData()
|
||||
{
|
||||
int currentRawDataIndex = this->rawDataIndex;
|
||||
int32_t currentRawDataIndex = this->rawDataIndex;
|
||||
|
||||
scalars.clear();
|
||||
ClearScalars();
|
||||
|
||||
for (uint32_t i = 0; i < this->dimensions; i++)
|
||||
{
|
||||
ZScalar* scalar = new ZScalar(this->scalarType);
|
||||
ZScalar* scalar = new ZScalar(this->scalarType, this->parent);
|
||||
scalar->rawDataIndex = currentRawDataIndex;
|
||||
scalar->rawData = this->rawData;
|
||||
scalar->ParseRawData();
|
||||
@@ -57,11 +66,13 @@ void ZVector::ParseRawData()
|
||||
assert(this->scalars.size() == this->dimensions);
|
||||
}
|
||||
|
||||
int ZVector::GetRawDataSize()
|
||||
size_t ZVector::GetRawDataSize()
|
||||
{
|
||||
int size = 0;
|
||||
size_t size = 0;
|
||||
|
||||
for (size_t i = 0; i < this->scalars.size(); i++)
|
||||
size += this->scalars[i]->GetRawDataSize();
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -73,17 +84,11 @@ bool ZVector::DoesSupportArray()
|
||||
std::string ZVector::GetSourceTypeName()
|
||||
{
|
||||
if (dimensions == 3 && scalarType == ZSCALAR_F32)
|
||||
{
|
||||
return "Vec3f";
|
||||
}
|
||||
else if (dimensions == 3 && scalarType == ZSCALAR_S16)
|
||||
{
|
||||
return "Vec3s";
|
||||
}
|
||||
else if (dimensions == 3 && scalarType == ZSCALAR_S32)
|
||||
{
|
||||
return "Vec3i";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string output = StringHelper::Sprintf(
|
||||
@@ -93,15 +98,17 @@ std::string ZVector::GetSourceTypeName()
|
||||
if (Globals::Instance->verbosity >= VERBOSITY_DEBUG)
|
||||
printf("%s\n", output.c_str());
|
||||
|
||||
throw output;
|
||||
throw std::runtime_error(output);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ZVector::GetSourceValue()
|
||||
{
|
||||
std::vector<std::string> strings = std::vector<std::string>();
|
||||
|
||||
for (size_t i = 0; i < this->scalars.size(); i++)
|
||||
strings.push_back(scalars[i]->GetSourceValue());
|
||||
|
||||
return "{ " + StringHelper::Implode(strings, ", ") + " }";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user