diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2021-08-05 05:11:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-05 05:11:24 -0400 |
| commit | 82bd27604a4c8f8c1f01f9c2f54c87fab103c39f (patch) | |
| tree | 282b189bd2d6113bf134a8b34d7ddc518369f3bb /ZAPD/ZResource.h | |
| parent | 469285b3e1f7885b42905fbfb9b4448f51ea20b3 (diff) | |
Exporter Support Added (#127)
* Initial exporter implementation
* Updated to use static library.
* minor cleanup
* Cleaned things up a bit
* Fixed merge issues
* Minor commenting
* Added Begin and End functions, and removed HL stuff (to be turned into an exporter at a later date)
* Cleaned some stuff up
* Additional cleanup
* Removed some commented out code
* Fixed compilation issues
* Cleanup
* Fixed merge issues
* Got rid of unused windows.h includes
* Cleanup
* Fixed warning
* Removed additional redundancies
* Cleanup
* Fixed merge issues
* Fixed some compiler issues, added makefile for exportertest.
* Removed redundancies and clang formatted
* Made sure exportertest compiles with C++17
* Moved certain files into new "Utils" folder.
* GetExporterMap uses a reference now
* Minor fixes and updates.
Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
Diffstat (limited to 'ZAPD/ZResource.h')
| -rw-r--r-- | ZAPD/ZResource.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ZAPD/ZResource.h b/ZAPD/ZResource.h index 6ebfcf8..853fc7c 100644 --- a/ZAPD/ZResource.h +++ b/ZAPD/ZResource.h @@ -1,5 +1,6 @@ #pragma once +#include <Utils/BinaryWriter.h> #include <map> #include <stdexcept> #include <stdint.h> @@ -8,7 +9,7 @@ #include "Declaration.h" #include "tinyxml2.h" -#include "Directory.h" +#include "Utils/Directory.h" #define SEGMENT_SCENE 2 #define SEGMENT_ROOM 3 @@ -23,7 +24,6 @@ typedef uint32_t segptr_t; class ZFile; -class HLFileIntermediette; enum class ZResourceType { @@ -82,7 +82,6 @@ public: virtual std::string GetSourceOutputCode(const std::string& prefix); virtual std::string GetSourceOutputHeader(const std::string& prefix); virtual void PreGenSourceFiles(); - virtual void GenerateHLIntermediette(HLFileIntermediette& hlFile); virtual void CalcHash(); virtual void Save(const fs::path& outFolder); @@ -129,6 +128,14 @@ protected: void RegisterOptionalAttribute(const std::string& attr, const std::string& defaultValue = ""); }; +class ZResourceExporter +{ +public: + ZResourceExporter() = default; + + virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) = 0; +}; + uint32_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress); typedef ZResource*(ZResourceFactoryFunc)(ZFile* nParent); @@ -148,3 +155,11 @@ typedef ZResource*(ZResourceFactoryFunc)(ZFile* nParent); } \ }; \ static ZRes_##nodeName inst_ZRes_##nodeName + +#define REGISTER_EXPORTER(expFunc) \ + class ZResExp_##expFunc \ + { \ + public: \ + ZResExp_##expFunc() { expFunc(); } \ + }; \ + static ZResExp_##expFunc inst_ZResExp_##expFunc; |
