diff options
| author | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2024-02-15 21:19:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-15 21:19:33 -0500 |
| commit | e93bd2be062b13106fdb29d98cf4ada4d7ad6827 (patch) | |
| tree | 31815a922cee2443ee0567cb4c3c841e59af3fae | |
| parent | d8f3c4dd4a46fb46c4f69cd387afadfa711606e9 (diff) | |
resource refactory (#15)
* lus won't give us that anymore
* animation
* namespace shanans
* clean up
* more cleanup
| -rw-r--r-- | OTRExporter/AnimationExporter.cpp | 10 | ||||
| -rw-r--r-- | OTRExporter/ArrayExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/AudioExporter.cpp | 8 | ||||
| -rw-r--r-- | OTRExporter/BackgroundExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/BlobExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/CollisionExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/CutsceneExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/DisplayListExporter.cpp | 4 | ||||
| -rw-r--r-- | OTRExporter/Exporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/Exporter.h | 6 | ||||
| -rw-r--r-- | OTRExporter/MtxExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/PathExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/PlayerAnimationExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/RoomExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/SkeletonExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/SkeletonLimbExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/TextExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/TextureExporter.cpp | 2 | ||||
| -rw-r--r-- | OTRExporter/VersionInfo.cpp | 35 | ||||
| -rw-r--r-- | OTRExporter/VersionInfo.h | 2 | ||||
| -rw-r--r-- | OTRExporter/VtxExporter.cpp | 4 |
21 files changed, 49 insertions, 48 deletions
diff --git a/OTRExporter/AnimationExporter.cpp b/OTRExporter/AnimationExporter.cpp index 416d747..bc8c473 100644 --- a/OTRExporter/AnimationExporter.cpp +++ b/OTRExporter/AnimationExporter.cpp @@ -5,20 +5,20 @@ void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, Binary { ZAnimation* anim = (ZAnimation*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_Animation); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Animation)); ZNormalAnimation* normalAnim = dynamic_cast<ZNormalAnimation*>(anim); ZCurveAnimation* curveAnim = dynamic_cast<ZCurveAnimation*>(anim); ZLinkAnimation* linkAnim = dynamic_cast<ZLinkAnimation*>(anim); if (linkAnim != nullptr) { - writer->Write((uint32_t)LUS::AnimationType::Link); + writer->Write((uint32_t)SOH::AnimationType::Link); writer->Write((uint16_t)linkAnim->frameCount); writer->Write((uint32_t)linkAnim->segmentAddress); } else if (curveAnim != nullptr) { - writer->Write((uint32_t)LUS::AnimationType::Curve); + writer->Write((uint32_t)SOH::AnimationType::Curve); writer->Write((uint16_t)curveAnim->frameCount); writer->Write((uint32_t)curveAnim->refIndexArr.size()); @@ -44,7 +44,7 @@ void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, Binary } else if (normalAnim != nullptr) { - writer->Write((uint32_t)LUS::AnimationType::Normal); + writer->Write((uint32_t)SOH::AnimationType::Normal); writer->Write((uint16_t)normalAnim->frameCount); writer->Write((uint32_t)normalAnim->rotationValues.size()); @@ -65,6 +65,6 @@ void OTRExporter_Animation::Save(ZResource* res, const fs::path& outPath, Binary } else { - writer->Write((uint32_t)LUS::AnimationType::Legacy); + writer->Write((uint32_t)SOH::AnimationType::Legacy); } } diff --git a/OTRExporter/ArrayExporter.cpp b/OTRExporter/ArrayExporter.cpp index f6b602b..2ff186f 100644 --- a/OTRExporter/ArrayExporter.cpp +++ b/OTRExporter/ArrayExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Array::Save(ZResource* res, const fs::path& outPath, BinaryWrit {
ZArray* arr = (ZArray*)res;
- WriteHeader(res, outPath, writer, LUS::ResourceType::Array);
+ WriteHeader(res, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Array));
writer->Write((uint32_t)arr->resList[0]->GetResourceType());
writer->Write((uint32_t)arr->arrayCnt);
diff --git a/OTRExporter/AudioExporter.cpp b/OTRExporter/AudioExporter.cpp index 6e1f38e..f79b23f 100644 --- a/OTRExporter/AudioExporter.cpp +++ b/OTRExporter/AudioExporter.cpp @@ -29,7 +29,7 @@ void OTRExporter_Audio::WriteSampleEntryReference(ZAudio* audio, SampleEntry* en void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* writer) { - WriteHeader(nullptr, "", writer, LUS::ResourceType::SOH_AudioSample, 2); + WriteHeader(nullptr, "", writer, static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSample), 2); writer->Write(entry->codec); writer->Write(entry->medium); @@ -81,7 +81,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit { ZAudio* audio = (ZAudio*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_Audio, 2); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Audio), 2); // Write Samples as individual files for (auto pair : audio->samples) @@ -114,7 +114,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit MemoryStream* fntStream = new MemoryStream(); BinaryWriter fntWriter = BinaryWriter(fntStream); - WriteHeader(nullptr, "", &fntWriter, LUS::ResourceType::SOH_AudioSoundFont, 2); + WriteHeader(nullptr, "", &fntWriter, static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSoundFont), 2); fntWriter.Write((uint32_t)i); fntWriter.Write(audio->soundFontTable[i].medium); @@ -173,7 +173,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit MemoryStream* seqStream = new MemoryStream(); BinaryWriter seqWriter = BinaryWriter(seqStream); - WriteHeader(nullptr, "", &seqWriter, LUS::ResourceType::SOH_AudioSequence, 2); + WriteHeader(nullptr, "", &seqWriter, static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSequence), 2); seqWriter.Write((uint32_t)seq.size()); seqWriter.Write(seq.data(), seq.size()); diff --git a/OTRExporter/BackgroundExporter.cpp b/OTRExporter/BackgroundExporter.cpp index f0f1a55..0c04ec4 100644 --- a/OTRExporter/BackgroundExporter.cpp +++ b/OTRExporter/BackgroundExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Background::Save(ZResource* res, const fs::path& outPath, Binar { ZBackground* bg = (ZBackground*)res; - WriteHeader(bg, outPath, writer, LUS::ResourceType::SOH_Background); + WriteHeader(bg, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Background)); writer->Write((uint32_t)bg->GetRawDataSize()); diff --git a/OTRExporter/BlobExporter.cpp b/OTRExporter/BlobExporter.cpp index a547718..f935a33 100644 --- a/OTRExporter/BlobExporter.cpp +++ b/OTRExporter/BlobExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Blob::Save(ZResource* res, const fs::path& outPath, BinaryWrite { ZBlob* blob = (ZBlob*)res; - WriteHeader(blob, outPath, writer, LUS::ResourceType::Blob); + WriteHeader(blob, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Blob)); auto start = std::chrono::steady_clock::now(); diff --git a/OTRExporter/CollisionExporter.cpp b/OTRExporter/CollisionExporter.cpp index cbcdbb3..8b86122 100644 --- a/OTRExporter/CollisionExporter.cpp +++ b/OTRExporter/CollisionExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Collision::Save(ZResource* res, const fs::path& outPath, Binary { ZCollisionHeader* col = (ZCollisionHeader*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_CollisionHeader); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader)); writer->Write(col->absMinX); writer->Write(col->absMinY); diff --git a/OTRExporter/CutsceneExporter.cpp b/OTRExporter/CutsceneExporter.cpp index 2194ce6..b4e2d53 100644 --- a/OTRExporter/CutsceneExporter.cpp +++ b/OTRExporter/CutsceneExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Cutscene::Save(ZResource* res, const fs::path& outPath, BinaryW { ZCutscene* cs = (ZCutscene*)res; - WriteHeader(cs, outPath, writer, LUS::ResourceType::SOH_Cutscene); + WriteHeader(cs, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Cutscene)); writer->Write((uint32_t)0); diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index 77697dd..f35464a 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -51,7 +51,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina //printf("Exporting DList %s\n", dList->GetName().c_str()); - WriteHeader(res, outPath, writer, LUS::ResourceType::DisplayList); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::DisplayList)); while (writer->GetBaseAddress() % 8 != 0) writer->Write((uint8_t)0xFF); @@ -787,7 +787,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina } // OTRTODO: Once we aren't relying on text representations, we should call ArrayExporter... - OTRExporter::WriteHeader(nullptr, "", &vtxWriter, LUS::ResourceType::Array); + OTRExporter::WriteHeader(nullptr, "", &vtxWriter, static_cast<uint32_t>(LUS::ResourceType::Array)); vtxWriter.Write((uint32_t)ZResourceType::Vertex); vtxWriter.Write((uint32_t)arrCnt); diff --git a/OTRExporter/Exporter.cpp b/OTRExporter/Exporter.cpp index a523bb1..c2a582a 100644 --- a/OTRExporter/Exporter.cpp +++ b/OTRExporter/Exporter.cpp @@ -1,7 +1,7 @@ #include "Exporter.h" #include "VersionInfo.h" -void OTRExporter::WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, LUS::ResourceType resType, int32_t resVersion) +void OTRExporter::WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, uint32_t resType, int32_t resVersion) { writer->Write((uint8_t)Endianness::Little); // 0x00 writer->Write((uint8_t)0); // 0x01 diff --git a/OTRExporter/Exporter.h b/OTRExporter/Exporter.h index cd4ed9a..0844c54 100644 --- a/OTRExporter/Exporter.h +++ b/OTRExporter/Exporter.h @@ -2,13 +2,13 @@ #include "ZResource.h" #include "ZArray.h" #include "stdint.h" -//#include "OTRExporter.h" #include <Utils/BinaryWriter.h> #include <libultraship/bridge.h> #include "VersionInfo.h" +#include "../../soh/soh/resource/type/SohResourceType.h" class OTRExporter : public ZResourceExporter { protected: - static void WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, LUS::ResourceType resType, int32_t resVersion = 0); -};
\ No newline at end of file + static void WriteHeader(ZResource* res, const fs::path& outPath, BinaryWriter* writer, uint32_t resType, int32_t resVersion = 0); +}; diff --git a/OTRExporter/MtxExporter.cpp b/OTRExporter/MtxExporter.cpp index 129e43a..79bdc80 100644 --- a/OTRExporter/MtxExporter.cpp +++ b/OTRExporter/MtxExporter.cpp @@ -4,7 +4,7 @@ void OTRExporter_MtxExporter::Save(ZResource* res, const fs::path& outPath, Bina { ZMtx* mtx = (ZMtx*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::Matrix); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Matrix)); for (size_t i = 0; i < 4; i++) for (size_t j = 0; j < 4; j++) diff --git a/OTRExporter/PathExporter.cpp b/OTRExporter/PathExporter.cpp index cc507c7..2c64308 100644 --- a/OTRExporter/PathExporter.cpp +++ b/OTRExporter/PathExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Path::Save(ZResource* res, const fs::path& outPath, BinaryWrite { ZPath* path = (ZPath*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_Path); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Path)); writer->Write((uint32_t)path->pathways.size()); diff --git a/OTRExporter/PlayerAnimationExporter.cpp b/OTRExporter/PlayerAnimationExporter.cpp index b735c4e..4c25b1a 100644 --- a/OTRExporter/PlayerAnimationExporter.cpp +++ b/OTRExporter/PlayerAnimationExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_PlayerAnimationExporter::Save(ZResource* res, const fs::path& o { ZPlayerAnimationData* anim = (ZPlayerAnimationData*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_PlayerAnimation); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation)); auto start = std::chrono::steady_clock::now(); diff --git a/OTRExporter/RoomExporter.cpp b/OTRExporter/RoomExporter.cpp index 3959d76..1928ab0 100644 --- a/OTRExporter/RoomExporter.cpp +++ b/OTRExporter/RoomExporter.cpp @@ -39,7 +39,7 @@ void OTRExporter_Room::Save(ZResource* res, const fs::path& outPath, BinaryWrite { ZRoom* room = (ZRoom*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_Room); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Room)); writer->Write((uint32_t)room->commands.size()); diff --git a/OTRExporter/SkeletonExporter.cpp b/OTRExporter/SkeletonExporter.cpp index fc4bba6..b6c8694 100644 --- a/OTRExporter/SkeletonExporter.cpp +++ b/OTRExporter/SkeletonExporter.cpp @@ -7,7 +7,7 @@ void OTRExporter_Skeleton::Save(ZResource* res, const fs::path& outPath, BinaryW { ZSkeleton* skel = (ZSkeleton*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_Skeleton); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton)); writer->Write((uint8_t)skel->type); writer->Write((uint8_t)skel->limbType); diff --git a/OTRExporter/SkeletonLimbExporter.cpp b/OTRExporter/SkeletonLimbExporter.cpp index 1ee17c4..d95c84d 100644 --- a/OTRExporter/SkeletonLimbExporter.cpp +++ b/OTRExporter/SkeletonLimbExporter.cpp @@ -7,7 +7,7 @@ void OTRExporter_SkeletonLimb::Save(ZResource* res, const fs::path& outPath, Bin { ZLimb* limb = (ZLimb*)res; - WriteHeader(res, outPath, writer, LUS::ResourceType::SOH_SkeletonLimb); + WriteHeader(res, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_SkeletonLimb)); writer->Write((uint8_t)limb->type); writer->Write((uint8_t)limb->skinSegmentType); diff --git a/OTRExporter/TextExporter.cpp b/OTRExporter/TextExporter.cpp index 2fcfe82..1dde7cf 100644 --- a/OTRExporter/TextExporter.cpp +++ b/OTRExporter/TextExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Text::Save(ZResource* res, const fs::path& outPath, BinaryWrite { ZText* txt = (ZText*)res; - WriteHeader(txt, outPath, writer, LUS::ResourceType::SOH_Text); + WriteHeader(txt, outPath, writer, static_cast<uint32_t>(SOH::ResourceType::SOH_Text)); writer->Write((uint32_t)txt->messages.size()); diff --git a/OTRExporter/TextureExporter.cpp b/OTRExporter/TextureExporter.cpp index 77cc209..ffc64ce 100644 --- a/OTRExporter/TextureExporter.cpp +++ b/OTRExporter/TextureExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Texture::Save(ZResource* res, const fs::path& outPath, BinaryWr { ZTexture* tex = (ZTexture*)res; - WriteHeader(tex, outPath, writer, LUS::ResourceType::Texture); + WriteHeader(tex, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Texture)); auto start = std::chrono::steady_clock::now(); diff --git a/OTRExporter/VersionInfo.cpp b/OTRExporter/VersionInfo.cpp index 50910bc..1dbc3df 100644 --- a/OTRExporter/VersionInfo.cpp +++ b/OTRExporter/VersionInfo.cpp @@ -1,25 +1,26 @@ #include "VersionInfo.h" #include <libultraship/bridge.h> +#include "../../soh/soh/resource/type/SohResourceType.h" -std::map<LUS::ResourceType, uint32_t> resourceVersions; +std::map<uint32_t, uint32_t> resourceVersions; void InitVersionInfo() { - resourceVersions = std::map<LUS::ResourceType, uint32_t> { - { LUS::ResourceType::SOH_Animation, 0 }, - { LUS::ResourceType::Texture, 0 }, - { LUS::ResourceType::SOH_PlayerAnimation, 0 }, - { LUS::ResourceType::DisplayList, 0 }, - { LUS::ResourceType::SOH_Room, 0 }, - { LUS::ResourceType::SOH_CollisionHeader, 0 }, - { LUS::ResourceType::SOH_Skeleton, 0 }, - { LUS::ResourceType::SOH_SkeletonLimb, 0 }, - { LUS::ResourceType::Matrix, 0 }, - { LUS::ResourceType::SOH_Path, 0 }, - { LUS::ResourceType::Vertex, 0 }, - { LUS::ResourceType::SOH_Cutscene, 0 }, - { LUS::ResourceType::Array, 0 }, - { LUS::ResourceType::SOH_Text, 0 }, - { LUS::ResourceType::Blob, 0 }, + resourceVersions = std::map<uint32_t, uint32_t> { + { static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::Texture), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_SkeletonLimb), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::Matrix), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_Path), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::Vertex), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_Cutscene), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::Array), 0 }, + { static_cast<uint32_t>(SOH::ResourceType::SOH_Text), 0 }, + { static_cast<uint32_t>(LUS::ResourceType::Blob), 0 }, }; } diff --git a/OTRExporter/VersionInfo.h b/OTRExporter/VersionInfo.h index 03f8417..a58ce1c 100644 --- a/OTRExporter/VersionInfo.h +++ b/OTRExporter/VersionInfo.h @@ -4,4 +4,4 @@ #include <vector> #include "src/resource/Resource.h" -extern std::map<LUS::ResourceType, uint32_t> resourceVersions;
\ No newline at end of file +extern std::map<uint32_t, uint32_t> resourceVersions; diff --git a/OTRExporter/VtxExporter.cpp b/OTRExporter/VtxExporter.cpp index 009545d..1102f10 100644 --- a/OTRExporter/VtxExporter.cpp +++ b/OTRExporter/VtxExporter.cpp @@ -5,7 +5,7 @@ void OTRExporter_Vtx::SaveArr(ZResource* res, const fs::path& outPath, const std::vector<ZResource*>& vec, BinaryWriter* writer)
{
- WriteHeader(res, outPath, writer, LUS::ResourceType::Vertex);
+ WriteHeader(res, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Vertex));
for (auto& res: vec) {
ZVtx* vtx = (ZVtx*)res;
@@ -27,7 +27,7 @@ void OTRExporter_Vtx::Save(ZResource* res, const fs::path& outPath, BinaryWriter {
ZVtx* vtx = (ZVtx*)res;
- WriteHeader(res, outPath, writer, LUS::ResourceType::Vertex);
+ WriteHeader(res, outPath, writer, static_cast<uint32_t>(LUS::ResourceType::Vertex));
writer->Write((uint32_t)1); //Yes I'm hard coding it to one, it *should* be fine.
|
