Remove the __APPLE__ workaround for reading config files from a ctor.

'#' is a fairly accepted comment character for .ini files along with
the more official ';', but '//' isn't.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6872 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-01-18 00:04:29 +00:00
parent d0805aef37
commit 1a3cd2d34c
14 changed files with 30 additions and 79 deletions

View File

@ -37,11 +37,11 @@ namespace AudioCommon
std::string backend = ac_Config.sBackend; std::string backend = ac_Config.sBackend;
if (backend == BACKEND_OPENAL && OpenALStream::isValid()) if (backend == BACKEND_OPENAL && OpenALStream::isValid())
soundStream = new OpenALStream(mixer); soundStream = new OpenALStream(mixer);
else if (backend == BACKEND_NULLSOUND && NullSound::isValid()) else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
soundStream = new NullSound(mixer, g_dspInitialize.hWnd); soundStream = new NullSound(mixer, g_dspInitialize.hWnd);
else if (backend == BACKEND_DIRECTSOUND && DSound::isValid()) else if (backend == BACKEND_DIRECTSOUND && DSound::isValid())
soundStream = new DSound(mixer, g_dspInitialize.hWnd); soundStream = new DSound(mixer, g_dspInitialize.hWnd);
else if (backend == BACKEND_XAUDIO2 && XAudio2::isValid()) else if (backend == BACKEND_XAUDIO2 && XAudio2::isValid())
soundStream = new XAudio2(mixer); soundStream = new XAudio2(mixer);
else if (backend == BACKEND_AOSOUND && AOSound::isValid()) else if (backend == BACKEND_AOSOUND && AOSound::isValid())
soundStream = new AOSound(mixer); soundStream = new AOSound(mixer);

View File

@ -23,23 +23,17 @@ void AudioCommonConfig::Load(IniFile &file) {
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); file.Get("Config", "EnableThrottle", &m_EnableThrottle, true);
file.Get("Config", "EnableJIT", &m_EnableJIT, true); file.Get("Config", "EnableJIT", &m_EnableJIT, true);
file.Get("Config", "Volume", &m_Volume, 100); #if defined __linux__ && HAVE_ALSA
#ifdef _WIN32
file.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND);
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz");
#elif defined __APPLE__
std::string temp;
file.Get("Config", "Backend", &temp, BACKEND_COREAUDIO);
strncpy(sBackend, temp.c_str(), 128);
file.Get("Config", "Frequency", &temp, "48,000 Hz");
strncpy(sFrequency, temp.c_str(), 128);
#elif defined __linux__
file.Get("Config", "Backend", &sBackend, BACKEND_ALSA); file.Get("Config", "Backend", &sBackend, BACKEND_ALSA);
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz"); #elif defined __APPLE__
file.Get("Config", "Backend", &sBackend, BACKEND_COREAUDIO);
#elif defined _WIN32
file.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND);
#else #else
file.Get("Config", "Backend", &sBackend, BACKEND_OPENAL); file.Get("Config", "Backend", &sBackend, BACKEND_NULLSOUND);
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz");
#endif #endif
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz");
file.Get("Config", "Volume", &m_Volume, 100);
} }
// Set the values for the file // Set the values for the file

View File

@ -23,12 +23,12 @@
// Backend Types // Backend Types
#define BACKEND_NULLSOUND "No audio output" #define BACKEND_NULLSOUND "No audio output"
#define BACKEND_COREAUDIO "CoreAudio" #define BACKEND_ALSA "ALSA"
#define BACKEND_DIRECTSOUND "DSound" #define BACKEND_AOSOUND "AOSound"
#define BACKEND_AOSOUND "AOSound" #define BACKEND_COREAUDIO "CoreAudio"
#define BACKEND_OPENAL "OpenAL" #define BACKEND_DIRECTSOUND "DSound"
#define BACKEND_ALSA "ALSA" #define BACKEND_OPENAL "OpenAL"
#define BACKEND_PULSEAUDIO "Pulse" #define BACKEND_PULSEAUDIO "Pulse"
#define BACKEND_XAUDIO2 "XAudio2" #define BACKEND_XAUDIO2 "XAudio2"
struct AudioCommonConfig struct AudioCommonConfig
@ -37,13 +37,8 @@ struct AudioCommonConfig
bool m_EnableThrottle; bool m_EnableThrottle;
bool m_EnableJIT; bool m_EnableJIT;
int m_Volume; int m_Volume;
#ifdef __APPLE__
char sBackend[128];
char sFrequency[128];
#else
std::string sBackend; std::string sBackend;
std::string sFrequency; std::string sFrequency;
#endif
// Load from given file // Load from given file
void Load(IniFile &file); void Load(IniFile &file);

View File

@ -32,13 +32,16 @@ namespace {
static void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) static void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut)
{ {
//
int FirstEquals = (int)line.find("=", 0); int FirstEquals = (int)line.find("=", 0);
int FirstCommentChar = -1; int FirstCommentChar = -1;
// Comments // Comments
//if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find(";", FirstEquals > 0 ? FirstEquals : 0);} if (FirstCommentChar < 0)
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("#", FirstEquals > 0 ? FirstEquals : 0);} FirstCommentChar =
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("//", FirstEquals > 0 ? FirstEquals : 0);} (int)line.find(";", FirstEquals > 0 ? FirstEquals : 0);
if (FirstCommentChar < 0)
FirstCommentChar =
(int)line.find("#", FirstEquals > 0 ? FirstEquals : 0);
// Allow preservation of spacing before comment // Allow preservation of spacing before comment
if (FirstCommentChar > 0) if (FirstCommentChar > 0)

View File

@ -150,9 +150,6 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize)
if (!GetAvailableSock(client)) if (!GetAvailableSock(client))
return; return;
// for debug
u32 oldval = _uData;
switch (_uData >> 28) switch (_uData >> 28)
{ {
// maybe do something fun later // maybe do something fun later

View File

@ -908,12 +908,10 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
set_control(m_shake, i, "Click 2"); set_control(m_shake, i, "Click 2");
// IR // IR
#ifndef __APPLE__
set_control(m_ir, 0, "Cursor Y-"); set_control(m_ir, 0, "Cursor Y-");
set_control(m_ir, 1, "Cursor Y+"); set_control(m_ir, 1, "Cursor Y+");
set_control(m_ir, 2, "Cursor X-"); set_control(m_ir, 2, "Cursor X-");
set_control(m_ir, 3, "Cursor X+"); set_control(m_ir, 3, "Cursor X+");
#endif
// DPad // DPad
#ifdef _WIN32 #ifdef _WIN32

View File

@ -1497,7 +1497,6 @@ void Jit64::twx(UGeckoInstruction inst)
JITDISABLE(Integer) JITDISABLE(Integer)
s32 a = inst.RA; s32 a = inst.RA;
s32 TO = inst.TO;
gpr.Flush(FLUSH_ALL); gpr.Flush(FLUSH_ALL);
fpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL);

View File

@ -918,10 +918,7 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Device")); wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Device"));
device_cbox = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1)); device_cbox = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxSize(64,-1));
#ifndef __APPLE__
// causes a crash with some OS X wxWidgets
device_cbox->ToggleWindowStyle(wxTE_PROCESS_ENTER); device_cbox->ToggleWindowStyle(wxTE_PROCESS_ENTER);
#endif
wxButton* refresh_button = new wxButton(this, -1, _("Refresh"), wxDefaultPosition, wxSize(60,-1)); wxButton* refresh_button = new wxButton(this, -1, _("Refresh"), wxDefaultPosition, wxSize(60,-1));

View File

@ -24,11 +24,6 @@
CConfig g_Config; CConfig g_Config;
CConfig::CConfig()
{
Load();
}
void CConfig::Load() void CConfig::Load()
{ {
// first load defaults // first load defaults

View File

@ -23,8 +23,6 @@
struct CConfig struct CConfig
{ {
bool m_EnableHLEAudio; bool m_EnableHLEAudio;
CConfig();
void Load(); void Load();
void Save(); void Save();

View File

@ -92,11 +92,8 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id,
m_FrequencySelection->Append(_("48,000 Hz")); m_FrequencySelection->Append(_("48,000 Hz"));
m_FrequencySelection->Append(_("32,000 Hz")); m_FrequencySelection->Append(_("32,000 Hz"));
#ifdef __APPLE__ int num = m_FrequencySelection->\
int num = m_FrequencySelection->FindString(wxString::FromAscii(ac_Config.sFrequency)); FindString(wxString::FromAscii(ac_Config.sFrequency.c_str()));
#else
int num = m_FrequencySelection->FindString(wxString::FromAscii(ac_Config.sFrequency.c_str()));
#endif
m_FrequencySelection->SetSelection(num); m_FrequencySelection->SetSelection(num);
sbSettings->Add(sFrequency, 0, wxALL, 7); sbSettings->Add(sFrequency, 0, wxALL, 7);
@ -127,11 +124,8 @@ void DSPConfigDialogHLE::AddBackend(const char* backend)
{ {
// Update values // Update values
m_BackendSelection->Append(wxString::FromAscii(backend)); m_BackendSelection->Append(wxString::FromAscii(backend));
#ifdef __APPLE__ int num = m_BackendSelection->\
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend)); FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
#else
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
#endif
m_BackendSelection->SetSelection(num); m_BackendSelection->SetSelection(num);
} }
@ -158,13 +152,8 @@ void DSPConfigDialogHLE::SettingsChanged(wxCommandEvent& event)
ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue(); ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue();
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
#ifdef __APPLE__
strncpy(ac_Config.sBackend, m_BackendSelection->GetStringSelection().mb_str(), 128);
strncpy(ac_Config.sFrequency, m_FrequencySelection->GetStringSelection().mb_str(), 128);
#else
ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str(); ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str();
ac_Config.sFrequency = m_FrequencySelection->GetStringSelection().mb_str(); ac_Config.sFrequency = m_FrequencySelection->GetStringSelection().mb_str();
#endif
ac_Config.Update(); ac_Config.Update();
g_Config.Save(); g_Config.Save();

View File

@ -25,11 +25,6 @@
CConfig g_Config; CConfig g_Config;
CConfig::CConfig()
{
Load();
}
void CConfig::Load() void CConfig::Load()
{ {
// first load defaults // first load defaults

View File

@ -22,8 +22,6 @@
struct CConfig struct CConfig
{ {
CConfig();
void Load(); void Load();
void Save(); void Save();
}; };

View File

@ -95,13 +95,10 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
void DSPConfigDialogLLE::AddBackend(const char* backend) void DSPConfigDialogLLE::AddBackend(const char* backend)
{ {
// Update value // Update value
m_BackendSelection->Append(wxString::FromAscii(backend)); m_BackendSelection->Append(wxString::FromAscii(backend));
#ifdef __APPLE__ int num = m_BackendSelection->\
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend)); FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
#else
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
#endif
m_BackendSelection->SetSelection(num); m_BackendSelection->SetSelection(num);
} }
@ -128,11 +125,7 @@ void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event)
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue(); ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
ac_Config.m_EnableJIT = m_buttonEnableJIT->GetValue(); ac_Config.m_EnableJIT = m_buttonEnableJIT->GetValue();
#ifdef __APPLE__
strncpy(ac_Config.sBackend, m_BackendSelection->GetStringSelection().mb_str(), 128);
#else
ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str(); ac_Config.sBackend = m_BackendSelection->GetStringSelection().mb_str();
#endif
ac_Config.Update(); ac_Config.Update();
g_Config.Save(); g_Config.Save();