mirror of
https://github.com/zeldaret/tmc
synced 2026-08-20 14:15:10 -04:00
Extract some data
Sort data according to the compilation using they belong to. Extract background animations.
This commit is contained in:
Vendored
+3
-1
@@ -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
@@ -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;
|
||||
}
|
||||
Vendored
+3
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user