[nostalgia] Remove nodiscards from Error and ValErr functions
This commit is contained in:
parent
75814a2896
commit
d2eea8c2ec
@ -18,9 +18,9 @@ namespace nostalgia::core {
|
||||
|
||||
using event_handler = int(*)(Context*);
|
||||
|
||||
[[nodiscard]] ox::Error init(Context *ctx);
|
||||
ox::Error init(Context *ctx);
|
||||
|
||||
[[nodiscard]] ox::Error run(Context *ctx);
|
||||
ox::Error run(Context *ctx);
|
||||
|
||||
// Sets event handler that sleeps for the time given in the return value. The
|
||||
// sleep time is a minimum of ~16 milliseconds.
|
||||
|
@ -66,18 +66,18 @@ ox::Error model(T *io, NostalgiaGraphic *ng) {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error initGfx(Context *ctx);
|
||||
ox::Error initGfx(Context *ctx);
|
||||
|
||||
[[nodiscard]] ox::Error shutdownGfx(Context*);
|
||||
ox::Error shutdownGfx(Context*);
|
||||
|
||||
[[nodiscard]] ox::Error initConsole(Context *ctx);
|
||||
ox::Error initConsole(Context *ctx);
|
||||
|
||||
/**
|
||||
* @param section describes which section of the selected TileSheetSpace to use (e.g. MEM_PALLETE_BG[section])
|
||||
*/
|
||||
[[nodiscard]] ox::Error loadBgTileSheet(Context *ctx, int section, ox::FileAddress tilesheet, ox::FileAddress palette = nullptr);
|
||||
ox::Error loadBgTileSheet(Context *ctx, int section, ox::FileAddress tilesheet, ox::FileAddress palette = nullptr);
|
||||
|
||||
[[nodiscard]] ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
int section,
|
||||
ox::FileAddress tilesheetAddr,
|
||||
ox::FileAddress paletteAddr);
|
||||
|
@ -33,7 +33,7 @@ struct SdlImplData {
|
||||
|
||||
constexpr auto Scale = 5;
|
||||
|
||||
[[nodiscard]] static ox::ValErr<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) {
|
||||
static ox::ValErr<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) {
|
||||
auto [stat, err] = ctx->rom->stat(file);
|
||||
oxReturnError(err);
|
||||
ox::Vector<char> buff(stat.size);
|
||||
@ -42,7 +42,7 @@ constexpr auto Scale = 5;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] ox::ValErr<T> readObj(Context *ctx, const ox::FileAddress &file) {
|
||||
ox::ValErr<T> readObj(Context *ctx, const ox::FileAddress &file) {
|
||||
auto [buff, err] = readFile(ctx, file);
|
||||
oxReturnError(err);
|
||||
T t;
|
||||
|
@ -18,7 +18,7 @@
|
||||
namespace nostalgia::core {
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] ox::ValErr<std::vector<uint8_t>> toBuffer(T *data, std::size_t buffSize = ox::units::MB) {
|
||||
ox::ValErr<std::vector<uint8_t>> toBuffer(T *data, std::size_t buffSize = ox::units::MB) {
|
||||
std::vector<uint8_t> buff(buffSize);
|
||||
std::size_t sz = 0;
|
||||
oxReturnError(ox::writeMC(buff.data(), buff.size(), data, &sz));
|
||||
|
@ -32,12 +32,12 @@ static_assert(!endsWith("asdf", "eu"));
|
||||
* @return error
|
||||
* stub for now
|
||||
*/
|
||||
[[nodiscard]] ox::Error pathToInode(std::vector<uint8_t>*) {
|
||||
ox::Error pathToInode(std::vector<uint8_t>*) {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
// stub for now
|
||||
[[nodiscard]] ox::Error toMetalClaw(std::vector<uint8_t> *buff) {
|
||||
ox::Error toMetalClaw(std::vector<uint8_t> *buff) {
|
||||
auto [mc, err] = ox::stripClawHeader(ox::bit_cast<char*>(buff->data()), buff->size());
|
||||
oxReturnError(err);
|
||||
buff->resize(mc.size());
|
||||
@ -47,7 +47,7 @@ static_assert(!endsWith("asdf", "eu"));
|
||||
|
||||
// claw file transformations are broken out because path to inode
|
||||
// transformations need to be done after the copy to the new FS is complete
|
||||
[[nodiscard]] ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) {
|
||||
ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) {
|
||||
// copy
|
||||
oxTrace("pack::transformClaw") << "path:" << path.c_str();
|
||||
return dest->ls(path.c_str(), [dest, path](const char *name, ox::InodeId_t) {
|
||||
@ -74,7 +74,7 @@ static_assert(!endsWith("asdf", "eu"));
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error verifyFile(ox::FileSystem32 *fs, const std::string &path, const std::vector<uint8_t> &expected) noexcept {
|
||||
ox::Error verifyFile(ox::FileSystem32 *fs, const std::string &path, const std::vector<uint8_t> &expected) noexcept {
|
||||
std::vector<uint8_t> buff(expected.size());
|
||||
oxReturnError(fs->read(path.c_str(), buff.data(), buff.size()));
|
||||
return OxError(buff == expected ? 0 : 1);
|
||||
@ -85,7 +85,7 @@ struct VerificationPair {
|
||||
std::vector<uint8_t> buff;
|
||||
};
|
||||
|
||||
[[nodiscard]] ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) {
|
||||
ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) {
|
||||
std::cout << "copying directory: " << path << '\n';
|
||||
std::vector<VerificationPair> verficationPairs;
|
||||
// copy
|
||||
@ -126,7 +126,7 @@ struct VerificationPair {
|
||||
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest) {
|
||||
ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest) {
|
||||
oxReturnError(copy(src, dest, "/"));
|
||||
oxReturnError(transformClaw(dest, "/"));
|
||||
return OxError(0);
|
||||
|
@ -51,7 +51,7 @@ struct Zone {
|
||||
|
||||
~Zone();
|
||||
|
||||
[[nodiscard]] ox::Error init(core::Context *ctx, common::Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette = {});
|
||||
ox::Error init(core::Context *ctx, common::Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette = {});
|
||||
|
||||
void draw(core::Context *ctx);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user