glorified stash

This commit is contained in:
briaguya 2024-02-21 00:39:45 -05:00
parent 65e85d1ced
commit 2ea32eae30
6 changed files with 68 additions and 2 deletions

View File

@ -354,7 +354,7 @@ void InputViewer::DrawElement() {
} }
InputViewerSettingsWindow::~InputViewerSettingsWindow() { InputViewerSettingsWindow::~InputViewerSettingsWindow() {
SPDLOG_TRACE("destruct input viewer settings window"); // SPDLOG_TRACE("destruct input viewer settings window");
} }
void InputViewerSettingsWindow::DrawElement() { void InputViewerSettingsWindow::DrawElement() {

View File

@ -1037,7 +1037,7 @@ void InitTTSBank() {
break; 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) { if (sceneFile != nullptr) {
sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true); sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true);
} }

View File

@ -0,0 +1,24 @@
#include "resource/factory/BlobFactory.h"
#include "resource/type/Blob.h"
#include "spdlog/spdlog.h"
namespace LUS {
std::shared_ptr<IResource> ResourceFactoryBinaryBlobV0::ReadResource(std::shared_ptr<File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto blob = std::make_shared<Blob>(file->InitData);
auto reader = std::get<std::shared_ptr<BinaryReader>>(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

View File

@ -0,0 +1,11 @@
#pragma once
#include "resource/Resource.h"
#include "resource/ResourceFactoryBinary.h"
namespace LUS {
class ResourceFactoryBinaryBlobV0 : public ResourceFactoryBinary {
public:
std::shared_ptr<IResource> ReadResource(std::shared_ptr<File> file) override;
};
}; // namespace LUS

View File

@ -0,0 +1,14 @@
#include "Blob.h"
namespace LUS {
Blob::Blob() : Resource(std::shared_ptr<ResourceInitData>()) {
}
void* Blob::GetPointer() {
return Data.data();
}
size_t Blob::GetPointerSize() {
return Data.size() * sizeof(uint8_t);
}
} // namespace LUS

View File

@ -0,0 +1,17 @@
#pragma once
#include "Resource.h"
namespace SOH {
class RawJson : public LUS::Resource<void> {
public:
using Resource::Resource;
RawJson();
void* GetPointer() override;
size_t GetPointerSize() override;
std::vector<uint8_t> Data;
};
}; // namespace LUS