BASE: Update scaler settings from old config files
This commit is contained in:
parent
b2d41daabc
commit
c2ae54306f
3 changed files with 71 additions and 40 deletions
|
@ -72,22 +72,6 @@
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
#include <SDL_clipboard.h>
|
#include <SDL_clipboard.h>
|
||||||
#endif
|
#endif
|
||||||
struct LegacyGraphicsMode {
|
|
||||||
const char *name;
|
|
||||||
const char *oldName;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Table for using old names for scalers in the configuration
|
|
||||||
// to keep compatibility with old config files.
|
|
||||||
static const LegacyGraphicsMode s_legacyGraphicsModes[] = {
|
|
||||||
{ "supereagle2x", "supereagle" },
|
|
||||||
{ "dotmatrix2x", "dotmatrix" },
|
|
||||||
{ "sai2x", "2xsai" },
|
|
||||||
{ "normal1x", "1x" },
|
|
||||||
{ "normal2x", "2x" },
|
|
||||||
{ "normal3x", "3x" },
|
|
||||||
{ "supersai2x", "super2xsai" },
|
|
||||||
};
|
|
||||||
|
|
||||||
OSystem_SDL::OSystem_SDL()
|
OSystem_SDL::OSystem_SDL()
|
||||||
:
|
:
|
||||||
|
@ -253,30 +237,7 @@ void OSystem_SDL::initBackend() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for legacy gfx_mode and replace it
|
// Search for legacy gfx_mode and replace it
|
||||||
if (ConfMan.hasKey("gfx_mode")) {
|
ScalerMan.updateOldSettings();
|
||||||
Common::String gfxMode(ConfMan.get("gfx_mode"));
|
|
||||||
for (uint i = 0; i < ARRAYSIZE(s_legacyGraphicsModes); ++i) {
|
|
||||||
if (gfxMode == s_legacyGraphicsModes[i].oldName) {
|
|
||||||
ConfMan.set("gfx_mode", s_legacyGraphicsModes[i].name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Look in all game domains as well
|
|
||||||
#if 0
|
|
||||||
Common::ConfigManager::DomainMap &dm = ConfMan.getGameDomains();
|
|
||||||
for (Common::ConfigManager::DomainMap::iterator domain = dm.begin(); domain != dm.end(); ++domain) {
|
|
||||||
Common::ConfigManager::Domain::const_iterator gm = domain->_value.find("gfx_mode");
|
|
||||||
if (gm != domain->_value.end()) {
|
|
||||||
for (uint i = 0; i < ARRAYSIZE(s_legacyGraphicsModes); ++i) {
|
|
||||||
if (gm->_value == s_legacyGraphicsModes[i].oldName) {
|
|
||||||
gm->_value = s_legacyGraphicsModes[i].name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_graphicsManager == 0) {
|
if (_graphicsManager == 0) {
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
|
@ -1037,3 +1037,68 @@ uint ScalerManager::findScalerPluginIndex(const char *name) const {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct LegacyGraphicsMode {
|
||||||
|
const char *oldName;
|
||||||
|
const char *newName;
|
||||||
|
uint factor;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Table for using old names for scalers in the configuration
|
||||||
|
// to keep compatibiblity with old config files.
|
||||||
|
static const LegacyGraphicsMode s_legacyGraphicsModes[] = {
|
||||||
|
{ "1x", "normal", 1 },
|
||||||
|
{ "2x", "normal", 2 },
|
||||||
|
{ "3x", "normal", 3 },
|
||||||
|
{ "normal1x", "normal", 1 },
|
||||||
|
{ "normal2x", "normal", 2 },
|
||||||
|
{ "normal3x", "normal", 3 },
|
||||||
|
{ "normal4x", "normal", 4 },
|
||||||
|
{ "hq2x", "hq", 2 },
|
||||||
|
{ "hq3x", "hq", 3 },
|
||||||
|
{ "edge2x", "edge", 2 },
|
||||||
|
{ "edge3x", "edge", 3 },
|
||||||
|
{ "advmame2x", "advmame", 2 },
|
||||||
|
{ "advmame3x", "advmame", 3 },
|
||||||
|
{ "advmame4x", "advmame", 4 },
|
||||||
|
{ "2xsai", "sai", 2 },
|
||||||
|
{ "sai2x", "sai", 2 },
|
||||||
|
{ "super2xsai", "supersai", 2 },
|
||||||
|
{ "supersai2x", "supersai", 2 },
|
||||||
|
{ "supereagle", "supereagle", 2 },
|
||||||
|
{ "supereagle2x", "supereagle", 2 },
|
||||||
|
{ "pm2x", "pm", 2 },
|
||||||
|
{ "dotmatrix", "dotmatrix", 2 },
|
||||||
|
{ "dotmatrix2x", "dotmatrix", 2 },
|
||||||
|
{ "tv2x", "tv", 2 }
|
||||||
|
};
|
||||||
|
|
||||||
|
void ScalerManager::updateOldSettings() {
|
||||||
|
// Search for legacy gfx_mode and replace it
|
||||||
|
if (ConfMan.hasKey("gfx_mode")) {
|
||||||
|
Common::String gfxMode(ConfMan.get("gfx_mode"));
|
||||||
|
for (uint i = 0; i < ARRAYSIZE(s_legacyGraphicsModes); ++i) {
|
||||||
|
if (gfxMode == s_legacyGraphicsModes[i].oldName) {
|
||||||
|
ConfMan.set("scaler", s_legacyGraphicsModes[i].newName);
|
||||||
|
ConfMan.setInt("scale_factor", s_legacyGraphicsModes[i].factor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look in all game domains as well
|
||||||
|
for (Common::ConfigManager::DomainMap::iterator domain = ConfMan.beginGameDomains(); domain != ConfMan.endGameDomains(); ++domain) {
|
||||||
|
if (domain->_value.contains("gfx_mode")) {
|
||||||
|
Common::String gfxMode(domain->_value.getVal("gfx_mode"));
|
||||||
|
for (uint i = 0; i < ARRAYSIZE(s_legacyGraphicsModes); ++i) {
|
||||||
|
if (gfxMode == s_legacyGraphicsModes[i].oldName) {
|
||||||
|
warning("%s: %s -> %s@%dx", domain->_value.getDomainComment().c_str(), s_legacyGraphicsModes[i].oldName, s_legacyGraphicsModes[i].newName, s_legacyGraphicsModes[i].factor);
|
||||||
|
domain->_value.setVal("scaler", s_legacyGraphicsModes[i].newName);
|
||||||
|
domain->_value.setVal("scale_factor", Common::String::format("%i", s_legacyGraphicsModes[i].factor));
|
||||||
|
domain->_value.erase("gfx_mode");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -230,6 +230,11 @@ public:
|
||||||
* Search the scaler plugins for a special plugin based on its name.
|
* Search the scaler plugins for a special plugin based on its name.
|
||||||
*/
|
*/
|
||||||
uint findScalerPluginIndex(const char *name) const;
|
uint findScalerPluginIndex(const char *name) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update scaler settings from older versions of ScummVM.
|
||||||
|
*/
|
||||||
|
void updateOldSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Convenience shortcut for accessing singleton */
|
/** Convenience shortcut for accessing singleton */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue