fix main config dir on osx and autodetect ogl version when it build

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2630 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
tmator 2009-03-09 10:43:56 +00:00
parent 2f00c0bda9
commit 9635b50a35
6 changed files with 37 additions and 6 deletions

View File

@ -510,6 +510,19 @@ bool SetCurrentDirectory(const char *_rDirectory)
} }
#if defined(__APPLE__) #if defined(__APPLE__)
//get the full config dir
char *GetConfigDirectory()
{
static char path[MAX_PATH] = {0};
if (strlen(path) > 0)
return path;
snprintf(path, sizeof(path), "%s" DIR_SEP CONFIG_FILE, GetUserDirectory());
return path;
}
std::string GetBundleDirectory() std::string GetBundleDirectory()
{ {
// Plugin path will be Dolphin.app/Contents/PlugIns // Plugin path will be Dolphin.app/Contents/PlugIns
@ -542,7 +555,9 @@ std::string GetPluginsDirectory()
pluginsDir = PLUGINS_DIR; pluginsDir = PLUGINS_DIR;
#endif #endif
#if !defined (__APPLE__)
pluginsDir += DIR_SEP; pluginsDir += DIR_SEP;
#endif
INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str()); INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str());
return pluginsDir; return pluginsDir;

View File

@ -96,6 +96,9 @@ std::string GetPluginsDirectory();
std::string GetSysDirectory(); std::string GetSysDirectory();
#ifdef __APPLE__ #ifdef __APPLE__
char *GetConfigDirectory();
std::string GetBundleDirectory(); std::string GetBundleDirectory();
#endif #endif

View File

@ -40,7 +40,11 @@ SConfig::~SConfig()
void SConfig::SaveSettings() void SConfig::SaveSettings()
{ {
IniFile ini; IniFile ini;
#if defined(__APPLE__)
ini.Load(File::GetConfigDirectory()); // yes we must load first to not kill unknown stuff
#else
ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff
#endif
// General // General
{ {
@ -109,14 +113,22 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiMote1Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[0]); ini.Set("Core", "WiiMote1Plugin", m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
} }
#if defined(__APPLE__)
ini.Save(File::GetConfigDirectory());
#else
ini.Save(CONFIG_FILE); ini.Save(CONFIG_FILE);
#endif
} }
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
IniFile ini; IniFile ini;
#if defined(__APPLE__)
ini.Load(File::GetConfigDirectory());
#else
ini.Load(CONFIG_FILE); ini.Load(CONFIG_FILE);
#endif
std::string PluginsDir = File::GetPluginsDirectory(); std::string PluginsDir = File::GetPluginsDirectory();
// Hard coded default // Hard coded default

View File

@ -191,7 +191,7 @@ bool DolphinApp::OnInit()
if (!File::Exists("User")) File::CreateDir("User"); if (!File::Exists("User")) File::CreateDir("User");
if (!File::Exists("User/GC")) File::CreateDir("User/GC"); if (!File::Exists("User/GC")) File::CreateDir("User/GC");
if (!File::Exists("User/Config")) File::CreateDir("User/Config");
// HACK: Get rid of bogus osx param // HACK: Get rid of bogus osx param
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) { if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1]; delete argv[argc-1];

View File

@ -69,11 +69,12 @@ NSOpenGLContext* cocoaGLInit(int mode)
attr[i++] = mode; attr[i++] = mode;
attr[i++] = NSOpenGLPFASamples; attr[i++] = NSOpenGLPFASamples;
attr[i++] = 1; attr[i++] = 1;
#ifdef GL_VERSION_1_2
#warning "your car support ogl 1.2, dolphin wil use software renderer"
//if opengl < 1.3 uncomment this twoo lines to use software renderer //if opengl < 1.3 uncomment this twoo lines to use software renderer
//attr[i++] = NSOpenGLPFARendererID; attr[i++] = NSOpenGLPFARendererID;
//attr[i++] = kCGLRendererGenericFloatID; attr[i++] = kCGLRendererGenericFloatID;
#endif
attr[i++] = NSOpenGLPFAScreenMask; attr[i++] = NSOpenGLPFAScreenMask;
attr[i++] = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID()); attr[i++] = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID());