diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2022-03-03 00:11:35 -0500 |
|---|---|---|
| committer | M4xw <m4x@m4xw.net> | 2022-03-22 02:37:49 +0100 |
| commit | 55007f0815ba25aee073a7b8b7dc62b7dbeddc09 (patch) | |
| tree | b9b985d815b1f3fe8e5359da3b192ce2ce3927e7 | |
| parent | 3c84d6fabd95f717193facb25ec5cd6255855c10 (diff) | |
Bug fixes, file format updates, cleanup, removed redundant files, etc
| -rw-r--r-- | OTRExporter/DisplayListExporter.cpp | 4 | ||||
| -rw-r--r-- | OTRExporter/Exporter.cpp | 4 | ||||
| -rw-r--r-- | OTRExporter/OTRExporter.vcxproj | 2 | ||||
| -rw-r--r-- | OTRExporter/OTRExporter.vcxproj.filters | 6 | ||||
| -rw-r--r-- | OTRExporter/VersionInfo.cpp | 25 | ||||
| -rw-r--r-- | OTRExporter/VersionInfo.h | 9 | ||||
| -rw-r--r-- | OTRExporter/VtxExporter.cpp | 11 | ||||
| -rw-r--r-- | OTRExporter/VtxExporter.h | 2 |
8 files changed, 53 insertions, 10 deletions
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index 12f4267..78702ae 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -11,6 +11,7 @@ #include <string> #include "MtxExporter.h" #include <Utils/File.h> +#include "VersionInfo.h" //#include "gbi.h" //#include "Lib/Fast3D/U64/PR/gbi.h" @@ -876,8 +877,9 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina // OTRTODO: Stupid stupid hack we need to just call arrayexporter... vtxWriter.Write((uint8_t)Endianess::Little); vtxWriter.Write((uint32_t)Ship::ResourceType::Array); - vtxWriter.Write((uint32_t)Ship::Version::Deckard); + vtxWriter.Write((uint32_t)MAJOR_VERSION); vtxWriter.Write((uint64_t)0xDEADBEEFDEADBEEF); // id + vtxWriter.Write((uint32_t)resourceVersions[Ship::ResourceType::Array]); // id vtxWriter.Write((uint32_t)ZResourceType::Vertex); vtxWriter.Write((uint32_t)arrCnt); diff --git a/OTRExporter/Exporter.cpp b/OTRExporter/Exporter.cpp index 02af0f5..4070d12 100644 --- a/OTRExporter/Exporter.cpp +++ b/OTRExporter/Exporter.cpp @@ -1,9 +1,11 @@ #include "Exporter.h" +#include "VersionInfo.h" void OTRExporter::WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType) { writer->Write((uint8_t)Endianess::Little); writer->Write((uint32_t)resType); - writer->Write((uint32_t)Ship::Version::Deckard); + writer->Write((uint32_t)MAJOR_VERSION); writer->Write((uint64_t)0xDEADBEEFDEADBEEF); // id + writer->Write((uint32_t)resourceVersions[resType]); // id } diff --git a/OTRExporter/OTRExporter.vcxproj b/OTRExporter/OTRExporter.vcxproj index 828ca5f..9653130 100644 --- a/OTRExporter/OTRExporter.vcxproj +++ b/OTRExporter/OTRExporter.vcxproj @@ -37,6 +37,7 @@ <ClInclude Include="RoomExporter.h" />
<ClInclude Include="TextExporter.h" />
<ClInclude Include="TextureExporter.h" />
+ <ClInclude Include="VersionInfo.h" />
<ClInclude Include="VtxExporter.h" />
<ClInclude Include="z64cutscene.h" />
<ClInclude Include="z64cutscene_commands.h" />
@@ -59,6 +60,7 @@ <ClCompile Include="RoomExporter.cpp" />
<ClCompile Include="TextExporter.cpp" />
<ClCompile Include="TextureExporter.cpp" />
+ <ClCompile Include="VersionInfo.cpp" />
<ClCompile Include="VtxExporter.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
diff --git a/OTRExporter/OTRExporter.vcxproj.filters b/OTRExporter/OTRExporter.vcxproj.filters index 5ea7088..8ecc347 100644 --- a/OTRExporter/OTRExporter.vcxproj.filters +++ b/OTRExporter/OTRExporter.vcxproj.filters @@ -78,6 +78,9 @@ <ClInclude Include="MtxExporter.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="VersionInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CollisionExporter.cpp">
@@ -134,5 +137,8 @@ <ClCompile Include="MtxExporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="VersionInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/OTRExporter/VersionInfo.cpp b/OTRExporter/VersionInfo.cpp new file mode 100644 index 0000000..9b684d2 --- /dev/null +++ b/OTRExporter/VersionInfo.cpp @@ -0,0 +1,25 @@ +#include "VersionInfo.h" +#include <Resource.h> + +std::map<Ship::ResourceType, uint32_t> resourceVersions; + +void InitVersionInfo() +{ + resourceVersions[Ship::ResourceType::Animation] = 0; + resourceVersions[Ship::ResourceType::Model] = 0; + resourceVersions[Ship::ResourceType::Texture] = 0; + resourceVersions[Ship::ResourceType::Material] = 0; + resourceVersions[Ship::ResourceType::PlayerAnimation] = 0; + resourceVersions[Ship::ResourceType::DisplayList] = 0; + resourceVersions[Ship::ResourceType::Room] = 0; + resourceVersions[Ship::ResourceType::CollisionHeader] = 0; + resourceVersions[Ship::ResourceType::Skeleton] = 0; + resourceVersions[Ship::ResourceType::SkeletonLimb] = 0; + resourceVersions[Ship::ResourceType::Matrix] = 0; + resourceVersions[Ship::ResourceType::Path] = 0; + resourceVersions[Ship::ResourceType::Vertex] = 0; + resourceVersions[Ship::ResourceType::Cutscene] = 0; + resourceVersions[Ship::ResourceType::Array] = 0; + resourceVersions[Ship::ResourceType::Text] = 0; + resourceVersions[Ship::ResourceType::Blob] = 0; +}
\ No newline at end of file diff --git a/OTRExporter/VersionInfo.h b/OTRExporter/VersionInfo.h new file mode 100644 index 0000000..6c380a6 --- /dev/null +++ b/OTRExporter/VersionInfo.h @@ -0,0 +1,9 @@ +#pragma once + +#include <map> +#include <vector> +#include "Resource.h" + +#define MAJOR_VERSION Ship::Version::Deckard + +extern std::map<Ship::ResourceType, uint32_t> resourceVersions;
\ No newline at end of file diff --git a/OTRExporter/VtxExporter.cpp b/OTRExporter/VtxExporter.cpp index b766b08..10a13f4 100644 --- a/OTRExporter/VtxExporter.cpp +++ b/OTRExporter/VtxExporter.cpp @@ -1,15 +1,12 @@ #include "VtxExporter.h"
#include "Resource.h"
+#include "VersionInfo.h"
-void OTRExporter_Vtx::SaveArr(const std::vector<ZResource*>& vec, BinaryWriter* writer)
+void OTRExporter_Vtx::SaveArr(ZResource* res, const fs::path& outPath, const std::vector<ZResource*>& vec, BinaryWriter* writer)
{
- writer->Write((uint8_t)Endianess::Little);
- writer->Write((uint32_t)Ship::ResourceType::Vertex);
- writer->Write((uint32_t)Ship::Version::Deckard);
- writer->Write((uint64_t)0xDEADBEEFDEADBEEF); // id
- writer->Write((uint32_t)vec.size());
-
+ WriteHeader(res, outPath, writer, Ship::ResourceType::Vertex);
+
for (auto& res: vec) {
ZVtx* vtx = (ZVtx*)res;
writer->Write(vtx->x);
diff --git a/OTRExporter/VtxExporter.h b/OTRExporter/VtxExporter.h index 5b97465..433aadd 100644 --- a/OTRExporter/VtxExporter.h +++ b/OTRExporter/VtxExporter.h @@ -8,6 +8,6 @@ class OTRExporter_Vtx : public OTRExporter
{
public:
- void SaveArr(const std::vector<ZResource*>&, BinaryWriter* writer);
+ void SaveArr(ZResource* res, const fs::path& outPath, const std::vector<ZResource*>&, BinaryWriter* writer);
virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
};
\ No newline at end of file |
