From e91d2653a32c6f3937b138bba54dc0603bac5410 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 2 Nov 2021 00:41:31 -0500 Subject: [PATCH] [nostalgia/core] Fix incorrect bit_cast uses --- src/nostalgia/core/gba/addresses.hpp | 2 +- src/nostalgia/core/gba/gfx.cpp | 4 ++-- src/nostalgia/core/gba/irq.arm.cpp | 2 +- src/nostalgia/core/userland/gfx_opengl.cpp | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/nostalgia/core/gba/addresses.hpp b/src/nostalgia/core/gba/addresses.hpp index 29a44c60..18de77be 100644 --- a/src/nostalgia/core/gba/addresses.hpp +++ b/src/nostalgia/core/gba/addresses.hpp @@ -85,7 +85,7 @@ typedef uint16_t BgMapTile[1024]; #define MEM_BG_TILES reinterpret_cast(0x06000000) #define MEM_BG_MAP reinterpret_cast(0x0600e000) -#define MEM_SPRITE_TILES reinterpret_cast(0x06010000) +#define MEM_SPRITE_TILES reinterpret_cast(0x06010000) #define MEM_OAM reinterpret_cast(0x07000000) #define MEM_ROM reinterpret_cast(0x08000000) diff --git a/src/nostalgia/core/gba/gfx.cpp b/src/nostalgia/core/gba/gfx.cpp index ff2f5e9e..60487fbb 100644 --- a/src/nostalgia/core/gba/gfx.cpp +++ b/src/nostalgia/core/gba/gfx.cpp @@ -177,7 +177,7 @@ ox::Error loadBgTileSheet(Context *ctx, GbaTileMapTarget target; target.pal.palette = &MEM_BG_PALETTE[section]; target.bgCtl = &bgCtl(section); - target.tileMap = &ox::bit_cast(MEM_BG_TILES)[section * 512]; + target.tileMap = &reinterpret_cast(MEM_BG_TILES)[section * 512]; oxReturnError(ox::readMC(ts, tsStat.size, &target)); // load external palette if available if (paletteAddr) { @@ -198,7 +198,7 @@ ox::Error loadSpriteTileSheet(Context *ctx, target.pal.palette = &MEM_SPRITE_PALETTE[section]; // Is this needed? Should this be written to an equivalent sprite value? // target.bgCtl = &bgCtl(section); - target.tileMap = &ox::bit_cast(MEM_SPRITE_TILES)[section * 512]; + target.tileMap = &reinterpret_cast(MEM_SPRITE_TILES)[section * 512]; oxReturnError(ox::readMC(ts, tsStat.size, &target)); // load external palette if available if (paletteAddr) { diff --git a/src/nostalgia/core/gba/irq.arm.cpp b/src/nostalgia/core/gba/irq.arm.cpp index 4881bbc8..54fb679b 100644 --- a/src/nostalgia/core/gba/irq.arm.cpp +++ b/src/nostalgia/core/gba/irq.arm.cpp @@ -35,7 +35,7 @@ void nostalgia_core_isr_vblank() { const unsigned updates = g_spriteUpdates; for (unsigned i = 0; i < updates; ++i) { const auto &oa = g_spriteBuffer[i]; - MEM_OAM[oa.idx] = *ox::bit_cast(&oa); + MEM_OAM[oa.idx] = *reinterpret_cast(&oa); } g_spriteUpdates = 0; if constexpr(config::GbaEventLoopTimerBased) { diff --git a/src/nostalgia/core/userland/gfx_opengl.cpp b/src/nostalgia/core/userland/gfx_opengl.cpp index a45821bd..56793f88 100644 --- a/src/nostalgia/core/userland/gfx_opengl.cpp +++ b/src/nostalgia/core/userland/gfx_opengl.cpp @@ -13,7 +13,6 @@ #include -#include #include #include @@ -128,7 +127,7 @@ static void initBackgroundBufferset(Context *ctx, GLuint shader, glutils::Buffer auto texCoordAttr = static_cast(glGetAttribLocation(shader, "vTexCoord")); glEnableVertexAttribArray(texCoordAttr); glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float), - std::bit_cast(2 * sizeof(float))); + reinterpret_cast(2 * sizeof(float))); } static glutils::GLTexture loadTexture(GLsizei w, GLsizei h, void *pixels) noexcept {