Extract some data

Sort data according to the compilation using they belong to.
Extract background animations.
This commit is contained in:
octorock
2022-09-03 20:14:10 +02:00
parent bdf796fffe
commit a83c83ee8c
116 changed files with 9178 additions and 8793 deletions
+3 -1
View File
@@ -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
+4 -3
View File
@@ -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;
}
+3 -2
View File
@@ -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;