Files
ox/src/nostalgia/core/module.cpp
T

42 lines
1.1 KiB
C++

/*
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/model/model.hpp>
#include <nostalgia/foundation/module.hpp>
#include "gfx.hpp"
#include "typeconv.hpp"
#include "module.hpp"
namespace nostalgia::core {
CoreModule CoreModule::mod;
ox::Vector<foundation::BaseConverter*> CoreModule::converters() const noexcept {
return {
&nostalgiaPaletteToPaletteConverter,
&nostalgiaGraphicToTileSheetConverter,
&tileSheetToCompactTileSheetConverter,
};
}
ox::Vector<foundation::PackTransform> CoreModule::packTransforms() const noexcept {
return {
// convert tilesheets to CompactTileSheets
[](foundation::Context *ctx, ox::Buffer *buff) -> ox::Error {
oxRequire(hdr, ox::readClawHeader(*buff));
const auto typeId = ox::buildTypeId(hdr.typeName, hdr.typeVersion);
if (typeId == ox::buildTypeId<TileSheet>() ||
typeId == ox::buildTypeId<NostalgiaGraphic>()) {
oxReturnError(foundation::convertBuffToBuff<core::CompactTileSheet>(ctx, *buff, ox::ClawFormat::Metal).moveTo(buff));
}
return {};
},
};
}
}