From 833154f3d827f98506cd19931c7f2dd92f070f05 Mon Sep 17 00:00:00 2001 From: tmator Date: Fri, 15 May 2009 08:55:46 +0000 Subject: [PATCH] osx fixes for nongui and ogl plugin git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3239 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp | 7 +++- Source/Core/DolphinWX/Src/MainNoGUI.cpp | 25 ++++++++++++- Source/Plugins/Plugin_VideoOGL/Src/cocoaGL.m | 1 + Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 39 ++++++++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp index b9c9a2a284..f6bc2ddc81 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Unix.cpp @@ -20,12 +20,14 @@ #include "../EXI_DeviceEthernet.h" #include #include - #include #include #include #include #include +#if !defined(__APPLE__) + #include #include +#endif int fd = -1; bool CEXIETHERNET::deactivate() { @@ -47,8 +49,8 @@ bool CEXIETHERNET::activate() { return false; } struct ifreq ifr; +#if !defined(__APPLE__) int err; - memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TAP; @@ -61,6 +63,7 @@ bool CEXIETHERNET::activate() { DEBUGPRINT(" Error with IOCTL: 0x%X\n", err); return false; } +#endif DEBUGPRINT("Returned Socket name is: %s\n", ifr.ifr_name); return true; diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index 5bcbcba0ca..33cf89df4d 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -8,6 +8,11 @@ #endif #include "Common.h" +#include "FileUtil.h" + +#ifdef __APPLE__ +#include +#endif #if defined(HAVE_COCOA) && HAVE_COCOA #import "cocoaApp.h" @@ -151,7 +156,7 @@ int main(int argc, char *argv[]) cocoaCreateApp(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + CocoaThread *thread = [[CocoaThread alloc] init]; NSEvent *event = [[NSEvent alloc] init]; @@ -196,6 +201,24 @@ int main(int argc, char* argv[]) updateMainFrameEvent.Init(); cpu_info.Detect(); CPluginManager::GetInstance().ScanForPlugins(); + + // check to see if ~/Library/Application Support/Dolphin exists; if not, create it + char AppSupportDir[MAXPATHLEN]; + snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME")); + if (!File::Exists(AppSupportDir) || !File::IsDirectory(AppSupportDir)) + PanicAlert("Could not open ~/Library/Application Support"); + + strlcat(AppSupportDir, "/Dolphin", sizeof(AppSupportDir)); + + if (!File::Exists(AppSupportDir)) + File::CreateDir(AppSupportDir); + + if (!File::IsDirectory(AppSupportDir)) + PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory"); + + chdir(AppSupportDir); + + BootManager::BootCore(bootFile); while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/cocoaGL.m b/Source/Plugins/Plugin_VideoOGL/Src/cocoaGL.m index 1934183cd8..4eb1d2f18d 100755 --- a/Source/Plugins/Plugin_VideoOGL/Src/cocoaGL.m +++ b/Source/Plugins/Plugin_VideoOGL/Src/cocoaGL.m @@ -69,6 +69,7 @@ NSOpenGLContext* cocoaGLInit(int mode) attr[i++] = mode; attr[i++] = NSOpenGLPFASamples; attr[i++] = 1; + attr[i++] = NSOpenGLPFANoRecovery; #ifdef GL_VERSION_1_3 #else diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index a852508f72..6662896db2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -195,6 +195,45 @@ void DllConfig(HWND _hParent) } } XFree(modes); +#elif defined(HAVE_COCOA) && HAVE_COCOA && defined(HAVE_WX) && HAVE_WX + + CFArrayRef modes; + CFRange range; + CFDictionaryRef modesDict; + CFNumberRef modeValue; + + int modeWidth; + int modeHeight; + int modeBpp; + int modeIndex; + int px = 0, py = 0; + + + modes = CGDisplayAvailableModes(CGMainDisplayID()); + + range.location = 0; + range.length = CFArrayGetCount(modes); + + for (modeIndex=0; modeIndexAddFSReso(temp); + config_dialog->AddWindowReso(temp);//Add same to Window ones, since they should be nearly all that's needed + px = modeWidth; + py = modeHeight; + } + } #endif // Check if at least one resolution was found. If we don't and the resolution array is empty