diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-10-01 22:19:47 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-01 21:19:47 -0400 |
| commit | 6b06266eb8d35a7865aa1f942ecbe393e7cde740 (patch) | |
| tree | 6b23ec1617f1ae76f49079ccc9c93c7f4d06eff3 /ZAPD/ZResource.cpp | |
| parent | 26b00a2431a70ff190a2b22ee1faf77afa75a034 (diff) | |
Add `--static` flag (#193)
* remove static from every extracted asset
* fix makefile
* Move a bunch of code to Declaration
* make static enablalble
* fix texture static
* clean up
* minor fixes
* Format
* add small docs
* fix
* add table
* add note in the readme
* typo
* maybe_unused
* Add warning to ZSymbol
* format
* fix
Diffstat (limited to 'ZAPD/ZResource.cpp')
| -rw-r--r-- | ZAPD/ZResource.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp index a28204f..55861ef 100644 --- a/ZAPD/ZResource.cpp +++ b/ZAPD/ZResource.cpp @@ -19,6 +19,7 @@ ZResource::ZResource(ZFile* nParent) RegisterOptionalAttribute("OutName"); RegisterOptionalAttribute("Offset"); RegisterOptionalAttribute("Custom"); + RegisterOptionalAttribute("Static", "Global"); } void ZResource::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) @@ -110,6 +111,24 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) isCustomAsset = registeredAttributes["Custom"].wasSet; + std::string& staticXml = registeredAttributes["Static"].value; + if (staticXml == "Global") + { + staticConf = StaticConfig::Global; + } + else if (staticXml == "On") + { + staticConf = StaticConfig::On; + } + else if (staticXml == "Off") + { + staticConf = StaticConfig::Off; + } + else + { + throw std::runtime_error("Invalid value for 'Static' attribute."); + } + declaredInXml = true; } } @@ -237,13 +256,14 @@ uint32_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress) if (GETSEGNUM(segmentedAddress) == 0x80) // Is defined in code? { uint32_t parentBaseOffset = GETSEGOFFSET(parentBaseAddress); - if (parentBaseOffset > currentPtr) + if (parentBaseOffset > currentPtr) { - throw std::runtime_error(StringHelper::Sprintf( - "\nSeg2Filespace: Segmented address is smaller than 'BaseAddress'. Maybe your 'BaseAddress' is wrong?\n" - "\t SegmentedAddress: 0x%08X\n" - "\t BaseAddress: 0x%08X\n", - segmentedAddress, parentBaseAddress)); + throw std::runtime_error( + StringHelper::Sprintf("\nSeg2Filespace: Segmented address is smaller than " + "'BaseAddress'. Maybe your 'BaseAddress' is wrong?\n" + "\t SegmentedAddress: 0x%08X\n" + "\t BaseAddress: 0x%08X\n", + segmentedAddress, parentBaseAddress)); } currentPtr -= parentBaseOffset; } |
