[keel] Cleanup
Build / build (push) Successful in 1m21s

This commit is contained in:
2026-04-29 01:55:32 -05:00
parent d42e10fcbe
commit 88e901e214
5 changed files with 29 additions and 17 deletions
+2 -2
View File
@@ -17,14 +17,14 @@ ox::Result<ox::UUID> readUuidHeader(ox::BufferView const &buff) noexcept;
ox::Result<ox::UUID> regenerateUuidHeader(ox::Buffer &buff) noexcept;
ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const &uuid) noexcept {
constexpr ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const &uuid) noexcept {
OX_RETURN_ERROR(write(writer, "K1;"));
OX_RETURN_ERROR(uuid.toString(writer));
return writer.put(';');
}
template<typename T>
ox::Result<T> readAsset(ox::BufferView buff) noexcept {
constexpr ox::Result<T> readAsset(ox::BufferView buff) noexcept {
auto const err = readUuidHeader(buff).error;
if (!err) {
buff += K1HdrSz; // the size of K1 headers
+2
View File
@@ -37,6 +37,8 @@ class Module {
virtual ox::Vector<PackTransform> packTransforms() const noexcept;
};
void registerModule(Module const &mod) noexcept;
void registerModule(Module const *mod) noexcept;
[[nodiscard]]
+5 -5
View File
@@ -12,7 +12,7 @@
namespace keel {
ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
static ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
if (!file.good()) {
oxErrorf("Could not find ROM file: {}", path);
@@ -33,8 +33,8 @@ ox::Result<char*> loadRom(ox::StringViewCR path) noexcept {
}
}
void unloadRom(char *rom) noexcept {
ox::safeDelete(rom);
static void unloadRom(char *rom) noexcept {
ox::safeDeleteArray(rom);
}
static void clearUuidMap(Context &ctx) noexcept {
@@ -212,7 +212,7 @@ static ox::Error buildUuidMap(Context&, DuplicateSet*) noexcept {
return {};
}
ox::Result<char*> loadRom(ox::StringViewCR) noexcept {
static ox::Result<char*> loadRom(ox::StringViewCR) noexcept {
// put the header in the wrong order to prevent mistaking this code for the
// media section
constexpr auto headerP2 = "R_______________";
@@ -229,7 +229,7 @@ ox::Result<char*> loadRom(ox::StringViewCR) noexcept {
return ox::Error(1);
}
void unloadRom(char*) noexcept {
static void unloadRom(char*) noexcept {
}
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept {
+5 -1
View File
@@ -8,9 +8,13 @@ namespace keel {
static ox::Vector<Module const*> mods;
void registerModule(Module const &mod) noexcept {
mods.emplace_back(&mod);
}
void registerModule(Module const *mod) noexcept {
if (mod) {
mods.emplace_back(mod);
registerModule(*mod);
}
}
+10 -4
View File
@@ -38,8 +38,9 @@ static ox::Error pathToInode(
auto const uuid = ox::substr(path, 7);
OX_RETURN_ERROR(keel::uuidToPath(ctx, uuid).to<ox::String>().moveTo(path));
}
auto const s = dest.stat(path);
auto const inode = s.ok() ? s.value.inode : 0;
auto const inode = dest.stat(path)
.or_value({.inode = 0})
.inode;
OX_RETURN_ERROR(typeVal->set(static_cast<int8_t>(ox::FileAddressType::Inode)));
oxOutf("\tpath to inode: {} => {}\n", path, inode);
return data.set(2, inode);
@@ -49,6 +50,7 @@ static ox::Error transformFileAddressesObj(
Context &ctx,
ox::FileSystem const &dest,
ox::ModelObject &obj) noexcept;
static ox::Error transformFileAddressesVec(
Context &ctx,
ox::FileSystem const &dest,
@@ -58,15 +60,19 @@ static ox::Error transformFileAddresses(
Context &ctx,
ox::FileSystem const &dest,
ox::ModelValue &v) noexcept {
if (v.type() == ox::ModelValue::Type::Object) {
switch (v.type()) {
case ox::ModelValue::Type::Object: {
auto &obj = v.get<ox::ModelObject>();
return transformFileAddressesObj(ctx, dest, obj);
} else if (v.type() == ox::ModelValue::Type::Vector) {
}
case ox::ModelValue::Type::Vector: {
auto &vec = v.get<ox::ModelValueVector>();
return transformFileAddressesVec(ctx, dest, vec);
}
default:
return {};
}
}
static ox::Error transformFileAddressesVec(
Context &ctx,