From 5254d7143a1a77275f41fd5ae4e0791ac32f0da2 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sat, 14 Feb 2015 02:26:02 +0000 Subject: [PATCH] Cocoa Port: - Fix some compiling issues if the C++ standard library is set to libc++ w/ C++11 support instead of libstdc++. - Fix some compiling issues if compiling on OS X Leopard w/ Xcode 3.1.4. --- desmume/src/cocoa/cocoa_firmware.h | 3 ++- desmume/src/cocoa/macosx_10_5_compat.cpp | 8 +++++++- .../cocoa/userinterface/DisplayWindowController.mm | 9 +++++++-- desmume/src/cocoa/userinterface/InputManager.h | 13 ++++++++++--- desmume/src/cocoa/userinterface/InputManager.mm | 6 ++++-- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/desmume/src/cocoa/cocoa_firmware.h b/desmume/src/cocoa/cocoa_firmware.h index ff56a3af1..9e2b1aa49 100644 --- a/desmume/src/cocoa/cocoa_firmware.h +++ b/desmume/src/cocoa/cocoa_firmware.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ */ #import +#include /******************************************************************************************** diff --git a/desmume/src/cocoa/macosx_10_5_compat.cpp b/desmume/src/cocoa/macosx_10_5_compat.cpp index a4b843a10..5e07eb109 100644 --- a/desmume/src/cocoa/macosx_10_5_compat.cpp +++ b/desmume/src/cocoa/macosx_10_5_compat.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,6 +15,10 @@ along with the this software. If not, see . */ +#include + +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5 + #include #include @@ -88,3 +92,5 @@ template wistream& wistream::_M_extract(void*&); #endif _GLIBCXX_END_NAMESPACE + +#endif diff --git a/desmume/src/cocoa/userinterface/DisplayWindowController.mm b/desmume/src/cocoa/userinterface/DisplayWindowController.mm index f08d0f3e1..78a2f34d9 100644 --- a/desmume/src/cocoa/userinterface/DisplayWindowController.mm +++ b/desmume/src/cocoa/userinterface/DisplayWindowController.mm @@ -35,8 +35,10 @@ #if defined(__ppc__) || defined(__ppc64__) #include -#else +#elif !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6) #include +#else +#include #endif @@ -67,8 +69,11 @@ #if defined(__ppc__) || defined(__ppc64__) static std::map _screenMap; // Key = NSScreen object pointer, Value = DisplayWindowController object pointer -#else +#elif !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6) static std::tr1::unordered_map _screenMap; // Key = NSScreen object pointer, Value = DisplayWindowController object pointer +#else +static std::unordered_map _screenMap; // Key = NSScreen object pointer, Value = DisplayWindowController object pointer + #endif - (id)initWithWindowNibName:(NSString *)windowNibName emuControlDelegate:(EmuControllerDelegate *)theEmuController diff --git a/desmume/src/cocoa/userinterface/InputManager.h b/desmume/src/cocoa/userinterface/InputManager.h index 672073614..2e78e4667 100644 --- a/desmume/src/cocoa/userinterface/InputManager.h +++ b/desmume/src/cocoa/userinterface/InputManager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 DeSmuME Team + Copyright (C) 2013-2015 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +22,10 @@ #if defined(__ppc__) || defined(__ppc64__) #include -#else +#elif !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6) #include +#else +#include #endif #include #include @@ -93,11 +95,16 @@ typedef std::map InputCommandMap; // Key = Input typedef std::map CommandAttributesMap; // Key = Command Tag, Value = CommandAttributes typedef std::map CommandSelectorMap; // Key = Command Tag, Value = Obj-C Selector typedef std::map AudioFileSampleGeneratorMap; // Key = File path to audio file, Value = AudioSampleBlockGenerator -#else +#elif !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6) typedef std::tr1::unordered_map InputCommandMap; // Key = Input key in deviceCode:elementCode format, Value = CommandAttributes typedef std::tr1::unordered_map CommandAttributesMap; // Key = Command Tag, Value = CommandAttributes typedef std::tr1::unordered_map CommandSelectorMap; // Key = Command Tag, Value = Obj-C Selector typedef std::tr1::unordered_map AudioFileSampleGeneratorMap; // Key = File path to audio file, Value = AudioSampleBlockGenerator +#else +typedef std::unordered_map InputCommandMap; // Key = Input key in deviceCode:elementCode format, Value = CommandAttributes +typedef std::unordered_map CommandAttributesMap; // Key = Command Tag, Value = CommandAttributes +typedef std::unordered_map CommandSelectorMap; // Key = Command Tag, Value = Obj-C Selector +typedef std::unordered_map AudioFileSampleGeneratorMap; // Key = File path to audio file, Value = AudioSampleBlockGenerator #endif #pragma mark - diff --git a/desmume/src/cocoa/userinterface/InputManager.mm b/desmume/src/cocoa/userinterface/InputManager.mm index b9e05d296..0df5e3abf 100644 --- a/desmume/src/cocoa/userinterface/InputManager.mm +++ b/desmume/src/cocoa/userinterface/InputManager.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012-2014 DeSmuME Team + Copyright (C) 2012-2015 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -982,8 +982,10 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen #if defined(__ppc__) || defined(__ppc64__) static std::map keyboardNameTable; // Key = Key code, Value = Key name -#else +#elif !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6) static std::tr1::unordered_map keyboardNameTable; // Key = Key code, Value = Key name +#else +static std::unordered_map keyboardNameTable; // Key = Key code, Value = Key name #endif - (id)init