diff options
Diffstat (limited to 'ZAPD/ZFile.cpp')
| -rw-r--r-- | ZAPD/ZFile.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 7d461b8..3709771 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -276,8 +276,10 @@ void ZFile::ExtractResources() if (!Directory::Exists(GetSourceOutputFolderPath().string())) Directory::CreateDirectory(GetSourceOutputFolderPath().string()); - for (ZResource* res : resources) - res->PreGenSourceFiles(); + for (size_t i = 0; i < resources.size(); i++) + resources[i]->ParseRawDataLate(); + for (size_t i = 0; i < resources.size(); i++) + resources[i]->DeclareReferencesLate(name); if (Globals::Instance->genSourceFile) GenerateSourceFiles(Globals::Instance->outputPath); @@ -375,12 +377,8 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a size_t size, std::string varType, std::string varName, size_t arrayItemCnt, std::string body) { - assert(GETSEGNUM(address) == 0); - AddDeclarationDebugChecks(address); - - declarations[address] = - new Declaration(alignment, size, varType, varName, true, arrayItemCnt, body); - return declarations[address]; + return AddDeclarationArray(address, alignment, DeclarationPadding::None, size, varType, varName, + arrayItemCnt, body); } Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, @@ -396,18 +394,6 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a } Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, - size_t size, std::string varType, std::string varName, - size_t arrayItemCnt, std::string body, bool isExternal) -{ - assert(GETSEGNUM(address) == 0); - AddDeclarationDebugChecks(address); - - declarations[address] = - new Declaration(alignment, size, varType, varName, true, arrayItemCnt, body, isExternal); - return declarations[address]; -} - -Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment alignment, DeclarationPadding padding, size_t size, std::string varType, std::string varName, size_t arrayItemCnt, std::string body) @@ -415,9 +401,28 @@ Declaration* ZFile::AddDeclarationArray(uint32_t address, DeclarationAlignment a assert(GETSEGNUM(address) == 0); AddDeclarationDebugChecks(address); - declarations[address] = - new Declaration(alignment, padding, size, varType, varName, true, arrayItemCnt, body); - return declarations[address]; + Declaration* decl = GetDeclaration(address); + if (decl == nullptr) + { + decl = + new Declaration(alignment, padding, size, varType, varName, true, arrayItemCnt, body); + declarations[address] = decl; + } + else + { + if (decl->isPlaceholder) + decl->varName = varName; + decl->alignment = alignment; + decl->padding = padding; + decl->size = size; + decl->varType = varType; + decl->isArray = true; + decl->arrayItemCnt = arrayItemCnt; + if (body != "" && decl->text == "") + decl->text = body; + } + + return decl; } Declaration* ZFile::AddDeclarationPlaceholder(uint32_t address) |
