From b36cd1694b6a3e6064555f3b27689483f3049a85 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 15 May 2021 01:42:17 -0500 Subject: [PATCH] [nostalgia/core/gba] Make BG CTLs uint16 --- src/nostalgia/core/gba/addresses.hpp | 8 ++++---- src/nostalgia/core/gba/gfx.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nostalgia/core/gba/addresses.hpp b/src/nostalgia/core/gba/addresses.hpp index 80c71eb0..29a44c60 100644 --- a/src/nostalgia/core/gba/addresses.hpp +++ b/src/nostalgia/core/gba/addresses.hpp @@ -45,10 +45,10 @@ using interrupt_handler = void (*)(); // background registers // background control registers -#define REG_BG0CTL *reinterpret_cast(0x04000008) -#define REG_BG1CTL *reinterpret_cast(0x0400000a) -#define REG_BG2CTL *reinterpret_cast(0x0400000c) -#define REG_BG3CTL *reinterpret_cast(0x0400000e) +#define REG_BG0CTL *reinterpret_cast(0x04000008) +#define REG_BG1CTL *reinterpret_cast(0x0400000a) +#define REG_BG2CTL *reinterpret_cast(0x0400000c) +#define REG_BG3CTL *reinterpret_cast(0x0400000e) // background horizontal scrolling registers #define REG_BG0HOFS *reinterpret_cast(0x04000010) diff --git a/src/nostalgia/core/gba/gfx.cpp b/src/nostalgia/core/gba/gfx.cpp index 65b39e8d..8454d7a4 100644 --- a/src/nostalgia/core/gba/gfx.cpp +++ b/src/nostalgia/core/gba/gfx.cpp @@ -37,7 +37,7 @@ struct GbaTileMapTarget { static constexpr auto TypeName = NostalgiaGraphic::TypeName; static constexpr auto Fields = NostalgiaGraphic::Fields; static constexpr auto TypeVersion = NostalgiaGraphic::TypeVersion; - volatile uint32_t *bgCtl = nullptr; + volatile uint16_t *bgCtl = nullptr; ox::FileAddress defaultPalette; GbaPaletteTarget pal; volatile uint16_t *tileMap = nullptr; @@ -132,7 +132,7 @@ void setBgStatus(Context*, unsigned bg, bool status) noexcept { } [[nodiscard]] -constexpr volatile uint32_t &bgCtl(int bg) noexcept { +constexpr volatile uint16_t &bgCtl(int bg) noexcept { switch (bg) { case 0: return REG_BG0CTL; @@ -244,7 +244,7 @@ void hideSprite(Context*, unsigned idx) noexcept { oa.attr0 = 2 << 8; oa.idx = idx; // block until g_spriteUpdates is less than buffer len - if (g_spriteUpdates >= config::GbaSpriteBufferLen) { + if (g_spriteUpdates >= config::GbaSpriteBufferLen) [[unlikely]] { nostalgia_core_vblankintrwait(); } if constexpr(config::GbaEventLoopTimerBased) { @@ -279,7 +279,7 @@ void setSprite(Context*, oa.attr2 = static_cast(tileIdx & ox::onMask(8)); oa.idx = idx; // block until g_spriteUpdates is less than buffer len - if (g_spriteUpdates >= config::GbaSpriteBufferLen) { + if (g_spriteUpdates >= config::GbaSpriteBufferLen) [[unlikely]] { nostalgia_core_vblankintrwait(); } if constexpr(config::GbaEventLoopTimerBased) {