[nostalgia] Make almost everyting noexcept

This commit is contained in:
2021-04-20 01:56:41 -05:00
parent 161780cb91
commit 6ece0b6f9b
22 changed files with 139 additions and 136 deletions
+6 -6
View File
@@ -14,7 +14,7 @@
namespace nostalgia::core {
static ox::Result<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) {
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()));
@@ -22,14 +22,14 @@ static ox::Result<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress
}
template<typename T>
ox::Result<T> readObj(Context *ctx, const ox::FileAddress &file) {
ox::Result<T> readObj(Context *ctx, const ox::FileAddress &file) noexcept {
oxRequire(buff, readFile(ctx, file));
T t;
oxReturnError(ox::readClaw(buff.data(), buff.size(), &t));
return ox::move(t);
}
ox::Error initConsole(Context *ctx) {
ox::Error initConsole(Context *ctx) noexcept {
constexpr auto TilesheetAddr = "/TileSheets/Charset.ng";
constexpr auto PaletteAddr = "/Palettes/Charset.npal";
setBgStatus(ctx, 0b0001);
@@ -39,14 +39,14 @@ ox::Error initConsole(Context *ctx) {
ox::Error loadSpriteTileSheet(Context*,
int,
ox::FileAddress,
ox::FileAddress) {
ox::FileAddress) noexcept {
return OxError(0);
}
ox::Error loadBgTileSheet(Context *ctx,
int section,
ox::FileAddress tilesheetPath,
ox::FileAddress palettePath) {
ox::FileAddress palettePath) noexcept {
oxRequire(tilesheet, readObj<NostalgiaGraphic>(ctx, tilesheetPath));
if (!palettePath) {
palettePath = tilesheet.defaultPalette;
@@ -72,7 +72,7 @@ ox::Error loadBgTileSheet(Context *ctx,
return renderer::loadBgTexture(ctx, section, pixels.data(), width, height);
}
void puts(Context *ctx, int column, int row, const char *str) {
void puts(Context *ctx, int column, int row, const char *str) noexcept {
for (int i = 0; str[i]; ++i) {
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
}