diff options
| -rw-r--r-- | ExporterTest/ExporterTest.vcxproj | 1 | ||||
| -rw-r--r-- | ZAPD/Globals.h | 2 | ||||
| -rw-r--r-- | ZAPD/Main.cpp | 1 | ||||
| -rw-r--r-- | ZAPD/NuGet/libpng.static.txt | 0 | ||||
| -rw-r--r-- | ZAPD/WarningHandler.cpp | 2 | ||||
| -rw-r--r-- | ZAPD/ZAPD.vcxproj | 21 | ||||
| -rw-r--r-- | ZAPD/ZAPD.vcxproj.filters | 24 | ||||
| -rw-r--r-- | ZAPD/ZBlob.cpp | 5 | ||||
| -rw-r--r-- | ZAPD/ZBlob.h | 1 | ||||
| -rw-r--r-- | ZAPD/ZDisplayList.cpp | 18 | ||||
| -rw-r--r-- | ZAPD/ZDisplayList.h | 3 | ||||
| -rw-r--r-- | ZAPD/ZFile.cpp | 32 | ||||
| -rw-r--r-- | ZAPD/ZFile.h | 1 | ||||
| -rw-r--r-- | ZAPD/ZResource.cpp | 19 | ||||
| -rw-r--r-- | ZAPD/ZResource.h | 2 | ||||
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetMesh.cpp | 12 | ||||
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetMesh.h | 2 | ||||
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetRoomList.cpp | 4 | ||||
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetRoomList.h | 2 | ||||
| -rw-r--r-- | ZAPD/ZRoom/ZRoom.cpp | 10 | ||||
| -rw-r--r-- | ZAPD/ZRoom/ZRoom.h | 2 | ||||
| -rw-r--r-- | ZAPD/any/any/zlib.static.txt | 0 | ||||
| -rw-r--r-- | ZAPD/packages.config | 4 | ||||
| -rw-r--r-- | ZAPDUtils/ZAPDUtils.vcxproj | 5 | ||||
| -rw-r--r-- | ZAPDUtils/ZAPDUtils.vcxproj.filters | 6 |
25 files changed, 102 insertions, 77 deletions
diff --git a/ExporterTest/ExporterTest.vcxproj b/ExporterTest/ExporterTest.vcxproj index 9fb4771..839d451 100644 --- a/ExporterTest/ExporterTest.vcxproj +++ b/ExporterTest/ExporterTest.vcxproj @@ -120,6 +120,7 @@ <ConformanceMode>true</ConformanceMode> <LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard_C>stdc11</LanguageStandard_C> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Console</SubSystem> diff --git a/ZAPD/Globals.h b/ZAPD/Globals.h index 31c9d6a..19e193f 100644 --- a/ZAPD/Globals.h +++ b/ZAPD/Globals.h @@ -20,6 +20,7 @@ typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode); typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i); typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode); typedef void (*ExporterSetFuncVoid3)(); +typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer); class ExporterSet { @@ -34,6 +35,7 @@ public: ExporterSetFunc endFileFunc = nullptr; ExporterSetFuncVoid3 beginXMLFunc = nullptr; ExporterSetFuncVoid3 endXMLFunc = nullptr; + ExporterSetResSave resSaveFunc = nullptr; }; class Globals diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp index 7f2854a..fd2ed06 100644 --- a/ZAPD/Main.cpp +++ b/ZAPD/Main.cpp @@ -48,6 +48,7 @@ void ErrorHandler(int sig) const char* crashEasterEgg[] = { "\tYou've met with a terrible fate, haven't you?", "\tSEA BEARS FOAM. SLEEP BEARS DREAMS. \n\tBOTH END IN THE SAME WAY: CRASSSH!", + "ZAPD has fallen and cannot get up." }; srand(time(nullptr)); diff --git a/ZAPD/NuGet/libpng.static.txt b/ZAPD/NuGet/libpng.static.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ZAPD/NuGet/libpng.static.txt diff --git a/ZAPD/WarningHandler.cpp b/ZAPD/WarningHandler.cpp index f672600..29f8352 100644 --- a/ZAPD/WarningHandler.cpp +++ b/ZAPD/WarningHandler.cpp @@ -364,7 +364,7 @@ void WarningHandler::Warning_Resource(const char* filename, int32_t line, const void WarningHandler::PrintHelp() { std::set<std::string> sortedKeys; WarningInfoInit warningInfo; - uint columnWidth = 25; + uint32_t columnWidth = 25; std::string dt; // Sort keys through the magic of `set`, to print in alphabetical order diff --git a/ZAPD/ZAPD.vcxproj b/ZAPD/ZAPD.vcxproj index 4053c42..431abb7 100644 --- a/ZAPD/ZAPD.vcxproj +++ b/ZAPD/ZAPD.vcxproj @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="..\packages\libpng-v142.1.6.37.2\build\native\libpng-v142.props" Condition="Exists('..\packages\libpng-v142.1.6.37.2\build\native\libpng-v142.props')" /> + <Import Project="..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.props" Condition="Exists('..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.props')" /> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> @@ -72,7 +72,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LibraryPath>$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\x64\Debug;$(ProjectDir)..\packages\libpng-v142.1.6.37.2\build\native\lib\x64\v142\Debug\;$(LibraryPath)</LibraryPath> + <LibraryPath>$(OutDir);$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\packages\libpng-v142.1.6.37.2\build\native\lib\x64\v142\Debug\;$(LibraryPath)</LibraryPath> <IncludePath>$(ProjectDir)..\ZAPDUtils;$(ProjectDir)..\lib\tinyxml2;$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\lib\elfio;$(ProjectDir)..\lib\stb;$(ProjectDir);$(IncludePath)</IncludePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> @@ -106,10 +106,12 @@ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <LanguageStandard_C>stdc11</LanguageStandard_C> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> </ClCompile> <Link> <Profile>true</Profile> - <AdditionalDependencies>libpng16.lib;ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies)</AdditionalDependencies> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> </Link> <PreBuildEvent> <Command>cd .. @@ -156,7 +158,6 @@ python3 ZAPD/genbuildinfo.py</Command> <ClCompile Include="..\lib\libgfxd\uc_f3dex.c" /> <ClCompile Include="..\lib\libgfxd\uc_f3dex2.c" /> <ClCompile Include="..\lib\libgfxd\uc_f3dexb.c" /> - <ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp" /> <ClCompile Include="Declaration.cpp" /> <ClCompile Include="GameConfig.cpp" /> <ClCompile Include="Globals.cpp" /> @@ -165,6 +166,7 @@ python3 ZAPD/genbuildinfo.py</Command> <ClCompile Include="OtherStructs\SkinLimbStructs.cpp" /> <ClCompile Include="OutputFormatter.cpp" /> <ClCompile Include="Overlays\ZOverlay.cpp" /> + <ClCompile Include="WarningHandler.cpp" /> <ClCompile Include="ZArray.cpp" /> <ClCompile Include="ZBackground.cpp" /> <ClCompile Include="ZCutsceneMM.cpp" /> @@ -250,6 +252,7 @@ python3 ZAPD/genbuildinfo.py</Command> <ClInclude Include="OtherStructs\SkinLimbStructs.h" /> <ClInclude Include="OutputFormatter.h" /> <ClInclude Include="Overlays\ZOverlay.h" /> + <ClInclude Include="WarningHandler.h" /> <ClInclude Include="ZAnimation.h" /> <ClInclude Include="ZArray.h" /> <ClInclude Include="ZBackground.h" /> @@ -312,6 +315,8 @@ python3 ZAPD/genbuildinfo.py</Command> <Text Include="..\SymbolMap_OoTMqDbg.txt"> <DeploymentContent>true</DeploymentContent> </Text> + <Text Include="any\any\zlib.static.txt" /> + <Text Include="NuGet\libpng.static.txt" /> </ItemGroup> <ItemGroup> <None Include="packages.config" /> @@ -320,6 +325,9 @@ python3 ZAPD/genbuildinfo.py</Command> <ImportGroup Label="ExtensionTargets"> <Import Project="..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" /> <Import Project="..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" /> + <Import Project="..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.targets" Condition="Exists('..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.targets')" /> + <Import Project="..\packages\zlib.static.1.2.5\build\native\zlib.static.targets" Condition="Exists('..\packages\zlib.static.1.2.5\build\native\zlib.static.targets')" /> + <Import Project="..\packages\libpng.static.1.6.37\build\native\libpng.static.targets" Condition="Exists('..\packages\libpng.static.1.6.37\build\native\libpng.static.targets')" /> </ImportGroup> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> @@ -327,6 +335,9 @@ python3 ZAPD/genbuildinfo.py</Command> </PropertyGroup> <Error Condition="!Exists('..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" /> <Error Condition="!Exists('..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" /> - <Error Condition="!Exists('..\packages\libpng-v142.1.6.37.2\build\native\libpng-v142.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\libpng-v142.1.6.37.2\build\native\libpng-v142.props'))" /> + <Error Condition="!Exists('..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.props'))" /> + <Error Condition="!Exists('..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\YY.NuGet.Import.Helper.1.0.0.4\build\native\YY.NuGet.Import.Helper.targets'))" /> + <Error Condition="!Exists('..\packages\zlib.static.1.2.5\build\native\zlib.static.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zlib.static.1.2.5\build\native\zlib.static.targets'))" /> + <Error Condition="!Exists('..\packages\libpng.static.1.6.37\build\native\libpng.static.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\libpng.static.1.6.37\build\native\libpng.static.targets'))" /> </Target> </Project>
\ No newline at end of file diff --git a/ZAPD/ZAPD.vcxproj.filters b/ZAPD/ZAPD.vcxproj.filters index f99bd2e..b8a7daa 100644 --- a/ZAPD/ZAPD.vcxproj.filters +++ b/ZAPD/ZAPD.vcxproj.filters @@ -49,6 +49,15 @@ <Filter Include="Header Files\Libraries\libgfxd"> <UniqueIdentifier>{85600275-99fe-491d-8189-bcc3dc1a8903}</UniqueIdentifier> </Filter> + <Filter Include="any"> + <UniqueIdentifier>{ba9990b0-1082-48bb-874c-6108534b5455}</UniqueIdentifier> + </Filter> + <Filter Include="any\any"> + <UniqueIdentifier>{ce9d91b0-ba20-4296-bc2d-8630965bb392}</UniqueIdentifier> + </Filter> + <Filter Include="NuGet"> + <UniqueIdentifier>{730beb67-6d59-4849-9d9b-702c4a565fc0}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="Main.cpp"> @@ -135,9 +144,6 @@ <ClCompile Include="ZRoom\Commands\SetCutscenes.cpp"> <Filter>Source Files\Z64\ZRoom\Commands</Filter> </ClCompile> - <ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp"> - <Filter>Source Files\Libraries</Filter> - </ClCompile> <ClCompile Include="ZAnimation.cpp"> <Filter>Source Files\Z64</Filter> </ClCompile> @@ -273,6 +279,9 @@ <ClCompile Include="ZPlayerAnimationData.cpp"> <Filter>Source Files\Z64</Filter> </ClCompile> + <ClCompile Include="WarningHandler.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="ZRoom\ZRoom.h"> @@ -524,11 +533,20 @@ <ClInclude Include="ZPlayerAnimationData.h"> <Filter>Header Files\Z64</Filter> </ClInclude> + <ClInclude Include="WarningHandler.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <Text Include="..\SymbolMap_OoTMqDbg.txt"> <Filter>Resource Files</Filter> </Text> + <Text Include="any\any\zlib.static.txt"> + <Filter>any\any</Filter> + </Text> + <Text Include="NuGet\libpng.static.txt"> + <Filter>NuGet</Filter> + </Text> </ItemGroup> <ItemGroup> <None Include="packages.config" /> diff --git a/ZAPD/ZBlob.cpp b/ZAPD/ZBlob.cpp index c1f0788..6812bfa 100644 --- a/ZAPD/ZBlob.cpp +++ b/ZAPD/ZBlob.cpp @@ -83,11 +83,6 @@ std::string ZBlob::GetBodySourceCode() const return sourceOutput; } -std::string ZBlob::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return StringHelper::Sprintf("extern u8 %s[];\n", name.c_str()); -} - void ZBlob::Save(const fs::path& outFolder) { File::WriteAllBytes((outFolder / (name + ".bin")).string(), blobData); diff --git a/ZAPD/ZBlob.h b/ZAPD/ZBlob.h index 86623b5..d7a7fef 100644 --- a/ZAPD/ZBlob.h +++ b/ZAPD/ZBlob.h @@ -16,7 +16,6 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputHeader(const std::string& prefix) override; void Save(const fs::path& outFolder) override; bool IsExternalResource() const override; diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp index d2defb1..869b563 100644 --- a/ZAPD/ZDisplayList.cpp +++ b/ZAPD/ZDisplayList.cpp @@ -1524,11 +1524,6 @@ void ZDisplayList::Opcode_G_ENDDL([[maybe_unused]] const std::string& prefix, ch TextureGenCheck(); } -std::string ZDisplayList::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return ""; -} - static int32_t GfxdCallback_FormatSingleEntry() { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); @@ -1739,7 +1734,7 @@ static int32_t GfxdCallback_Matrix(uint32_t seg) return 1; } -std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) +void ZDisplayList::DeclareReferences(const std::string& prefix) { std::string sourceOutput; @@ -1752,7 +1747,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) if (vertices.size() > 0) { std::vector<std::pair<uint32_t, std::vector<ZVtx>>> verticesSorted(vertices.begin(), - vertices.end()); + vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -1783,9 +1778,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) auto& firstVtx = item.second.at(0); for (auto vtx : item.second) - { declaration += StringHelper::Sprintf("\t%s,\n", vtx.GetBodySourceCode().c_str()); - } Declaration* decl = parent->AddDeclarationArray( curAddr, firstVtx.GetDeclarationAlignment(), @@ -1802,7 +1795,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) if (vertices.size() > 0) { std::vector<std::pair<uint32_t, std::vector<ZVtx>>> verticesSorted(vertices.begin(), - vertices.end()); + vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -1865,11 +1858,6 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) } } } - - if (parent != nullptr) - return ""; - - return sourceOutput; } std::string ZDisplayList::ProcessLegacy(const std::string& prefix) diff --git a/ZAPD/ZDisplayList.h b/ZAPD/ZDisplayList.h index d538666..9680831 100644 --- a/ZAPD/ZDisplayList.h +++ b/ZAPD/ZDisplayList.h @@ -363,8 +363,7 @@ public: size_t GetRawDataSize() const override; DeclarationAlignment GetDeclarationAlignment() const override; - std::string GetSourceOutputHeader(const std::string& prefix) override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void DeclareReferences(const std::string& prefix) override; std::string ProcessLegacy(const std::string& prefix); std::string ProcessGfxDis(const std::string& prefix); diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp index 38482d9..77387fc 100644 --- a/ZAPD/ZFile.cpp +++ b/ZAPD/ZFile.cpp @@ -74,19 +74,13 @@ ZFile::ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBas ZFile::~ZFile() { for (ZResource* res : resources) - { delete res; - } for (auto d : declarations) - { delete d.second; - } for (auto sym : symbolResources) - { delete sym.second; - } } void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) @@ -323,6 +317,11 @@ std::string ZFile::GetName() const return name; } +std::string ZFile::GetOutName() const +{ + return outName.string(); +} + ZFileMode ZFile::GetMode() const { return mode; @@ -357,8 +356,8 @@ void ZFile::ExtractResources() if (Globals::Instance->genSourceFile) GenerateSourceFiles(); - MemoryStream* memStream = new MemoryStream(); - BinaryWriter writer = BinaryWriter(memStream); + auto memStreamFile = std::shared_ptr<MemoryStream>(new MemoryStream()); + BinaryWriter writerFile = BinaryWriter(memStreamFile); ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); @@ -367,6 +366,9 @@ void ZFile::ExtractResources() for (ZResource* res : resources) { + auto memStreamRes = std::shared_ptr<MemoryStream>(new MemoryStream()); + BinaryWriter writerRes = BinaryWriter(memStreamRes); + if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) printf("Saving resource %s\n", res->GetName().c_str()); @@ -375,18 +377,24 @@ void ZFile::ExtractResources() // Check if we have an exporter "registered" for this resource type ZResourceExporter* exporter = Globals::Instance->GetExporter(res->GetResourceType()); if (exporter != nullptr) - exporter->Save(res, Globals::Instance->outputPath.string(), &writer); + { + //exporter->Save(res, Globals::Instance->outputPath.string(), &writerFile); + exporter->Save(res, Globals::Instance->outputPath.string(), &writerRes); + } + + if (exporterSet != nullptr && exporterSet->resSaveFunc != nullptr) + exporterSet->resSaveFunc(res, writerRes); } - if (memStream->GetLength() > 0) + if (memStreamFile->GetLength() > 0) { File::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", Globals::Instance->outputPath.string().c_str(), GetName().c_str()), - memStream->ToVector()); + memStreamFile->ToVector()); } - writer.Close(); + writerFile.Close(); if (exporterSet != nullptr && exporterSet->endFileFunc != nullptr) exporterSet->endFileFunc(this); diff --git a/ZAPD/ZFile.h b/ZAPD/ZFile.h index d0a3464..7918d5f 100644 --- a/ZAPD/ZFile.h +++ b/ZAPD/ZFile.h @@ -45,6 +45,7 @@ public: ~ZFile(); std::string GetName() const; + std::string GetOutName() const; ZFileMode GetMode() const; const fs::path& GetXmlFilePath() const; const std::vector<uint8_t>& GetRawData() const; diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp index 4fd6d08..2dfe6d5 100644 --- a/ZAPD/ZResource.cpp +++ b/ZAPD/ZResource.cpp @@ -258,18 +258,21 @@ std::string ZResource::GetDefaultName(const std::string& prefix) const rawDataIndex); } -std::string ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) +void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string bodyStr = GetBodySourceCode(); - Declaration* decl = parent->GetDeclaration(rawDataIndex); - if (decl == nullptr || decl->isPlaceholder) - decl = DeclareVar(prefix, bodyStr); - else - decl->text = bodyStr; - decl->staticConf = staticConf; + if (bodyStr != "ERROR") + { + Declaration* decl = parent->GetDeclaration(rawDataIndex); - return ""; + if (decl == nullptr || decl->isPlaceholder) + decl = DeclareVar(prefix, bodyStr); + else + decl->text = bodyStr; + + decl->staticConf = staticConf; + } } std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) diff --git a/ZAPD/ZResource.h b/ZAPD/ZResource.h index b127417..4dad398 100644 --- a/ZAPD/ZResource.h +++ b/ZAPD/ZResource.h @@ -112,7 +112,7 @@ public: */ [[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const; - virtual std::string GetSourceOutputCode(const std::string& prefix); + virtual void GetSourceOutputCode(const std::string& prefix); virtual std::string GetSourceOutputHeader(const std::string& prefix); virtual void CalcHash(); /** diff --git a/ZAPD/ZRoom/Commands/SetMesh.cpp b/ZAPD/ZRoom/Commands/SetMesh.cpp index 5463496..69668c4 100644 --- a/ZAPD/ZRoom/Commands/SetMesh.cpp +++ b/ZAPD/ZRoom/Commands/SetMesh.cpp @@ -54,11 +54,9 @@ void SetMesh::DeclareReferences(const std::string& prefix) void GenDListDeclarations(ZRoom* zRoom, ZFile* parent, ZDisplayList* dList) { if (dList == nullptr) - { return; - } - std::string sourceOutput = dList->GetSourceOutputCode(zRoom->GetName()); + dList->DeclareReferences(zRoom->GetName()); for (ZDisplayList* otherDList : dList->otherDLists) GenDListDeclarations(zRoom, parent, otherDList); @@ -144,21 +142,17 @@ std::string PolygonDlist::GetBodySourceCode() const return bodyStr; } -std::string PolygonDlist::GetSourceOutputCode(const std::string& prefix) +void PolygonDlist::GetSourceOutputCode(const std::string& prefix) { std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str()); Declaration* decl = parent->GetDeclaration(rawDataIndex); + if (decl == nullptr) - { DeclareVar(prefix, bodyStr); - } else - { decl->text = bodyStr; - } - return ""; } std::string PolygonDlist::GetSourceTypeName() const diff --git a/ZAPD/ZRoom/Commands/SetMesh.h b/ZAPD/ZRoom/Commands/SetMesh.h index 566711a..9d90374 100644 --- a/ZAPD/ZRoom/Commands/SetMesh.h +++ b/ZAPD/ZRoom/Commands/SetMesh.h @@ -28,7 +28,7 @@ public: std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; diff --git a/ZAPD/ZRoom/Commands/SetRoomList.cpp b/ZAPD/ZRoom/Commands/SetRoomList.cpp index 43c3968..7027fa1 100644 --- a/ZAPD/ZRoom/Commands/SetRoomList.cpp +++ b/ZAPD/ZRoom/Commands/SetRoomList.cpp @@ -115,11 +115,9 @@ std::string RomFile::GetBodySourceCode() const return declaration; } -std::string RomFile::GetSourceOutputCode(const std::string& prefix) +void RomFile::GetSourceOutputCode(const std::string& prefix) { DeclareVar(prefix, GetBodySourceCode()); - - return ""; } std::string RomFile::GetSourceTypeName() const diff --git a/ZAPD/ZRoom/Commands/SetRoomList.h b/ZAPD/ZRoom/Commands/SetRoomList.h index 4fb2ced..2ae48b6 100644 --- a/ZAPD/ZRoom/Commands/SetRoomList.h +++ b/ZAPD/ZRoom/Commands/SetRoomList.h @@ -24,7 +24,7 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceTypeName() const override; virtual ZResourceType GetResourceType() const override; diff --git a/ZAPD/ZRoom/ZRoom.cpp b/ZAPD/ZRoom/ZRoom.cpp index cf9430d..c7e60d3 100644 --- a/ZAPD/ZRoom/ZRoom.cpp +++ b/ZAPD/ZRoom/ZRoom.cpp @@ -395,14 +395,10 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd) return 0; } -std::string ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) +void ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { - if (hackMode == "syotes_room") - return ""; - - DeclareVar(prefix, GetBodySourceCode()); - - return ""; + if (hackMode != "syotes_room") + DeclareVar(prefix, GetBodySourceCode()); } size_t ZRoom::GetRawDataSize() const diff --git a/ZAPD/ZRoom/ZRoom.h b/ZAPD/ZRoom/ZRoom.h index 0993a9d..e837ec7 100644 --- a/ZAPD/ZRoom/ZRoom.h +++ b/ZAPD/ZRoom/ZRoom.h @@ -34,7 +34,7 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetDefaultName(const std::string& prefix) const override; size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress); diff --git a/ZAPD/any/any/zlib.static.txt b/ZAPD/any/any/zlib.static.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ZAPD/any/any/zlib.static.txt diff --git a/ZAPD/packages.config b/ZAPD/packages.config index 5346e15..c387aae 100644 --- a/ZAPD/packages.config +++ b/ZAPD/packages.config @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="libpng-v142" version="1.6.37.2" targetFramework="native" /> + <package id="libpng.static" version="1.6.37" targetFramework="native" /> + <package id="YY.NuGet.Import.Helper" version="1.0.0.4" targetFramework="native" /> <package id="zlib" version="1.2.8.8" targetFramework="native" /> + <package id="zlib.static" version="1.2.5" targetFramework="native" /> <package id="zlib.v120.windesktop.msvcstl.dyn.rt-dyn" version="1.2.8.8" targetFramework="native" /> <package id="zlib.v140.windesktop.msvcstl.dyn.rt-dyn" version="1.2.8.8" targetFramework="native" /> </packages>
\ No newline at end of file diff --git a/ZAPDUtils/ZAPDUtils.vcxproj b/ZAPDUtils/ZAPDUtils.vcxproj index 803cdb5..0a09666 100644 --- a/ZAPDUtils/ZAPDUtils.vcxproj +++ b/ZAPDUtils/ZAPDUtils.vcxproj @@ -43,7 +43,7 @@ <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> + <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> @@ -116,6 +116,8 @@ <SDLCheck>true</SDLCheck> <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ConformanceMode>true</ConformanceMode> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <LanguageStandard_C>Default</LanguageStandard_C> </ClCompile> <Link> <SubSystem>Console</SubSystem> @@ -155,6 +157,7 @@ <ClInclude Include="Vec3s.h" /> </ItemGroup> <ItemGroup> + <ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp" /> <ClCompile Include="Utils\BinaryReader.cpp" /> <ClCompile Include="Utils\BinaryWriter.cpp" /> <ClCompile Include="Utils\MemoryStream.cpp" /> diff --git a/ZAPDUtils/ZAPDUtils.vcxproj.filters b/ZAPDUtils/ZAPDUtils.vcxproj.filters index 48117c8..4765ad5 100644 --- a/ZAPDUtils/ZAPDUtils.vcxproj.filters +++ b/ZAPDUtils/ZAPDUtils.vcxproj.filters @@ -19,6 +19,9 @@ <Filter Include="Source Files\Utils"> <UniqueIdentifier>{e047919d-7186-49ca-b115-e48fbb5c8743}</UniqueIdentifier> </Filter> + <Filter Include="Source Files\Libraries"> + <UniqueIdentifier>{3de9dd46-0dfd-4d48-9f20-9f24e5b80fe0}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="Utils\BinaryWriter.h"> @@ -74,5 +77,8 @@ <ClCompile Include="Utils\BinaryReader.cpp"> <Filter>Source Files\Utils</Filter> </ClCompile> + <ClCompile Include="..\lib\tinyxml2\tinyxml2.cpp"> + <Filter>Source Files\Libraries</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file |
