diff --git a/src/Companion.cpp b/src/Companion.cpp index e7f259f..9df69cc 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -138,6 +138,11 @@ void Companion::ParseCurrentFileConfig(YAML::Node node) { SPDLOG_DEBUG("Segment {} replaced with 0x{:X}", id, replacement); } } + if(node["header"]) { + for(auto line = node["header"].begin(); line != node["header"].end(); ++line) { + this->gFileHeader += line->as() + "\n"; + } + } } void Companion::Process() { @@ -329,6 +334,7 @@ void Companion::Process() { // Stupid hack because the iteration broke the assets root = YAML::LoadFile(yamlPath); this->gConfig.segment.local.clear(); + this->gFileHeader.clear(); if(root[":config"]) { this->ParseCurrentFileConfig(root[":config"]); @@ -389,7 +395,7 @@ void Companion::Process() { break; } case ExportType::Code: { - output += "/root.inc.c"; + output += "/bin.c"; break; } default: break; @@ -456,6 +462,9 @@ void Companion::Process() { file << buffer; file << std::endl << "#endif" << std::endl; } else { + if(!this->gFileHeader.empty()) { + file << this->gFileHeader << std::endl; + } file << buffer; } diff --git a/src/Companion.h b/src/Companion.h index bf61f11..e0849e0 100644 --- a/src/Companion.h +++ b/src/Companion.h @@ -88,6 +88,7 @@ private: // Temporal Variables std::string gCurrentFile; + std::string gFileHeader; std::variant, std::string> gWriteOrder; std::unordered_map> gFactories; std::map>> gAssetDependencies; diff --git a/src/factories/TextureFactory.cpp b/src/factories/TextureFactory.cpp index df81174..eb89480 100644 --- a/src/factories/TextureFactory.cpp +++ b/src/factories/TextureFactory.cpp @@ -110,7 +110,11 @@ void TextureCodeExporter::Export(std::ostream &write, std::shared_ptrGetGBIMinorVersion() == GBIMinorVersion::Mk64) { write << "u8 " << symbol << "[] = {\n"; } else { - write << "ALIGNED8 static const u8 " << symbol << "[] = {\n"; + if(node["ctype"]) { + write << node["ctype"].as() << " " << symbol << "[] = {\n"; + } else { + write << "static const u8 " << symbol << "[] = {\n"; + } } write << tab << "#include \"" << Companion::Instance->GetOutputPath() + "/" << (*replacement) << ".inc.c\"\n"; write << "};\n\n";