[olympic] Change readClaw to take ref to TypeStore
This commit is contained in:
parent
8b3b8d50d6
commit
4b824ddef4
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user