From 4fa8834de47563c2a9f77f8e003fd3f92980067e Mon Sep 17 00:00:00 2001 From: Juha Laukkanen Date: Tue, 17 Nov 2015 20:59:53 +0200 Subject: [PATCH] Darwin/OSX ifdef __APPLE__ or __WXMAC__ cases. OSX comment about __WXMAC__ usage --- pcsx2/DebugTools/Debug.h | 8 +++++++ pcsx2/IPU/yuv2rgb.cpp | 8 ++++++- pcsx2/gui/AppMain.cpp | 17 +++++++++++++- pcsx2/x86/aVUzerorec.S | 49 +++++++++++++++++++++++++++++++--------- 4 files changed, 69 insertions(+), 13 deletions(-) diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index a55c0080ac..f6f6149aa6 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -335,6 +335,14 @@ extern void __Log( const char* fmt, ... ); # define SysTraceActive(trace) (false) #endif +#ifdef __WXMAC__ + // Not available on OSX, apparently always double buffered window. +# define SetDoubleBuffered(x) + + // TODO OSX OsxKeyCodes.cpp pending +# define NewPipeRedir(x) NULL +#endif + #define macTrace(trace) SysTraceActive(trace) && SysTrace.trace.Write #define SIF_LOG macTrace(SIF) diff --git a/pcsx2/IPU/yuv2rgb.cpp b/pcsx2/IPU/yuv2rgb.cpp index 065cb35a20..5fae01f7b6 100644 --- a/pcsx2/IPU/yuv2rgb.cpp +++ b/pcsx2/IPU/yuv2rgb.cpp @@ -58,7 +58,13 @@ void yuv2rgb_reference(void) } } -#ifdef _M_X86_32 +// TODO OSX optimize me +#ifdef __APPLE__ +void yuv2rgb_sse2() { + yuv2rgb_reference(); +} + +#elif defined(_M_X86_32) // Everything below is bit accurate to the IPU specification (except maybe rounding). // Know the specification before you touch it. #define SSE_BYTES(x) {x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x} diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 3f4ecd5a5d..854566e7b8 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -50,6 +50,19 @@ #include #endif +// Safe to remove these lines when this is handled properly. +#ifdef __WXMAC__ +// Great joy.... +#undef EBP +#undef ESP +#undef EDI +#undef ESI +#undef EDX +#undef EAX +#undef EBX +#undef ECX +#include // needed to implement the app! +#endif IMPLEMENT_APP(Pcsx2App) @@ -277,6 +290,8 @@ void Pcsx2App::PadKeyDispatch( const keyEvent& ev ) //returns 0 for normal keys and a WXK_* value for special keys #ifdef __WXMSW__ const int vkey = TranslateVKToWXK(ev.key); +#elif defined( __WXMAC__ ) + const int vkey = wxCharCodeWXToOSX( (wxKeyCode) ev.key ); #elif defined( __WXGTK__ ) const int vkey = TranslateGDKtoWXK( ev.key ); #else @@ -415,7 +430,7 @@ public: return Path::Combine( GetDataDir(), L"Langs" ); } -#ifdef __linux__ +#ifdef __POSIX__ wxString GetUserLocalDataDir() const { // I got memory corruption inside wxGetEnv when I heavily toggle the GS renderer (F9). It seems wxGetEnv diff --git a/pcsx2/x86/aVUzerorec.S b/pcsx2/x86/aVUzerorec.S index 472eeacb3b..37cd85b658 100644 --- a/pcsx2/x86/aVUzerorec.S +++ b/pcsx2/x86/aVUzerorec.S @@ -1,7 +1,34 @@ // iVUzerorec.cpp assembly routines // zerofrog(@gmail.com) -.intel_syntax noprefix + +#ifdef __APPLE__ + #define svudispfntemp _svudispfntemp + #define s_TotalVUCycles _s_TotalVUCycles + #define s_callstack _s_callstack + #define s_vu1ebp _s_vu1ebp + #define s_vu1esp _s_vu1esp + #define s_vu1esi _s_vu1esi + #define s_vuedi _s_vuedi + #define s_vuebx _s_vuebx + #define s_saveebx _s_saveebx + #define s_saveecx _s_saveecx + #define s_saveedx _s_saveedx + #define s_saveesi _s_saveesi + #define s_saveedi _s_saveedi + #define s_saveebp _s_saveebp + #define s_writeQ _s_writeQ + #define s_writeP _s_writeP + #define g_curdebugvu _g_curdebugvu + #define SuperVUGetProgram _SuperVUGetProgram + #define SuperVUCleanupProgram _SuperVUCleanupProgram + #define SuperVUExecuteProgram _SuperVUExecuteProgram + #define SuperVUEndProgram _SuperVUEndProgram + #define g_sseVUMXCSR _g_sseVUMXCSR + #define g_sseMXCSR _g_sseMXCSR +#endif + +.intel_syntax noprefix .extern s_TotalVUCycles .extern s_callstack .extern s_vu1esp @@ -26,7 +53,7 @@ SuperVUExecuteProgram: mov s_vuebx, ebx mov s_vu1esp, esp - and esp, -16 // align stack for GCC compilance + and esp, -16 // align stack for GCC compilance ldmxcsr g_sseVUMXCSR mov dword ptr s_writeQ, 0xffffffff @@ -35,17 +62,17 @@ SuperVUExecuteProgram: .globl SuperVUEndProgram SuperVUEndProgram: - // restore cpu state - ldmxcsr g_sseMXCSR - mov esi, s_vu1esi - mov edi, s_vuedi - mov ebx, s_vuebx - + // restore cpu state + ldmxcsr g_sseMXCSR + mov esi, s_vu1esi + mov edi, s_vuedi + mov ebx, s_vuebx + mov esp, s_vu1esp - call SuperVUCleanupProgram - jmp [s_callstack] // so returns correctly + call SuperVUCleanupProgram + jmp [s_callstack] // so returns correctly -#if defined(__linux__) && defined(__ELF__) +#if defined(__POSIX__) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif