osx fixes for nongui and ogl plugin

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3239 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
tmator 2009-05-15 08:55:46 +00:00
parent 7986366ff3
commit 833154f3d8
4 changed files with 69 additions and 3 deletions

View File

@ -20,12 +20,14 @@
#include "../EXI_DeviceEthernet.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <stropts.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <net/if.h>
#if !defined(__APPLE__)
#include <stropts.h>
#include <linux/if_tun.h>
#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;

View File

@ -8,6 +8,11 @@
#endif
#include "Common.h"
#include "FileUtil.h"
#ifdef __APPLE__
#include <sys/param.h>
#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)
{

View File

@ -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

View File

@ -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; modeIndex<range.length; modeIndex++)
{
modesDict = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, modeIndex);
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayWidth);
CFNumberGetValue(modeValue, kCFNumberLongType, &modeWidth);
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayHeight);
CFNumberGetValue(modeValue, kCFNumberLongType, &modeHeight);
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayBitsPerPixel);
CFNumberGetValue(modeValue, kCFNumberLongType, &modeBpp);
if (px != modeWidth && py != modeHeight)
{
char temp[32];
sprintf(temp,"%dx%d", modeWidth, modeHeight);
config_dialog->AddFSReso(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