diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2022-09-03 20:14:10 +0200 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2022-09-03 23:33:35 +0200 |
| commit | a83c83ee8cc500f3128902a1c1c47c9ba2ae4981 (patch) | |
| tree | 81c1f5ae649ccac932b35b057b18a7b8bf2bdba5 /tools/src | |
| parent | bdf796fffe54f7b80224b0ed342a91fd9d49d5cf (diff) | |
Extract some data
Sort data according to the compilation using they belong to.
Extract background animations.
Diffstat (limited to 'tools/src')
| -rw-r--r-- | tools/src/asset_processor/main.cpp | 4 | ||||
| -rw-r--r-- | tools/src/asset_processor/offsets.cpp | 7 | ||||
| -rw-r--r-- | tools/src/asset_processor/offsets.h | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/tools/src/asset_processor/main.cpp b/tools/src/asset_processor/main.cpp index 2e6da1d1..c1bb66cf 100644 --- a/tools/src/asset_processor/main.cpp +++ b/tools/src/asset_processor/main.cpp @@ -151,12 +151,14 @@ int main(int argc, char** argv) { if (gMode == EXTRACT || gMode == BUILD) { std::filesystem::path path = gAssetsFolder; path = path / asset["calculateOffsets"]; + std::filesystem::path cPath = path; + cPath.replace_extension(".h"); int baseOffset = 0; // During build mode the offsets are calculated directly instead of from a base address. if (gMode == EXTRACT) { baseOffset = asset["start"].get<int>() + currentOffset; } - offsetCalculator = std::make_unique<OffsetCalculator>(path, baseOffset); + offsetCalculator = std::make_unique<OffsetCalculator>(path, cPath, baseOffset); } } else if (asset.contains("path")) { // Asset definition diff --git a/tools/src/asset_processor/offsets.cpp b/tools/src/asset_processor/offsets.cpp index 827fe7a6..f865a85a 100644 --- a/tools/src/asset_processor/offsets.cpp +++ b/tools/src/asset_processor/offsets.cpp @@ -1,9 +1,10 @@ #include "offsets.h" -OffsetCalculator::OffsetCalculator(const std::filesystem::path& outputFile, int baseOffset_) - : output(outputFile), baseOffset(baseOffset_), lastEnd(0) { +OffsetCalculator::OffsetCalculator(const std::filesystem::path& asmOutputFile, const std::filesystem::path& cOutputFile, int baseOffset_) + : asmOutput(asmOutputFile), cOutput(cOutputFile), baseOffset(baseOffset_), lastEnd(0) { } void OffsetCalculator::addAsset(int start, const std::string& symbol) { - output << "\t.equiv offset_" << symbol << ", " << start - baseOffset << std::endl; + asmOutput << "\t.equiv offset_" << symbol << ", " << start - baseOffset << std::endl; + cOutput << "#define offset_" << symbol << " " << start - baseOffset << std::endl; }
\ No newline at end of file diff --git a/tools/src/asset_processor/offsets.h b/tools/src/asset_processor/offsets.h index 83c41dac..9f7d2bfe 100644 --- a/tools/src/asset_processor/offsets.h +++ b/tools/src/asset_processor/offsets.h @@ -7,7 +7,7 @@ class OffsetCalculator { public: - OffsetCalculator(const std::filesystem::path& offsetsFile, int baseOffset_); + OffsetCalculator(const std::filesystem::path& asmOffsetsFile, const std::filesystem::path& cOffsetsFile, int baseOffset_); void addAsset(int start, const std::string& symbol); [[nodiscard]] int getLastEnd() const { return lastEnd; @@ -16,7 +16,8 @@ class OffsetCalculator { this->lastEnd = lastEnd_; } private: - std::ofstream output; + std::ofstream asmOutput; + std::ofstream cOutput; int baseOffset; // Store the end of the previously added asset int lastEnd; |
