Squashed 'deps/nostalgia/' changes from c7bc2a95..e27eee50
e27eee50 [teagba] Add set and scroll background offset functions fd610454 [nostalgia/gfx] Fix compiler warning e61d4647 [nostalgia/gfx] Fix BG tilesheet loading, add background offset functions c275c5f5 [hull] Disable building hull for now fbf49ba5 [ox/std] Add pre- and post-increment operators to Span 92f74b27 [ox/std] Add null check for deallocating in consteval context Vector 934f0c92 [ox/std] Add beginsWith and endsWith variants that that cingle chars ee9a3e11 [ox/std] Cleanup 16886cdf [hull] Add start on command interpreter 08b9508d [ox/std] Give std::ignore a named type 69bd968f [nostalgia/player] Fix build 4e7dc666 [nostalgia,olympic] Rename string len() functions to size() bea0cf5a [ox/std] Rename string len() functions to size() git-subtree-dir: deps/nostalgia git-subtree-split: e27eee50f05bb437710313430e0d9cef636a66b1
This commit is contained in:
40
deps/teagba/include/teagba/addresses.hpp
vendored
40
deps/teagba/include/teagba/addresses.hpp
vendored
@@ -54,25 +54,41 @@ inline volatile BgCtl ®BgCtl(uintptr_t const bgIdx) noexcept {
|
||||
}
|
||||
|
||||
// background horizontal scrolling registers
|
||||
#define REG_BG0HOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'0010))
|
||||
#define REG_BG1HOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'0014))
|
||||
#define REG_BG2HOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'0018))
|
||||
#define REG_BG3HOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'001c))
|
||||
#define REG_BG0HOFS (*reinterpret_cast<volatile int16_t*>(0x0400'0010))
|
||||
#define REG_BG1HOFS (*reinterpret_cast<volatile int16_t*>(0x0400'0014))
|
||||
#define REG_BG2HOFS (*reinterpret_cast<volatile int16_t*>(0x0400'0018))
|
||||
#define REG_BG3HOFS (*reinterpret_cast<volatile int16_t*>(0x0400'001c))
|
||||
|
||||
[[nodiscard]]
|
||||
volatile uint32_t ®BgHofs(auto const bgIdx) noexcept {
|
||||
return *reinterpret_cast<volatile uint32_t*>(0x0400'0010 + 4 * bgIdx);
|
||||
volatile int16_t ®BgHofs(auto const bgIdx) noexcept {
|
||||
return *reinterpret_cast<volatile int16_t*>(0x0400'0010 + 4 * bgIdx);
|
||||
}
|
||||
|
||||
// background vertical scrolling registers
|
||||
#define REG_BG0VOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'0012))
|
||||
#define REG_BG1VOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'0016))
|
||||
#define REG_BG2VOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'001a))
|
||||
#define REG_BG3VOFS (*reinterpret_cast<volatile uint32_t*>(0x0400'001e))
|
||||
#define REG_BG0VOFS (*reinterpret_cast<volatile int16_t*>(0x0400'0012))
|
||||
#define REG_BG1VOFS (*reinterpret_cast<volatile int16_t*>(0x0400'0016))
|
||||
#define REG_BG2VOFS (*reinterpret_cast<volatile int16_t*>(0x0400'001a))
|
||||
#define REG_BG3VOFS (*reinterpret_cast<volatile int16_t*>(0x0400'001e))
|
||||
|
||||
[[nodiscard]]
|
||||
volatile uint32_t ®BgVofs(auto const bgIdx) noexcept {
|
||||
return *reinterpret_cast<volatile uint32_t*>(0x0400'0012 + 4 * bgIdx);
|
||||
volatile int16_t ®BgVofs(auto const bgIdx) noexcept {
|
||||
return *reinterpret_cast<volatile int16_t*>(0x0400'0012 + 4 * bgIdx);
|
||||
}
|
||||
|
||||
// background scrolling registers
|
||||
|
||||
struct OffsetPair {
|
||||
int16_t x{}, y{};
|
||||
};
|
||||
|
||||
#define REG_BG0OFS (*reinterpret_cast<volatile OffsetPair*>(0x0400'0010))
|
||||
#define REG_BG1OFS (*reinterpret_cast<volatile OffsetPair*>(0x0400'0014))
|
||||
#define REG_BG2OFS (*reinterpret_cast<volatile OffsetPair*>(0x0400'0018))
|
||||
#define REG_BG3OFS (*reinterpret_cast<volatile OffsetPair*>(0x0400'001c))
|
||||
|
||||
[[nodiscard]]
|
||||
volatile OffsetPair ®BgOfs(auto const bgIdx) noexcept {
|
||||
return *reinterpret_cast<volatile OffsetPair*>(0x0400'0010 + sizeof(OffsetPair) * bgIdx);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
4
deps/teagba/include/teagba/gfx.hpp
vendored
4
deps/teagba/include/teagba/gfx.hpp
vendored
@@ -41,4 +41,8 @@ void addSpriteUpdate(GbaSpriteAttrUpdate const &upd) noexcept;
|
||||
|
||||
void applySpriteUpdates() noexcept;
|
||||
|
||||
void setBgOffset(uint16_t bg, int16_t x, int16_t y) noexcept;
|
||||
|
||||
void scrollBgOffset(uint16_t bg, int16_t x, int16_t y) noexcept;
|
||||
|
||||
}
|
||||
|
14
deps/teagba/src/gfx.cpp
vendored
14
deps/teagba/src/gfx.cpp
vendored
@@ -12,7 +12,7 @@ namespace teagba {
|
||||
|
||||
static ox::Array<GbaSpriteAttrUpdate, 128> g_spriteBuffer;
|
||||
|
||||
GbaSpriteAttrUpdate &spriteAttr(size_t i) noexcept {
|
||||
GbaSpriteAttrUpdate &spriteAttr(size_t const i) noexcept {
|
||||
return g_spriteBuffer[i];
|
||||
}
|
||||
|
||||
@@ -29,4 +29,16 @@ void applySpriteUpdates() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void setBgOffset(uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
||||
auto &o = regBgOfs(bg);
|
||||
o.x = x;
|
||||
o.y = y;
|
||||
}
|
||||
|
||||
void scrollBgOffset(uint16_t const bg, int16_t const x, int16_t const y) noexcept {
|
||||
auto &o = regBgOfs(bg);
|
||||
o.x = o.x + x;
|
||||
o.y = o.y + y;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user