Fixed importers

This commit is contained in:
KiritoDv 2025-03-16 17:16:24 -06:00
parent baabd2457e
commit c062a87e98
44 changed files with 121 additions and 77 deletions

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryAnimV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryAnimV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryColPolyV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryColPolyV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -6,8 +6,9 @@
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryEnvSettingsV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryEnvSettingsV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryGenericArrayV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryGenericArrayV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryHitboxV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryHitboxV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -7,8 +7,9 @@
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryLimbV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryLimbV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryMessageV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryMessageV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -5,8 +5,9 @@
#include "ResourceUtil.h" #include "ResourceUtil.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryMessageLookupV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryMessageLookupV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -6,8 +6,9 @@
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryObjectInitV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryObjectInitV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -4,8 +4,9 @@
#include "ResourceUtil.h" #include "ResourceUtil.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryScriptCMDV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryScriptCMDV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -4,8 +4,9 @@
#include "ResourceUtil.h" #include "ResourceUtil.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryScriptV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryScriptV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -5,8 +5,9 @@
#include "ResourceUtil.h" #include "ResourceUtil.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinarySkeletonV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinarySkeletonV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3fV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3fV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryVec3fV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryVec3fV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3sV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3sV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryVec3sV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryVec3sV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "../ResourceUtil.h" #include "../ResourceUtil.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAudioTableV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAudioTableV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryAudioTableV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryAudioTableV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -2,8 +2,9 @@
#include "port/resource/type/audio/AdpcmBook.h" #include "port/resource/type/audio/AdpcmBook.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAdpcmBookV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAdpcmBookV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryAdpcmBookV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryAdpcmBookV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "port/resource/type/audio/Drum.h" #include "port/resource/type/audio/Drum.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryDrumV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryDrumV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryDrumV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryDrumV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -2,8 +2,9 @@
#include "port/resource/type/audio/Envelope.h" #include "port/resource/type/audio/Envelope.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvelopeV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvelopeV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryEnvelopeV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryEnvelopeV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -3,8 +3,9 @@
#include "port/resource/type/audio/Instrument.h" #include "port/resource/type/audio/Instrument.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryInstrumentV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryInstrumentV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryInstrumentV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryInstrumentV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -2,8 +2,9 @@
#include "port/resource/type/audio/AdpcmLoop.h" #include "port/resource/type/audio/AdpcmLoop.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAdpcmLoopV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAdpcmLoopV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }

View file

@ -6,6 +6,7 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinaryAdpcmLoopV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinaryAdpcmLoopV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
}; // namespace LUS }; // namespace LUS

View file

@ -11,8 +11,9 @@
#include "vorbis/vorbisfile.h" #include "vorbis/vorbisfile.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySampleV1::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinarySampleV1::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }
@ -142,14 +143,14 @@ static void OggDecoderWorker(std::shared_ptr<Sample> sample, std::shared_ptr<Shi
ov_clear(&vf); ov_clear(&vf);
} }
std::shared_ptr<Ship::IResource> ResourceFactoryXMLSampleV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryXMLSampleV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }
auto sample = std::make_shared<Sample>(file->InitData); auto sample = std::make_shared<Sample>(file->InitData);
auto child = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement(); auto child = std::get<std::shared_ptr<tinyxml2::XMLDocument>>(file->Reader)->FirstChildElement();
std::shared_ptr<Ship::ResourceInitData> initData = std::make_shared<Ship::ResourceInitData>();
const char* customFormatStr = child->Attribute("CustomFormat"); const char* customFormatStr = child->Attribute("CustomFormat");
memset(&sample->mSample, 0, sizeof(sample->mSample)); memset(&sample->mSample, 0, sizeof(sample->mSample));
sample->mSample.isRelocated = 0; sample->mSample.isRelocated = 0;
@ -190,10 +191,7 @@ std::shared_ptr<Ship::IResource> ResourceFactoryXMLSampleV0::ReadResource(std::s
sample->mSample.size = size; sample->mSample.size = size;
const char* path = child->Attribute("Path"); const char* path = child->Attribute("Path");
initData->Path = path; auto sampleFile = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
initData->IsCustom = false;
initData->ByteOrder = Ship::Endianness::Native;
auto sampleFile = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path, initData);
if (customFormatStr != nullptr) { if (customFormatStr != nullptr) {
// Compressed files can take a really long time to decode (~250ms per). // Compressed files can take a really long time to decode (~250ms per).
// This worked when we tested it (09/04/2024) (Works on my machine) // This worked when we tested it (09/04/2024) (Works on my machine)

View file

@ -13,12 +13,14 @@ struct OggFileData {
class ResourceFactoryBinarySampleV1 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinarySampleV1 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
class ResourceFactoryXMLSampleV0 : public Ship::ResourceFactoryXML { class ResourceFactoryXMLSampleV0 : public Ship::ResourceFactoryXML {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
private: private:
static uint8_t CodecStrToInt(const char* str, const char* file); static uint8_t CodecStrToInt(const char* str, const char* file);
static uint32_t MediumStrToInt(const char* str); static uint32_t MediumStrToInt(const char* str);

View file

@ -5,8 +5,9 @@
#include "port/resource/type/audio/SoundFont.h" #include "port/resource/type/audio/SoundFont.h"
namespace SF64 { namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySoundFontV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinarySoundFontV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }
@ -210,8 +211,9 @@ std::vector<EnvelopePointData> ResourceFactoryXMLSoundFontV0::ParseEnvelopes(Sou
return envelopes; return envelopes;
} }
std::shared_ptr<Ship::IResource> ResourceFactoryXMLSoundFontV0::ReadResource(std::shared_ptr<Ship::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryXMLSoundFontV0::ReadResource(std::shared_ptr<Ship::File> file,
if (!FileHasValidFormatAndReader(file)) { std::shared_ptr<Ship::ResourceInitData> initData) {
if (!FileHasValidFormatAndReader(file, initData)) {
return nullptr; return nullptr;
} }
auto audioSoundFont = std::make_shared<SoundFont>(file->InitData); auto audioSoundFont = std::make_shared<SoundFont>(file->InitData);

View file

@ -8,12 +8,14 @@
namespace SF64 { namespace SF64 {
class ResourceFactoryBinarySoundFontV0 : public Ship::ResourceFactoryBinary { class ResourceFactoryBinarySoundFontV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
}; };
class ResourceFactoryXMLSoundFontV0 : public Ship::ResourceFactoryXML { class ResourceFactoryXMLSoundFontV0 : public Ship::ResourceFactoryXML {
public: public:
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file,
std::shared_ptr<Ship::ResourceInitData> initData) override;
static int8_t MediumStrToInt(const char* str); static int8_t MediumStrToInt(const char* str);
static int8_t CachePolicyToInt(const char* str); static int8_t CachePolicyToInt(const char* str);