summaryrefslogtreecommitdiff
path: root/ZAPD/ZResource.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-05-07 17:35:00 -0400
committerGitHub <noreply@github.com>2021-05-07 17:35:00 -0400
commit547c9b200d1dff745dee694c20a9f9e8e409a11d (patch)
tree4eb2ec3fe46fb5709a43d268a2de74668839f2f1 /ZAPD/ZResource.cpp
parent5a721d58d4b28f4797d6fdf29d9926e5e968a939 (diff)
Change image library to `libpng` and improve how palettized textures are extracted (#133)
* trying to change to libpng * It works again! * move the libpng abstraction to another file * GetBytesPerPixel * I'm dumb * fix warnings and remove dead code * Fix CRC being called multiples times and clean up code * textureDataRaw * code clean * Optimizations and removal of redundant data moves * ups * run format * use fs::path more * i'm dumb again * Add a Readme * remove texDeclarations * handle tluts better * vtx change and set segment file * small changes * Fix ZAPD ignoring textures declared in a scene in the XML * small cleanup before tluts * paletted images are broken * kinda works for automatic textures * fix automatic ci * TEXTURE_DEBUG * Remove extra `-j` * Fix extraction of ci4 * Finally palettes OK * ups * Move textures map to ZFile * Fix intersection warnings * Add `TlutOffset` attribute * Move Tlut declaration to a later step * Hopefully the last cleanup of this branch * Run format * Always calc hash * run format * Delete stb * fix merge issues * run format
Diffstat (limited to 'ZAPD/ZResource.cpp')
-rw-r--r--ZAPD/ZResource.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp
index 466b3ab..fb76605 100644
--- a/ZAPD/ZResource.cpp
+++ b/ZAPD/ZResource.cpp
@@ -26,6 +26,7 @@ void ZResource::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<u
ParseXML(reader);
ParseRawData();
+ CalcHash();
}
void ZResource::ExtractFromFile(const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex)
@@ -34,6 +35,7 @@ void ZResource::ExtractFromFile(const std::vector<uint8_t>& nRawData, uint32_t n
rawDataIndex = nRawDataIndex;
ParseRawData();
+ CalcHash();
}
void ZResource::ParseXML(tinyxml2::XMLElement* reader)
@@ -74,10 +76,12 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader)
"with inner element/child detected.\n",
name.c_str(), reader->Name()));
}
+
+ declaredInXml = true;
}
}
-void ZResource::Save(const std::string& outFolder)
+void ZResource::Save(const fs::path& outFolder)
{
}
@@ -85,12 +89,12 @@ void ZResource::PreGenSourceFiles()
{
}
-string ZResource::GetName()
+const std::string& ZResource::GetName() const
{
return name;
}
-std::string ZResource::GetOutName()
+const std::string& ZResource::GetOutName() const
{
return outName;
}
@@ -120,16 +124,21 @@ std::string ZResource::GetExternalExtension()
return "";
}
-vector<uint8_t> ZResource::GetRawData()
+const std::vector<uint8_t>& ZResource::GetRawData() const
{
return rawData;
}
-void ZResource::SetRawData(std::vector<uint8_t> nData)
+void ZResource::SetRawData(const std::vector<uint8_t>& nData)
{
rawData = nData;
}
+bool ZResource::WasDeclaredInXml() const
+{
+ return declaredInXml;
+}
+
uint32_t ZResource::GetRawDataIndex()
{
return rawDataIndex;
@@ -159,6 +168,10 @@ void ZResource::ParseRawData()
{
}
+void ZResource::DeclareReferences(const std::string& prefix)
+{
+}
+
void ZResource::GenerateHLIntermediette(HLFileIntermediette& hlFile)
{
}