[nostalgia/core/userland] Cleanup readObj
This commit is contained in:
parent
239f4d149d
commit
6c302b7d1c
@ -14,19 +14,10 @@
|
|||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
static ox::Result<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) noexcept {
|
|
||||||
oxRequire(stat, ctx->rom->stat(file));
|
|
||||||
ox::Vector<char> buff(stat.size);
|
|
||||||
oxReturnError(ctx->rom->read(file, buff.data(), buff.size()));
|
|
||||||
return ox::move(buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Result<T> readObj(Context *ctx, const ox::FileAddress &file) noexcept {
|
static ox::Result<T> readObj(Context *ctx, const ox::FileAddress &file) noexcept {
|
||||||
oxRequire(buff, readFile(ctx, file));
|
oxRequire(buff, ctx->rom->read(file));
|
||||||
T t;
|
return ox::readClaw<T>(buff);
|
||||||
oxReturnError(ox::readClaw(buff.data(), buff.size(), &t));
|
|
||||||
return ox::move(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error initConsole(Context *ctx) noexcept {
|
ox::Error initConsole(Context *ctx) noexcept {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user