diff --git a/SConstruct b/SConstruct index a1567dc4ca..13265150ae 100644 --- a/SConstruct +++ b/SConstruct @@ -344,7 +344,7 @@ dirs = [ 'Source/Core/VideoUICommon/Src', 'Source/DSPTool/Src', 'Source/Plugins/Plugin_VideoOGL/Src', - #'Source/Plugins/Plugin_VideoSoftware/Src', + 'Source/Plugins/Plugin_VideoSoftware/Src', 'Source/UnitTests', ] diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index 0238b14008..fe9586f427 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -19,6 +19,12 @@ #include "Thread.h" #include "Common.h" +#ifdef __APPLE__ +#include +#elif defined BSD4_4 +#include +#endif + #ifdef USE_BEGINTHREADEX #include #endif @@ -30,6 +36,8 @@ int CurrentThreadId() { #ifdef _WIN32 return GetCurrentThreadId(); +#elif defined __APPLE__ + return mach_thread_self(); #else return 0; #endif @@ -263,10 +271,12 @@ void SetCurrentThreadAffinity(u32 mask) #else // !WIN32, so must be POSIX threads -void LinuxSetThreadAffinity(pthread_t thread, u32 mask) -{ - // This is non-standard -#ifdef __linux__ +void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) +{ +#ifdef __APPLE__ + thread_policy_set(pthread_mach_thread_np(thread), + THREAD_AFFINITY_POLICY, (integer_t *)&mask, 1); +#elif defined __linux__ || defined BSD4_4 cpu_set_t cpu_set; CPU_ZERO(&cpu_set); @@ -278,14 +288,9 @@ void LinuxSetThreadAffinity(pthread_t thread, u32 mask) #endif } -void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) -{ - LinuxSetThreadAffinity(thread, mask); -} - void SetCurrentThreadAffinity(u32 mask) { - LinuxSetThreadAffinity(pthread_self(), mask); + SetThreadAffinity(pthread_self(), mask); } static pthread_key_t threadname_key; diff --git a/Source/Core/DiscIO/Src/FileMonitor.cpp b/Source/Core/DiscIO/Src/FileMonitor.cpp index c5ef5c45c5..822c010364 100644 --- a/Source/Core/DiscIO/Src/FileMonitor.cpp +++ b/Source/Core/DiscIO/Src/FileMonitor.cpp @@ -101,7 +101,7 @@ void CheckFile(std::string File, u64 Size) std::string Str = StringFromFormat("%s kB %s", ThousandSeparate(Size, 7).c_str(), File.c_str()); if (ShowSound(File)) { - NOTICE_LOG(FILEMON, "%s", Str.c_str()); + INFO_LOG(FILEMON, "%s", Str.c_str()); } else { diff --git a/Source/Plugins/CMakeLists.txt b/Source/Plugins/CMakeLists.txt index 50a5dfab01..619e00ded1 100644 --- a/Source/Plugins/CMakeLists.txt +++ b/Source/Plugins/CMakeLists.txt @@ -1,3 +1,3 @@ add_subdirectory(Plugin_VideoOGL) -#add_subdirectory(Plugin_VideoSoftware) +add_subdirectory(Plugin_VideoSoftware) # TODO: Add other plugins here! diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index d1c0bd2d01..7c9f91a992 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -22,10 +22,6 @@ if(wxWidgets_FOUND) set(LIBS videouicommon ${LIBS} ${wxWidgets_LIBRARIES}) endif(wxWidgets_FOUND) -if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) - set(SRCS ${SRCS} Src/cocoaGL.m) -endif() - if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LIBS ${LIBS} Cg CgGL) endif() diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index f23393f7ce..35a440e788 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -48,7 +48,7 @@ void OpenGL_SwapBuffers() #if defined(USE_WX) && USE_WX GLWin.glCanvas->SwapBuffers(); #elif defined(__APPLE__) - [GLWin.cocoaCtx flushBuffer]; + [GLWin.cocoaCtx flushBuffer]; #elif defined(_WIN32) SwapBuffers(hDC); #elif defined(HAVE_X11) && HAVE_X11 @@ -322,7 +322,7 @@ void XEventThread() // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() bool OpenGL_Create(int _iwidth, int _iheight) { - int _tx, _ty, _twidth, _theight; + int _tx, _ty, _twidth, _theight; Core::Callback_VideoGetWindowSize(_tx, _ty, _twidth, _theight); // Control window size and picture scaling @@ -342,7 +342,7 @@ bool OpenGL_Create(int _iwidth, int _iheight) NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: attr]; if (fmt == nil) { - printf("failed to create pixel format\n"); + ERROR_LOG(VIDEO, "failed to create pixel format"); return NULL; } @@ -350,16 +350,18 @@ bool OpenGL_Create(int _iwidth, int _iheight) initWithFormat: fmt shareContext: nil]; [fmt release]; if (GLWin.cocoaCtx == nil) { - printf("failed to create context\n"); + ERROR_LOG(VIDEO, "failed to create context"); return NULL; } - GLWin.cocoaWin = [[NSWindow alloc] - initWithContentRect: NSMakeRect(50, 50, _twidth, _theight) - styleMask: NSTitledWindowMask | NSResizableWindowMask - backing: NSBackingStoreBuffered defer: FALSE]; - [GLWin.cocoaWin setReleasedWhenClosed: YES]; - [GLWin.cocoaWin makeKeyAndOrderFront: nil]; + (void)VideoWindowHandle; + CGDisplayCapture(CGMainDisplayID()); + GLWin.cocoaWin = [[NSWindow alloc] + initWithContentRect: [[NSScreen mainScreen] frame] + styleMask: NSBorderlessWindowMask + backing: NSBackingStoreBuffered defer: NO]; + [GLWin.cocoaWin makeKeyAndOrderFront: nil]; + [GLWin.cocoaWin setLevel: CGShieldingWindowLevel()]; [GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]]; #elif defined(_WIN32) @@ -583,9 +585,9 @@ void OpenGL_Shutdown() // XXX GLWin.glCanvas->Destroy(); // XXX delete GLWin.glCtxt; #elif defined(__APPLE__) - [GLWin.cocoaWin close]; - [GLWin.cocoaCtx clearDrawable]; - [GLWin.cocoaCtx release]; + [GLWin.cocoaWin close]; + [GLWin.cocoaCtx clearDrawable]; + [GLWin.cocoaCtx release]; #elif defined(_WIN32) if (hRC) // Do We Have A Rendering Context? { diff --git a/Source/Plugins/Plugin_VideoSoftware/CMakeLists.txt b/Source/Plugins/Plugin_VideoSoftware/CMakeLists.txt index 7955e5f9e9..87d6eff617 100644 --- a/Source/Plugins/Plugin_VideoSoftware/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoSoftware/CMakeLists.txt @@ -35,11 +35,11 @@ set(LIBS videocommon ${X11_LIBRARIES} ${wxWidgets_LIBRARIES}) -if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) - set(SRCS ${SRCS} Src/cocoaGL.m) -elseif(WIN32) +if(WIN32) set(SRCS ${SRCS} Src/Win32.cpp) -elseif(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) +endif() + +if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) set(LIBS ${LIBS} clrun) endif() diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp index 3c0b0418e3..3b204aa4d7 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp @@ -81,7 +81,7 @@ void BPWritten(int address, int newvalue) break; case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bpmem.petokenint & 0xFFFF)); - PixelEngine::SetToken(static_cast(bpmem.petokenint & 0xFFFF), TRUE); + PixelEngine::SetToken(static_cast(bpmem.petokenint & 0xFFFF), true); break; case BPMEM_TRIGGER_EFB_COPY: EfbCopy::CopyEfb();