[keel,nostalgia,turbine] Cleanup

This commit is contained in:
2023-11-23 01:46:11 -06:00
parent a84a829769
commit b946e428ad
30 changed files with 120 additions and 122 deletions

View File

@@ -17,7 +17,6 @@ target_link_libraries(
OxFS
OxModel
OxPreloader
OxStd
)
install(
@@ -45,4 +44,4 @@ install(
if(TURBINE_BUILD_TYPE STREQUAL "Native")
add_subdirectory(test)
endif()
endif()

View File

@@ -56,20 +56,24 @@ ox::Result<keel::AssetRef<T>> readObjFile(
path = ctx->uuidToPath[assetId];
} else {
path = assetId;
uuidStr = ctx->pathToUuid[path].toString();
// Warning: StringView to String
uuidStr = ctx->pathToUuid[ox::String(path)].toString();
assetId = uuidStr;
}
if (forceLoad) {
oxRequire(buff, ctx->rom->read(path));
oxRequire(obj, readConvert(ctx, buff));
oxRequire(cached, ctx->assetManager.setAsset(assetId, obj));
// Warning: StringView to String
oxRequire(cached, ctx->assetManager.setAsset(ox::String(assetId), obj));
return cached;
} else {
auto [cached, err] = ctx->assetManager.getAsset<T>(assetId);
// Warning: StringView to String
auto [cached, err] = ctx->assetManager.getAsset<T>(ox::String(assetId));
if (err) {
oxRequire(buff, ctx->rom->read(path));
oxRequire(obj, readConvert(ctx, buff));
oxReturnError(ctx->assetManager.setAsset(assetId, obj).moveTo(&cached));
// Warning: StringView to String
oxReturnError(ctx->assetManager.setAsset(ox::String(assetId), obj).moveTo(&cached));
}
return cached;
}
@@ -103,12 +107,14 @@ ox::Result<AssetRef<T>> setAsset(keel::Context *ctx, ox::StringView assetId, T c
}
ox::UUIDStr idStr;
if (assetId[0] == '/') {
const auto [id, err] = ctx->pathToUuid.at(assetId);
// Warning: StringView to String
const auto [id, err] = ctx->pathToUuid.at(ox::String(assetId));
oxReturnError(err);
idStr = id->toString();
assetId = idStr;
}
return ctx->assetManager.setAsset(assetId, asset);
// Warning: StringView to String
return ctx->assetManager.setAsset(ox::String(assetId), asset);
#else
return OxError(1, "Not supported on this platform");
#endif