diff options
Diffstat (limited to 'tools/src/asset_processor/assets/map.cpp')
| -rw-r--r-- | tools/src/asset_processor/assets/map.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/src/asset_processor/assets/map.cpp b/tools/src/asset_processor/assets/map.cpp new file mode 100644 index 00000000..2d5a0bca --- /dev/null +++ b/tools/src/asset_processor/assets/map.cpp @@ -0,0 +1,44 @@ +#include "map.h" +#include "util.h" +#include <nlohmann/json.hpp> + +std::filesystem::path MapAsset::generateAssetPath() { + std::filesystem::path decompressedPath = path; + if (isCompressed()) { + if (decompressedPath.extension() == ".lz") { + decompressedPath.replace_extension(""); + } + } + return decompressedPath; +} + + +void MapAsset::convertToHumanReadable(const std::vector<char>& baserom) { + (void)baserom; + if (isCompressed()) { + std::filesystem::path toolsPath = "tools"; + std::vector<std::string> cmd; + // Decompress. + cmd.push_back(toolsPath / "bin" / "gbagfx"); + cmd.push_back(path); + cmd.push_back(assetPath); + check_call(cmd); + } +} + +void MapAsset::buildToBinary() { + if (isCompressed()) { + std::filesystem::path toolsPath = "tools"; + std::vector<std::string> cmd; + // Compress. + cmd.push_back(toolsPath / "bin" / "gbagfx"); + cmd.push_back(assetPath); + cmd.push_back(path); + check_call(cmd); + } + +} + +bool MapAsset::isCompressed() { + return path.extension() == ".lz"; +}
\ No newline at end of file |
