From 8009863daa77de8046ad6eb226bf682a44e9deee Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 2 Apr 2009 18:37:21 +0000 Subject: [PATCH] see if this fixes the build in non-windows --- desmume/src/NDSSystem.cpp | 4 ++-- desmume/src/types.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 3d5b04bb1..fa910a8a1 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -2226,8 +2226,8 @@ std::string MakeInputDisplayString(u16 pad, u16 padExt) { const std::string Buttons[] = {"A", "B", "Sl", "St", "R", "L", "U", "D", "Rs", "Ls"}; const std::string Ext[] = {"X", "Y"}; - std::string s = MakeInputDisplayString(pad, Ext, ARRAYSIZE(Ext)); - s += MakeInputDisplayString(padExt, Buttons, ARRAYSIZE(Buttons)); + std::string s = MakeInputDisplayString(pad, Ext, ARRAY_SIZE(Ext)); + s += MakeInputDisplayString(padExt, Buttons, ARRAY_SIZE(Buttons)); return s; } diff --git a/desmume/src/types.h b/desmume/src/types.h index ba77eba99..5fd012b94 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -332,5 +332,15 @@ inline u16 de16lsb(u8 *morp) return morp[0]|(morp[1]<<8); } +#ifndef ARRAY_SIZE +//taken from winnt.h +extern "C++" // templates cannot be declared to have 'C' linkage +template +char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N]; + +#define ARRAY_SIZE(A) (sizeof(*BLAHBLAHBLAH(A))) +#endif + + #endif