[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);
|
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 {
|
struct AssetHdr {
|
||||||
ox::UUID uuid;
|
ox::UUID uuid;
|
||||||
|
@ -89,7 +89,7 @@ ox::Error preloadObj(
|
|||||||
ox::CRStringView path) noexcept {
|
ox::CRStringView path) noexcept {
|
||||||
// load file
|
// load file
|
||||||
oxRequireM(buff, romFs.read(path));
|
oxRequireM(buff, romFs.read(path));
|
||||||
oxRequireM(obj, keel::readAsset(&ts, buff));
|
oxRequireM(obj, keel::readAsset(ts, buff));
|
||||||
if (obj.type()->preloadable) {
|
if (obj.type()->preloadable) {
|
||||||
oxOutf("preloading {}\n", path);
|
oxOutf("preloading {}\n", path);
|
||||||
// preload
|
// 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));
|
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;
|
std::size_t offset = 0;
|
||||||
if (!readUuidHeader(buff).error) {
|
if (!readUuidHeader(buff).error) {
|
||||||
offset = K1HdrSz;
|
offset = K1HdrSz;
|
||||||
|
@ -95,7 +95,7 @@ static ox::Error doTransformations(
|
|||||||
oxRequireM(buff, dest.read(s.inode));
|
oxRequireM(buff, dest.read(s.inode));
|
||||||
oxReturnError(keel::performPackTransforms(ctx, buff));
|
oxReturnError(keel::performPackTransforms(ctx, buff));
|
||||||
// transform FileAddresses
|
// transform FileAddresses
|
||||||
oxRequireM(obj, keel::readAsset(&ts, buff));
|
oxRequireM(obj, keel::readAsset(ts, buff));
|
||||||
oxReturnError(transformFileAddressesObj(ctx, dest, obj));
|
oxReturnError(transformFileAddressesObj(ctx, dest, obj));
|
||||||
oxReturnError(ox::writeClaw(obj).moveTo(buff));
|
oxReturnError(ox::writeClaw(obj).moveTo(buff));
|
||||||
// write file to dest
|
// write file to dest
|
||||||
|
@ -133,7 +133,7 @@ template<typename T>
|
|||||||
ox::Result<T> Project::loadObj(ox::CRStringView path) const noexcept {
|
ox::Result<T> Project::loadObj(ox::CRStringView path) const noexcept {
|
||||||
oxRequire(buff, loadBuff(path));
|
oxRequire(buff, loadBuff(path));
|
||||||
if constexpr(ox::is_same_v<T, ox::ModelObject>) {
|
if constexpr(ox::is_same_v<T, ox::ModelObject>) {
|
||||||
return keel::readAsset(&m_typeStore, buff);
|
return keel::readAsset(m_typeStore, buff);
|
||||||
} else {
|
} else {
|
||||||
return keel::readAsset<T>(buff);
|
return keel::readAsset<T>(buff);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user