diff --git a/common/include/PS2Eext.h b/common/include/PS2Eext.h index 0011a3e240..be404c231d 100644 --- a/common/include/PS2Eext.h +++ b/common/include/PS2Eext.h @@ -20,17 +20,24 @@ #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) #include #include #include #define EXPORT_C_(type) extern "C" type CALLBACK -#else + +#elif defined(GTK_MAJOR_VERSION) + #include #include #define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type + +#else + +#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type + #endif //#include "PS2Edefs.h" @@ -161,7 +168,7 @@ struct PluginConf } }; -#ifdef __linux__ +#if defined(GTK_MAJOR_VERSION) static void SysMessage(const char *fmt, ...) { @@ -221,6 +228,48 @@ static void __forceinline PluginNullAbout(const char *aboutText) #define ENTRY_POINT /* We don't need no stinkin' entry point! */ + +#elif defined(__WXMAC__) || defined(__APPLE__) + +static void SysMessage(const char *fmt, ...) +{ + va_list list; + char msg[512]; + + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; + + // TODO OSX can we use WX MessageBox here or should Cocoa MessageBox used? +} + +static void SysMessage(const wchar_t *fmt, ...) +{ + va_list list; + wchar_t msg[512]; + + va_start(list, fmt); + //vsprintf(msg, fmt, list); + va_end(list); + + // TODO OSX can we use WX MessageBox here or should Cocoa MessageBox used? +} + +static void __forceinline PluginNullConfigure(std::string desc, int &log) +{ + SysMessage("This space intentionally left blank."); +} + +static void __forceinline PluginNullAbout(const char *aboutText) +{ + SysMessage(aboutText); +} + +#define ENTRY_POINT /* We don't need no stinkin' entry point! */ // TODO OSX WTF is this anyway? + + #else #define usleep(x) Sleep(x / 1000) diff --git a/common/include/Pcsx2Defs.h b/common/include/Pcsx2Defs.h index 1402e19a97..4d69fdadbd 100644 --- a/common/include/Pcsx2Defs.h +++ b/common/include/Pcsx2Defs.h @@ -23,6 +23,14 @@ #define __linux__ #endif +// make sure __POSIX__ is defined for all systems where we assume POSIX +// compliance +#if defined(__linux__) || defined(__APPLE__) || defined(__unix__) || defined(__CYGWIN__) || defined(__LINUX__) +# if !defined(__POSIX__) +# define __POSIX__ 1 +# endif +#endif + #include "Pcsx2Types.h" #ifdef _MSC_VER diff --git a/common/include/Utilities/MemcpyFast.h b/common/include/Utilities/MemcpyFast.h index 4200e22ba6..3efa3bbf2d 100644 --- a/common/include/Utilities/MemcpyFast.h +++ b/common/include/Utilities/MemcpyFast.h @@ -15,7 +15,7 @@ #pragma once -#ifdef __linux__ +#if defined(__POSIX__) # include "lnx_memzero.h" #else # include "win_memzero.h" diff --git a/common/include/Utilities/PageFaultSource.h b/common/include/Utilities/PageFaultSource.h index a22b32b66e..8868c8f3df 100644 --- a/common/include/Utilities/PageFaultSource.h +++ b/common/include/Utilities/PageFaultSource.h @@ -271,7 +271,7 @@ protected: virtual void CommitBlocks( uptr page, uint blocks ); }; -#ifdef __linux__ +#ifdef __POSIX__ # define PCSX2_PAGEFAULT_PROTECT # define PCSX2_PAGEFAULT_EXCEPT diff --git a/common/include/Utilities/Threading.h b/common/include/Utilities/Threading.h index 7751204dbd..e21522ae2e 100644 --- a/common/include/Utilities/Threading.h +++ b/common/include/Utilities/Threading.h @@ -19,6 +19,10 @@ #include // EBUSY #include +#ifdef __APPLE__ +#include +#endif + #include "Pcsx2Defs.h" #include "ScopedPtr.h" #include "TraceLog.h" @@ -66,11 +70,7 @@ extern ConsoleLogSource_Threading pxConLog_Thread; //#define PCSX2_THREAD_LOCAL 0 // uncomment this line to force-disable native TLS (useful for testing TlsVariable on windows/linux) #ifndef PCSX2_THREAD_LOCAL -# ifdef __WXMAC__ -# define PCSX2_THREAD_LOCAL 0 -# else -# define PCSX2_THREAD_LOCAL 1 -# endif +# define PCSX2_THREAD_LOCAL 1 #endif class wxTimeSpan; @@ -252,7 +252,12 @@ namespace Threading class Semaphore { protected: +#ifdef __APPLE__ + semaphore_t m_sema; + int m_counter; +#else sem_t m_sema; +#endif public: Semaphore();