[nostalgia/core] Fix incorrect bit_cast uses

This commit is contained in:
Gary Talent 2021-11-02 00:41:31 -05:00
parent 9fd14b0744
commit e91d2653a3
4 changed files with 5 additions and 6 deletions

View File

@ -85,7 +85,7 @@ typedef uint16_t BgMapTile[1024];
#define MEM_BG_TILES reinterpret_cast<BgMapTile*>(0x06000000)
#define MEM_BG_MAP reinterpret_cast<BgMapTile*>(0x0600e000)
#define MEM_SPRITE_TILES reinterpret_cast<uint8_t*>(0x06010000)
#define MEM_SPRITE_TILES reinterpret_cast<uint16_t*>(0x06010000)
#define MEM_OAM reinterpret_cast<uint64_t*>(0x07000000)
#define MEM_ROM reinterpret_cast<char*>(0x08000000)

View File

@ -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<uint16_t*>(MEM_BG_TILES)[section * 512];
target.tileMap = &reinterpret_cast<uint16_t*>(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<uint16_t*>(MEM_SPRITE_TILES)[section * 512];
target.tileMap = &reinterpret_cast<uint16_t*>(MEM_SPRITE_TILES)[section * 512];
oxReturnError(ox::readMC(ts, tsStat.size, &target));
// load external palette if available
if (paletteAddr) {

View File

@ -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<const uint64_t*>(&oa);
MEM_OAM[oa.idx] = *reinterpret_cast<const uint64_t*>(&oa);
}
g_spriteUpdates = 0;
if constexpr(config::GbaEventLoopTimerBased) {

View File

@ -13,7 +13,6 @@
#include <nostalgia/glutils/glutils.hpp>
#include <ox/std/bit.hpp>
#include <ox/std/fmt.hpp>
#include <nostalgia/core/config.hpp>
@ -128,7 +127,7 @@ static void initBackgroundBufferset(Context *ctx, GLuint shader, glutils::Buffer
auto texCoordAttr = static_cast<GLuint>(glGetAttribLocation(shader, "vTexCoord"));
glEnableVertexAttribArray(texCoordAttr);
glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
std::bit_cast<void*>(2 * sizeof(float)));
reinterpret_cast<void*>(2 * sizeof(float)));
}
static glutils::GLTexture loadTexture(GLsizei w, GLsizei h, void *pixels) noexcept {