[keel] Make keel attempt to delete all existing assets when FS is changed

This commit is contained in:
2025-07-30 00:36:56 -05:00
parent aacff3daf9
commit 07e5bf9054
2 changed files with 5 additions and 3 deletions

View File

@@ -25,12 +25,11 @@ ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const&uuid) noexce
template<typename T>
ox::Result<T> readAsset(ox::BufferView buff) noexcept {
std::size_t offset = 0;
auto const err = readUuidHeader(buff).error;
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(ensureValid(out.value));
return out;

View File

@@ -261,6 +261,9 @@ namespace keel {
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs, DuplicateSet &duplicateSet) noexcept {
ctx.rom = std::move(fs);
clearUuidMap(ctx);
#ifndef OX_BARE_METAL
ctx.assetManager.gc();
#endif
return buildUuidMap(ctx, &duplicateSet);
}