mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-18 13:00:23 +00:00
git subrepo pull --force tools/ZAPD (#1049)
subrepo: subdir: "tools/ZAPD" merged: "a3363333d" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "a3363333d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
This commit is contained in:
parent
5e9d24fca4
commit
68899c2e33
72 changed files with 1311 additions and 569 deletions
|
@ -1,8 +1,10 @@
|
|||
#include "SetMesh.h"
|
||||
#include <Globals.h>
|
||||
#include <Utils/Path.h>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/BitConverter.h"
|
||||
#include "Utils/Path.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "WarningHandler.h"
|
||||
#include "ZBackground.h"
|
||||
#include "ZFile.h"
|
||||
#include "ZRoom/ZRoom.h"
|
||||
|
@ -34,9 +36,8 @@ void SetMesh::ParseRawData()
|
|||
break;
|
||||
|
||||
default:
|
||||
throw std::runtime_error(StringHelper::Sprintf("Error in SetMesh::ParseRawData\n"
|
||||
"\t Unknown meshHeaderType: %i\n",
|
||||
meshHeaderType));
|
||||
HANDLE_ERROR(WarningType::InvalidExtractedData,
|
||||
StringHelper::Sprintf("unknown meshHeaderType: %i", meshHeaderType), "");
|
||||
}
|
||||
|
||||
polyType->ParseRawData();
|
||||
|
@ -53,11 +54,9 @@ void SetMesh::DeclareReferences(const std::string& prefix)
|
|||
void GenDListDeclarations(ZRoom* zRoom, ZFile* parent, ZDisplayList* dList)
|
||||
{
|
||||
if (dList == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sourceOutput = dList->GetSourceOutputCode(zRoom->GetName());
|
||||
dList->DeclareReferences(zRoom->GetName());
|
||||
|
||||
for (ZDisplayList* otherDList : dList->otherDLists)
|
||||
GenDListDeclarations(zRoom, parent, otherDList);
|
||||
|
@ -143,21 +142,17 @@ std::string PolygonDlist::GetBodySourceCode() const
|
|||
return bodyStr;
|
||||
}
|
||||
|
||||
std::string PolygonDlist::GetSourceOutputCode(const std::string& prefix)
|
||||
void PolygonDlist::GetSourceOutputCode(const std::string& prefix)
|
||||
{
|
||||
std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str());
|
||||
|
||||
Declaration* decl = parent->GetDeclaration(rawDataIndex);
|
||||
if (decl == nullptr)
|
||||
{
|
||||
DeclareVar(prefix, bodyStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
decl->text = bodyStr;
|
||||
}
|
||||
|
||||
return "";
|
||||
if (decl == nullptr)
|
||||
DeclareVar(prefix, bodyStr);
|
||||
else
|
||||
decl->text = bodyStr;
|
||||
|
||||
}
|
||||
|
||||
std::string PolygonDlist::GetSourceTypeName() const
|
||||
|
@ -472,8 +467,8 @@ void PolygonType1::DeclareReferences(const std::string& prefix)
|
|||
break;
|
||||
|
||||
default:
|
||||
throw std::runtime_error(StringHelper::Sprintf(
|
||||
"Error in PolygonType1::PolygonType1\n\t Unknown format: %i\n", format));
|
||||
HANDLE_ERROR(WarningType::InvalidExtractedData,
|
||||
StringHelper::Sprintf("unknown format: %i", format), "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -582,9 +577,11 @@ void PolygonType2::DeclareReferences(const std::string& prefix)
|
|||
polyDListName = StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), polyDlistType.c_str(),
|
||||
GETSEGOFFSET(start));
|
||||
|
||||
parent->AddDeclarationArray(GETSEGOFFSET(start), DeclarationAlignment::Align4,
|
||||
polyDLists.size() * polyDLists.at(0).GetRawDataSize(),
|
||||
polyDlistType, polyDListName, polyDLists.size(), declaration);
|
||||
Declaration* decl = parent->AddDeclarationArray(
|
||||
GETSEGOFFSET(start), DeclarationAlignment::Align4,
|
||||
polyDLists.size() * polyDLists.at(0).GetRawDataSize(), polyDlistType, polyDListName,
|
||||
polyDLists.size(), declaration);
|
||||
decl->forceArrayCnt = true;
|
||||
}
|
||||
|
||||
parent->AddDeclaration(GETSEGOFFSET(end), DeclarationAlignment::Align4, 4, "s32",
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceOutputCode(const std::string& prefix) override;
|
||||
void GetSourceOutputCode(const std::string& prefix) override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
ZResourceType GetResourceType() const override;
|
||||
|
|
|
@ -115,11 +115,9 @@ std::string RomFile::GetBodySourceCode() const
|
|||
return declaration;
|
||||
}
|
||||
|
||||
std::string RomFile::GetSourceOutputCode(const std::string& prefix)
|
||||
void RomFile::GetSourceOutputCode(const std::string& prefix)
|
||||
{
|
||||
DeclareVar(prefix, GetBodySourceCode());
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string RomFile::GetSourceTypeName() const
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
Declaration* DeclareVar(const std::string& prefix, const std::string& body) override;
|
||||
std::string GetBodySourceCode() const override;
|
||||
std::string GetSourceOutputCode(const std::string& prefix) override;
|
||||
void GetSourceOutputCode(const std::string& prefix) override;
|
||||
|
||||
std::string GetSourceTypeName() const override;
|
||||
virtual ZResourceType GetResourceType() const override;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "Utils/File.h"
|
||||
#include "Utils/Path.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "WarningHandler.h"
|
||||
#include "ZBlob.h"
|
||||
#include "ZCutscene.h"
|
||||
#include "ZFile.h"
|
||||
|
@ -123,10 +124,12 @@ void ZRoom::ParseXML(tinyxml2::XMLElement* reader)
|
|||
{
|
||||
hackMode = std::string(reader->Attribute("HackMode"));
|
||||
if (hackMode != "syotes_room")
|
||||
throw std::runtime_error(
|
||||
StringHelper::Sprintf("ZRoom::ParseXML: Fatal error in '%s'.\n"
|
||||
"\t Invalid value for attribute 'HackMode': '%s'\n",
|
||||
name.c_str(), hackMode.c_str()));
|
||||
{
|
||||
std::string headerError = StringHelper::Sprintf(
|
||||
"invalid value found for 'HackMode' attribute: '%s'", hackMode.c_str());
|
||||
HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex,
|
||||
headerError, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,14 +395,10 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::string ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
|
||||
void ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
|
||||
{
|
||||
if (hackMode == "syotes_room")
|
||||
return "";
|
||||
|
||||
DeclareVar(prefix, GetBodySourceCode());
|
||||
|
||||
return "";
|
||||
if (hackMode != "syotes_room")
|
||||
DeclareVar(prefix, GetBodySourceCode());
|
||||
}
|
||||
|
||||
size_t ZRoom::GetRawDataSize() const
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
Declaration* DeclareVar(const std::string& prefix, const std::string& body) override;
|
||||
std::string GetBodySourceCode() const override;
|
||||
|
||||
std::string GetSourceOutputCode(const std::string& prefix) override;
|
||||
void GetSourceOutputCode(const std::string& prefix) override;
|
||||
|
||||
std::string GetDefaultName(const std::string& prefix) const override;
|
||||
size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue