[nostalgia/core] Expand conversion system to allow raw-to-raw

This commit is contained in:
2022-02-17 21:29:46 -06:00
parent fba203a1e7
commit b87c2f0c50
5 changed files with 129 additions and 122 deletions
+2 -6
View File
@@ -29,8 +29,8 @@ struct GbaPaletteTarget {
};
struct GbaTileMapTarget {
static constexpr auto TypeName = TileSheet::TypeName;
static constexpr auto TypeVersion = TileSheet::TypeVersion;
static constexpr auto TypeName = CompactTileSheet::TypeName;
static constexpr auto TypeVersion = CompactTileSheet::TypeVersion;
volatile uint16_t *bgCtl = nullptr;
ox::FileAddress defaultPalette;
GbaPaletteTarget pal;
@@ -51,10 +51,7 @@ template<typename T>
constexpr ox::Error modelRead(T *io, GbaTileMapTarget *t) noexcept {
io->template setTypeInfo<GbaTileMapTarget>();
uint8_t bpp;
int dummy;
oxReturnError(io->field("bpp", &bpp));
oxReturnError(io->field("rows", &dummy));
oxReturnError(io->field("columns", &dummy));
constexpr auto Bpp8 = 1 << 7;
if (t->bgCtl) {
*t->bgCtl = (28 << 8) | 1;
@@ -65,7 +62,6 @@ constexpr ox::Error modelRead(T *io, GbaTileMapTarget *t) noexcept {
}
}
oxReturnError(io->field("defaultPalette", &t->defaultPalette));
oxReturnError(io->field("pal", &t->pal));
uint16_t intermediate = 0;
const auto handleTileMap = [t, &intermediate](std::size_t i, uint8_t *tile) {
if (i & 1) { // i is odd