[nostalgia] Fix Mac build

This commit is contained in:
Gary Talent 2020-05-09 18:44:37 -05:00
parent 819959745d
commit 86652ca8d4
6 changed files with 12 additions and 7 deletions

View File

@ -25,11 +25,14 @@ constexpr auto GBA_TILE_COLUMNS = 32;
constexpr auto GBA_TILE_ROWS = 32; constexpr auto GBA_TILE_ROWS = 32;
struct GbaPaletteTarget { struct GbaPaletteTarget {
static constexpr auto TypeName = NostalgiaPalette::TypeName;
static constexpr auto Fields = NostalgiaPalette::Fields;
volatile uint16_t *palette = nullptr; volatile uint16_t *palette = nullptr;
}; };
struct GbaTileMapTarget { struct GbaTileMapTarget {
static constexpr auto Fields = 4; static constexpr auto TypeName = NostalgiaGraphic::TypeName;
static constexpr auto Fields = NostalgiaGraphic::Fields;
volatile uint32_t *bgCtl = nullptr; volatile uint32_t *bgCtl = nullptr;
ox::FileAddress defaultPalette; ox::FileAddress defaultPalette;
GbaPaletteTarget pal; GbaPaletteTarget pal;
@ -38,7 +41,7 @@ struct GbaTileMapTarget {
template<typename T> template<typename T>
ox::Error modelRead(T *io, GbaPaletteTarget *t) { ox::Error modelRead(T *io, GbaPaletteTarget *t) {
io->setTypeInfo("nostalgia::core::NostalgiaPalette", NostalgiaPalette::Fields); io->template setTypeInfo<T>();
oxReturnError(io->template field<Color16>("colors", [t](auto i, Color16 *c) { oxReturnError(io->template field<Color16>("colors", [t](auto i, Color16 *c) {
t->palette[i] = *c; t->palette[i] = *c;
return OxError(0); return OxError(0);
@ -48,7 +51,7 @@ ox::Error modelRead(T *io, GbaPaletteTarget *t) {
template<typename T> template<typename T>
ox::Error modelRead(T *io, GbaTileMapTarget *t) { ox::Error modelRead(T *io, GbaTileMapTarget *t) {
io->setTypeInfo("nostalgia::core::NostalgiaGraphic", NostalgiaGraphic::Fields); io->template setTypeInfo<T>();
uint8_t bpp; uint8_t bpp;
int dummy; int dummy;

View File

@ -30,12 +30,14 @@ using Color32 = uint32_t;
struct NostalgiaPalette { struct NostalgiaPalette {
static constexpr auto TypeName = "nostalgia::core::NostalgiaPalette"; static constexpr auto TypeName = "nostalgia::core::NostalgiaPalette";
static constexpr auto Fields = 1; static constexpr auto Fields = 1;
static constexpr auto TypeVersion = 1;
ox::Vector<Color16> colors; ox::Vector<Color16> colors;
}; };
struct NostalgiaGraphic { struct NostalgiaGraphic {
static constexpr auto TypeName = "nostalgia::core::NostalgiaGraphic"; static constexpr auto TypeName = "nostalgia::core::NostalgiaGraphic";
static constexpr auto Fields = 6; static constexpr auto Fields = 6;
static constexpr auto TypeVersion = 1;
int8_t bpp = 0; int8_t bpp = 0;
// rows and columns are really only used by TileSheetEditor // rows and columns are really only used by TileSheetEditor
int rows = 1; int rows = 1;

View File

@ -19,7 +19,7 @@ namespace nostalgia::core {
NewTilesheetWizardPage::NewTilesheetWizardPage(const studio::Context *ctx) { NewTilesheetWizardPage::NewTilesheetWizardPage(const studio::Context *ctx) {
m_ctx = ctx; m_ctx = ctx;
addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [this](QString) { addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [](QString) {
return 0; return 0;
}); });
m_palettePicker = addComboBox(tr("&Palette:"), QString(Palette) + "*", {""}); m_palettePicker = addComboBox(tr("&Palette:"), QString(Palette) + "*", {""});

View File

@ -20,7 +20,7 @@ namespace nostalgia::core {
NewPaletteWizardPage::NewPaletteWizardPage(const studio::Context *ctx) { NewPaletteWizardPage::NewPaletteWizardPage(const studio::Context *ctx) {
m_ctx = ctx; m_ctx = ctx;
addLineEdit(tr("&Palette Name:"), QString(PaletteName) + "*", "", [this](QString) { addLineEdit(tr("&Palette Name:"), QString(PaletteName) + "*", "", [](QString) {
return 0; return 0;
}); });
} }

View File

@ -23,7 +23,7 @@ char *loadRom(const char *path) {
const auto size = file.tellg(); const auto size = file.tellg();
file.seekg(0, std::ios::beg); file.seekg(0, std::ios::beg);
auto buff = new char[size]; auto buff = new char[static_cast<std::size_t>(size)];
file.read(buff, size); file.read(buff, size);
return buff; return buff;
} }

View File

@ -14,7 +14,7 @@ using namespace common;
using namespace core; using namespace core;
ox::Error Zone::init(Context *ctx, Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette) { ox::Error Zone::init(Context *ctx, Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette) {
const auto size = bnds.width * bnds.height; const auto size = static_cast<std::size_t>(bnds.width * bnds.height);
m_tiles = new Tile[size]; m_tiles = new Tile[size];
m_bounds = bnds; m_bounds = bnds;
return core::loadTileSheet(ctx, core::TileSheetSpace::Background, 0, tileSheet, palette); return core::loadTileSheet(ctx, core::TileSheetSpace::Background, 0, tileSheet, palette);