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

@ -23,23 +23,17 @@ void AudioCommonConfig::Load(IniFile &file) {
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
file.Get("Config", "EnableThrottle", &m_EnableThrottle, true);
file.Get("Config", "EnableJIT", &m_EnableJIT, true);
file.Get("Config", "Volume", &m_Volume, 100);
#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__
#if defined __linux__ && HAVE_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
file.Get("Config", "Backend", &sBackend, BACKEND_OPENAL);
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz");
file.Get("Config", "Backend", &sBackend, BACKEND_NULLSOUND);
#endif
file.Get("Config", "Frequency", &sFrequency, "48,000 Hz");
file.Get("Config", "Volume", &m_Volume, 100);
}
// Set the values for the file

View File

@ -23,11 +23,11 @@
// Backend Types
#define BACKEND_NULLSOUND "No audio output"
#define BACKEND_ALSA "ALSA"
#define BACKEND_AOSOUND "AOSound"
#define BACKEND_COREAUDIO "CoreAudio"
#define BACKEND_DIRECTSOUND "DSound"
#define BACKEND_AOSOUND "AOSound"
#define BACKEND_OPENAL "OpenAL"
#define BACKEND_ALSA "ALSA"
#define BACKEND_PULSEAUDIO "Pulse"
#define BACKEND_XAUDIO2 "XAudio2"
@ -37,13 +37,8 @@ struct AudioCommonConfig
bool m_EnableThrottle;
bool m_EnableJIT;
int m_Volume;
#ifdef __APPLE__
char sBackend[128];
char sFrequency[128];
#else
std::string sBackend;
std::string sFrequency;
#endif
// Load from given 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)
{
//
int FirstEquals = (int)line.find("=", 0);
int FirstCommentChar = -1;
// Comments
//if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find(";", FirstEquals > 0 ? FirstEquals : 0);}
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("#", FirstEquals > 0 ? FirstEquals : 0);}
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("//", FirstEquals > 0 ? FirstEquals : 0);}
if (FirstCommentChar < 0)
FirstCommentChar =
(int)line.find(";", FirstEquals > 0 ? FirstEquals : 0);
if (FirstCommentChar < 0)
FirstCommentChar =
(int)line.find("#", FirstEquals > 0 ? FirstEquals : 0);
// Allow preservation of spacing before comment
if (FirstCommentChar > 0)

View File

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

View File

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

View File

@ -1497,7 +1497,6 @@ void Jit64::twx(UGeckoInstruction inst)
JITDISABLE(Integer)
s32 a = inst.RA;
s32 TO = inst.TO;
gpr.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"));
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);
#endif
wxButton* refresh_button = new wxButton(this, -1, _("Refresh"), wxDefaultPosition, wxSize(60,-1));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -97,11 +97,8 @@ void DSPConfigDialogLLE::AddBackend(const char* backend)
// Update value
m_BackendSelection->Append(wxString::FromAscii(backend));
#ifdef __APPLE__
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend));
#else
int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
#endif
int num = m_BackendSelection->\
FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
m_BackendSelection->SetSelection(num);
}
@ -128,11 +125,7 @@ void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event)
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->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();
#endif
ac_Config.Update();
g_Config.Save();