[olympic] Change readClaw to take ref to TypeStore

This commit is contained in:
Gary Talent 2023-12-14 23:56:14 -06:00
parent 8b3b8d50d6
commit 4b824ddef4
5 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ ox::Result<T> readAsset(const ox::Buffer &buff) noexcept {
return ox::readClaw<T>(buff.data() + offset, buff.size() - offset);
}
ox::Result<ox::ModelObject> readAsset(ox::TypeStore *ts, const ox::Buffer &buff) noexcept;
ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, const ox::Buffer &buff) noexcept;
struct AssetHdr {
ox::UUID uuid;

View File

@ -89,7 +89,7 @@ ox::Error preloadObj(
ox::CRStringView path) noexcept {
// load file
oxRequireM(buff, romFs.read(path));
oxRequireM(obj, keel::readAsset(&ts, buff));
oxRequireM(obj, keel::readAsset(ts, buff));
if (obj.type()->preloadable) {
oxOutf("preloading {}\n", path);
// preload

View File

@ -21,7 +21,7 @@ ox::Result<ox::UUID> readUuidHeader(const char *buff, std::size_t buffLen) noexc
return ox::UUID::fromString(ox::StringView(buff + k1Hdr.bytes(), 36));
}
ox::Result<ox::ModelObject> readAsset(ox::TypeStore *ts, ox::Buffer const&buff) noexcept {
ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, ox::Buffer const&buff) noexcept {
std::size_t offset = 0;
if (!readUuidHeader(buff).error) {
offset = K1HdrSz;

View File

@ -95,7 +95,7 @@ static ox::Error doTransformations(
oxRequireM(buff, dest.read(s.inode));
oxReturnError(keel::performPackTransforms(ctx, buff));
// transform FileAddresses
oxRequireM(obj, keel::readAsset(&ts, buff));
oxRequireM(obj, keel::readAsset(ts, buff));
oxReturnError(transformFileAddressesObj(ctx, dest, obj));
oxReturnError(ox::writeClaw(obj).moveTo(buff));
// write file to dest

View File

@ -133,7 +133,7 @@ template<typename T>
ox::Result<T> Project::loadObj(ox::CRStringView path) const noexcept {
oxRequire(buff, loadBuff(path));
if constexpr(ox::is_same_v<T, ox::ModelObject>) {
return keel::readAsset(&m_typeStore, buff);
return keel::readAsset(m_typeStore, buff);
} else {
return keel::readAsset<T>(buff);
}