Trying to make gameini support some gl options

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2687 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-03-20 11:51:22 +00:00
parent eff7b1aa14
commit f22af37320
13 changed files with 85 additions and 26 deletions

View File

@ -171,6 +171,27 @@ std::string* IniFile::GetLine(Section* section, const char* key, std::string* va
return 0;
}
bool IniFile::Exists(const char* sectionName, const char* key)
{
const Section* section = GetSection(sectionName);
if (!section)
return false;
for (std::vector<std::string>::const_iterator iter = section->lines.begin(); iter != section->lines.end(); ++iter)
{
std::string lineKey;
ParseLine(*iter, &lineKey, NULL, NULL);
if (!strcasecmp(lineKey.c_str(), key))
{
return true;
}
}
return false;
}
void IniFile::SetLines(const char* sectionName, const std::vector<std::string> &lines)
{
Section* section = GetOrCreateSection(sectionName);

View File

@ -57,6 +57,9 @@ public:
void SetLines(const char* sectionName, const std::vector<std::string> &lines);
// Returns true if exists key in section
bool Exists(const char* sectionName, const char* key);
// getter should be const
bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);

View File

@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef _CONFIGMANAGER_H
#define _CONFIGMANAGER_H
#include <string>
#include <vector>
@ -88,4 +88,4 @@ struct SConfig
static SConfig m_Instance;
};
#endif
#endif // endif config manager

View File

@ -45,6 +45,8 @@ void SCoreStartupParameter::LoadDefaults()
bWii = false;
SelectedLanguage = 0;
iTLBHack = 0;
delete gameIni;
gameIni = NULL;
bJITOff = false; // debugger only settings
bJITLoadStoreOff = false;

View File

@ -22,6 +22,7 @@
#include <windows.h>
#endif
#include "IniFile.h"
#include <string>
#define MAXPADS 4
@ -36,6 +37,9 @@ struct SCoreStartupParameter
// Windows/GUI related
void* hMainWindow;
// game ini
IniFile *gameIni;
// Settings
bool bEnableDebugging; bool bAutomaticStart; bool bBootToPause;
bool bUseJIT;

View File

@ -122,17 +122,19 @@ bool BootCore(const std::string& _rFilename)
// ====================================================
// Load game specific settings
// ----------------
IniFile ini;
// Released when you LoadDefaults
IniFile *ini = new IniFile();
std::string unique_id = StartUp.GetUniqueID();
if (unique_id.size() == 6 && ini.Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str()))
if (unique_id.size() == 6 && ini->Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str()))
{
StartUp.gameIni = ini;
// ------------------------------------------------
// General settings
// ----------------
ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
ini->Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
ini->Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
ini->Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini->Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
// ------------------------------------------------
// Wii settings
@ -144,8 +146,8 @@ bool BootCore(const std::string& _rFilename)
u16 IPL_PGS = 0x17CC; // progressive scan
u16 IPL_AR = 0x04D9; // widescreen
ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
ini->Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
ini->Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
// Save the update Wii SYSCONF settings
pStream = NULL;
@ -164,6 +166,9 @@ bool BootCore(const std::string& _rFilename)
}
}
// ---------------
} else {
delete ini;
ini = NULL;
}
// =====================