From f707af34dbc707d4cfc769a8ce59e65689a8b46a Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 12 Jul 2023 14:12:03 -0700 Subject: [PATCH] move `override` macro to `compat.h` --- LEGO1/compat.h | 9 ++++++++- LEGO1/legostream.h | 3 ++- LEGO1/mxcore.h | 5 +++-- LEGO1/mxthread.h | 3 ++- LEGO1/mxtypes.h | 4 ---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/LEGO1/compat.h b/LEGO1/compat.h index 496fa4db..7d76dfd0 100644 --- a/LEGO1/compat.h +++ b/LEGO1/compat.h @@ -11,4 +11,11 @@ #define COMPAT_CONST #endif -#endif // ISLECOMPAT_H \ No newline at end of file +// We use `override` so newer compilers can tell us our vtables are valid, +// however this keyword was added in C++11, so we define it as empty for +// compatibility with older compilers. +#if defined(_MSC_VER) && _MSC_VER <= 1200 // 1200 corresponds to VC6.0 but "override" was probably added even later +#define override +#endif + +#endif // ISLECOMPAT_H diff --git a/LEGO1/legostream.h b/LEGO1/legostream.h index a505cd54..ca110f01 100644 --- a/LEGO1/legostream.h +++ b/LEGO1/legostream.h @@ -1,6 +1,7 @@ #ifndef LEGOSTREAM_H #define LEGOSTREAM_H +#include "compat.h" #include "decomp.h" #include "mxtypes.h" @@ -70,4 +71,4 @@ class LegoMemoryStream : public LegoStream MxU32 m_offset; }; -#endif // LEGOSTREAM_H \ No newline at end of file +#endif // LEGOSTREAM_H diff --git a/LEGO1/mxcore.h b/LEGO1/mxcore.h index 5e6586ba..9fb3e689 100644 --- a/LEGO1/mxcore.h +++ b/LEGO1/mxcore.h @@ -3,6 +3,7 @@ #include +#include "compat.h" #include "mxtypes.h" class MxParam; @@ -14,8 +15,8 @@ class MxCore public: __declspec(dllexport) MxCore(); __declspec(dllexport) virtual ~MxCore(); // vtable+00 - __declspec(dllexport) virtual MxLong Notify(MxParam &p); // vtable+04 - virtual MxLong Tickle(); // vtable+08 + __declspec(dllexport) virtual MxResult Notify(MxParam &p); // vtable+04 + virtual MxResult Tickle(); // vtable+08 // OFFSET: LEGO1 0x100144c0 inline virtual const char *ClassName() const // vtable+0c diff --git a/LEGO1/mxthread.h b/LEGO1/mxthread.h index 6ac96b59..4537dc14 100644 --- a/LEGO1/mxthread.h +++ b/LEGO1/mxthread.h @@ -1,6 +1,7 @@ #ifndef MXTHREAD_H #define MXTHREAD_H +#include "compat.h" #include "mxtypes.h" #include "mxsemaphore.h" @@ -54,4 +55,4 @@ class MxTickleThread : public MxThread MxS32 m_frequencyMS; }; -#endif // MXTHREAD_H \ No newline at end of file +#endif // MXTHREAD_H diff --git a/LEGO1/mxtypes.h b/LEGO1/mxtypes.h index 8a7d5026..d17ac09a 100644 --- a/LEGO1/mxtypes.h +++ b/LEGO1/mxtypes.h @@ -39,8 +39,4 @@ typedef MxU8 MxBool; #define FALSE 0 #endif -#if defined(_MSC_VER) && _MSC_VER <= 1200 // 1200 corresponds to VC6.0 but "override" was probably added even later -#define override -#endif - #endif // MXTYPE_H