[nostalgia/core/gba] Make BG CTLs uint16

This commit is contained in:
Gary Talent 2021-05-15 01:42:17 -05:00
parent 56269004d7
commit b36cd1694b
2 changed files with 8 additions and 8 deletions

View File

@ -45,10 +45,10 @@ using interrupt_handler = void (*)();
// background registers // background registers
// background control registers // background control registers
#define REG_BG0CTL *reinterpret_cast<volatile uint32_t*>(0x04000008) #define REG_BG0CTL *reinterpret_cast<volatile uint16_t*>(0x04000008)
#define REG_BG1CTL *reinterpret_cast<volatile uint32_t*>(0x0400000a) #define REG_BG1CTL *reinterpret_cast<volatile uint16_t*>(0x0400000a)
#define REG_BG2CTL *reinterpret_cast<volatile uint32_t*>(0x0400000c) #define REG_BG2CTL *reinterpret_cast<volatile uint16_t*>(0x0400000c)
#define REG_BG3CTL *reinterpret_cast<volatile uint32_t*>(0x0400000e) #define REG_BG3CTL *reinterpret_cast<volatile uint16_t*>(0x0400000e)
// background horizontal scrolling registers // background horizontal scrolling registers
#define REG_BG0HOFS *reinterpret_cast<volatile uint32_t*>(0x04000010) #define REG_BG0HOFS *reinterpret_cast<volatile uint32_t*>(0x04000010)

View File

@ -37,7 +37,7 @@ struct GbaTileMapTarget {
static constexpr auto TypeName = NostalgiaGraphic::TypeName; static constexpr auto TypeName = NostalgiaGraphic::TypeName;
static constexpr auto Fields = NostalgiaGraphic::Fields; static constexpr auto Fields = NostalgiaGraphic::Fields;
static constexpr auto TypeVersion = NostalgiaGraphic::TypeVersion; static constexpr auto TypeVersion = NostalgiaGraphic::TypeVersion;
volatile uint32_t *bgCtl = nullptr; volatile uint16_t *bgCtl = nullptr;
ox::FileAddress defaultPalette; ox::FileAddress defaultPalette;
GbaPaletteTarget pal; GbaPaletteTarget pal;
volatile uint16_t *tileMap = nullptr; volatile uint16_t *tileMap = nullptr;
@ -132,7 +132,7 @@ void setBgStatus(Context*, unsigned bg, bool status) noexcept {
} }
[[nodiscard]] [[nodiscard]]
constexpr volatile uint32_t &bgCtl(int bg) noexcept { constexpr volatile uint16_t &bgCtl(int bg) noexcept {
switch (bg) { switch (bg) {
case 0: case 0:
return REG_BG0CTL; return REG_BG0CTL;
@ -244,7 +244,7 @@ void hideSprite(Context*, unsigned idx) noexcept {
oa.attr0 = 2 << 8; oa.attr0 = 2 << 8;
oa.idx = idx; oa.idx = idx;
// block until g_spriteUpdates is less than buffer len // block until g_spriteUpdates is less than buffer len
if (g_spriteUpdates >= config::GbaSpriteBufferLen) { if (g_spriteUpdates >= config::GbaSpriteBufferLen) [[unlikely]] {
nostalgia_core_vblankintrwait(); nostalgia_core_vblankintrwait();
} }
if constexpr(config::GbaEventLoopTimerBased) { if constexpr(config::GbaEventLoopTimerBased) {
@ -279,7 +279,7 @@ void setSprite(Context*,
oa.attr2 = static_cast<uint16_t>(tileIdx & ox::onMask<uint16_t>(8)); oa.attr2 = static_cast<uint16_t>(tileIdx & ox::onMask<uint16_t>(8));
oa.idx = idx; oa.idx = idx;
// block until g_spriteUpdates is less than buffer len // block until g_spriteUpdates is less than buffer len
if (g_spriteUpdates >= config::GbaSpriteBufferLen) { if (g_spriteUpdates >= config::GbaSpriteBufferLen) [[unlikely]] {
nostalgia_core_vblankintrwait(); nostalgia_core_vblankintrwait();
} }
if constexpr(config::GbaEventLoopTimerBased) { if constexpr(config::GbaEventLoopTimerBased) {