From 264737fedec7ad1c3ef7625eb66b1d60367aa2fd Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Sat, 25 Apr 2009 16:47:45 +0000 Subject: [PATCH] A compile fix for Linux/OSX in InfoWindow.cpp and also get OSX to stop crashing from loading the audio backend. It's a pretty bad way to do it, but I couldn't find another way. Now to figure out why SMS looks horrible in OSX git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3074 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/AudioCommon/Src/AudioCommonConfig.cpp | 7 +++++-- Source/Core/AudioCommon/Src/AudioCommonConfig.h | 5 ++++- Source/Core/Common/Src/IniFile.cpp | 2 +- Source/Core/DolphinWX/Src/InfoWindow.cpp | 4 ++-- Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp | 8 ++++++++ Source/Plugins/Plugin_DSP_LLE/Src/DSPConfigDlgLLE.cpp | 8 ++++++++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp index 476918771e..c46a1edfbe 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp @@ -1,5 +1,4 @@ #include "AudioCommon.h" - AudioCommonConfig ac_Config; // Load from given file @@ -8,6 +7,10 @@ void AudioCommonConfig::Load(IniFile &file) { file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); #ifdef _WIN32 file.Get("Config", "Backend", &sBackend, "DSound"); +#elif defined(__APPLE__) + std::string temp; + file.Get("Config", "Backend", &temp, "AOSound"); + strncpy(sBackend, temp.c_str(), 128); #else file.Get("Config", "Backend", &sBackend, "AOSound"); #endif @@ -17,7 +20,7 @@ void AudioCommonConfig::Load(IniFile &file) { void AudioCommonConfig::Set(IniFile &file) { file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); file.Set("Config", "EnableThrottle", m_EnableThrottle); - file.Set("Config", "Backend", sBackend.c_str()); + file.Set("Config", "Backend", sBackend); } // Update according to the values (stream/mixer) diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.h b/Source/Core/AudioCommon/Src/AudioCommonConfig.h index aeceed2486..19b0db90ef 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.h +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.h @@ -9,12 +9,15 @@ #define BACKEND_AOSOUND "AOSound" #define BACKEND_OPENAL "OpenAL" #define BACKEND_NULL "NullSound" - struct AudioCommonConfig { bool m_EnableDTKMusic; bool m_EnableThrottle; +#ifdef __APPLE__ + char sBackend[128]; +#else std::string sBackend; +#endif // Load from given file void Load(IniFile &file); diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index d2c8b2f94e..8e3add2d8d 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -417,7 +417,7 @@ void IniFile::Set(const char* sectionName, const char* key, bool newValue) bool IniFile::Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue) { Section* section = GetSection(sectionName); - + if (!section) { if (defaultValue) diff --git a/Source/Core/DolphinWX/Src/InfoWindow.cpp b/Source/Core/DolphinWX/Src/InfoWindow.cpp index 84d296d481..5643c4b38f 100644 --- a/Source/Core/DolphinWX/Src/InfoWindow.cpp +++ b/Source/Core/DolphinWX/Src/InfoWindow.cpp @@ -65,7 +65,7 @@ void wxInfoWindow::Init_ChildControls() m_Tab_Log = new wxPanel(m_Notebook_Main, ID_TAB_LOG, wxDefaultPosition, wxDefaultSize); m_TextCtrl_Log = new wxTextCtrl(m_Tab_Log, ID_TEXTCTRL_LOG, - wxT( + wxString::FromAscii(std::string( //Dolphin revision number std::string("Dolphin Revision: ") + SVN_REV_STR +"\n"+ @@ -80,7 +80,7 @@ void wxInfoWindow::Init_ChildControls() //CPU Info std::string("Processor Information:\n")+cpu_info.Summarize()+"\n\n" - ), + ).c_str()), wxDefaultPosition, wxSize(100, 600), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index 104679c4bb..a5e3c41f07 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -81,7 +81,11 @@ void ConfigDialog::AddBackend(const char* backend) { m_BackendSelection->Append(wxString::FromAscii(backend)); // Update value +#ifdef __APPLE__ + m_BackendSelection->SetValue(wxString::FromAscii(ac_Config.sBackend)); +#else m_BackendSelection->SetValue(wxString::FromAscii(ac_Config.sBackend.c_str())); +#endif } ConfigDialog::~ConfigDialog() @@ -93,7 +97,11 @@ void ConfigDialog::SettingsChanged(wxCommandEvent& event) g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue(); ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); +#ifdef __APPLE__ + strncpy(ac_Config.sBackend, m_BackendSelection->GetValue().mb_str(), 128); +#else ac_Config.sBackend = m_BackendSelection->GetValue().mb_str(); +#endif g_Config.Save(); if (event.GetId() == wxID_OK) diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DSPConfigDlgLLE.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/DSPConfigDlgLLE.cpp index 1d0ca39271..89859a35d7 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/DSPConfigDlgLLE.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DSPConfigDlgLLE.cpp @@ -76,7 +76,11 @@ void DSPConfigDialogLLE::AddBackend(const char* backend) { m_BackendSelection->Append(wxString::FromAscii(backend)); // Update value +#ifdef __APPLE__ + m_BackendSelection->SetValue(wxString::FromAscii(ac_Config.sBackend)); +#else m_BackendSelection->SetValue(wxString::FromAscii(ac_Config.sBackend.c_str())); +#endif } DSPConfigDialogLLE::~DSPConfigDialogLLE() @@ -87,7 +91,11 @@ void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event) { ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); +#ifdef __APPLE__ + strncpy(ac_Config.sBackend, m_BackendSelection->GetValue().mb_str(), 128); +#else ac_Config.sBackend = m_BackendSelection->GetValue().mb_str(); +#endif ac_Config.Update(); g_Config.Save();