Skip to content

Commit

Permalink
Capitalize filterRange6581 .ini parameter (fixes #40)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Jul 14, 2024
1 parent 23e9f43 commit b6d89b9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/IniConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,18 @@ void IniConfig::readEmulation(iniHandler &ini)
readDouble(ini, TEXT("FilterBias"), emulation_s.bias);
readDouble(ini, TEXT("FilterCurve6581"), emulation_s.filterCurve6581);
#ifdef FEAT_FILTER_RANGE
readDouble(ini, TEXT("filterRange6581"), emulation_s.filterRange6581);
{
// For backward compatibility, remove for 3.0
const TCHAR *key = TEXT("filterRange6581");
const TCHAR* value = ini.getValue(key);
if (value && value[0])
{
ini.addValue(TEXT("FilterRange6581"), value);
ini.removeValue(key);
}
}
readDouble(ini, TEXT("FilterRange6581"), emulation_s.filterRange6581);

#endif
readDouble(ini, TEXT("FilterCurve8580"), emulation_s.filterCurve8580);

Expand Down
7 changes: 7 additions & 0 deletions src/ini/iniHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ void iniHandler::addValue(const TCHAR *key, const TCHAR *value)
changed = true;
}

void iniHandler::removeValue(const TCHAR *key)
{
auto section = &(*curSection).second;
section->erase(std::remove_if(section->begin(), section->end(), compare<stringPair_t>(key)));
changed = true;
}

bool iniHandler::write(const TCHAR *fName)
{
SID_WOFSTREAM iniFile(fName);
Expand Down
1 change: 1 addition & 0 deletions src/ini/iniHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class iniHandler

void addSection(const TCHAR *section);
void addValue(const TCHAR *key, const TCHAR *value);
void removeValue(const TCHAR *key);
};

#endif // INIHANDLER_H

0 comments on commit b6d89b9

Please sign in to comment.