1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-25 08:21:22 +00: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:
Nicholas Estelami 2021-04-30 17:23:22 -04:00 committed by GitHub
parent 6e58354c71
commit 0432011bd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
141 changed files with 7843 additions and 4338 deletions

View file

@ -1,10 +1,13 @@
#include "ZResource.h"
#include <regex>
#include "StringHelper.h"
using namespace std;
ZResource::ZResource()
ZResource::ZResource(ZFile* nParent)
{
parent = nullptr;
parent = nParent;
name = "";
outName = "";
relativePath = "";
@ -14,17 +17,68 @@ ZResource::ZResource()
outputDeclaration = true;
}
void ZResource::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
const uint32_t nRawDataIndex, const std::string& nRelPath)
{
rawData = nRawData;
rawDataIndex = nRawDataIndex;
relativePath = nRelPath;
if (reader != nullptr)
ParseXML(reader);
ParseRawData();
}
void ZResource::ExtractFromFile(const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex,
const std::string& nRelPath)
{
rawData = nRawData;
rawDataIndex = nRawDataIndex;
relativePath = nRelPath;
ParseRawData();
}
void ZResource::ParseXML(tinyxml2::XMLElement* reader)
{
if (reader->Attribute("Name") != nullptr)
name = reader->Attribute("Name");
else
name = "";
if (reader != nullptr)
{
if (reader->Attribute("Name") != nullptr)
{
name = reader->Attribute("Name");
static std::regex r("[a-zA-Z_]+[a-zA-Z0-9_]*",
std::regex::icase | std::regex::optimize);
if (reader->Attribute("OutName") != nullptr)
outName = reader->Attribute("OutName");
else
outName = name;
if (!std::regex_match(name, r))
{
throw std::domain_error(
StringHelper::Sprintf("ZResource::ParseXML: Fatal error in '%s'.\n\t Resource "
"with invalid 'Name' attribute.\n",
name.c_str()));
}
}
else
name = "";
if (reader->Attribute("OutName") != nullptr)
outName = reader->Attribute("OutName");
else
outName = name;
if (reader->Attribute("Custom") != nullptr)
isCustomAsset = true;
else
isCustomAsset = false;
if (!canHaveInner && !reader->NoChildren())
{
throw std::runtime_error(
StringHelper::Sprintf("ZResource::ParseXML: Fatal error in '%s'.\n\t Resource '%s' "
"with inner element/child detected.\n",
name.c_str(), reader->Name()));
}
}
}
void ZResource::Save(const std::string& outFolder)
@ -45,6 +99,11 @@ std::string ZResource::GetOutName()
return outName;
}
void ZResource::SetOutName(std::string nName)
{
outName = nName;
}
void ZResource::SetName(string nName)
{
name = std::move(nName);
@ -75,17 +134,22 @@ vector<uint8_t> ZResource::GetRawData()
return rawData;
}
int ZResource::GetRawDataIndex()
void ZResource::SetRawData(std::vector<uint8_t> nData)
{
rawData = nData;
}
uint32_t ZResource::GetRawDataIndex()
{
return rawDataIndex;
}
int ZResource::GetRawDataSize()
size_t ZResource::GetRawDataSize()
{
return rawData.size();
}
void ZResource::SetRawDataIndex(int value)
void ZResource::SetRawDataIndex(uint32_t value)
{
rawDataIndex = value;
}
@ -110,7 +174,7 @@ void ZResource::GenerateHLIntermediette(HLFileIntermediette& hlFile)
std::string ZResource::GetSourceTypeName()
{
return "";
return "u8";
}
ZResourceType ZResource::GetResourceType()
@ -132,3 +196,7 @@ uint32_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress)
return currentPtr;
}
ZResource::~ZResource()
{
}