This commit is contained in:
@@ -321,23 +321,23 @@ void showSprite(Context&, unsigned const idx) noexcept {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSprite(Context&, uint_t const idx, Sprite const &s) noexcept {
|
void setSprite(Context&, uint_t const idx, Sprite const &sprite) noexcept {
|
||||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||||
uint16_t const eightBpp = s.bpp == 8;
|
uint16_t const eightBpp = sprite.bpp == 8;
|
||||||
teagba::addSpriteUpdate({
|
teagba::addSpriteUpdate({
|
||||||
.attr0 = static_cast<uint16_t>(
|
.attr0 = static_cast<uint16_t>(
|
||||||
(static_cast<uint16_t>(s.y & ox::onMask<uint8_t>(0b111'1111)))
|
(static_cast<uint16_t>(sprite.y & ox::onMask<uint8_t>(0b111'1111)))
|
||||||
| (static_cast<uint16_t>(1) << 10) // enable alpha
|
| (static_cast<uint16_t>(1) << 10) // enable alpha
|
||||||
| (static_cast<uint16_t>(eightBpp) << 13)
|
| (static_cast<uint16_t>(eightBpp) << 13)
|
||||||
| (static_cast<uint16_t>(s.spriteShape) << 14)),
|
| (static_cast<uint16_t>(sprite.spriteShape) << 14)),
|
||||||
.attr1 = static_cast<uint16_t>(
|
.attr1 = static_cast<uint16_t>(
|
||||||
(static_cast<uint16_t>(s.x) & ox::onMask<uint8_t>(8))
|
(static_cast<uint16_t>(sprite.x) & ox::onMask<uint8_t>(8))
|
||||||
| (static_cast<uint16_t>(s.flipX) << 12)
|
| (static_cast<uint16_t>(sprite.flipX) << 12)
|
||||||
| (static_cast<uint16_t>(s.spriteSize) << 14)),
|
| (static_cast<uint16_t>(sprite.spriteSize) << 14)),
|
||||||
.attr2 = static_cast<uint16_t>(
|
.attr2 = static_cast<uint16_t>(
|
||||||
// double tileIdx if 8 bpp
|
// double tileIdx if 8 bpp
|
||||||
(static_cast<uint16_t>((s.tileIdx * (1 + eightBpp)) & ox::onMask<uint16_t>(8)))
|
(static_cast<uint16_t>((sprite.tileIdx * (1 + eightBpp)) & ox::onMask<uint16_t>(8)))
|
||||||
| (static_cast<uint16_t>(s.priority & 0b11) << 10)),
|
| (static_cast<uint16_t>(sprite.priority & 0b11) << 10)),
|
||||||
.idx = static_cast<uint16_t>(idx),
|
.idx = static_cast<uint16_t>(idx),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ uint_t spriteCount(Context const &) noexcept {
|
|||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
void panic(char const *file, int line, char const *panicMsg, ox::Error const &err) noexcept {
|
void panic(char const*panicMsg, Error const&err, std::source_location const &src) noexcept {
|
||||||
using namespace nostalgia::gfx;
|
using namespace nostalgia::gfx;
|
||||||
// reset heap to make sure we have enough memory to allocate context data
|
// reset heap to make sure we have enough memory to allocate context data
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||||
@@ -374,7 +374,7 @@ void panic(char const *file, int line, char const *panicMsg, ox::Error const &er
|
|||||||
}
|
}
|
||||||
consoleWrite(*ctx, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
|
consoleWrite(*ctx, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
|
||||||
// print to terminal if in mGBA
|
// print to terminal if in mGBA
|
||||||
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", file, line, panicMsg);
|
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", src.file_name(), src.line(), panicMsg);
|
||||||
if (err.msg) {
|
if (err.msg) {
|
||||||
oxErrf("\tError Message:\t{}\n", err.msg);
|
oxErrf("\tError Message:\t{}\n", err.msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user