diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index 6b25589c6..6a1393ebd 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -354,7 +354,7 @@ void InputViewer::DrawElement() { } InputViewerSettingsWindow::~InputViewerSettingsWindow() { - SPDLOG_TRACE("destruct input viewer settings window"); + // SPDLOG_TRACE("destruct input viewer settings window"); } void InputViewerSettingsWindow::DrawElement() { diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index ff78fd0ab..143df2fb9 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -1037,7 +1037,7 @@ void InitTTSBank() { break; } - auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/scenes" + languageSuffix); + auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix); if (sceneFile != nullptr) { sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true); } diff --git a/soh/soh/resource/importer/RawJsonFactory.cpp b/soh/soh/resource/importer/RawJsonFactory.cpp new file mode 100644 index 000000000..b1c79167a --- /dev/null +++ b/soh/soh/resource/importer/RawJsonFactory.cpp @@ -0,0 +1,24 @@ +#include "resource/factory/BlobFactory.h" +#include "resource/type/Blob.h" +#include "spdlog/spdlog.h" + +namespace LUS { +std::shared_ptr ResourceFactoryBinaryBlobV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto blob = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); + + uint32_t dataSize = reader->ReadUInt32(); + + blob->Data.reserve(dataSize); + + for (uint32_t i = 0; i < dataSize; i++) { + blob->Data.push_back(reader->ReadUByte()); + } + + return blob; +} +} // namespace LUS diff --git a/soh/soh/resource/importer/RawJsonFactory.h b/soh/soh/resource/importer/RawJsonFactory.h new file mode 100644 index 000000000..38295858d --- /dev/null +++ b/soh/soh/resource/importer/RawJsonFactory.h @@ -0,0 +1,11 @@ +#pragma once + +#include "resource/Resource.h" +#include "resource/ResourceFactoryBinary.h" + +namespace LUS { +class ResourceFactoryBinaryBlobV0 : public ResourceFactoryBinary { + public: + std::shared_ptr ReadResource(std::shared_ptr file) override; +}; +}; // namespace LUS diff --git a/soh/soh/resource/type/RawJson.cpp b/soh/soh/resource/type/RawJson.cpp new file mode 100644 index 000000000..619c6231a --- /dev/null +++ b/soh/soh/resource/type/RawJson.cpp @@ -0,0 +1,14 @@ +#include "Blob.h" + +namespace LUS { +Blob::Blob() : Resource(std::shared_ptr()) { +} + +void* Blob::GetPointer() { + return Data.data(); +} + +size_t Blob::GetPointerSize() { + return Data.size() * sizeof(uint8_t); +} +} // namespace LUS diff --git a/soh/soh/resource/type/RawJson.h b/soh/soh/resource/type/RawJson.h new file mode 100644 index 000000000..54622af47 --- /dev/null +++ b/soh/soh/resource/type/RawJson.h @@ -0,0 +1,17 @@ +#pragma once + +#include "Resource.h" + +namespace SOH { +class RawJson : public LUS::Resource { + public: + using Resource::Resource; + + RawJson(); + + void* GetPointer() override; + size_t GetPointerSize() override; + + std::vector Data; +}; +}; // namespace LUS