WINTERMUTE: Rename FuncName->funcName in BRegistry

This commit is contained in:
Einar Johan Trøan Sømåen
2012-07-08 20:07:01 +02:00
parent cf63cea1e8
commit 5afd4c966e
9 changed files with 81 additions and 81 deletions
+2 -2
View File
@@ -284,7 +284,7 @@ HRESULT CBFileManager::initPaths() {
int numPaths;
// single files paths
pathList = Game->_registry->ReadString("Resource", "CustomPaths", "");
pathList = Game->_registry->readString("Resource", "CustomPaths", "");
numPaths = CBUtils::strNumEntries(pathList.c_str(), ';');
for (int i = 0; i < numPaths; i++) {
@@ -328,7 +328,7 @@ HRESULT CBFileManager::initPaths() {
#endif*/
pathList = Game->_registry->ReadString("Resource", "PackagePaths", "");
pathList = Game->_registry->readString("Resource", "PackagePaths", "");
numPaths = CBUtils::strNumEntries(pathList.c_str(), ';');
for (int i = 0; i < numPaths; i++) {
+12 -12
View File
@@ -286,7 +286,7 @@ CBGame::~CBGame() {
getDebugMgr()->onGameShutdown();
_registry->WriteBool("System", "LastRun", true);
_registry->writeBool("System", "LastRun", true);
cleanup();
@@ -1494,7 +1494,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(2);
const char *key = stack->pop()->getString();
int val = stack->pop()->getInt();
_registry->WriteInt("PrivateSettings", key, val);
_registry->writeInt("PrivateSettings", key, val);
stack->pushNULL();
return S_OK;
}
@@ -1506,7 +1506,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(2);
const char *key = stack->pop()->getString();
int initVal = stack->pop()->getInt();
stack->pushInt(_registry->ReadInt("PrivateSettings", key, initVal));
stack->pushInt(_registry->readInt("PrivateSettings", key, initVal));
return S_OK;
}
@@ -1517,7 +1517,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(2);
const char *key = stack->pop()->getString();
const char *val = stack->pop()->getString();
_registry->WriteString("PrivateSettings", key, val);
_registry->writeString("PrivateSettings", key, val);
stack->pushNULL();
return S_OK;
}
@@ -1529,7 +1529,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(2);
const char *key = stack->pop()->getString();
const char *initVal = stack->pop()->getString();
AnsiString val = _registry->ReadString("PrivateSettings", key, initVal);
AnsiString val = _registry->readString("PrivateSettings", key, initVal);
stack->pushString(val.c_str());
return S_OK;
}
@@ -2550,7 +2550,7 @@ CScValue *CBGame::scGetProperty(const char *name) {
// MostRecentSaveSlot (RO)
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MostRecentSaveSlot") == 0) {
_scValue->setInt(_registry->ReadInt("System", "MostRecentSaveSlot", -1));
_scValue->setInt(_registry->readInt("System", "MostRecentSaveSlot", -1));
return _scValue;
}
@@ -3267,7 +3267,7 @@ HRESULT CBGame::SaveGame(int slot, const char *desc, bool quickSave) {
if (FAILED(ret = CSysClassRegistry::getInstance()->saveInstances(Game, pm, quickSave))) goto save_finish;
if (FAILED(ret = pm->saveFile(filename))) goto save_finish;
_registry->WriteInt("System", "MostRecentSaveSlot", slot);
_registry->writeInt("System", "MostRecentSaveSlot", slot);
save_finish: // TODO: Remove gotos
delete pm;
@@ -3588,7 +3588,7 @@ HRESULT CBGame::loadSettings(const char *filename) {
break;
case TOKEN_REGISTRY_PATH:
_registry->SetBasePath((char *)params);
_registry->setBasePath((char *)params);
break;
case TOKEN_RICH_SAVED_GAMES:
@@ -3612,8 +3612,8 @@ HRESULT CBGame::loadSettings(const char *filename) {
ret = E_FAIL;
}
_settingsAllowWindowed = _registry->ReadBool("Debug", "AllowWindowed", _settingsAllowWindowed);
_compressedSavegames = _registry->ReadBool("Debug", "CompressedSavegames", _compressedSavegames);
_settingsAllowWindowed = _registry->readBool("Debug", "AllowWindowed", _settingsAllowWindowed);
_compressedSavegames = _registry->readBool("Debug", "CompressedSavegames", _compressedSavegames);
//_compressedSavegames = false;
delete [] origBuffer;
@@ -3910,7 +3910,7 @@ AnsiString CBGame::getDataDir() {
#ifdef __IPHONEOS__
return userDir;
#else
AnsiString baseDir = _registry->GetBasePath();
AnsiString baseDir = _registry->getBasePath();
return PathUtil::combine(userDir, baseDir);
#endif
}
@@ -4553,7 +4553,7 @@ bool CBGame::isDoubleClick(int buttonIndex) {
//////////////////////////////////////////////////////////////////////////
void CBGame::autoSaveOnExit() {
_soundMgr->saveSettings();
_registry->SaveValues();
_registry->saveValues();
if (!_autoSaveOnExit) return;
if (_state == GAME_FROZEN) return;
+27 -27
View File
@@ -41,14 +41,14 @@ namespace WinterMute {
CBRegistry::CBRegistry(CBGame *inGame): CBBase(inGame) {
_iniName = NULL;
SetIniName("./wme.ini");
LoadValues(true);
setIniName("./wme.ini");
loadValues(true);
}
//////////////////////////////////////////////////////////////////////////
CBRegistry::~CBRegistry() {
SaveValues();
saveValues();
delete[] _iniName;
_iniName = NULL;
}
@@ -56,7 +56,7 @@ CBRegistry::~CBRegistry() {
//////////////////////////////////////////////////////////////////////////
AnsiString CBRegistry::ReadString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init) {
AnsiString CBRegistry::readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init) {
AnsiString ret = "";
#ifdef __WIN32__
@@ -69,8 +69,8 @@ AnsiString CBRegistry::ReadString(const AnsiString &subKey, const AnsiString &ke
#endif
bool found = false;
ret = GetValue(_localValues, subKey, key, found);
if (!found) ret = GetValue(_values, subKey, key, found);
ret = getValue(_localValues, subKey, key, found);
if (!found) ret = getValue(_values, subKey, key, found);
if (!found) ret = init;
return ret;
@@ -78,46 +78,46 @@ AnsiString CBRegistry::ReadString(const AnsiString &subKey, const AnsiString &ke
//////////////////////////////////////////////////////////////////////////
bool CBRegistry::WriteString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value) {
bool CBRegistry::writeString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value) {
_values[subKey][key] = value;
return true;
}
//////////////////////////////////////////////////////////////////////////
int CBRegistry::ReadInt(const AnsiString &subKey, const AnsiString &key, int init) {
int CBRegistry::readInt(const AnsiString &subKey, const AnsiString &key, int init) {
#ifdef __WIN32__
int ret = GetPrivateProfileInt(subKey.c_str(), key.c_str(), init, _iniName);
if (ret != init) return ret;
#endif
AnsiString val = ReadString(subKey, key, "");
AnsiString val = readString(subKey, key, "");
if (val.empty()) return init;
else return atoi(val.c_str());
}
//////////////////////////////////////////////////////////////////////////
bool CBRegistry::WriteInt(const AnsiString &subKey, const AnsiString &key, int value) {
WriteString(subKey, key, StringUtil::toString(value));
bool CBRegistry::writeInt(const AnsiString &subKey, const AnsiString &key, int value) {
writeString(subKey, key, StringUtil::toString(value));
return true;
}
//////////////////////////////////////////////////////////////////////////
bool CBRegistry::ReadBool(const AnsiString &subKey, const AnsiString &key, bool init) {
return (ReadInt(subKey, key, (int)init) != 0);
bool CBRegistry::readBool(const AnsiString &subKey, const AnsiString &key, bool init) {
return (readInt(subKey, key, (int)init) != 0);
}
//////////////////////////////////////////////////////////////////////////
bool CBRegistry::WriteBool(const AnsiString &subKey, const AnsiString &key, bool value) {
return WriteInt(subKey, key, (int)value);
bool CBRegistry::writeBool(const AnsiString &subKey, const AnsiString &key, bool value) {
return writeInt(subKey, key, (int)value);
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SetIniName(const char *name) {
void CBRegistry::setIniName(const char *name) {
delete[] _iniName;
_iniName = NULL;
@@ -132,30 +132,30 @@ void CBRegistry::SetIniName(const char *name) {
//////////////////////////////////////////////////////////////////////////
char *CBRegistry::GetIniName() {
char *CBRegistry::getIniName() {
return _iniName;
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::LoadValues(bool local) {
if (local) LoadXml("settings.xml", _localValues);
else LoadXml(PathUtil::combine(Game->getDataDir(), "settings.xml"), _values);
void CBRegistry::loadValues(bool local) {
if (local) loadXml("settings.xml", _localValues);
else loadXml(PathUtil::combine(Game->getDataDir(), "settings.xml"), _values);
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SaveValues() {
SaveXml(PathUtil::combine(Game->getDataDir(), "settings.xml"), _values);
void CBRegistry::saveValues() {
saveXml(PathUtil::combine(Game->getDataDir(), "settings.xml"), _values);
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SetBasePath(const char *basePath) {
void CBRegistry::setBasePath(const char *basePath) {
_basePath = PathUtil::getFileNameWithoutExtension(basePath);
LoadValues(false);
loadValues(false);
}
//////////////////////////////////////////////////////////////////////////
AnsiString CBRegistry::GetValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found) {
AnsiString CBRegistry::getValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found) {
found = false;
PathValueMap::iterator it = values.find(path);
if (it == values.end()) return "";
@@ -170,7 +170,7 @@ AnsiString CBRegistry::GetValue(PathValueMap &values, const AnsiString path, con
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::LoadXml(const AnsiString fileName, PathValueMap &values) {
void CBRegistry::loadXml(const AnsiString fileName, PathValueMap &values) {
TiXmlDocument doc(fileName.c_str());
if (!doc.LoadFile()) return;
@@ -187,7 +187,7 @@ void CBRegistry::LoadXml(const AnsiString fileName, PathValueMap &values) {
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SaveXml(const AnsiString fileName, PathValueMap &values) {
void CBRegistry::saveXml(const AnsiString fileName, PathValueMap &values) {
CBUtils::createPath(fileName.c_str());
TiXmlDocument doc;
+15 -15
View File
@@ -35,24 +35,24 @@ namespace WinterMute {
class CBRegistry : public CBBase {
public:
void SetIniName(const char *name);
char *GetIniName();
bool WriteBool(const AnsiString &subKey, const AnsiString &key, bool Value);
bool ReadBool(const AnsiString &subKey, const AnsiString &key, bool init = false);
bool WriteInt(const AnsiString &subKey, const AnsiString &key, int value);
int ReadInt(const AnsiString &subKey, const AnsiString &key, int init = 0);
bool WriteString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value);
AnsiString ReadString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init = "");
void setIniName(const char *name);
char *getIniName();
bool writeBool(const AnsiString &subKey, const AnsiString &key, bool Value);
bool readBool(const AnsiString &subKey, const AnsiString &key, bool init = false);
bool writeInt(const AnsiString &subKey, const AnsiString &key, int value);
int readInt(const AnsiString &subKey, const AnsiString &key, int init = 0);
bool writeString(const AnsiString &subKey, const AnsiString &key, const AnsiString &value);
AnsiString readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init = "");
CBRegistry(CBGame *inGame);
virtual ~CBRegistry();
void SetBasePath(const char *basePath);
AnsiString GetBasePath() const {
void setBasePath(const char *basePath);
AnsiString getBasePath() const {
return _basePath;
}
void LoadValues(bool local);
void SaveValues();
void loadValues(bool local);
void saveValues();
private:
char *_iniName;
@@ -65,10 +65,10 @@ private:
AnsiString _basePath;
void LoadXml(const AnsiString fileName, PathValueMap &values);
void SaveXml(const AnsiString fileName, PathValueMap &values);
void loadXml(const AnsiString fileName, PathValueMap &values);
void saveXml(const AnsiString fileName, PathValueMap &values);
AnsiString GetValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found);
AnsiString getValue(PathValueMap &values, const AnsiString path, const AnsiString &key, bool &found);
};
} // end of namespace WinterMute
+4 -4
View File
@@ -144,8 +144,8 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
}
}
#else
_realWidth = Game->_registry->ReadInt("Debug", "ForceResWidth", _width);
_realHeight = Game->_registry->ReadInt("Debug", "ForceResHeight", _height);
_realWidth = Game->_registry->readInt("Debug", "ForceResWidth", _width);
_realHeight = Game->_registry->readInt("Debug", "ForceResHeight", _height);
#endif
/*
@@ -184,7 +184,7 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS;
#endif
//_windowed = Game->_registry->ReadBool("Video", "Windowed", true);
//_windowed = Game->_registry->readBool("Video", "Windowed", true);
// if (!windowed) flags |= SDL_WINDOW_FULLSCREEN;
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
@@ -549,7 +549,7 @@ HRESULT CBRenderSDL::switchFullscreen() {
_windowed = !_windowed;
*/
Game->_registry->WriteBool("Video", "Windowed", _windowed);
Game->_registry->writeBool("Video", "Windowed", _windowed);
return S_OK;
}
+8 -8
View File
@@ -71,11 +71,11 @@ HRESULT CBSoundMgr::cleanup() {
//////////////////////////////////////////////////////////////////////////
void CBSoundMgr::saveSettings() {
if (_soundAvailable) {
Game->_registry->WriteInt("Audio", "MasterVolume", _volumeMaster);
Game->_registry->writeInt("Audio", "MasterVolume", _volumeMaster);
Game->_registry->WriteInt("Audio", "SFXVolume", _volumeSFX);
Game->_registry->WriteInt("Audio", "SpeechVolume", _volumeSpeech);
Game->_registry->WriteInt("Audio", "MusicVolume", _volumeMusic);
Game->_registry->writeInt("Audio", "SFXVolume", _volumeSFX);
Game->_registry->writeInt("Audio", "SpeechVolume", _volumeSpeech);
Game->_registry->writeInt("Audio", "MusicVolume", _volumeMusic);
}
}
@@ -101,11 +101,11 @@ HRESULT CBSoundMgr::initialize() {
}
#endif
_volumeMaster = Game->_registry->ReadInt("Audio", "MasterVolume", 100);
_volumeMaster = Game->_registry->readInt("Audio", "MasterVolume", 100);
_volumeSFX = Game->_registry->ReadInt("Audio", "SFXVolume", 100);
_volumeSpeech = Game->_registry->ReadInt("Audio", "SpeechVolume", 100);
_volumeMusic = Game->_registry->ReadInt("Audio", "MusicVolume", 100);
_volumeSFX = Game->_registry->readInt("Audio", "SFXVolume", 100);
_volumeSpeech = Game->_registry->readInt("Audio", "SpeechVolume", 100);
_volumeMusic = Game->_registry->readInt("Audio", "MusicVolume", 100);
_soundAvailable = true;
setMasterVolumePercent(_volumeMaster);
@@ -202,8 +202,8 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
const char *prodId = stack->pop()->getString();
Game->_registry->WriteBool("Purchases", prodId, true);
Game->_registry->SaveValues();
Game->_registry->writeBool("Purchases", prodId, true);
Game->_registry->saveValues();
stack->pushBool(true);
@@ -217,7 +217,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
const char *prodId = stack->pop()->getString();
stack->pushBool(Game->_registry->ReadBool("Purchases", prodId, false));
stack->pushBool(Game->_registry->readBool("Purchases", prodId, false));
return S_OK;
}
@@ -766,10 +766,10 @@ HRESULT CScEngine::SaveBreakpoints() {
sprintf(Key, "Breakpoint%d", Count);
sprintf(Text, "%s:%d", _breakpoints[i]->_filename.c_str(), _breakpoints[i]->_lines[j]);
Game->_registry->WriteString("Debug", Key, Text);
Game->_registry->writeString("Debug", Key, Text);
}
}
Game->_registry->WriteInt("Debug", "NumBreakpoints", Count);
Game->_registry->writeInt("Debug", "NumBreakpoints", Count);
return S_OK;
}
@@ -780,11 +780,11 @@ HRESULT CScEngine::LoadBreakpoints() {
char Key[100];
int Count = Game->_registry->ReadInt("Debug", "NumBreakpoints", 0);
int Count = Game->_registry->readInt("Debug", "NumBreakpoints", 0);
for (int i = 1; i <= Count; i++) {
/* uint32 BufSize = 512; */
sprintf(Key, "Breakpoint%d", i);
AnsiString breakpoint = Game->_registry->ReadString("Debug", Key, "");
AnsiString breakpoint = Game->_registry->readString("Debug", Key, "");
char *Path = CBUtils::strEntry(0, breakpoint.c_str(), ':');
char *Line = CBUtils::strEntry(1, breakpoint.c_str(), ':');
+6 -6
View File
@@ -174,16 +174,16 @@ int WinterMuteEngine::init() {
}*/
if (_game->_registry->ReadBool("Debug", "DebugMode")) _game->DEBUG_DebugEnable("./wme.log");
if (_game->_registry->readBool("Debug", "DebugMode")) _game->DEBUG_DebugEnable("./wme.log");
_game->_dEBUG_ShowFPS = _game->_registry->ReadBool("Debug", "ShowFPS");
_game->_dEBUG_ShowFPS = _game->_registry->readBool("Debug", "ShowFPS");
if (_game->_registry->ReadBool("Debug", "DisableSmartCache")) {
if (_game->_registry->readBool("Debug", "DisableSmartCache")) {
_game->LOG(0, "Smart cache is DISABLED");
_game->_smartCache = false;
}
/* bool AllowDirectDraw = _game->_registry->ReadBool("Debug", "AllowDirectDraw", false);*/
/* bool AllowDirectDraw = _game->_registry->readBool("Debug", "AllowDirectDraw", false);*/
// load general game settings
_game->initialize1();
@@ -307,8 +307,8 @@ int WinterMuteEngine::messageLoop() {
PosX -= _game->_renderer->_monitorRect.left;
PosY -= _game->_renderer->_monitorRect.top;
_game->_registry->WriteInt("Video", "WindowPosX", PosX);
_game->_registry->WriteInt("Video", "WindowPosY", PosY);
_game->_registry->writeInt("Video", "WindowPosX", PosX);
_game->_registry->writeInt("Video", "WindowPosY", PosY);
}
}
*/