mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-03-03 02:01:47 -05:00
resource refactory (#3926)
* animation * playeranimation * stop putting things in the LUS namespace from SoH * get all the factories out of the namespace * LUS:: * start on scene command stuff * i think that's the rest of scene * reduce copypasta * collision header * skeleton * skeletonlimb * fix * path * cutscene * text * audio sample * sound font * audiosequence * background * Revert "stop putting things in the LUS namespace from SoH" This reverts commit 0ead6056e66287f515a3bb0f9117ad93bc32d543. * namespace shanans * wrap all factories in namespace soh * it's trying to link now * lus * scene command override etc * fix audio loading * slightly less logspam * get past the cutscene problem * in game! * exporter cleanup * more exporter cleanup * clang formatted lus * msvc * itny lus change * variant * formatty * fix of some sort i guess? * use latest lus main * fix name to enum/factory mapping * otrexporter
This commit is contained in:
parent
7f4fc8dc4a
commit
e0d502b696
@ -1 +1 @@
|
||||
Subproject commit d8f3c4dd4a46fb46c4f69cd387afadfa711606e9
|
||||
Subproject commit e93bd2be062b13106fdb29d98cf4ada4d7ad6827
|
@ -1 +1 @@
|
||||
Subproject commit d5a39635a118f814613c0fdd1601f80c809a742d
|
||||
Subproject commit a516b66ce0c89fe4e33c55b1fbfbde845d0bf129
|
@ -92,6 +92,7 @@ GameInteractorSail* GameInteractorSail::Instance;
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
// Resource Types/Factories
|
||||
#include "soh/resource/type/SohResourceType.h"
|
||||
#include "soh/resource/type/Animation.h"
|
||||
#include "soh/resource/type/AudioSample.h"
|
||||
#include "soh/resource/type/AudioSequence.h"
|
||||
@ -319,19 +320,24 @@ OTRGlobals::OTRGlobals() {
|
||||
|
||||
SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion);
|
||||
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Animation), std::make_shared<LUS::AnimationFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_PlayerAnimation), std::make_shared<LUS::PlayerAnimationFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Room), std::make_shared<LUS::SceneFactory>()); // Is room scene? maybe?
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_CollisionHeader), std::make_shared<LUS::CollisionHeaderFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Skeleton), std::make_shared<LUS::SkeletonFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_SkeletonLimb), std::make_shared<LUS::SkeletonLimbFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Path), std::make_shared<LUS::PathFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Cutscene), std::make_shared<LUS::CutsceneFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Text), std::make_shared<LUS::TextFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_AudioSample), std::make_shared<LUS::AudioSampleFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_AudioSoundFont), std::make_shared<LUS::AudioSoundFontFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_AudioSequence), std::make_shared<LUS::AudioSequenceFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast<uint32_t>(LUS::ResourceType::SOH_Background), std::make_shared<LUS::BackgroundFactory>());
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAnimationV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPlayerAnimationV0>(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySceneV0>(), RESOURCE_FORMAT_BINARY, "Room", static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe?
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCollisionHeaderV0>(), RESOURCE_FORMAT_BINARY, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLCollisionHeaderV0>(), RESOURCE_FORMAT_XML, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonV0>(), RESOURCE_FORMAT_BINARY, "Skeleton", static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLSkeletonV0>(), RESOURCE_FORMAT_XML, "Skeleton", static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonLimbV0>(), RESOURCE_FORMAT_BINARY, "SkeletonLimb", static_cast<uint32_t>(SOH::ResourceType::SOH_SkeletonLimb), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLSkeletonLimbV0>(), RESOURCE_FORMAT_XML, "SkeletonLimb", static_cast<uint32_t>(SOH::ResourceType::SOH_SkeletonLimb), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPathV0>(), RESOURCE_FORMAT_BINARY, "Path", static_cast<uint32_t>(SOH::ResourceType::SOH_Path), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCutsceneV0>(), RESOURCE_FORMAT_BINARY, "Cutscene", static_cast<uint32_t>(SOH::ResourceType::SOH_Cutscene), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryTextV0>(), RESOURCE_FORMAT_BINARY, "Text", static_cast<uint32_t>(SOH::ResourceType::SOH_Text), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLTextV0>(), RESOURCE_FORMAT_XML, "Text", static_cast<uint32_t>(SOH::ResourceType::SOH_Text), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSampleV2>(), RESOURCE_FORMAT_BINARY, "AudioSample", static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSample), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSoundFontV2>(), RESOURCE_FORMAT_BINARY, "AudioSoundFont", static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSoundFont), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSequenceV2>(), RESOURCE_FORMAT_BINARY, "AudioSequence", static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSequence), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryBackgroundV0>(), RESOURCE_FORMAT_BINARY, "Background", static_cast<uint32_t>(SOH::ResourceType::SOH_Background), 0);
|
||||
|
||||
gSaveStateMgr = std::make_shared<SaveStateMgr>();
|
||||
gRandomizer = std::make_shared<Randomizer>();
|
||||
@ -1390,7 +1396,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||
// Actually update the CVar now before runing the alt asset update listeners
|
||||
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0));
|
||||
gfx_texture_cache_clear();
|
||||
LUS::SkeletonPatcher::UpdateSkeletons();
|
||||
SOH::SkeletonPatcher::UpdateSkeletons();
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
|
||||
}
|
||||
|
||||
@ -1618,7 +1624,7 @@ extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) {
|
||||
|
||||
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
||||
auto res = GetResourceByNameHandlingMQ(texPath);
|
||||
return res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::SOH_Background);
|
||||
return res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Background);
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize)
|
||||
@ -1689,7 +1695,7 @@ extern "C" Sprite* GetSeedTexture(uint8_t index) {
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
|
||||
auto anim = std::static_pointer_cast<LUS::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
|
||||
auto anim = std::static_pointer_cast<SOH::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
|
||||
|
||||
return (char*)&anim->limbRotData[0];
|
||||
}
|
||||
@ -1953,7 +1959,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
|
||||
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
|
||||
if (skelAnime != nullptr) {
|
||||
auto stringPath = std::string(path);
|
||||
LUS::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
||||
SOH::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
||||
}
|
||||
|
||||
return skelHeader;
|
||||
@ -1961,12 +1967,12 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
|
||||
|
||||
extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) {
|
||||
if (skelAnime != nullptr)
|
||||
LUS::SkeletonPatcher::UnregisterSkeleton(skelAnime);
|
||||
SOH::SkeletonPatcher::UnregisterSkeleton(skelAnime);
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_ClearSkeletons(SkelAnime* skelAnime) {
|
||||
if (skelAnime != nullptr)
|
||||
LUS::SkeletonPatcher::ClearSkeletons();
|
||||
SOH::SkeletonPatcher::ClearSkeletons();
|
||||
}
|
||||
|
||||
extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
|
||||
|
@ -2,32 +2,14 @@
|
||||
#include "soh/resource/type/Animation.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AnimationFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Animation>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<AnimationFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
||||
|
||||
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
||||
auto animation = std::make_shared<Animation>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
AnimationType animType = (AnimationType)reader->ReadUInt32();
|
||||
animation->type = animType;
|
||||
@ -100,5 +82,7 @@ void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> read
|
||||
} else if (animType == AnimationType::Legacy) {
|
||||
SPDLOG_DEBUG("BEYTAH ANIMATION?!");
|
||||
}
|
||||
|
||||
return animation;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -1,17 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class AnimationFactory : public ResourceFactory {
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryAnimationV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AnimationFactoryV0 : public ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,33 +2,14 @@
|
||||
#include "soh/resource/type/AudioSample.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSampleFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSample>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||
break;
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||
auto audioSample = std::make_shared<AudioSample>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSample->sample.codec = reader->ReadUByte();
|
||||
audioSample->sample.medium = reader->ReadUByte();
|
||||
@ -65,9 +46,10 @@ void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> re
|
||||
}
|
||||
audioSample->book.book = audioSample->bookData.data();
|
||||
audioSample->sample.book = &audioSample->book;
|
||||
}
|
||||
} // namespace LUS
|
||||
|
||||
return audioSample;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
||||
/*
|
||||
in ResourceMgr_LoadAudioSample we used to have
|
||||
|
@ -1,19 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class AudioSampleFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryAudioSampleV2 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,33 +2,14 @@
|
||||
#include "soh/resource/type/AudioSequence.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSequence>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||
auto audioSequence = std::make_shared<AudioSequence>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
||||
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
||||
@ -48,5 +29,7 @@ void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) {
|
||||
audioSequence->sequence.fonts[i] = reader->ReadUByte();
|
||||
}
|
||||
|
||||
return audioSequence;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,19 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class AudioSequenceFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryAudioSequenceV2 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,33 +3,14 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSoundFont>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||
auto audioSoundFont = std::make_shared<AudioSoundFont>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
||||
audioSoundFont->medium = reader->ReadInt8();
|
||||
@ -186,5 +167,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
audioSoundFont->soundEffects.push_back(soundEffect);
|
||||
}
|
||||
audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data();
|
||||
|
||||
return audioSoundFont;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,19 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class AudioSoundFontFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,31 +2,14 @@
|
||||
#include "soh/resource/type/Background.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
BackgroundFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Background>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<BackgroundFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Background> background = std::static_pointer_cast<Background>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, background);
|
||||
auto background = std::make_shared<Background>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
uint32_t dataSize = reader->ReadUInt32();
|
||||
|
||||
@ -35,5 +18,7 @@ void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
for (uint32_t i = 0; i < dataSize; i++) {
|
||||
background->Data.push_back(reader->ReadUByte());
|
||||
}
|
||||
|
||||
return background;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,17 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource/Resource.h"
|
||||
#include "resource/ResourceFactory.h"
|
||||
#include "resource/ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class BackgroundFactory : public ResourceFactory {
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryBackgroundV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class BackgroundFactoryV0 : public ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,54 +2,14 @@
|
||||
#include "soh/resource/type/CollisionHeader.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<CollisionHeader>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
std::shared_ptr<IResource>
|
||||
CollisionHeaderFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||
auto resource = std::make_shared<CollisionHeader>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileXML(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||
auto collisionHeader = std::make_shared<CollisionHeader>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
|
||||
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
|
||||
@ -159,10 +119,19 @@ void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
|
||||
collisionHeader->waterBoxes.push_back(waterBox);
|
||||
}
|
||||
collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data();
|
||||
|
||||
return collisionHeader;
|
||||
}
|
||||
|
||||
void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto collisionHeader = std::make_shared<CollisionHeader>(file->InitData);
|
||||
|
||||
auto reader = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement();
|
||||
auto child = reader->FirstChildElement();
|
||||
|
||||
collisionHeader->collisionHeaderData.minBounds.x = reader->IntAttribute("MinBoundsX");
|
||||
collisionHeader->collisionHeaderData.minBounds.y = reader->IntAttribute("MinBoundsY");
|
||||
@ -178,8 +147,6 @@ void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, s
|
||||
zero.z = 0;
|
||||
collisionHeader->camPosDataZero = zero;
|
||||
|
||||
auto child = reader->FirstChildElement();
|
||||
|
||||
while (child != nullptr) {
|
||||
std::string childName = child->Name();
|
||||
if (childName == "Vertex") {
|
||||
@ -274,5 +241,7 @@ void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, s
|
||||
collisionHeader->collisionHeaderData.cameraDataList = collisionHeader->camData.data();
|
||||
collisionHeader->collisionHeaderData.cameraDataListLen = collisionHeader->camDataCount;
|
||||
collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data();
|
||||
|
||||
return collisionHeader;
|
||||
}
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -1,20 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
#include "ResourceFactoryXML.h"
|
||||
|
||||
namespace LUS {
|
||||
class CollisionHeaderFactory : public ResourceFactory {
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryCollisionHeaderV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<IResource>
|
||||
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
|
||||
class ResourceFactoryXMLCollisionHeaderV0 : public LUS::ResourceFactoryXML {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,36 +2,14 @@
|
||||
#include "soh/resource/type/Cutscene.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
CutsceneFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Cutscene>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<CutsceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
static inline uint32_t read_CMD_BBBB(std::shared_ptr<BinaryReader> reader) {
|
||||
static inline uint32_t read_CMD_BBBB(std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
uint32_t v;
|
||||
reader->Read((char*)&v, sizeof(uint32_t));
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline uint32_t read_CMD_BBH(std::shared_ptr<BinaryReader> reader) {
|
||||
static inline uint32_t read_CMD_BBH(std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
uint32_t v;
|
||||
reader->Read((char*)&v, sizeof(uint32_t));
|
||||
|
||||
@ -46,7 +24,7 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr<BinaryReader> reader) {
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline uint32_t read_CMD_HBB(std::shared_ptr<BinaryReader> reader) {
|
||||
static inline uint32_t read_CMD_HBB(std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
uint32_t v;
|
||||
reader->Read((char*)&v, sizeof(uint32_t));
|
||||
|
||||
@ -61,7 +39,7 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr<BinaryReader> reader) {
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
|
||||
static inline uint32_t read_CMD_HH(std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
uint32_t v;
|
||||
reader->Read((char*)&v, sizeof(uint32_t));
|
||||
|
||||
@ -79,11 +57,14 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
|
||||
return v;
|
||||
}
|
||||
|
||||
void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto cutscene = std::make_shared<Cutscene>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
cutscene->commands.reserve(numEntries);
|
||||
@ -459,7 +440,7 @@ void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
|
||||
case 0xFFFFFFFF: // CS_END
|
||||
{
|
||||
cutscene->commands.push_back(reader->ReadUInt32());
|
||||
return;
|
||||
return cutscene;
|
||||
}
|
||||
default:
|
||||
SPDLOG_TRACE("CutsceneV0: Unknown command {}\n", commandId);
|
||||
@ -467,5 +448,7 @@ void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cutscene;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,19 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class CutsceneFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryCutsceneV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class CutsceneFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,14 @@
|
||||
#include "soh/resource/type/Path.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
PathFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Path>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<PathFactoryV0>();
|
||||
break;
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||
auto path = std::make_shared<Path>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
path->numPaths = reader->ReadUInt32();
|
||||
path->paths.reserve(path->numPaths);
|
||||
@ -52,5 +34,7 @@ void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
|
||||
path->pathData.push_back(pathDataEntry);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,19 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class PathFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryPathV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class PathFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,34 +2,14 @@
|
||||
#include "soh/resource/type/PlayerAnimation.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<PlayerAnimation>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||
break;
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||
auto playerAnimation = std::make_shared<PlayerAnimation>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
uint32_t numEntries = reader->ReadUInt32();
|
||||
playerAnimation->limbRotData.reserve(numEntries);
|
||||
@ -37,5 +17,7 @@ void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
|
||||
for (uint32_t i = 0; i < numEntries; i++) {
|
||||
playerAnimation->limbRotData.push_back(reader->ReadInt16());
|
||||
}
|
||||
}
|
||||
} // namespace LUS
|
||||
|
||||
return playerAnimation;
|
||||
};
|
||||
} // namespace SOH
|
||||
|
@ -1,17 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class PlayerAnimationFactory : public ResourceFactory {
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryPlayerAnimationV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "soh/resource/type/SohResourceType.h"
|
||||
#include "soh/resource/importer/SceneFactory.h"
|
||||
#include "soh/resource/type/Scene.h"
|
||||
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||
@ -28,67 +29,36 @@
|
||||
#include "soh/resource/importer/scenecommand/SetLightListFactory.h"
|
||||
#include "soh/resource/importer/scenecommand/SetMeshFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
|
||||
std::shared_ptr<IResource>
|
||||
SceneFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
if (SceneFactory::sceneCommandFactories.empty()) {
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomBehavior] = std::make_shared<SetRoomBehaviorFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCsCamera] = std::make_shared<SetCsCameraFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCameraSettings] = std::make_shared<SetCameraSettingsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomList] = std::make_shared<SetRoomListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCollisionHeader] = std::make_shared<SetCollisionHeaderFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEntranceList] = std::make_shared<SetEntranceListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSpecialObjects] = std::make_shared<SetSpecialObjectsFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetObjectList] = std::make_shared<SetObjectListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetStartPositionList] = std::make_shared<SetStartPositionListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetActorList] = std::make_shared<SetActorListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTransitionActorList] = std::make_shared<SetTransitionActorListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::EndMarker] = std::make_shared<EndMarkerFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetAlternateHeaders] = std::make_shared<SetAlternateHeadersFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetPathways] = std::make_shared<SetPathwaysFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCutscenes] = std::make_shared<SetCutscenesFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightList] = std::make_shared<SetLightListFactory>();
|
||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
||||
}
|
||||
|
||||
auto resource = std::make_shared<Scene>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SceneFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Scene with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
namespace SOH {
|
||||
ResourceFactoryBinarySceneV0::ResourceFactoryBinarySceneV0() {
|
||||
sceneCommandFactories[SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetRoomBehavior] = std::make_shared<SetRoomBehaviorFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetCsCamera] = std::make_shared<SetCsCameraFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetCameraSettings] = std::make_shared<SetCameraSettingsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetRoomList] = std::make_shared<SetRoomListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetCollisionHeader] = std::make_shared<SetCollisionHeaderFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetEntranceList] = std::make_shared<SetEntranceListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetSpecialObjects] = std::make_shared<SetSpecialObjectsFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetObjectList] = std::make_shared<SetObjectListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetStartPositionList] = std::make_shared<SetStartPositionListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetActorList] = std::make_shared<SetActorListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetTransitionActorList] = std::make_shared<SetTransitionActorListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::EndMarker] = std::make_shared<EndMarkerFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetAlternateHeaders] = std::make_shared<SetAlternateHeadersFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetPathways] = std::make_shared<SetPathwaysFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetCutscenes] = std::make_shared<SetCutscenesFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetLightList] = std::make_shared<SetLightListFactory>();
|
||||
sceneCommandFactories[SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
||||
}
|
||||
|
||||
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||
|
||||
ParseSceneCommands(scene, reader);
|
||||
}
|
||||
|
||||
void SceneFactoryV0::ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader) {
|
||||
void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
uint32_t commandCount = reader->ReadUInt32();
|
||||
scene->commands.reserve(commandCount);
|
||||
|
||||
@ -97,19 +67,19 @@ void SceneFactoryV0::ParseSceneCommands(std::shared_ptr<Scene> scene, std::share
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ISceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr<Scene> scene,
|
||||
std::shared_ptr<BinaryReader> reader, uint32_t index) {
|
||||
std::shared_ptr<ISceneCommand> ResourceFactoryBinarySceneV0::ParseSceneCommand(std::shared_ptr<Scene> scene,
|
||||
std::shared_ptr<LUS::BinaryReader> reader, uint32_t index) {
|
||||
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
|
||||
|
||||
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
|
||||
reader->Seek(-sizeof(int32_t), LUS::SeekOffsetType::Current);
|
||||
|
||||
std::shared_ptr<ISceneCommand> result = nullptr;
|
||||
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
|
||||
auto commandFactory = ResourceFactoryBinarySceneV0::sceneCommandFactories[cmdID];
|
||||
|
||||
if (commandFactory != nullptr) {
|
||||
auto initData = std::make_shared<ResourceInitData>();
|
||||
auto initData = std::make_shared<LUS::ResourceInitData>();
|
||||
initData->Id = scene->GetInitData()->Id;
|
||||
initData->Type = static_cast<uint32_t>(ResourceType::SOH_SceneCommand);
|
||||
initData->Type = static_cast<uint32_t>(SOH::ResourceType::SOH_SceneCommand);
|
||||
initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index);
|
||||
initData->ResourceVersion = scene->GetInitData()->ResourceVersion;
|
||||
result = std::static_pointer_cast<ISceneCommand>(commandFactory->ReadResource(initData, reader));
|
||||
@ -123,4 +93,16 @@ std::shared_ptr<ISceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinarySceneV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto scene = std::make_shared<Scene>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
ParseSceneCommands(scene, reader);
|
||||
|
||||
return scene;
|
||||
};
|
||||
} // namespace SOH
|
||||
|
@ -4,26 +4,22 @@
|
||||
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace LUS {
|
||||
class SceneFactory : public ResourceFactory {
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinarySceneV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
ResourceFactoryBinarySceneV0();
|
||||
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
void ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<LUS::BinaryReader> reader);
|
||||
|
||||
// Doing something very similar to what we do on the ResourceLoader.
|
||||
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
||||
// They can not right now because the exporter does not give them a proper resource type enum value,
|
||||
// and the exporter does not export the commands with a proper OTR header.
|
||||
static inline std::unordered_map<SceneCommandID, std::shared_ptr<SceneCommandFactory>> sceneCommandFactories;
|
||||
};
|
||||
|
||||
class SceneFactoryV0 : public ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
void ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader);
|
||||
static inline std::unordered_map<SceneCommandID, std::shared_ptr<SceneCommandFactoryBinaryV0>> sceneCommandFactories;
|
||||
protected:
|
||||
std::shared_ptr<ISceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader, uint32_t index);
|
||||
std::shared_ptr<ISceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<LUS::BinaryReader> reader, uint32_t index);
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,54 +3,14 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SkeletonFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Skeleton>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
std::shared_ptr<IResource>
|
||||
SkeletonFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||
auto resource = std::make_shared<Skeleton>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileXML(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
||||
auto skeleton = std::make_shared<Skeleton>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
skeleton->type = (SkeletonType)reader->ReadInt8();
|
||||
skeleton->limbType = (LimbType)reader->ReadInt8();
|
||||
@ -66,17 +26,17 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
skeleton->limbTable.push_back(limbPath);
|
||||
}
|
||||
|
||||
if (skeleton->type == LUS::SkeletonType::Curve) {
|
||||
if (skeleton->type == SkeletonType::Curve) {
|
||||
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
|
||||
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
|
||||
} else if (skeleton->type == LUS::SkeletonType::Flex) {
|
||||
} else if (skeleton->type == SkeletonType::Flex) {
|
||||
skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount;
|
||||
}
|
||||
|
||||
if (skeleton->type == LUS::SkeletonType::Normal) {
|
||||
if (skeleton->type == SkeletonType::Normal) {
|
||||
skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount;
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount);
|
||||
} else if (skeleton->type == LUS::SkeletonType::Flex) {
|
||||
} else if (skeleton->type == SkeletonType::Flex) {
|
||||
skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount;
|
||||
skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount);
|
||||
}
|
||||
@ -87,21 +47,29 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr);
|
||||
}
|
||||
|
||||
if (skeleton->type == LUS::SkeletonType::Normal) {
|
||||
if (skeleton->type == SkeletonType::Normal) {
|
||||
skeleton->skeletonData.skeletonHeader.segment = (void**)skeleton->skeletonHeaderSegments.data();
|
||||
} else if (skeleton->type == LUS::SkeletonType::Flex) {
|
||||
} else if (skeleton->type == SkeletonType::Flex) {
|
||||
skeleton->skeletonData.flexSkeletonHeader.sh.segment = (void**)skeleton->skeletonHeaderSegments.data();
|
||||
} else if (skeleton->type == LUS::SkeletonType::Curve) {
|
||||
} else if (skeleton->type == SkeletonType::Curve) {
|
||||
skeleton->skeletonData.skelCurveLimbList.limbs = (SkelCurveLimb**)skeleton->skeletonHeaderSegments.data();
|
||||
} else {
|
||||
SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type);
|
||||
}
|
||||
|
||||
skeleton->skeletonData.skeletonHeader.skeletonType = (uint8_t)skeleton->type;
|
||||
|
||||
return skeleton;
|
||||
}
|
||||
void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<Skeleton> skel = std::static_pointer_cast<Skeleton>(resource);
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto skel = std::make_shared<Skeleton>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement();
|
||||
auto child = reader->FirstChildElement();
|
||||
|
||||
skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons
|
||||
if (reader->FindAttribute("Type")) {
|
||||
@ -137,8 +105,6 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
|
||||
skel->limbCount = reader->IntAttribute("LimbCount");
|
||||
skel->dListCount = reader->IntAttribute("DisplayListCount");
|
||||
|
||||
auto child = reader->FirstChildElement();
|
||||
|
||||
while (child != nullptr) {
|
||||
std::string childName = child->Name();
|
||||
|
||||
@ -157,6 +123,7 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
|
||||
skel->skeletonData.flexSkeletonHeader.sh.segment = (void**)skel->skeletonHeaderSegments.data();
|
||||
skel->skeletonData.flexSkeletonHeader.dListCount = skel->dListCount;
|
||||
skel->skeletonData.skeletonHeader.skeletonType = (uint8_t)skel->type;
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return skel;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -1,23 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
#include "ResourceFactoryXML.h"
|
||||
|
||||
namespace LUS {
|
||||
class SkeletonFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinarySkeletonV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<IResource>
|
||||
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class SkeletonFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
class ResourceFactoryXMLSkeletonV0 : public LUS::ResourceFactoryXML {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
||||
} // namespace SOH
|
||||
|
@ -3,54 +3,14 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SkeletonLimb>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
std::shared_ptr<IResource>
|
||||
SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||
auto resource = std::make_shared<SkeletonLimb>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileXML(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||
auto skeletonLimb = std::make_shared<SkeletonLimb>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
skeletonLimb->limbType = (LimbType)reader->ReadInt8();
|
||||
skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8();
|
||||
@ -124,7 +84,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->childIndex = reader->ReadUByte();
|
||||
skeletonLimb->siblingIndex = reader->ReadUByte();
|
||||
|
||||
if (skeletonLimb->limbType == LUS::LimbType::LOD) {
|
||||
if (skeletonLimb->limbType == LimbType::LOD) {
|
||||
skeletonLimb->limbData.lodLimb.jointPos.x = skeletonLimb->transX;
|
||||
skeletonLimb->limbData.lodLimb.jointPos.y = skeletonLimb->transY;
|
||||
skeletonLimb->limbData.lodLimb.jointPos.z = skeletonLimb->transZ;
|
||||
@ -144,7 +104,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
} else {
|
||||
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
|
||||
}
|
||||
} else if (skeletonLimb->limbType == LUS::LimbType::Standard) {
|
||||
} else if (skeletonLimb->limbType == LimbType::Standard) {
|
||||
skeletonLimb->limbData.standardLimb.jointPos.x = skeletonLimb->transX;
|
||||
skeletonLimb->limbData.standardLimb.jointPos.y = skeletonLimb->transY;
|
||||
skeletonLimb->limbData.standardLimb.jointPos.z = skeletonLimb->transZ;
|
||||
@ -156,7 +116,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr;
|
||||
skeletonLimb->limbData.standardLimb.dList = (Gfx*)skeletonLimb->dListPtr.c_str();
|
||||
}
|
||||
} else if (skeletonLimb->limbType == LUS::LimbType::Curve) {
|
||||
} else if (skeletonLimb->limbType == LimbType::Curve) {
|
||||
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
|
||||
skeletonLimb->limbData.skelCurveLimb.nextLimbIdx = skeletonLimb->siblingIndex;
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[0] = nullptr;
|
||||
@ -171,31 +131,31 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr;
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str();
|
||||
}
|
||||
} else if (skeletonLimb->limbType == LUS::LimbType::Skin) {
|
||||
} else if (skeletonLimb->limbType == LimbType::Skin) {
|
||||
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
|
||||
skeletonLimb->limbData.skinLimb.jointPos.y = skeletonLimb->transY;
|
||||
skeletonLimb->limbData.skinLimb.jointPos.z = skeletonLimb->transZ;
|
||||
skeletonLimb->limbData.skinLimb.child = skeletonLimb->childIndex;
|
||||
skeletonLimb->limbData.skinLimb.sibling = skeletonLimb->siblingIndex;
|
||||
|
||||
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
|
||||
if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) {
|
||||
skeletonLimb->limbData.skinLimb.segmentType = static_cast<int32_t>(skeletonLimb->skinSegmentType);
|
||||
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
|
||||
} else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_4) {
|
||||
skeletonLimb->limbData.skinLimb.segmentType = 4;
|
||||
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_5) {
|
||||
} else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_5) {
|
||||
skeletonLimb->limbData.skinLimb.segmentType = 5;
|
||||
} else {
|
||||
skeletonLimb->limbData.skinLimb.segmentType = 0;
|
||||
}
|
||||
|
||||
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
|
||||
if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) {
|
||||
if (skeletonLimb->skinDList != "") {
|
||||
skeletonLimb->skinDList = "__OTR__" + skeletonLimb->skinDList;
|
||||
skeletonLimb->limbData.skinLimb.segment = (Gfx*)skeletonLimb->skinDList.c_str();
|
||||
} else {
|
||||
skeletonLimb->limbData.skinLimb.segment = nullptr;
|
||||
}
|
||||
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
|
||||
} else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_4) {
|
||||
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
|
||||
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
|
||||
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
||||
@ -220,10 +180,17 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->limbData.skinLimb.segment = &skeletonLimb->skinAnimLimbData;
|
||||
}
|
||||
}
|
||||
|
||||
return skeletonLimb;
|
||||
}
|
||||
void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SkeletonLimb> skelLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryXMLSkeletonLimbV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto skelLimb = std::make_shared<SkeletonLimb>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement();
|
||||
|
||||
std::string limbType = reader->Attribute("Type");
|
||||
|
||||
@ -275,6 +242,7 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar
|
||||
limbData.lodLimb.sibling = skelLimb->siblingIndex;
|
||||
|
||||
// skelLimb->dList2Ptr = reader->Attribute("DisplayList2");
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return skelLimb;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -1,23 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
#include "ResourceFactoryXML.h"
|
||||
|
||||
namespace LUS {
|
||||
class SkeletonLimbFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinarySkeletonLimbV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<IResource>
|
||||
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class SkeletonLimbFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
class ResourceFactoryXMLSkeletonLimbV0 : public LUS::ResourceFactoryXML {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
||||
} // namespace SOH
|
||||
|
@ -2,74 +2,38 @@
|
||||
#include "soh/resource/type/Text.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
TextFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Text>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<TextFactoryV0>();
|
||||
break;
|
||||
default:
|
||||
// VERSION NOT SUPPORTED
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
std::shared_ptr<IResource>
|
||||
TextFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||
auto resource = std::make_shared<Text>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<TextFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryTextV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileXML(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, text);
|
||||
auto text = std::make_shared<Text>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
uint32_t msgCount = reader->ReadUInt32();
|
||||
text->messages.reserve(msgCount);
|
||||
|
||||
for (uint32_t i = 0; i < msgCount; i++) {
|
||||
MessageEntry entry;
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.textboxType = reader->ReadUByte();
|
||||
entry.textboxYPos = reader->ReadUByte();
|
||||
entry.msg = reader->ReadString();
|
||||
MessageEntry entry;
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.textboxType = reader->ReadUByte();
|
||||
entry.textboxYPos = reader->ReadUByte();
|
||||
entry.msg = reader->ReadString();
|
||||
|
||||
text->messages.push_back(entry);
|
||||
text->messages.push_back(entry);
|
||||
}
|
||||
}
|
||||
void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Text> txt = std::static_pointer_cast<Text>(resource);
|
||||
|
||||
auto child = reader->FirstChildElement();
|
||||
return text;
|
||||
}
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryXMLTextV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto txt = std::make_shared<Text>(file->InitData);
|
||||
auto child = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement()->FirstChildElement();
|
||||
|
||||
while (child != nullptr) {
|
||||
std::string childName = child->Name();
|
||||
@ -88,6 +52,7 @@ void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<I
|
||||
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return txt;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -1,23 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
#include "ResourceFactoryXML.h"
|
||||
|
||||
namespace LUS {
|
||||
class TextFactory : public ResourceFactory
|
||||
{
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryTextV0 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<IResource>
|
||||
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class TextFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
class ResourceFactoryXMLTextV0 : public LUS::ResourceFactoryXML {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
||||
} // namespace SOH
|
||||
|
@ -2,37 +2,13 @@
|
||||
#include "soh/resource/type/scenecommand/EndMarker.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
EndMarkerFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<EndMarker>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<EndMarkerFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
EndMarkerFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto endMarker = std::make_shared<EndMarker>(initData);
|
||||
|
||||
ReadCommandId(endMarker, reader);
|
||||
|
||||
// This has no data.
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return endMarker;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,9 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class EndMarkerFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class EndMarkerFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class EndMarkerFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,9 +2,8 @@
|
||||
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<BinaryReader> reader) {
|
||||
namespace SOH {
|
||||
void SceneCommandFactoryBinaryV0::ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
command->cmdId = (SceneCommandID)reader->ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace SOH
|
||||
|
@ -5,11 +5,12 @@
|
||||
#include "ResourceFactory.h"
|
||||
#include "soh/resource/type/scenecommand/SceneCommand.h"
|
||||
|
||||
namespace LUS {
|
||||
class SceneCommandFactory : public ResourceFactory {};
|
||||
namespace SOH {
|
||||
class SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
virtual std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) = 0;
|
||||
|
||||
class SceneCommandVersionFactory : public ResourceVersionFactory {
|
||||
protected:
|
||||
void ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<BinaryReader> reader);
|
||||
protected:
|
||||
void ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<LUS::BinaryReader> reader);
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,52 +2,30 @@
|
||||
#include "soh/resource/type/scenecommand/SetActorList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetActorListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetActorList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetActorListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setActorList = std::make_shared<SetActorList>(initData);
|
||||
|
||||
ReadCommandId(setActorList, reader);
|
||||
|
||||
setActorList->numActors = reader->ReadUInt32();
|
||||
setActorList->actorList.reserve(setActorList->numActors);
|
||||
for (uint32_t i = 0; i < setActorList->numActors; i++) {
|
||||
ActorEntry entry;
|
||||
ActorEntry entry;
|
||||
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
|
||||
setActorList->actorList.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setActorList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetActorListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetActorListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetActorListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,47 +3,24 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetAlternateHeaders>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setAlternateHeaders = std::make_shared<SetAlternateHeaders>(initData);
|
||||
|
||||
ReadCommandId(setAlternateHeaders, reader);
|
||||
|
||||
setAlternateHeaders->numHeaders = reader->ReadUInt32();
|
||||
setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders);
|
||||
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
|
||||
auto headerName = reader->ReadString();
|
||||
if (!headerName.empty()) {
|
||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<LUS::Scene>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
||||
} else {
|
||||
setAlternateHeaders->headers.push_back(nullptr);
|
||||
}
|
||||
auto headerName = reader->ReadString();
|
||||
if (!headerName.empty()) {
|
||||
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
|
||||
} else {
|
||||
setAlternateHeaders->headers.push_back(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setAlternateHeaders;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetAlternateHeadersFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,38 +2,16 @@
|
||||
#include "soh/resource/type/scenecommand/SetCameraSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetCameraSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setCameraSettings = std::make_shared<SetCameraSettings>(initData);
|
||||
|
||||
ReadCommandId(setCameraSettings, reader);
|
||||
|
||||
setCameraSettings->settings.cameraMovement = reader->ReadInt8();
|
||||
setCameraSettings->settings.worldMapArea = reader->ReadInt32();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setCameraSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetCameraSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,37 +3,16 @@
|
||||
#include "libultraship/libultraship.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetCollisionHeader>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setCollisionHeader = std::make_shared<SetCollisionHeader>(initData);
|
||||
|
||||
ReadCommandId(setCollisionHeader, reader);
|
||||
|
||||
setCollisionHeader->fileName = reader->ReadString();
|
||||
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str()));
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setCollisionHeader;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetCollisionHeaderFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetCsCamera.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetCsCamera>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCsCameraFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetCsCameraFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setCsCamera = std::make_shared<SetCsCamera>(initData);
|
||||
|
||||
ReadCommandId(setCsCamera, reader);
|
||||
|
||||
@ -35,6 +13,7 @@ void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> re
|
||||
reader->ReadInt32(); // segOffset
|
||||
|
||||
// OTRTODO: FINISH!
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setCsCamera;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetCsCameraFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,38 +3,16 @@
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetCutscenes>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetCutscenesFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetCutscenesFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setCutscenes = std::make_shared<SetCutscenes>(initData);
|
||||
|
||||
ReadCommandId(setCutscenes, reader);
|
||||
|
||||
setCutscenes->fileName = reader->ReadString();
|
||||
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setCutscenes;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetCutscenesFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetCutscenesFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,37 +2,15 @@
|
||||
#include "soh/resource/type/scenecommand/SetEchoSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetEchoSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetEchoSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setEchoSettings = std::make_shared<SetEchoSettings>(initData);
|
||||
|
||||
ReadCommandId(setEchoSettings, reader);
|
||||
|
||||
setEchoSettings->settings.echo = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setEchoSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetEchoSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetEntranceList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetEntranceList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetEntranceListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetEntranceListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setEntranceList = std::make_shared<SetEntranceList>(initData);
|
||||
|
||||
ReadCommandId(setEntranceList, reader);
|
||||
|
||||
@ -41,6 +19,7 @@ void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
|
||||
|
||||
setEntranceList->entrances.push_back(entranceEntry);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setEntranceList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetEntranceListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetExitList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetExitListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetExitList>( initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetExitListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetExitListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setExitList = std::make_shared<SetExitList>( initData);
|
||||
|
||||
ReadCommandId(setExitList, reader);
|
||||
|
||||
@ -36,6 +14,7 @@ void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> re
|
||||
for (uint32_t i = 0; i < setExitList->numExits; i++) {
|
||||
setExitList->exits.push_back(reader->ReadUInt16());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setExitList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetExitListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetExitListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetExitListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,34 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetLightList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetLightListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetLightList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetLightListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setLightList = std::make_shared<SetLightList>(initData);
|
||||
|
||||
ReadCommandId(setLightList, reader);
|
||||
|
||||
@ -40,7 +16,7 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
|
||||
light.type = reader->ReadUByte();
|
||||
|
||||
light.params.point.x = reader->ReadInt16();
|
||||
light.params.point.x = reader->ReadInt16();
|
||||
light.params.point.y = reader->ReadInt16();
|
||||
light.params.point.z = reader->ReadInt16();
|
||||
|
||||
@ -49,10 +25,11 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
light.params.point.color[2] = reader->ReadUByte(); // b
|
||||
|
||||
light.params.point.drawGlow = reader->ReadUByte();
|
||||
light.params.point.radius = reader->ReadInt16();
|
||||
light.params.point.radius = reader->ReadInt16();
|
||||
|
||||
setLightList->lightList.push_back(light);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setLightList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetLightListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetLightListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetLightListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,33 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetLightingSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetLightingSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetLightingSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetLightingSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetLightingSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setLightingSettings = std::make_shared<SetLightingSettings>(initData);
|
||||
|
||||
ReadCommandId(setLightingSettings, reader);
|
||||
|
||||
@ -65,6 +42,7 @@ void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryRe
|
||||
lightSettings.fogFar = reader->ReadUInt16();
|
||||
setLightingSettings->settings.push_back(lightSettings);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setLightingSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetLightingSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,34 +3,10 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetMeshFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetMesh>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetMeshFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetMesh with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetMesh> setMesh = std::static_pointer_cast<SetMesh>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setMesh);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetMeshFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setMesh = std::make_shared<SetMesh>(initData);
|
||||
|
||||
ReadCommandId(setMesh, reader);
|
||||
|
||||
@ -143,10 +119,10 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader
|
||||
std::string meshOpa = reader->ReadString();
|
||||
std::string meshXlu = reader->ReadString();
|
||||
|
||||
auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str());
|
||||
auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str());
|
||||
dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0;
|
||||
dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0;
|
||||
auto opaRes = meshOpa != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()) : nullptr;
|
||||
auto xluRes = meshXlu != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()) : nullptr;
|
||||
dlist.opa = (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr);
|
||||
dlist.xlu = (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr);
|
||||
|
||||
setMesh->dlists2.push_back(dlist);
|
||||
} else {
|
||||
@ -164,6 +140,7 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader
|
||||
} else {
|
||||
SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setMesh;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetMeshFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetMeshFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetMeshFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,33 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetObjectList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetObjectListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetObjectList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetObjectListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setObjectList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetObjectListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setObjectList = std::make_shared<SetObjectList>(initData);
|
||||
|
||||
ReadCommandId(setObjectList, reader);
|
||||
|
||||
@ -37,6 +14,7 @@ void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
for (uint32_t i = 0; i < setObjectList->numObjects; i++) {
|
||||
setObjectList->objects.push_back(reader->ReadUInt16());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setObjectList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetObjectListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetObjectListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetObjectListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -3,32 +3,10 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetPathwaysFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetPathways>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetPathwaysFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetPathwaysFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setPathways = std::make_shared<SetPathways>(initData);
|
||||
|
||||
ReadCommandId(setPathways, reader);
|
||||
|
||||
@ -39,6 +17,7 @@ void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> re
|
||||
auto path = std::static_pointer_cast<Path>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
|
||||
setPathways->paths.push_back(path->GetPointer());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setPathways;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetPathwaysFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetPathwaysFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetPathwaysFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,37 +2,16 @@
|
||||
#include "soh/resource/type/scenecommand/SetRoomBehavior.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetRoomBehaviorFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetRoomBehavior>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomBehaviorFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetRoomBehaviorFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setRoomBehavior = std::make_shared<SetRoomBehavior>(initData);
|
||||
|
||||
ReadCommandId(setRoomBehavior, reader);
|
||||
|
||||
setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8();
|
||||
setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setRoomBehavior;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetRoomBehaviorFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetRoomBehaviorFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,49 +2,27 @@
|
||||
#include "soh/resource/type/scenecommand/SetRoomList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetRoomListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetRoomList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetRoomListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetRoomList> setRoomList = std::static_pointer_cast<SetRoomList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setRoomList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetRoomListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setRoomList = std::make_shared<SetRoomList>(initData);
|
||||
|
||||
ReadCommandId(setRoomList, reader);
|
||||
|
||||
setRoomList->numRooms = reader->ReadInt32();
|
||||
setRoomList->rooms.reserve(setRoomList->numRooms);
|
||||
for (uint32_t i = 0; i < setRoomList->numRooms; i++) {
|
||||
RomFile room;
|
||||
RomFile room;
|
||||
|
||||
setRoomList->fileNames.push_back(reader->ReadString());
|
||||
setRoomList->fileNames.push_back(reader->ReadString());
|
||||
|
||||
room.fileName = (char*)setRoomList->fileNames.back().c_str();
|
||||
room.vromStart = reader->ReadInt32();
|
||||
room.vromEnd = reader->ReadInt32();
|
||||
room.fileName = (char*)setRoomList->fileNames.back().c_str();
|
||||
room.vromStart = reader->ReadInt32();
|
||||
room.vromEnd = reader->ReadInt32();
|
||||
|
||||
setRoomList->rooms.push_back(room);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setRoomList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetRoomListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetRoomListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetRoomListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,37 +2,16 @@
|
||||
#include "soh/resource/type/scenecommand/SetSkyboxModifier.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetSkyboxModifierFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetSkyboxModifier>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxModifierFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetSkyboxModifier> setSkyboxModifier = std::static_pointer_cast<SetSkyboxModifier>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetSkyboxModifierFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setSkyboxModifier = std::make_shared<SetSkyboxModifier>(initData);
|
||||
|
||||
ReadCommandId(setSkyboxModifier, reader);
|
||||
|
||||
setSkyboxModifier->modifier.skyboxDisabled = reader->ReadInt8();
|
||||
setSkyboxModifier->modifier.sunMoonDisabled = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setSkyboxModifier;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetSkyboxModifierFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetSkyboxSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetSkyboxSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetSkyboxSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSkyboxSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetSkyboxSettings> setSkyboxSettings = std::static_pointer_cast<SetSkyboxSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetSkyboxSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setSkyboxSettings = std::make_shared<SetSkyboxSettings>(initData);
|
||||
|
||||
ReadCommandId(setSkyboxSettings, reader);
|
||||
|
||||
@ -35,6 +13,7 @@ void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
setSkyboxSettings->settings.skyboxId = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.weather = reader->ReadInt8();
|
||||
setSkyboxSettings->settings.indoors = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setSkyboxSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetSkyboxSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,38 +2,17 @@
|
||||
#include "soh/resource/type/scenecommand/SetSoundSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetSoundSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetSoundSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSoundSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetSoundSettings> setSoundSettings = std::static_pointer_cast<SetSoundSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetSoundSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setSoundSettings = std::make_shared<SetSoundSettings>(initData);
|
||||
|
||||
ReadCommandId(setSoundSettings, reader);
|
||||
|
||||
setSoundSettings->settings.reverb = reader->ReadInt8();
|
||||
setSoundSettings->settings.natureAmbienceId = reader->ReadInt8();
|
||||
setSoundSettings->settings.seqId = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setSoundSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetSoundSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,37 +2,16 @@
|
||||
#include "soh/resource/type/scenecommand/SetSpecialObjects.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetSpecialObjectsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetSpecialObjects>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetSpecialObjectsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr){
|
||||
SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetSpecialObjects> setSpecialObjects = std::static_pointer_cast<SetSpecialObjects>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetSpecialObjectsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setSpecialObjects = std::make_shared<SetSpecialObjects>(initData);
|
||||
|
||||
ReadCommandId(setSpecialObjects, reader);
|
||||
|
||||
setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8();
|
||||
setSpecialObjects->specialObjects.globalObject = reader->ReadInt16();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setSpecialObjects;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetSpecialObjectsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,54 +2,30 @@
|
||||
#include "soh/resource/type/scenecommand/SetStartPositionList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetStartPositionListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetStartPositionList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion)
|
||||
{
|
||||
case 0:
|
||||
factory = std::make_shared<SetStartPositionListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<SetStartPositionList> setStartPositionList = std::static_pointer_cast<SetStartPositionList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetStartPositionListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setStartPositionList = std::make_shared<SetStartPositionList>(initData);
|
||||
|
||||
ReadCommandId(setStartPositionList, reader);
|
||||
|
||||
setStartPositionList->numStartPositions = reader->ReadUInt32();
|
||||
setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions);
|
||||
for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) {
|
||||
ActorEntry entry;
|
||||
ActorEntry entry;
|
||||
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
entry.id = reader->ReadUInt16();
|
||||
entry.pos.x = reader->ReadInt16();
|
||||
entry.pos.y = reader->ReadInt16();
|
||||
entry.pos.z = reader->ReadInt16();
|
||||
entry.rot.x = reader->ReadInt16();
|
||||
entry.rot.y = reader->ReadInt16();
|
||||
entry.rot.z = reader->ReadInt16();
|
||||
entry.params = reader->ReadUInt16();
|
||||
|
||||
setStartPositionList->startPositions.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setStartPositionList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetStartPositionListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,38 +2,17 @@
|
||||
#include "soh/resource/type/scenecommand/SetTimeSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetTimeSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetTimeSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetTimeSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetTimeSettings> setTimeSettings = std::static_pointer_cast<SetTimeSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetTimeSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setTimeSettings = std::make_shared<SetTimeSettings>(initData);
|
||||
|
||||
ReadCommandId(setTimeSettings, reader);
|
||||
|
||||
setTimeSettings->settings.hour = reader->ReadInt8();
|
||||
setTimeSettings->settings.minute = reader->ReadInt8();
|
||||
setTimeSettings->settings.timeIncrement = reader->ReadInt8();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setTimeSettings;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetTimeSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,33 +2,11 @@
|
||||
#include "soh/resource/type/scenecommand/SetTransitionActorList.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource> SetTransitionActorListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||
std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetTransitionActorList>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetTransitionActorListFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetTransitionActorList> setTransitionActorList = std::static_pointer_cast<SetTransitionActorList>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList);
|
||||
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> SetTransitionActorListFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData,
|
||||
std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setTransitionActorList = std::make_shared<SetTransitionActorList>(initData);
|
||||
|
||||
ReadCommandId(setTransitionActorList, reader);
|
||||
|
||||
setTransitionActorList->numTransitionActors = reader->ReadUInt32();
|
||||
@ -49,6 +27,7 @@ void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr<Binar
|
||||
|
||||
setTransitionActorList->transitionActorList.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setTransitionActorList;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetTransitionActorListFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,32 +2,10 @@
|
||||
#include "soh/resource/type/scenecommand/SetWindSettings.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
SetWindSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<SetWindSettings>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<SetWindSettingsFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<SetWindSettings> setWind = std::static_pointer_cast<SetWindSettings>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, setWind);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
SetWindSettingsFactory::ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) {
|
||||
auto setWind = std::make_shared<SetWindSettings>(initData);
|
||||
|
||||
ReadCommandId(setWind, reader);
|
||||
|
||||
@ -35,6 +13,7 @@ void LUS::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
|
||||
setWind->settings.windVertical = reader->ReadInt8();
|
||||
setWind->settings.windSouth = reader->ReadInt8();
|
||||
setWind->settings.windSpeed = reader->ReadUByte();
|
||||
}
|
||||
|
||||
} // namespace LUS
|
||||
return setWind;
|
||||
}
|
||||
} // namespace SOH
|
||||
|
@ -2,15 +2,10 @@
|
||||
|
||||
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
|
||||
|
||||
namespace LUS {
|
||||
class SetWindSettingsFactory : public SceneCommandFactory {
|
||||
namespace SOH {
|
||||
class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 {
|
||||
public:
|
||||
std::shared_ptr<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ReadResource(std::shared_ptr<LUS::ResourceInitData> initData, std::shared_ptr<LUS::BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Animation.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
AnimationData* Animation::GetPointer() {
|
||||
return &animationData;
|
||||
}
|
||||
@ -18,4 +18,4 @@ size_t Animation::GetPointerSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -3,85 +3,85 @@
|
||||
#include "Resource.h"
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
namespace LUS {
|
||||
enum class AnimationType {
|
||||
Normal = 0,
|
||||
Link = 1,
|
||||
Curve = 2,
|
||||
Legacy = 3,
|
||||
};
|
||||
namespace SOH {
|
||||
enum class AnimationType {
|
||||
Normal = 0,
|
||||
Link = 1,
|
||||
Curve = 2,
|
||||
Legacy = 3,
|
||||
};
|
||||
|
||||
struct RotationIndex {
|
||||
uint16_t x, y, z;
|
||||
struct RotationIndex {
|
||||
uint16_t x, y, z;
|
||||
|
||||
RotationIndex(uint16_t nX, uint16_t nY, uint16_t nZ) : x(nX), y(nY), z(nZ) {
|
||||
}
|
||||
};
|
||||
RotationIndex(uint16_t nX, uint16_t nY, uint16_t nZ) : x(nX), y(nY), z(nZ) {
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u16 unk_00; // appears to be flags
|
||||
/* 0x0002 */ s16 unk_02;
|
||||
/* 0x0004 */ s16 unk_04;
|
||||
/* 0x0006 */ s16 unk_06;
|
||||
/* 0x0008 */ f32 unk_08;
|
||||
} TransformData; // size = 0xC
|
||||
typedef struct {
|
||||
/* 0x0000 */ u16 unk_00; // appears to be flags
|
||||
/* 0x0002 */ s16 unk_02;
|
||||
/* 0x0004 */ s16 unk_04;
|
||||
/* 0x0006 */ s16 unk_06;
|
||||
/* 0x0008 */ f32 unk_08;
|
||||
} TransformData; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8* refIndex;
|
||||
/* 0x0004 */ TransformData* transformData;
|
||||
/* 0x0008 */ s16* copyValues;
|
||||
/* 0x000C */ s16 unk_0C;
|
||||
/* 0x000E */ s16 unk_0E;
|
||||
} TransformUpdateIndex; // size = 0x10
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8* refIndex;
|
||||
/* 0x0004 */ TransformData* transformData;
|
||||
/* 0x0008 */ s16* copyValues;
|
||||
/* 0x000C */ s16 unk_0C;
|
||||
/* 0x000E */ s16 unk_0E;
|
||||
} TransformUpdateIndex; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 frameCount;
|
||||
} AnimationHeaderCommon;
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 frameCount;
|
||||
} AnimationHeaderCommon;
|
||||
|
||||
// Index into the frame data table.
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 x;
|
||||
/* 0x02 */ u16 y;
|
||||
/* 0x04 */ u16 z;
|
||||
} JointIndex; // size = 0x06
|
||||
// Index into the frame data table.
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 x;
|
||||
/* 0x02 */ u16 y;
|
||||
/* 0x04 */ u16 z;
|
||||
} JointIndex; // size = 0x06
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AnimationHeaderCommon common;
|
||||
/* 0x04 */ s16* frameData; // "tbl"
|
||||
/* 0x08 */ JointIndex* jointIndices; // "ref_tbl"
|
||||
/* 0x0C */ u16 staticIndexMax;
|
||||
} AnimationHeader; // size = 0x10
|
||||
typedef struct {
|
||||
/* 0x00 */ AnimationHeaderCommon common;
|
||||
/* 0x04 */ s16* frameData; // "tbl"
|
||||
/* 0x08 */ JointIndex* jointIndices; // "ref_tbl"
|
||||
/* 0x0C */ u16 staticIndexMax;
|
||||
} AnimationHeader; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AnimationHeaderCommon common;
|
||||
/* 0x04 */ void* segment;
|
||||
} LinkAnimationHeader; // size = 0x8
|
||||
typedef struct {
|
||||
/* 0x00 */ AnimationHeaderCommon common;
|
||||
/* 0x04 */ void* segment;
|
||||
} LinkAnimationHeader; // size = 0x8
|
||||
|
||||
union AnimationData {
|
||||
AnimationHeader animationHeader;
|
||||
LinkAnimationHeader linkAnimationHeader;
|
||||
TransformUpdateIndex transformUpdateIndex;
|
||||
};
|
||||
union AnimationData {
|
||||
AnimationHeader animationHeader;
|
||||
LinkAnimationHeader linkAnimationHeader;
|
||||
TransformUpdateIndex transformUpdateIndex;
|
||||
};
|
||||
|
||||
class Animation : public Resource<AnimationData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
class Animation : public LUS::Resource<AnimationData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Animation() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
Animation() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
AnimationData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
AnimationData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
AnimationType type;
|
||||
AnimationData animationData;
|
||||
AnimationType type;
|
||||
AnimationData animationData;
|
||||
|
||||
// NORMAL
|
||||
std::vector<uint16_t> rotationValues;
|
||||
std::vector<RotationIndex> rotationIndices;
|
||||
// NORMAL
|
||||
std::vector<uint16_t> rotationValues;
|
||||
std::vector<RotationIndex> rotationIndices;
|
||||
|
||||
// CURVE
|
||||
std::vector<uint8_t> refIndexArr;
|
||||
std::vector<TransformData> transformDataArr;
|
||||
std::vector<int16_t> copyValuesArr;
|
||||
};
|
||||
}; // namespace LUS
|
||||
// CURVE
|
||||
std::vector<uint8_t> refIndexArr;
|
||||
std::vector<TransformData> transformDataArr;
|
||||
std::vector<int16_t> copyValuesArr;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "AudioSample.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
Sample* AudioSample::GetPointer() {
|
||||
return &sample;
|
||||
}
|
||||
@ -8,4 +8,4 @@ Sample* AudioSample::GetPointer() {
|
||||
size_t AudioSample::GetPointerSize() {
|
||||
return sizeof(Sample);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -5,7 +5,7 @@
|
||||
#include "Resource.h"
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
typedef struct {
|
||||
/* 0x00 */ uintptr_t start;
|
||||
/* 0x04 */ uintptr_t end;
|
||||
@ -39,11 +39,11 @@ namespace LUS {
|
||||
s32 sampleRate; // For wav samples only...
|
||||
} Sample; // size = 0x10
|
||||
|
||||
class AudioSample : public Resource<Sample> {
|
||||
class AudioSample : public LUS::Resource<Sample> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
AudioSample() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
AudioSample() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
Sample* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "AudioSequence.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
Sequence* AudioSequence::GetPointer() {
|
||||
return &sequence;
|
||||
@ -9,4 +9,4 @@ Sequence* AudioSequence::GetPointer() {
|
||||
size_t AudioSequence::GetPointerSize() {
|
||||
return sizeof(Sequence);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "Resource.h"
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
typedef struct {
|
||||
char* seqData;
|
||||
@ -17,11 +17,11 @@ typedef struct {
|
||||
uint8_t fonts[16];
|
||||
} Sequence;
|
||||
|
||||
class AudioSequence : public Resource<Sequence> {
|
||||
class AudioSequence : public LUS::Resource<Sequence> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
AudioSequence() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
AudioSequence() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
Sequence* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "AudioSoundFont.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
SoundFont* AudioSoundFont::GetPointer() {
|
||||
return &soundFont;
|
||||
}
|
||||
@ -8,4 +8,4 @@ SoundFont* AudioSoundFont::GetPointer() {
|
||||
size_t AudioSoundFont::GetPointerSize() {
|
||||
return sizeof(SoundFont);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "soh/resource/type/AudioSample.h"
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 delay;
|
||||
@ -52,11 +52,11 @@ typedef struct {
|
||||
s32 fntIndex;
|
||||
} SoundFont; // size = 0x14
|
||||
|
||||
class AudioSoundFont : public Resource<SoundFont> {
|
||||
class AudioSoundFont : public LUS::Resource<SoundFont> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
AudioSoundFont() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
AudioSoundFont() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
SoundFont* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Background.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
uint8_t* Background::GetPointer() {
|
||||
return Data.data();
|
||||
}
|
||||
@ -8,4 +8,4 @@ uint8_t* Background::GetPointer() {
|
||||
size_t Background::GetPointerSize() {
|
||||
return Data.size() * sizeof(uint8_t);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
#include "resource/Resource.h"
|
||||
|
||||
namespace LUS {
|
||||
class Background : public Resource<uint8_t> {
|
||||
namespace SOH {
|
||||
class Background : public LUS::Resource<uint8_t> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Background() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
Background() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
uint8_t* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "CollisionHeader.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
CollisionHeaderData* CollisionHeader::GetPointer() {
|
||||
return &collisionHeaderData;
|
||||
}
|
||||
@ -8,4 +8,4 @@ CollisionHeaderData* CollisionHeader::GetPointer() {
|
||||
size_t CollisionHeader::GetPointerSize() {
|
||||
return sizeof(collisionHeaderData);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -6,7 +6,7 @@
|
||||
#include <libultraship/libultra.h>
|
||||
#include "z64math.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 type;
|
||||
@ -67,11 +67,11 @@ typedef struct {
|
||||
size_t cameraDataListLen; // OTRTODO: Added to allow for bounds checking the cameraDataList.
|
||||
} CollisionHeaderData; // original name: BGDataInfo
|
||||
|
||||
class CollisionHeader : public Resource<CollisionHeaderData> {
|
||||
class CollisionHeader : public LUS::Resource<CollisionHeaderData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
CollisionHeader() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
CollisionHeader() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
CollisionHeaderData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "Cutscene.h"
|
||||
#include <libultraship/libultra/gbi.h>
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
uint32_t* Cutscene::GetPointer() {
|
||||
return commands.data();
|
||||
}
|
||||
@ -9,4 +9,4 @@ uint32_t* Cutscene::GetPointer() {
|
||||
size_t Cutscene::GetPointerSize() {
|
||||
return commands.size() * sizeof(uint32_t);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -7,7 +7,7 @@
|
||||
#include "Vec3f.h"
|
||||
#include "Color3b.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
enum class CutsceneCommands {
|
||||
Cmd00 = 0x0000,
|
||||
@ -44,11 +44,11 @@ enum class CutsceneCommands {
|
||||
Error = 0xFEAF,
|
||||
};
|
||||
|
||||
class Cutscene : public Resource<uint32_t> {
|
||||
class Cutscene : public LUS::Resource<uint32_t> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Cutscene() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
Cutscene() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
uint32_t* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
@ -57,7 +57,7 @@ class Cutscene : public Resource<uint32_t> {
|
||||
uint32_t endFrame;
|
||||
std::vector<uint32_t> commands;
|
||||
};
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
|
||||
/////////////
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Path.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
PathData* Path::GetPointer() {
|
||||
return pathData.data();
|
||||
}
|
||||
@ -8,4 +8,4 @@ PathData* Path::GetPointer() {
|
||||
size_t Path::GetPointerSize() {
|
||||
return pathData.size() * sizeof(PathData);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -6,18 +6,18 @@
|
||||
#include <libultraship/libultra/types.h>
|
||||
#include "z64math.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 count; // number of points in the path
|
||||
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
|
||||
} PathData; // size = 0x8
|
||||
|
||||
class Path : public Resource<PathData> {
|
||||
class Path : public LUS::Resource<PathData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Path() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
Path() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
PathData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "PlayerAnimation.h"
|
||||
#include <libultraship/libultra/gbi.h>
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
int16_t* PlayerAnimation::GetPointer() {
|
||||
return limbRotData.data();
|
||||
}
|
||||
@ -9,4 +9,4 @@ int16_t* PlayerAnimation::GetPointer() {
|
||||
size_t PlayerAnimation::GetPointerSize() {
|
||||
return limbRotData.size() * sizeof(int16_t);
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
@ -7,17 +7,16 @@
|
||||
#include "Vec3f.h"
|
||||
#include "Color3b.h"
|
||||
|
||||
namespace LUS {
|
||||
|
||||
class PlayerAnimation : public Resource<int16_t> {
|
||||
namespace SOH {
|
||||
class PlayerAnimation : public LUS::Resource<int16_t> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
PlayerAnimation() : Resource(std::shared_ptr<ResourceInitData>()) {}
|
||||
PlayerAnimation() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
|
||||
int16_t* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
||||
std::vector<int16_t> limbRotData;
|
||||
};
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
@ -1,6 +1,6 @@
|
||||
#include "Scene.h"
|
||||
|
||||
namespace LUS {
|
||||
namespace SOH {
|
||||
void* Scene::GetPointer() {
|
||||
// Scene is a special type that requries C++ processing. As such, we return nothing.
|
||||
return nullptr;
|
||||
@ -9,4 +9,4 @@ void* Scene::GetPointer() {
|
||||
size_t Scene::GetPointerSize() {
|
||||
return 0;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user