[keel] Make keel attempt to delete all existing assets when FS is changed
This commit is contained in:
@@ -25,12 +25,11 @@ ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const&uuid) noexce
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Result<T> readAsset(ox::BufferView buff) noexcept {
|
ox::Result<T> readAsset(ox::BufferView buff) noexcept {
|
||||||
std::size_t offset = 0;
|
|
||||||
auto const err = readUuidHeader(buff).error;
|
auto const err = readUuidHeader(buff).error;
|
||||||
if (!err) {
|
if (!err) {
|
||||||
offset = K1HdrSz; // the size of K1 headers
|
buff += K1HdrSz; // the size of K1 headers
|
||||||
}
|
}
|
||||||
auto out = ox::readClaw<T>(buff + offset);
|
auto out = ox::readClaw<T>(buff);
|
||||||
OX_RETURN_ERROR(out);
|
OX_RETURN_ERROR(out);
|
||||||
OX_RETURN_ERROR(ensureValid(out.value));
|
OX_RETURN_ERROR(ensureValid(out.value));
|
||||||
return out;
|
return out;
|
||||||
|
@@ -261,6 +261,9 @@ namespace keel {
|
|||||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs, DuplicateSet &duplicateSet) noexcept {
|
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs, DuplicateSet &duplicateSet) noexcept {
|
||||||
ctx.rom = std::move(fs);
|
ctx.rom = std::move(fs);
|
||||||
clearUuidMap(ctx);
|
clearUuidMap(ctx);
|
||||||
|
#ifndef OX_BARE_METAL
|
||||||
|
ctx.assetManager.gc();
|
||||||
|
#endif
|
||||||
return buildUuidMap(ctx, &duplicateSet);
|
return buildUuidMap(ctx, &duplicateSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user