From 86652ca8d427fb94b996bb75a4dd1f9178060724 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 9 May 2020 18:44:37 -0500 Subject: [PATCH] [nostalgia] Fix Mac build --- src/nostalgia/core/gba/gfx.cpp | 9 ++++++--- src/nostalgia/core/gfx.hpp | 2 ++ src/nostalgia/core/studio/new_tilesheet_wizard.cpp | 2 +- src/nostalgia/core/studio/newpalettewizard.cpp | 2 +- src/nostalgia/core/userland/media.cpp | 2 +- src/nostalgia/world/world.cpp | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/nostalgia/core/gba/gfx.cpp b/src/nostalgia/core/gba/gfx.cpp index 4ab5d7aa..8d7d1eaf 100644 --- a/src/nostalgia/core/gba/gfx.cpp +++ b/src/nostalgia/core/gba/gfx.cpp @@ -25,11 +25,14 @@ constexpr auto GBA_TILE_COLUMNS = 32; constexpr auto GBA_TILE_ROWS = 32; struct GbaPaletteTarget { + static constexpr auto TypeName = NostalgiaPalette::TypeName; + static constexpr auto Fields = NostalgiaPalette::Fields; volatile uint16_t *palette = nullptr; }; struct GbaTileMapTarget { - static constexpr auto Fields = 4; + static constexpr auto TypeName = NostalgiaGraphic::TypeName; + static constexpr auto Fields = NostalgiaGraphic::Fields; volatile uint32_t *bgCtl = nullptr; ox::FileAddress defaultPalette; GbaPaletteTarget pal; @@ -38,7 +41,7 @@ struct GbaTileMapTarget { template ox::Error modelRead(T *io, GbaPaletteTarget *t) { - io->setTypeInfo("nostalgia::core::NostalgiaPalette", NostalgiaPalette::Fields); + io->template setTypeInfo(); oxReturnError(io->template field("colors", [t](auto i, Color16 *c) { t->palette[i] = *c; return OxError(0); @@ -48,7 +51,7 @@ ox::Error modelRead(T *io, GbaPaletteTarget *t) { template ox::Error modelRead(T *io, GbaTileMapTarget *t) { - io->setTypeInfo("nostalgia::core::NostalgiaGraphic", NostalgiaGraphic::Fields); + io->template setTypeInfo(); uint8_t bpp; int dummy; diff --git a/src/nostalgia/core/gfx.hpp b/src/nostalgia/core/gfx.hpp index e1768d3b..3a5ec863 100644 --- a/src/nostalgia/core/gfx.hpp +++ b/src/nostalgia/core/gfx.hpp @@ -30,12 +30,14 @@ using Color32 = uint32_t; struct NostalgiaPalette { static constexpr auto TypeName = "nostalgia::core::NostalgiaPalette"; static constexpr auto Fields = 1; + static constexpr auto TypeVersion = 1; ox::Vector colors; }; struct NostalgiaGraphic { static constexpr auto TypeName = "nostalgia::core::NostalgiaGraphic"; static constexpr auto Fields = 6; + static constexpr auto TypeVersion = 1; int8_t bpp = 0; // rows and columns are really only used by TileSheetEditor int rows = 1; diff --git a/src/nostalgia/core/studio/new_tilesheet_wizard.cpp b/src/nostalgia/core/studio/new_tilesheet_wizard.cpp index 9ed171f8..6b9642de 100644 --- a/src/nostalgia/core/studio/new_tilesheet_wizard.cpp +++ b/src/nostalgia/core/studio/new_tilesheet_wizard.cpp @@ -19,7 +19,7 @@ namespace nostalgia::core { NewTilesheetWizardPage::NewTilesheetWizardPage(const studio::Context *ctx) { m_ctx = ctx; - addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [this](QString) { + addLineEdit(tr("&Tile Sheet Name:"), QString(TileSheetName) + "*", "", [](QString) { return 0; }); m_palettePicker = addComboBox(tr("&Palette:"), QString(Palette) + "*", {""}); diff --git a/src/nostalgia/core/studio/newpalettewizard.cpp b/src/nostalgia/core/studio/newpalettewizard.cpp index b2475847..07417f15 100644 --- a/src/nostalgia/core/studio/newpalettewizard.cpp +++ b/src/nostalgia/core/studio/newpalettewizard.cpp @@ -20,7 +20,7 @@ namespace nostalgia::core { NewPaletteWizardPage::NewPaletteWizardPage(const studio::Context *ctx) { m_ctx = ctx; - addLineEdit(tr("&Palette Name:"), QString(PaletteName) + "*", "", [this](QString) { + addLineEdit(tr("&Palette Name:"), QString(PaletteName) + "*", "", [](QString) { return 0; }); } diff --git a/src/nostalgia/core/userland/media.cpp b/src/nostalgia/core/userland/media.cpp index 15cfde9f..512365c6 100644 --- a/src/nostalgia/core/userland/media.cpp +++ b/src/nostalgia/core/userland/media.cpp @@ -23,7 +23,7 @@ char *loadRom(const char *path) { const auto size = file.tellg(); file.seekg(0, std::ios::beg); - auto buff = new char[size]; + auto buff = new char[static_cast(size)]; file.read(buff, size); return buff; } diff --git a/src/nostalgia/world/world.cpp b/src/nostalgia/world/world.cpp index 1bb73d08..c9ce60cc 100644 --- a/src/nostalgia/world/world.cpp +++ b/src/nostalgia/world/world.cpp @@ -14,7 +14,7 @@ using namespace common; using namespace core; 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(bnds.width * bnds.height); m_tiles = new Tile[size]; m_bounds = bnds; return core::loadTileSheet(ctx, core::TileSheetSpace::Background, 0, tileSheet, palette);