summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2022-01-31 12:32:36 -0500
committerGitHub <noreply@github.com>2022-01-31 12:32:36 -0500
commita9ea761b6903d691988ab96833be25ff243c6b94 (patch)
treef4c93e50c7d986a4b901710552bfc98fbe003c85
parent66b0d829dbe403335461399df29ce936e8d93578 (diff)
parentdad6d087fd4dce68db60f8d0cde23d1b14a6ada8 (diff)
Merge pull request #7 from louist103/Fix(ish)_vtx
Fix(ish) vtx
-rw-r--r--OTRExporter/AnimationExporter.cpp2
-rw-r--r--OTRExporter/AnimationExporter.h2
-rw-r--r--OTRExporter/ArrayExporter.cpp2
-rw-r--r--OTRExporter/ArrayExporter.h2
-rw-r--r--OTRExporter/BackgroundExporter.cpp2
-rw-r--r--OTRExporter/BackgroundExporter.h2
-rw-r--r--OTRExporter/CollisionExporter.cpp2
-rw-r--r--OTRExporter/CollisionExporter.h2
-rw-r--r--OTRExporter/CutsceneExporter.cpp2
-rw-r--r--OTRExporter/CutsceneExporter.h2
-rw-r--r--OTRExporter/DisplayListExporter.cpp41
-rw-r--r--OTRExporter/DisplayListExporter.h2
-rw-r--r--OTRExporter/Exporter.cpp2
-rw-r--r--OTRExporter/Exporter.h2
-rw-r--r--OTRExporter/PathExporter.cpp2
-rw-r--r--OTRExporter/PathExporter.h2
-rw-r--r--OTRExporter/PlayerAnimationExporter.cpp2
-rw-r--r--OTRExporter/PlayerAnimationExporter.h2
-rw-r--r--OTRExporter/RoomExporter.cpp2
-rw-r--r--OTRExporter/RoomExporter.h2
-rw-r--r--OTRExporter/SkeletonExporter.cpp2
-rw-r--r--OTRExporter/SkeletonExporter.h2
-rw-r--r--OTRExporter/SkeletonLimbExporter.cpp2
-rw-r--r--OTRExporter/SkeletonLimbExporter.h2
-rw-r--r--OTRExporter/TextExporter.cpp2
-rw-r--r--OTRExporter/TextExporter.h2
-rw-r--r--OTRExporter/TextureExporter.cpp2
-rw-r--r--OTRExporter/TextureExporter.h2
-rw-r--r--OTRExporter/VtxExporter.cpp2
-rw-r--r--OTRExporter/VtxExporter.h2
30 files changed, 42 insertions, 57 deletions
diff --git a/OTRExporter/AnimationExporter.cpp b/OTRExporter/AnimationExporter.cpp
index 3daed60..4f031b8 100644
--- a/OTRExporter/AnimationExporter.cpp
+++ b/OTRExporter/AnimationExporter.cpp
@@ -1,7 +1,7 @@
#include "AnimationExporter.h"
#include <Animation.h>
-void OTRExporter_Animation::Save(ZResource* res, const fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZAnimation* anim = (ZAnimation*)res;
diff --git a/OTRExporter/AnimationExporter.h b/OTRExporter/AnimationExporter.h
index ec5a5b8..58fddb2 100644
--- a/OTRExporter/AnimationExporter.h
+++ b/OTRExporter/AnimationExporter.h
@@ -9,5 +9,5 @@
class OTRExporter_Animation : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/ArrayExporter.cpp b/OTRExporter/ArrayExporter.cpp
index d0d8dc7..358b13b 100644
--- a/OTRExporter/ArrayExporter.cpp
+++ b/OTRExporter/ArrayExporter.cpp
@@ -1,6 +1,6 @@
#include "ArrayExporter.h"
#include "VtxExporter.h"
-void OTRExporter_Array::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Array::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZArray* arr = (ZArray*)res;
diff --git a/OTRExporter/ArrayExporter.h b/OTRExporter/ArrayExporter.h
index cb4101b..1d2dc0f 100644
--- a/OTRExporter/ArrayExporter.h
+++ b/OTRExporter/ArrayExporter.h
@@ -7,6 +7,6 @@
class OTRExporter_Array : public OTRExporter
{
public:
- virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/BackgroundExporter.cpp b/OTRExporter/BackgroundExporter.cpp
index fcae5e1..2bbee3f 100644
--- a/OTRExporter/BackgroundExporter.cpp
+++ b/OTRExporter/BackgroundExporter.cpp
@@ -1,7 +1,7 @@
#include "BackgroundExporter.h"
#include "../ZAPD/ZFile.h"
-void OTRExporter_Background::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Background::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZBackground* bg = (ZBackground*)res;
diff --git a/OTRExporter/BackgroundExporter.h b/OTRExporter/BackgroundExporter.h
index 30202de..30c1adb 100644
--- a/OTRExporter/BackgroundExporter.h
+++ b/OTRExporter/BackgroundExporter.h
@@ -8,5 +8,5 @@
class OTRExporter_Background : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/CollisionExporter.cpp b/OTRExporter/CollisionExporter.cpp
index d6e1904..02f20e6 100644
--- a/OTRExporter/CollisionExporter.cpp
+++ b/OTRExporter/CollisionExporter.cpp
@@ -1,7 +1,7 @@
#include "CollisionExporter.h"
#include <Resource.h>
-void OTRExporter_Collision::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZCollisionHeader* col = (ZCollisionHeader*)res;
diff --git a/OTRExporter/CollisionExporter.h b/OTRExporter/CollisionExporter.h
index 196383d..536d653 100644
--- a/OTRExporter/CollisionExporter.h
+++ b/OTRExporter/CollisionExporter.h
@@ -7,5 +7,5 @@
class OTRExporter_Collision : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/CutsceneExporter.cpp b/OTRExporter/CutsceneExporter.cpp
index 9002a3f..f283a50 100644
--- a/OTRExporter/CutsceneExporter.cpp
+++ b/OTRExporter/CutsceneExporter.cpp
@@ -1,7 +1,7 @@
#include "CutsceneExporter.h"
#include <Resource.h>
-void OTRExporter_Cutscene::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZCutscene* cs = (ZCutscene*)res;
diff --git a/OTRExporter/CutsceneExporter.h b/OTRExporter/CutsceneExporter.h
index c26fdf1..35bd32b 100644
--- a/OTRExporter/CutsceneExporter.h
+++ b/OTRExporter/CutsceneExporter.h
@@ -6,5 +6,5 @@
class OTRExporter_Cutscene : public ZResourceExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp
index 0809daf..b30c9c1 100644
--- a/OTRExporter/DisplayListExporter.cpp
+++ b/OTRExporter/DisplayListExporter.cpp
@@ -57,7 +57,7 @@ typedef union Mtx
{ (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12)) }
-void OTRExporter_DisplayList::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZDisplayList* dList = (ZDisplayList*)res;
@@ -677,29 +677,36 @@ void OTRExporter_DisplayList::Save(ZResource* res, fs::path outPath, BinaryWrite
std::string fName = OTRExporter_DisplayList::GetPathToRes(res, vtxDecl->varName);
- printf("Exporting VTX Data %s\n", fName.c_str());
+
uint64_t hash = CRC64(fName.c_str());
word0 = hash >> 32;
word1 = hash & 0xFFFFFFFF;
- //if (!otrArchive->HasFile(fName))
+ if (!otrArchive->HasFile(fName))
{
+ printf("Exporting VTX Data %s\n", fName.c_str());
// Write vertices to file
MemoryStream* vtxStream = new MemoryStream();
BinaryWriter vtxWriter = BinaryWriter(vtxStream);
size_t sz = dList->vertices[vtxDecl->address].size();
-
+
if (sz > 0)
{
auto start = std::chrono::steady_clock::now();
// God dammit this is so dumb
auto split = StringHelper::Split(vtxDecl->text, "\n");
-
- for (int i = 0; i < split.size(); i++)
+ size_t size = split.size();
+ vtxWriter.Write((uint8_t)Endianess::Little);
+ vtxWriter.Write((uint32_t)Ship::ResourceType::Vertex);
+ vtxWriter.Write((uint32_t)Ship::Version::Deckard);
+ vtxWriter.Write((uint64_t)0xDEADBEEFDEADBEEF); // id
+ vtxWriter.Write((uint32_t)vtxDecl->arrayItemCnt);
+
+ for (size_t i = 0; i < size; i++)
{
std::string line = split[i];
@@ -724,28 +731,6 @@ void OTRExporter_DisplayList::Save(ZResource* res, fs::path outPath, BinaryWrite
int bp = 0;
}
}
-
- /*for (size_t i = 0; i < sz; i++)
- {
- auto v = dList->vertices[vtxDecl->address][i];
-
- vtxWriter.Write(v.x);
- vtxWriter.Write(v.y);
- vtxWriter.Write(v.z);
- vtxWriter.Write(v.flag);
- vtxWriter.Write(v.s);
- vtxWriter.Write(v.t);
- vtxWriter.Write(v.r);
- vtxWriter.Write(v.g);
- vtxWriter.Write(v.b);
- vtxWriter.Write(v.a);
- }*/
-
- //#ifdef _DEBUG
- //if (otrotrArchive->HasFile(fName))
- //otrotrArchive->RemoveFile(fName);
- //#endif
-
otrArchive->AddFile(fName, (uintptr_t)vtxStream->ToVector().data(), vtxWriter.GetBaseAddress());
auto end = std::chrono::steady_clock::now();
diff --git a/OTRExporter/DisplayListExporter.h b/OTRExporter/DisplayListExporter.h
index d7d183a..e00571a 100644
--- a/OTRExporter/DisplayListExporter.h
+++ b/OTRExporter/DisplayListExporter.h
@@ -9,7 +9,7 @@
class OTRExporter_DisplayList : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
static std::string GetParentFolderName(ZResource* res);
static std::string GetPathToRes(ZResource* res, std::string varName);
diff --git a/OTRExporter/Exporter.cpp b/OTRExporter/Exporter.cpp
index e814244..02af0f5 100644
--- a/OTRExporter/Exporter.cpp
+++ b/OTRExporter/Exporter.cpp
@@ -1,6 +1,6 @@
#include "Exporter.h"
-void OTRExporter::WriteHeader(ZResource* res, fs::path outPath, BinaryWriter* writer, Ship::ResourceType resType)
+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);
diff --git a/OTRExporter/Exporter.h b/OTRExporter/Exporter.h
index 56cb25e..681f1d2 100644
--- a/OTRExporter/Exporter.h
+++ b/OTRExporter/Exporter.h
@@ -8,5 +8,5 @@
class OTRExporter : public ZResourceExporter
{
protected:
- void WriteHeader(ZResource* res, fs::path outPath, BinaryWriter* writer, Ship::ResourceType resType);
+ void WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, Ship::ResourceType resType);
}; \ No newline at end of file
diff --git a/OTRExporter/PathExporter.cpp b/OTRExporter/PathExporter.cpp
index 44b41ff..de15789 100644
--- a/OTRExporter/PathExporter.cpp
+++ b/OTRExporter/PathExporter.cpp
@@ -1,7 +1,7 @@
#include "PathExporter.h"
#include "../ZAPD/ZFile.h"
-void OTRExporter_Path::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Path::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZPath* path = (ZPath*)res;
diff --git a/OTRExporter/PathExporter.h b/OTRExporter/PathExporter.h
index a30dccf..9614b84 100644
--- a/OTRExporter/PathExporter.h
+++ b/OTRExporter/PathExporter.h
@@ -8,5 +8,5 @@
class OTRExporter_Path : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/PlayerAnimationExporter.cpp b/OTRExporter/PlayerAnimationExporter.cpp
index 08b9cc0..9b65f19 100644
--- a/OTRExporter/PlayerAnimationExporter.cpp
+++ b/OTRExporter/PlayerAnimationExporter.cpp
@@ -1,7 +1,7 @@
#include "PlayerAnimationExporter.h"
#include <Resource.h>
-void OTRExporter_PlayerAnimationExporter::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_PlayerAnimationExporter::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZPlayerAnimationData* anim = (ZPlayerAnimationData*)res;
diff --git a/OTRExporter/PlayerAnimationExporter.h b/OTRExporter/PlayerAnimationExporter.h
index 9de7f20..49e5468 100644
--- a/OTRExporter/PlayerAnimationExporter.h
+++ b/OTRExporter/PlayerAnimationExporter.h
@@ -9,5 +9,5 @@
class OTRExporter_PlayerAnimationExporter : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/RoomExporter.cpp b/OTRExporter/RoomExporter.cpp
index 3fb64de..63f9f6b 100644
--- a/OTRExporter/RoomExporter.cpp
+++ b/OTRExporter/RoomExporter.cpp
@@ -35,7 +35,7 @@
#include "PathExporter.h"
#undef FindResource
-void OTRExporter_Room::Save(ZResource* res, const fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZRoom* room = (ZRoom*)res;
diff --git a/OTRExporter/RoomExporter.h b/OTRExporter/RoomExporter.h
index 27eaf75..f748658 100644
--- a/OTRExporter/RoomExporter.h
+++ b/OTRExporter/RoomExporter.h
@@ -10,5 +10,5 @@ class OTRExporter_Room : public OTRExporter
{
public:
void WritePolyDList(BinaryWriter* writer, ZRoom* room, PolygonDlist* dlist);
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/SkeletonExporter.cpp b/OTRExporter/SkeletonExporter.cpp
index 2b372bc..338466c 100644
--- a/OTRExporter/SkeletonExporter.cpp
+++ b/OTRExporter/SkeletonExporter.cpp
@@ -1,7 +1,7 @@
#include "SkeletonExporter.h"
#include <Resource.h>
-void OTRExporter_Skeleton::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Skeleton::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZSkeleton* skel = (ZSkeleton*)res;
diff --git a/OTRExporter/SkeletonExporter.h b/OTRExporter/SkeletonExporter.h
index 57b96fc..36ffcf2 100644
--- a/OTRExporter/SkeletonExporter.h
+++ b/OTRExporter/SkeletonExporter.h
@@ -10,5 +10,5 @@
class OTRExporter_Skeleton : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/SkeletonLimbExporter.cpp b/OTRExporter/SkeletonLimbExporter.cpp
index 8364bfa..9a602f8 100644
--- a/OTRExporter/SkeletonLimbExporter.cpp
+++ b/OTRExporter/SkeletonLimbExporter.cpp
@@ -2,7 +2,7 @@
#include "DisplayListExporter.h"
#include <Resource.h>
-void OTRExporter_SkeletonLimb::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZLimb* limb = (ZLimb*)res;
diff --git a/OTRExporter/SkeletonLimbExporter.h b/OTRExporter/SkeletonLimbExporter.h
index 294e76d..0008274 100644
--- a/OTRExporter/SkeletonLimbExporter.h
+++ b/OTRExporter/SkeletonLimbExporter.h
@@ -11,5 +11,5 @@
class OTRExporter_SkeletonLimb : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/TextExporter.cpp b/OTRExporter/TextExporter.cpp
index 4c9821f..72db8d1 100644
--- a/OTRExporter/TextExporter.cpp
+++ b/OTRExporter/TextExporter.cpp
@@ -1,7 +1,7 @@
#include "TextExporter.h"
#include "../ZAPD/ZFile.h"
-void OTRExporter_Text::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Text::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZText* txt = (ZText*)res;
diff --git a/OTRExporter/TextExporter.h b/OTRExporter/TextExporter.h
index 7ffb5b4..2eaf2ce 100644
--- a/OTRExporter/TextExporter.h
+++ b/OTRExporter/TextExporter.h
@@ -8,5 +8,5 @@
class OTRExporter_Text : public OTRExporter
{
public:
- virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/TextureExporter.cpp b/OTRExporter/TextureExporter.cpp
index aaa7a4e..ab6a5a0 100644
--- a/OTRExporter/TextureExporter.cpp
+++ b/OTRExporter/TextureExporter.cpp
@@ -1,7 +1,7 @@
#include "TextureExporter.h"
#include "../ZAPD/ZFile.h"
-void OTRExporter_Texture::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Texture::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZTexture* tex = (ZTexture*)res;
diff --git a/OTRExporter/TextureExporter.h b/OTRExporter/TextureExporter.h
index 9ec92c6..cdf7491 100644
--- a/OTRExporter/TextureExporter.h
+++ b/OTRExporter/TextureExporter.h
@@ -8,5 +8,5 @@
class OTRExporter_Texture : public OTRExporter
{
public:
- virtual void Save(ZResource* res, const fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file
diff --git a/OTRExporter/VtxExporter.cpp b/OTRExporter/VtxExporter.cpp
index ea50c9d..b766b08 100644
--- a/OTRExporter/VtxExporter.cpp
+++ b/OTRExporter/VtxExporter.cpp
@@ -26,7 +26,7 @@ void OTRExporter_Vtx::SaveArr(const std::vector<ZResource*>& vec, BinaryWriter*
}
-void OTRExporter_Vtx::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
+void OTRExporter_Vtx::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZVtx* vtx = (ZVtx*)res;
diff --git a/OTRExporter/VtxExporter.h b/OTRExporter/VtxExporter.h
index 645ac28..5b97465 100644
--- a/OTRExporter/VtxExporter.h
+++ b/OTRExporter/VtxExporter.h
@@ -9,5 +9,5 @@ class OTRExporter_Vtx : public OTRExporter
{
public:
void SaveArr(const std::vector<ZResource*>&, BinaryWriter* writer);
- virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override;
+ virtual void Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer) override;
}; \ No newline at end of file