[keel] Fix UUID to path lookups to fail properly
This commit is contained in:
parent
348193ae9e
commit
3f83a254d2
@ -37,10 +37,6 @@ void unloadRom(char *rom) noexcept {
|
|||||||
ox::safeDelete(rom);
|
ox::safeDelete(rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<void*> findPreloadSection() noexcept {
|
|
||||||
return OxError(1, "findPreloadSection is unsupported on this platform");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clearUuidMap(Context &ctx) noexcept {
|
static void clearUuidMap(Context &ctx) noexcept {
|
||||||
ctx.uuidToPath.clear();
|
ctx.uuidToPath.clear();
|
||||||
ctx.pathToUuid.clear();
|
ctx.pathToUuid.clear();
|
||||||
@ -48,7 +44,7 @@ static void clearUuidMap(Context &ctx) noexcept {
|
|||||||
|
|
||||||
void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uuid) noexcept {
|
void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uuid) noexcept {
|
||||||
ctx.pathToUuid[filePath] = uuid;
|
ctx.pathToUuid[filePath] = uuid;
|
||||||
ctx.uuidToPath[uuid.toString()] = std::move(filePath);
|
ctx.uuidToPath[uuid.toString()] = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ox::Error buildUuidMap(Context &ctx, ox::CRStringView path) noexcept {
|
static ox::Error buildUuidMap(Context &ctx, ox::CRStringView path) noexcept {
|
||||||
@ -80,7 +76,8 @@ ox::Error buildUuidMap(Context &ctx) noexcept {
|
|||||||
|
|
||||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::CRStringView path) noexcept {
|
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::CRStringView path) noexcept {
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
return ctx.pathToUuid[path];
|
oxRequire(out, ctx.pathToUuid.at(path));
|
||||||
|
return *out;
|
||||||
#else
|
#else
|
||||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||||
#endif
|
#endif
|
||||||
@ -88,7 +85,8 @@ ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::CRStringView path) noexcept {
|
|||||||
|
|
||||||
ox::Result<ox::String> uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept {
|
ox::Result<ox::String> uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept {
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
return ctx.uuidToPath[uuid];
|
oxRequire(out, ctx.uuidToPath.at(uuid));
|
||||||
|
return *out;
|
||||||
#else
|
#else
|
||||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||||
#endif
|
#endif
|
||||||
@ -96,7 +94,8 @@ ox::Result<ox::String> uuidToPath(Context &ctx, ox::CRStringView uuid) noexcept
|
|||||||
|
|
||||||
ox::Result<ox::String> uuidToPath(Context &ctx, ox::UUID const&uuid) noexcept {
|
ox::Result<ox::String> uuidToPath(Context &ctx, ox::UUID const&uuid) noexcept {
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
return ctx.uuidToPath[uuid.toString()];
|
oxRequire(out, ctx.uuidToPath.at(uuid.toString()));
|
||||||
|
return *out;
|
||||||
#else
|
#else
|
||||||
return OxError(1, "UUID to path conversion not supported on this platform");
|
return OxError(1, "UUID to path conversion not supported on this platform");
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,14 +50,12 @@ ox::Result<keel::AssetRef<T>> readObjFile(
|
|||||||
return std::move(obj);
|
return std::move(obj);
|
||||||
};
|
};
|
||||||
ox::StringView path;
|
ox::StringView path;
|
||||||
ox::UUIDStr uuidStr;
|
|
||||||
if (beginsWith(assetId, "uuid://")) {
|
if (beginsWith(assetId, "uuid://")) {
|
||||||
assetId = substr(assetId, 7);
|
assetId = substr(assetId, 7);
|
||||||
path = ctx.uuidToPath[assetId];
|
oxRequire(p, ctx.uuidToPath.at(assetId));
|
||||||
|
path = *p;
|
||||||
} else {
|
} else {
|
||||||
path = assetId;
|
path = assetId;
|
||||||
uuidStr = ctx.pathToUuid[path].toString();
|
|
||||||
assetId = uuidStr;
|
|
||||||
}
|
}
|
||||||
if (forceLoad) {
|
if (forceLoad) {
|
||||||
oxRequire(buff, ctx.rom->read(path));
|
oxRequire(buff, ctx.rom->read(path));
|
||||||
|
Loading…
Reference in New Issue
Block a user