Remove duplicate variable `winFlashSize`.

We already had `optFlashSize` for both SDL and WX ports. We assigned
this variable to replace all ocurrences of `winFlashSize`.

As a side note, this entire scope could/should be replaced by a better
auto-detect system for saving types. At the moment, it is only really
useful for the SDL port, since we have overrides for the WX port.

- Fix #585.
This commit is contained in:
Edênis Freindorfer Azevedo 2020-02-17 04:57:17 -03:00 committed by Rafael Kitover
parent 8d62a790e3
commit 7bac34eda4
5 changed files with 7 additions and 8 deletions

View File

@ -248,7 +248,6 @@ int windowMaximized;
int windowPositionX, bkpPosX = 0; int windowPositionX, bkpPosX = 0;
int windowPositionY, bkpPosY = 0; int windowPositionY, bkpPosY = 0;
uint32_t windowWidth; uint32_t windowWidth;
int winFlashSize;
int winGbBorderOn; int winGbBorderOn;
int winGbPrinterEnabled; int winGbPrinterEnabled;
int winPauseNextFrame; int winPauseNextFrame;
@ -534,7 +533,7 @@ void LoadConfig()
maxScale = ReadPref("maxScale", 0); maxScale = ReadPref("maxScale", 0);
movieRecordDir = ReadPrefString("movieRecordDir"); movieRecordDir = ReadPrefString("movieRecordDir");
openGL = ReadPrefHex("openGL"); openGL = ReadPrefHex("openGL");
optFlashSize = ReadPrefHex("flashSize"); optFlashSize = ReadPref("flashSize", 0);
pauseWhenInactive = ReadPref("pauseWhenInactive", 1); pauseWhenInactive = ReadPref("pauseWhenInactive", 1);
recentFreeze = ReadPref("recentFreeze", 0); recentFreeze = ReadPref("recentFreeze", 0);
rewindTimer = ReadPref("rewindTimer", 0); rewindTimer = ReadPref("rewindTimer", 0);
@ -569,7 +568,6 @@ void LoadConfig()
windowPositionX = ReadPref("windowX", -1); windowPositionX = ReadPref("windowX", -1);
windowPositionY = ReadPref("windowY", -1); windowPositionY = ReadPref("windowY", -1);
windowWidth = ReadPref("windowWidth", 0); windowWidth = ReadPref("windowWidth", 0);
winFlashSize = ReadPref("flashSize", 0x10000);
winGbBorderOn = ReadPref("borderOn", 0); winGbBorderOn = ReadPref("borderOn", 0);
winGbPrinterEnabled = ReadPref("gbPrinter", 0); winGbPrinterEnabled = ReadPref("gbPrinter", 0);
@ -1334,6 +1332,8 @@ int ReadOpts(int argc, char ** argv)
// --opt-flash-size // --opt-flash-size
if (optarg) { if (optarg) {
optFlashSize = atoi(optarg); optFlashSize = atoi(optarg);
if (optFlashSize < 0 || optFlashSize > 1)
optFlashSize = 0;
} }
break; break;

View File

@ -139,7 +139,6 @@ extern int windowMaximized;
extern int windowPositionX, bkpPosX; extern int windowPositionX, bkpPosX;
extern int windowPositionY, bkpPosY; extern int windowPositionY, bkpPosY;
extern uint32_t windowWidth; extern uint32_t windowWidth;
extern int winFlashSize;
extern int winGbBorderOn; extern int winGbBorderOn;
extern int winGbPrinterEnabled; extern int winGbPrinterEnabled;
extern int winPauseNextFrame; extern int winPauseNextFrame;

View File

@ -3597,7 +3597,7 @@ bool MainFrame::BindControls()
/// System and peripherals /// System and peripherals
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "SaveType", wxGenericValidator(&cpuSaveType)); ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "SaveType", wxGenericValidator(&cpuSaveType));
BatConfigHandler.type = ch; BatConfigHandler.type = ch;
ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "FlashSize", wxGenericValidator(&winFlashSize)); ch = GetValidatedChild<wxChoice, wxGenericValidator>(d, "FlashSize", wxGenericValidator(&optFlashSize));
BatConfigHandler.size = ch; BatConfigHandler.size = ch;
d->Connect(XRCID("SaveType"), wxEVT_COMMAND_CHOICE_SELECTED, d->Connect(XRCID("SaveType"), wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler(BatConfig_t::ChangeType), wxCommandEventHandler(BatConfig_t::ChangeType),

View File

@ -569,7 +569,7 @@ void load_opts()
cfg->Read(opt.opt, &opt.curint, *opt.intopt); cfg->Read(opt.opt, &opt.curint, *opt.intopt);
if (opt.curint < opt.min || opt.curint > opt.max) { if (opt.curint < opt.min || opt.curint > opt.max) {
wxLogWarning(_("Invalid value %d for option %s; valid values are %d - %d"), opt.curint, opt.opt.c_str(), opt.min, opt.max); wxLogWarning(_("Invalid value %d for option %s; valid values are %d - %d"), opt.curint, opt.opt.c_str(), int(opt.min), int(opt.max));
} else } else
*opt.intopt = opt.curint; *opt.intopt = opt.curint;
} else if (opt.doubleopt) { } else if (opt.doubleopt) {

View File

@ -241,7 +241,7 @@ void GameArea::LoadGame(const wxString& name)
int fsz = cfg->Read(wxT("flashSize"), (long)0); int fsz = cfg->Read(wxT("flashSize"), (long)0);
if (fsz != 0x10000 && fsz != 0x20000) if (fsz != 0x10000 && fsz != 0x20000)
fsz = 0x10000 << winFlashSize; fsz = 0x10000 << optFlashSize;
flashSetSize(fsz); flashSetSize(fsz);
ovSaveType = cfg->Read(wxT("saveType"), cpuSaveType); ovSaveType = cfg->Read(wxT("saveType"), cpuSaveType);
@ -258,7 +258,7 @@ void GameArea::LoadGame(const wxString& name)
cfg->SetPath(wxT("/")); cfg->SetPath(wxT("/"));
} else { } else {
rtcEnable(rtcEnabled); rtcEnable(rtcEnabled);
flashSetSize(0x10000 << winFlashSize); flashSetSize(0x10000 << optFlashSize);
if (cpuSaveType < 0 || cpuSaveType > 5) if (cpuSaveType < 0 || cpuSaveType > 5)
cpuSaveType = 0; cpuSaveType = 0;