Subrepos update (#613)

* a

* git subrepo pull tools/asm-differ --force

subrepo:
  subdir:   "tools/asm-differ"
  merged:   "6f8f80b71"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "6f8f80b71"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* git subrepo pull tools/z64compress --force

subrepo:
  subdir:   "tools/z64compress"
  merged:   "9e7a6dbfa"
upstream:
  origin:   "https://github.com/z64me/z64compress.git"
  branch:   "main"
  commit:   "9e7a6dbfa"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* git subrepo pull tools/ZAPD --force

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "bf16ff7c4"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "bf16ff7c4"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* Revert "git subrepo pull tools/z64compress --force"

This reverts commit a7cc87394e.
This commit is contained in:
Anghelo Carvajal
2022-01-16 15:30:31 -03:00
committed by GitHub
parent 9e6a6eee4c
commit 194c99d80b
15 changed files with 240 additions and 90 deletions
+34 -19
View File
@@ -16,6 +16,7 @@ ZTexture::ZTexture(ZFile* nParent) : ZResource(nParent)
{
width = 0;
height = 0;
dWordAligned = true;
RegisterRequiredAttribute("Width");
RegisterRequiredAttribute("Height");
@@ -105,10 +106,7 @@ void ZTexture::ParseXML(tinyxml2::XMLElement* reader)
void ZTexture::ParseRawData()
{
if (rawDataIndex % 8 != 0)
{
HANDLE_WARNING_RESOURCE(WarningType::NotImplemented, parent, this, rawDataIndex,
"this texture is not 64-bit aligned", "");
}
dWordAligned = false;
switch (format)
{
@@ -724,7 +722,12 @@ void ZTexture::Save(const fs::path& outFolder)
if (!Directory::Exists(outPath.string()))
Directory::CreateDirectory(outPath.string());
auto outFileName = outPath / (outName + "." + GetExternalExtension() + ".png");
std::filesystem::__cxx11::path outFileName;
if (!dWordAligned)
outFileName = outPath / (outName + ".u32" + "." + GetExternalExtension() + ".png");
else
outFileName = outPath / (outName + +"." + GetExternalExtension() + ".png");
#ifdef TEXTURE_DEBUG
printf("Saving PNG: %s\n", outFileName.c_str());
@@ -745,7 +748,7 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
{
std::string auxName = name;
std::string auxOutName = outName;
std::string incStr;
if (auxName == "")
auxName = GetDefaultName(prefix);
@@ -754,8 +757,12 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
auto filepath = Globals::Instance->outputPath / fs::path(auxOutName).stem();
std::string incStr =
StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), GetExternalExtension().c_str());
if (dWordAligned)
incStr =
StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), GetExternalExtension().c_str());
else
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.c_str(),
GetExternalExtension().c_str());
if (!Globals::Instance->cfg.texturePool.empty())
{
@@ -765,13 +772,19 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
const auto& poolEntry = Globals::Instance->cfg.texturePool.find(hash);
if (poolEntry != Globals::Instance->cfg.texturePool.end())
{
incStr = StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.c_str(),
GetExternalExtension().c_str());
if (dWordAligned)
incStr = StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.c_str(),
GetExternalExtension().c_str());
else
incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", poolEntry->second.path.c_str(),
GetExternalExtension().c_str());
}
}
size_t texSizeDivisor = (dWordAligned) ? 8 : 4;
Declaration* decl = parent->AddDeclarationIncludeArray(
rawDataIndex, incStr, GetRawDataSize(), GetSourceTypeName(), auxName, GetRawDataSize() / 8);
Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(),
GetSourceTypeName(), auxName,
GetRawDataSize() / texSizeDivisor);
decl->staticConf = staticConf;
return decl;
}
@@ -779,15 +792,17 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix,
std::string ZTexture::GetBodySourceCode() const
{
std::string sourceOutput;
for (size_t i = 0; i < textureDataRaw.size(); i += 8)
size_t texSizeInc = (dWordAligned) ? 8 : 4;
for (size_t i = 0; i < textureDataRaw.size(); i += texSizeInc)
{
if (i % 32 == 0)
sourceOutput += " ";
sourceOutput +=
StringHelper::Sprintf("0x%016llX, ", BitConverter::ToUInt64BE(textureDataRaw, i));
if (dWordAligned)
sourceOutput +=
StringHelper::Sprintf("0x%016llX, ", BitConverter::ToUInt64BE(textureDataRaw, i));
else
sourceOutput +=
StringHelper::Sprintf("0x%08llX, ", BitConverter::ToUInt32BE(textureDataRaw, i));
if (i % 32 == 24)
sourceOutput += StringHelper::Sprintf(" // 0x%06X \n", rawDataIndex + ((i / 32) * 32));
}
@@ -812,7 +827,7 @@ ZResourceType ZTexture::GetResourceType() const
std::string ZTexture::GetSourceTypeName() const
{
return "u64";
return dWordAligned ? "u64" : "u32";
}
void ZTexture::CalcHash()