[nostalgia/core/gba] Fix GBA build issues
This commit is contained in:
parent
2dad1688b5
commit
0eb33f823c
@ -27,12 +27,14 @@ constexpr auto GBA_TILE_ROWS = 32;
|
|||||||
struct GbaPaletteTarget {
|
struct GbaPaletteTarget {
|
||||||
static constexpr auto TypeName = NostalgiaPalette::TypeName;
|
static constexpr auto TypeName = NostalgiaPalette::TypeName;
|
||||||
static constexpr auto Fields = NostalgiaPalette::Fields;
|
static constexpr auto Fields = NostalgiaPalette::Fields;
|
||||||
|
static constexpr auto TypeVersion = NostalgiaPalette::TypeVersion;
|
||||||
volatile uint16_t *palette = nullptr;
|
volatile uint16_t *palette = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GbaTileMapTarget {
|
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;
|
||||||
volatile uint32_t *bgCtl = nullptr;
|
volatile uint32_t *bgCtl = nullptr;
|
||||||
ox::FileAddress defaultPalette;
|
ox::FileAddress defaultPalette;
|
||||||
GbaPaletteTarget pal;
|
GbaPaletteTarget pal;
|
||||||
@ -41,17 +43,17 @@ struct GbaTileMapTarget {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Error modelRead(T *io, GbaPaletteTarget *t) {
|
ox::Error modelRead(T *io, GbaPaletteTarget *t) {
|
||||||
io->template setTypeInfo<T>();
|
io->template setTypeInfo<GbaPaletteTarget>();
|
||||||
oxReturnError(io->template field<Color16>("colors", [t](auto i, Color16 *c) {
|
auto colorHandler = [t](std::size_t i, Color16 *c) {
|
||||||
t->palette[i] = *c;
|
t->palette[i] = *c;
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}));
|
};
|
||||||
return OxError(0);
|
return io->template field<Color16, decltype(colorHandler)>("colors", colorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Error modelRead(T *io, GbaTileMapTarget *t) {
|
ox::Error modelRead(T *io, GbaTileMapTarget *t) {
|
||||||
io->template setTypeInfo<T>();
|
io->template setTypeInfo<GbaTileMapTarget>();
|
||||||
|
|
||||||
uint8_t bpp;
|
uint8_t bpp;
|
||||||
int dummy;
|
int dummy;
|
||||||
@ -69,7 +71,7 @@ ox::Error modelRead(T *io, GbaTileMapTarget *t) {
|
|||||||
oxReturnError(io->field("defaultPalette", &t->defaultPalette));
|
oxReturnError(io->field("defaultPalette", &t->defaultPalette));
|
||||||
oxReturnError(io->field("pal", &t->pal));
|
oxReturnError(io->field("pal", &t->pal));
|
||||||
uint16_t intermediate = 0;
|
uint16_t intermediate = 0;
|
||||||
auto err = io->template field<uint8_t>("tileMap", [t, &intermediate](auto i, uint8_t *tile) {
|
auto handleTileMap = [t, &intermediate](std::size_t i, uint8_t *tile) {
|
||||||
if (i & 1) { // i is odd
|
if (i & 1) { // i is odd
|
||||||
intermediate |= static_cast<uint16_t>(*tile) << 8;
|
intermediate |= static_cast<uint16_t>(*tile) << 8;
|
||||||
t->tileMap[i / 2] = intermediate;
|
t->tileMap[i / 2] = intermediate;
|
||||||
@ -77,8 +79,8 @@ ox::Error modelRead(T *io, GbaTileMapTarget *t) {
|
|||||||
intermediate = *tile & 0x00ff;
|
intermediate = *tile & 0x00ff;
|
||||||
}
|
}
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
});
|
};
|
||||||
return OxError(err);
|
return io->template field<uint8_t, decltype(handleTileMap)>("tileMap", handleTileMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error initGfx(Context*) {
|
ox::Error initGfx(Context*) {
|
||||||
|
Loading…
Reference in New Issue
Block a user