From 119a6883e6f795815744b9afd6a79084c619ddb6 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Thu, 20 Jan 2022 23:47:57 -0300 Subject: Automatic limbs enum generation (#221) * proof of concept * SetLimbIndex * LIMB_DONE * use proper enum name in limbs * fix naming * add ifdefs * fix me being dumb * format * Add EnumPrefix * EnumName * Remove autogenerator stuff * Add warnings * format * Use HANDLE_WARNING_RESOURCE for warning * object_box special case * whoops * Remove overloaded bitconverter methods and use boundary-checker .at method when possible * Fix warning * Fix warning * format * Hopefully fix every warning now * docs * Review * typo * Update jenkinsfile for MM * format * Force functionpreamble printing in development mode * Use ARRAY_COUNT on SkeletonHeaders * Simplify endif in header guards * fix limbs using the wrong enum value * use hex in enum comments --- ZAPD/ZFile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ZAPD/ZFile.cpp') diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 22a6a45..d9733f3 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -406,7 +406,7 @@ void ZFile::AddResource(ZResource* res) resources.push_back(res); } -ZResource* ZFile::FindResource(uint32_t rawDataIndex) +ZResource* ZFile::FindResource(offset_t rawDataIndex) { for (ZResource* res : resources) { @@ -776,6 +776,11 @@ void ZFile::GenerateSourceHeaderFiles() { OutputFormatter formatter; + std::string objectNameUpper = StringHelper::ToUpper(GetName()); + + formatter.Write(StringHelper::Sprintf("#ifndef %s_H\n#define %s_H 1\n\n", + objectNameUpper.c_str(), objectNameUpper.c_str())); + for (ZResource* res : resources) { std::string resSrc = res->GetSourceOutputHeader(""); @@ -792,6 +797,8 @@ void ZFile::GenerateSourceHeaderFiles() formatter.Write(ProcessExterns()); + formatter.Write("#endif\n"); + fs::path headerFilename = GetSourceOutputFolderPath() / outName.stem().concat(".h"); if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) -- cgit v1.2.3