From a5a678df52d1a11f9535b2f45f5b87bb4ce60def Mon Sep 17 00:00:00 2001 From: Solra Bizna Date: Mon, 18 Sep 2017 19:32:47 -0600 Subject: [PATCH] Now compiles without errors on all intended targets --- include/ars-emu.hh | 2 +- include/fxinternal.hh | 1 + include/optimize-this-file.hh | 2 +- include/ppu.hh | 10 +++++----- src/upscale.cc | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/ars-emu.hh b/include/ars-emu.hh index b511888..f17deac 100644 --- a/include/ars-emu.hh +++ b/include/ars-emu.hh @@ -76,7 +76,7 @@ namespace ARS { // $0228-$022F are complex on write uint8_t bankMap[8]; }; - constexpr Regs& Regs() { return *reinterpret_cast(dram+0x0200); } + static inline Regs& Regs() { return *reinterpret_cast(dram+0x0200); } extern class MessageImp { std::ostringstream stream; void outputLine(std::string line, int lifespan_value); diff --git a/include/fxinternal.hh b/include/fxinternal.hh index 0255c5f..877c9e8 100644 --- a/include/fxinternal.hh +++ b/include/fxinternal.hh @@ -4,6 +4,7 @@ #include "fx.hh" #include +#include #define restrict __restrict__ diff --git a/include/optimize-this-file.hh b/include/optimize-this-file.hh index cce2b19..08ac276 100644 --- a/include/optimize-this-file.hh +++ b/include/optimize-this-file.hh @@ -3,6 +3,6 @@ debugging. This is only really necessary in FX implementations. */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC optimize("3","fast-math") #endif diff --git a/include/ppu.hh b/include/ppu.hh index a47f9c0..fd08d71 100644 --- a/include/ppu.hh +++ b/include/ppu.hh @@ -67,13 +67,13 @@ namespace ARS { static constexpr uint8_t FOREGROUND_MASK = 4; uint8_t TileAddr, TilePage; } ssm[NUM_SPRITES]; - constexpr uint8_t* ssmBytes() {return reinterpret_cast(ssm);} + static inline uint8_t* ssmBytes() {return reinterpret_cast(ssm);} static_assert(sizeof(SpriteState) == 4, "Sprite size has slipped"); // HHHHHPPP // H = tile height-1, range 1..32 (8..128) typedef uint8_t SpriteAttr; extern SpriteAttr sam[NUM_SPRITES]; - constexpr uint8_t* samBytes() {return sam;} + static inline uint8_t* samBytes() {return sam;} constexpr uint8_t SA_HEIGHT_SHIFT = 3; constexpr uint8_t SA_HEIGHT_MASK = 0x1F; constexpr uint8_t SA_PALETTE_SHIFT = 0; @@ -88,13 +88,13 @@ namespace ARS { * MODE1_BACKGROUND_TILES_HIGH / 16]; uint8_t padding[4]; }; - constexpr struct Background_Mode1* backgrounds_mode1() { + static inline struct Background_Mode1* backgrounds_mode1() { return reinterpret_cast(vram); } struct Background_Mode2 { uint8_t Tiles[MODE2_BACKGROUND_TILES_WIDE * MODE2_BACKGROUND_TILES_HIGH]; }; - constexpr struct Background_Mode2* backgrounds_mode2() { + static inline struct Background_Mode2* backgrounds_mode2() { return reinterpret_cast(vram); } static_assert(sizeof(Background_Mode1)==0x400, "Background size slipped"); @@ -104,7 +104,7 @@ namespace ARS { uint8_t Attributes[OVERLAY_TILES_WIDE*OVERLAY_TILES_HIGH/8]; uint8_t padding[16]; }; - constexpr struct Overlay& overlay() { + static inline struct Overlay& overlay() { return *reinterpret_cast(ARS::dram+sizeof(ARS::dram) -sizeof(struct Overlay)); } diff --git a/src/upscale.cc b/src/upscale.cc index 61e3d6d..26b908a 100644 --- a/src/upscale.cc +++ b/src/upscale.cc @@ -113,16 +113,16 @@ Upscaler::~Upscaler() { } const SN::ConstKey Upscaler::SIGNAL_TYPE_SELECTOR = "VIDEO_SIGNAL_TYPE"_Key; -const std::array Upscaler::SIGNAL_TYPE_KEYS{ +const std::array Upscaler::SIGNAL_TYPE_KEYS{{ "VIDEO_SIGNAL_TYPE_COMPONENT"_Key, "VIDEO_SIGNAL_TYPE_SVIDEO"_Key, "VIDEO_SIGNAL_TYPE_COMPOSITE"_Key, -}; +}}; const SN::ConstKey Upscaler::UPSCALE_TYPE_SELECTOR = "VIDEO_UPSCALE_TYPE"_Key; -const std::array Upscaler::UPSCALE_TYPE_KEYS{ +const std::arrayUpscaler::UPSCALE_TYPE_KEYS{{ "VIDEO_UPSCALE_TYPE_NONE"_Key, "VIDEO_UPSCALE_TYPE_SMOOTH"_Key, "VIDEO_UPSCALE_TYPE_SCANLINES_CRISP"_Key, "VIDEO_UPSCALE_TYPE_SCANLINES_BRIGHT"_Key, -}; +}};