mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-16 03:50:20 +00:00
Building on Macs (#1086)
* git subrepo pull (merge) tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "945e6ca1a" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "50242eca9" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Fix extract_assets.py multithreading * Update binutils doc a bit * Remove * import, add multiprocessing option and way to pass arguments to ZAPD * Update format.sh to be more platform-independent * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "fd5a7f434" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "fd5a7f434" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Remove ; * Update formatting script to not just use 11 * Add Python requirements, move the Mac stuff in the README into its own doc * Fix readme link * Minor format thing * . * Move ZAPDArgs into its own function * Update readme and remove requirements.txt * Dragorn-inspired rewrite of processZAPDArgs * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "a0d3f7b68" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "a0d3f7b68" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Fix function definition * Building docs overhaul * Add Python packages to Mac and Cygwin * Heading number * format format.sh (!) * Replace "currently" * Remove Debian * git subrepo pull (merge) --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0ba781304" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0ba781304" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
This commit is contained in:
parent
9450272503
commit
9b67778a00
41 changed files with 640 additions and 325 deletions
|
@ -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");
|
||||
fs::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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue