From 42628361912cb87a15eff7fd410c8941c9f95007 Mon Sep 17 00:00:00 2001 From: INeedGames Date: Mon, 2 Oct 2023 15:42:14 -0600 Subject: [PATCH] feat(arc): add optional arg for filename in gscobj header (#153) --- include/xsk/arc/assembler.hpp | 2 +- src/arc/assembler.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/xsk/arc/assembler.hpp b/include/xsk/arc/assembler.hpp index a5f05103..792f502d 100644 --- a/include/xsk/arc/assembler.hpp +++ b/include/xsk/arc/assembler.hpp @@ -25,7 +25,7 @@ class assembler public: assembler(context const* ctx); - auto assemble(assembly const& data) -> buffer; + auto assemble(assembly const& data, std::string const& name = {}) -> buffer; private: auto assemble_function(function& func) -> void; diff --git a/src/arc/assembler.cpp b/src/arc/assembler.cpp index 0ecafebf..a4254941 100644 --- a/src/arc/assembler.cpp +++ b/src/arc/assembler.cpp @@ -14,7 +14,7 @@ assembler::assembler(context const* ctx) : ctx_{ ctx }, script_{ ctx->endian() = { } -auto assembler::assemble(assembly const& data) -> buffer +auto assembler::assemble(assembly const& data, std::string const& name) -> buffer { assembly_ = &data; script_.clear(); @@ -26,7 +26,7 @@ auto assembler::assemble(assembly const& data) -> buffer auto head = header{}; script_.pos((ctx_->props() & props::headerxx) ? 0 : (ctx_->props() & props::header72) ? 72 : 64); - process_string(""); + process_string(name); for (auto const& func : assembly_->functions) { @@ -183,7 +183,7 @@ auto assembler::assemble(assembly const& data) -> buffer head.profile_count = 0; head.flags = 0; - head.name = resolve_string(""); + head.name = resolve_string(name); auto endpos = script_.pos();