mirror of https://github.com/stella-emu/stella.git
refactoring
This commit is contained in:
parent
bb9425ae89
commit
59eb2d4fa8
|
@ -101,16 +101,6 @@ bool HighScoreManager::getFormats(Formats& formats) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool HighScoreManager::getAddresses(Addresses& addresses) const
|
|
||||||
{
|
|
||||||
addresses.playerAddr = playerAddress();
|
|
||||||
addresses.varAddr = varAddress();
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 HighScoreManager::numDigits() const
|
uInt32 HighScoreManager::numDigits() const
|
||||||
{
|
{
|
||||||
|
@ -150,6 +140,25 @@ bool HighScoreManager::varZeroBased() const
|
||||||
return zeroBased == EmptyString ? true : zeroBased != "0";
|
return zeroBased == EmptyString ? true : zeroBased != "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool HighScoreManager::getAddresses(Addresses& addresses) const
|
||||||
|
{
|
||||||
|
addresses.playerAddr = playerAddress();
|
||||||
|
addresses.varAddr = varAddress();
|
||||||
|
for (int p = 0; p < numPlayers(); ++p)
|
||||||
|
{
|
||||||
|
for (int a = 0; a < numAddrBytes(); ++a)
|
||||||
|
{
|
||||||
|
uInt32 idx = p * numAddrBytes() + a;
|
||||||
|
string addr = getPropIdx(PropType::Cart_Addresses, idx);
|
||||||
|
|
||||||
|
addresses.scoreAddr[p][a] = (addr == EmptyString ? 0 : stoi(addr, nullptr, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoreManager::playerAddress() const
|
uInt16 HighScoreManager::playerAddress() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -377,7 +377,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
EditableWidget::TextFilter fAddr = [](char c) {
|
EditableWidget::TextFilter fAddr = [](char c) {
|
||||||
return (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
|
return (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
|
||||||
};
|
};
|
||||||
int rwidth = font.getStringWidth("F") + 4;
|
int rwidth = font.getStringWidth("123") + 4;
|
||||||
|
|
||||||
myPlayersAddressLabel = new StaticTextWidget(myTab, font, myPlayers->getRight() + 16, ypos + 1, "Address ");
|
myPlayersAddressLabel = new StaticTextWidget(myTab, font, myPlayers->getRight() + 16, ypos + 1, "Address ");
|
||||||
myPlayersAddress = new EditTextWidget(myTab, font, myPlayersAddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
myPlayersAddress = new EditTextWidget(myTab, font, myPlayersAddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
||||||
|
@ -389,7 +389,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
fwidth = font.getStringWidth("255") + 5;
|
fwidth = font.getStringWidth("255") + 5;
|
||||||
rwidth = font.getStringWidth("FFF") + 4;
|
rwidth = font.getStringWidth("123") + 4;
|
||||||
myVariationsLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, lwidth, fontHeight, "Variations");
|
myVariationsLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, lwidth, fontHeight, "Variations");
|
||||||
myVariations = new EditTextWidget(myTab, font, xpos + lwidth, ypos - 1, fwidth, lineHeight);
|
myVariations = new EditTextWidget(myTab, font, xpos + lwidth, ypos - 1, fwidth, lineHeight);
|
||||||
wid.push_back(myVariations);
|
wid.push_back(myVariations);
|
||||||
|
@ -401,10 +401,10 @@ GameInfoDialog::GameInfoDialog(
|
||||||
myVarAddressVal = new EditTextWidget(myTab, font, myVarAddress->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
myVarAddressVal = new EditTextWidget(myTab, font, myVarAddress->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
||||||
myVarAddressVal->setEditable(false);
|
myVarAddressVal->setEditable(false);
|
||||||
|
|
||||||
myVarFormat = new CheckboxWidget(myTab, font, myVarAddressVal->getRight() + 16, ypos + 1, "BCD", kVarFormatChanged);
|
myVarBCD = new CheckboxWidget(myTab, font, myVarAddressVal->getRight() + 16, ypos + 1, "BCD", kVarFormatChanged);
|
||||||
wid.push_back(myVarFormat);
|
wid.push_back(myVarBCD);
|
||||||
|
|
||||||
myVarZeroBased = new CheckboxWidget(myTab, font, myVarFormat->getRight() + 16, ypos + 1, "0-based", kVar0BasedChanged);
|
myVarZeroBased = new CheckboxWidget(myTab, font, myVarBCD->getRight() + 16, ypos + 1, "0-based", kVar0BasedChanged);
|
||||||
wid.push_back(myVarZeroBased);
|
wid.push_back(myVarZeroBased);
|
||||||
|
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
@ -433,97 +433,35 @@ GameInfoDialog::GameInfoDialog(
|
||||||
VarList::push_back(items, "3", "3");
|
VarList::push_back(items, "3", "3");
|
||||||
pwidth = font.getStringWidth("0");
|
pwidth = font.getStringWidth("0");
|
||||||
|
|
||||||
myTrailing0sLabel = new StaticTextWidget(myTab, font, myScoreDigits->getRight() + 20, ypos + 1, "0-Digits ");
|
myTrailingZeroesLabel = new StaticTextWidget(myTab, font, myScoreDigits->getRight() + 20, ypos + 1, "0-Digits ");
|
||||||
myTrailing0s = new PopUpWidget(myTab, font, myTrailing0sLabel->getRight(), ypos, pwidth, lineHeight,
|
myTrailingZeroes = new PopUpWidget(myTab, font, myTrailingZeroesLabel->getRight(), ypos, pwidth, lineHeight,
|
||||||
items, "", 0, kScoreMultChanged);
|
items, "", 0, kScoreMultChanged);
|
||||||
wid.push_back(myTrailing0s);
|
wid.push_back(myTrailingZeroes);
|
||||||
|
|
||||||
myScoreFormat = new CheckboxWidget(myTab, font, myVarFormat->getLeft(), ypos + 1, "BCD", kScoreFormatChanged);
|
myScoreBCD = new CheckboxWidget(myTab, font, myVarBCD->getLeft(), ypos + 1, "BCD", kScoreFormatChanged);
|
||||||
wid.push_back(myScoreFormat);
|
wid.push_back(myScoreBCD);
|
||||||
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
myP1AddressLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, "P1 Addresses ");
|
for (uInt32 p = 0; p < HighScoreManager::MAX_PLAYERS; ++p)
|
||||||
myP1Address0 = new EditTextWidget(myTab, font, myP1AddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
{
|
||||||
myP1Address0->setTextFilter(fAddr);
|
uInt32 s_xpos = xpos;
|
||||||
wid.push_back(myP1Address0);
|
ypos += lineHeight + VGAP;
|
||||||
myP1Address0Val = new EditTextWidget(myTab, font, myP1Address0->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP1Address0Val->setEditable(false);
|
|
||||||
|
|
||||||
myP1Address1 = new EditTextWidget(myTab, font, myP1Address0Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
myScoreAddressesLabel[p] = new StaticTextWidget(myTab, font, s_xpos, ypos + 1,
|
||||||
myP1Address1->setTextFilter(fAddr);
|
"P" + std::to_string(p + 1) + " Addresses ");
|
||||||
wid.push_back(myP1Address1);
|
s_xpos += myScoreAddressesLabel[p]->getRight();
|
||||||
myP1Address1Val = new EditTextWidget(myTab, font, myP1Address1->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
for (uInt32 a = 0; a < HighScoreManager::MAX_SCORE_ADDR; ++a)
|
||||||
myP1Address1Val->setEditable(false);
|
{
|
||||||
|
myScoreAddress[p][a] = new EditTextWidget(myTab, font, s_xpos, ypos - 1, awidth, lineHeight);
|
||||||
|
myScoreAddress[p][a]->setTextFilter(fAddr);
|
||||||
|
wid.push_back(myScoreAddress[p][a]);
|
||||||
|
s_xpos += myScoreAddress[p][a]->getWidth() + 2;
|
||||||
|
|
||||||
myP1Address2 = new EditTextWidget(myTab, font, myP1Address1Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
myScoreAddressVal[p][a] = new EditTextWidget(myTab, font, myScoreAddress[p][a]->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
||||||
myP1Address2->setTextFilter(fAddr);
|
myScoreAddressVal[p][a]->setEditable(false);
|
||||||
wid.push_back(myP1Address2);
|
s_xpos += myScoreAddressVal[p][a]->getWidth() + 16;
|
||||||
myP1Address2Val = new EditTextWidget(myTab, font, myP1Address2->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
}
|
||||||
myP1Address2Val->setEditable(false);
|
}
|
||||||
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
myP2AddressLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, "P2 Addresses ");
|
|
||||||
myP2Address0 = new EditTextWidget(myTab, font, myP2AddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
|
||||||
myP2Address0->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP2Address0);
|
|
||||||
myP2Address0Val = new EditTextWidget(myTab, font, myP2Address0->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP2Address0Val->setEditable(false);
|
|
||||||
|
|
||||||
myP2Address1 = new EditTextWidget(myTab, font, myP2Address0Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP2Address1->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP2Address1);
|
|
||||||
myP2Address1Val = new EditTextWidget(myTab, font, myP2Address1->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP2Address1Val->setEditable(false);
|
|
||||||
|
|
||||||
myP2Address2 = new EditTextWidget(myTab, font, myP2Address1Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP2Address2->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP2Address2);
|
|
||||||
myP2Address2Val = new EditTextWidget(myTab, font, myP2Address2->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP2Address2Val->setEditable(false);
|
|
||||||
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
myP3AddressLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, "P3 Addresses ");
|
|
||||||
myP3Address0 = new EditTextWidget(myTab, font, myP3AddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
|
||||||
myP3Address0->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP3Address0);
|
|
||||||
myP3Address0Val = new EditTextWidget(myTab, font, myP3Address0->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP3Address0Val->setEditable(false);
|
|
||||||
|
|
||||||
myP3Address1 = new EditTextWidget(myTab, font, myP3Address0Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP3Address1->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP3Address1);
|
|
||||||
myP3Address1Val = new EditTextWidget(myTab, font, myP3Address1->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP3Address1Val->setEditable(false);
|
|
||||||
|
|
||||||
myP3Address2 = new EditTextWidget(myTab, font, myP3Address1Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP3Address2->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP3Address2);
|
|
||||||
myP3Address2Val = new EditTextWidget(myTab, font, myP3Address2->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP3Address2Val->setEditable(false);
|
|
||||||
|
|
||||||
ypos += lineHeight + VGAP;
|
|
||||||
|
|
||||||
myP4AddressLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, "P4 Addresses ");
|
|
||||||
myP4Address0 = new EditTextWidget(myTab, font, myP4AddressLabel->getRight(), ypos - 1, awidth, lineHeight);
|
|
||||||
myP4Address0->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP4Address0);
|
|
||||||
myP4Address0Val = new EditTextWidget(myTab, font, myP4Address0->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP4Address0Val->setEditable(false);
|
|
||||||
|
|
||||||
myP4Address1 = new EditTextWidget(myTab, font, myP4Address0Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP4Address1->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP4Address1);
|
|
||||||
myP4Address1Val = new EditTextWidget(myTab, font, myP4Address1->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP4Address1Val->setEditable(false);
|
|
||||||
|
|
||||||
myP4Address2 = new EditTextWidget(myTab, font, myP4Address1Val->getRight() + 16, ypos - 1, awidth, lineHeight);
|
|
||||||
myP4Address2->setTextFilter(fAddr);
|
|
||||||
wid.push_back(myP4Address2);
|
|
||||||
myP4Address2Val = new EditTextWidget(myTab, font, myP4Address2->getRight() + 2, ypos - 1, rwidth, lineHeight);
|
|
||||||
myP4Address2Val->setEditable(false);
|
|
||||||
|
|
||||||
// Add items for tab 4
|
// Add items for tab 4
|
||||||
addToFocusList(wid, myTab, tabID);
|
addToFocusList(wid, myTab, tabID);
|
||||||
|
@ -734,9 +672,9 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props)
|
||||||
myVariations->setText(std::to_string(instance().highScores().numVariations()));
|
myVariations->setText(std::to_string(instance().highScores().numVariations()));
|
||||||
|
|
||||||
myScoreDigits->setSelected(formats.numDigits);
|
myScoreDigits->setSelected(formats.numDigits);
|
||||||
myTrailing0s->setSelected(formats.trailingZeroes);
|
myTrailingZeroes->setSelected(formats.trailingZeroes);
|
||||||
myScoreFormat->setState(formats.scoreBCD);
|
myScoreBCD->setState(formats.scoreBCD);
|
||||||
myVarFormat->setState(formats.varBCD);
|
myVarBCD->setState(formats.varBCD);
|
||||||
myVarZeroBased->setState(formats.varZeroBased);
|
myVarZeroBased->setState(formats.varZeroBased);
|
||||||
|
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
@ -746,6 +684,17 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props)
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss << std::hex << std::right << std::setw(4) << std::setfill('0') << addresses.varAddr;
|
ss << std::hex << std::right << std::setw(4) << std::setfill('0') << addresses.varAddr;
|
||||||
myVarAddress->setText(ss.str());
|
myVarAddress->setText(ss.str());
|
||||||
|
|
||||||
|
|
||||||
|
for (uInt32 p = 0; p < instance().highScores().numPlayers(); ++p)
|
||||||
|
{
|
||||||
|
for (uInt32 a = 0; a < instance().highScores().numAddrBytes(); ++a)
|
||||||
|
{
|
||||||
|
ss.str("");
|
||||||
|
ss << std::hex << std::right << std::setw(4) << std::setfill('0') << addresses.scoreAddr[p][a];
|
||||||
|
myScoreAddress[p][a]->setText(ss.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
handleHighScoresWidgets();
|
handleHighScoresWidgets();
|
||||||
}
|
}
|
||||||
|
@ -963,12 +912,11 @@ void GameInfoDialog::eraseEEPROM()
|
||||||
void GameInfoDialog::handleHighScoresWidgets()
|
void GameInfoDialog::handleHighScoresWidgets()
|
||||||
{
|
{
|
||||||
bool enable = myHighScores->getState();
|
bool enable = myHighScores->getState();
|
||||||
int players = myPlayers->getSelected() + 1;
|
uInt32 players = myPlayers->getSelected() + 1;
|
||||||
bool enablePlayers = enable && players > 1;
|
bool enablePlayers = enable && players > 1;
|
||||||
bool enableVars = enable && myVariations->getText() > "1";
|
bool enableVars = enable && myVariations->getText() > "1";
|
||||||
int numAddr = instance().highScores().numAddrBytes(myScoreDigits->getSelected() + 1, myTrailing0s->getSelected());
|
uInt32 numAddr = instance().highScores().numAddrBytes(myScoreDigits->getSelected() + 1,
|
||||||
bool enable1 = enable && numAddr >= 2;
|
myTrailingZeroes->getSelected());
|
||||||
bool enable2 = enable && numAddr >= 3;
|
|
||||||
|
|
||||||
myPlayersLabel->setEnabled(enable);
|
myPlayersLabel->setEnabled(enable);
|
||||||
myPlayers->setEnabled(enable);
|
myPlayers->setEnabled(enable);
|
||||||
|
@ -984,83 +932,54 @@ void GameInfoDialog::handleHighScoresWidgets()
|
||||||
myVarAddress->setEnabled(enableVars);
|
myVarAddress->setEnabled(enableVars);
|
||||||
myVarAddress->setEditable(enableVars);
|
myVarAddress->setEditable(enableVars);
|
||||||
myVarAddressVal->setEnabled(enableVars);
|
myVarAddressVal->setEnabled(enableVars);
|
||||||
myVarFormat->setEnabled(enableVars);
|
myVarBCD->setEnabled(enableVars);
|
||||||
myVarZeroBased->setEnabled(enableVars);
|
myVarZeroBased->setEnabled(enableVars);
|
||||||
|
|
||||||
myScoresLabel->setEnabled(enable);
|
myScoresLabel->setEnabled(enable);
|
||||||
myScoreDigitsLabel->setEnabled(enable);
|
myScoreDigitsLabel->setEnabled(enable);
|
||||||
myScoreDigits->setEnabled(enable);
|
myScoreDigits->setEnabled(enable);
|
||||||
myScoreFormat->setEnabled(enable);
|
myScoreBCD->setEnabled(enable);
|
||||||
myTrailing0sLabel->setEnabled(enable);
|
myTrailingZeroesLabel->setEnabled(enable);
|
||||||
myTrailing0s->setEnabled(enable);
|
myTrailingZeroes->setEnabled(enable);
|
||||||
|
|
||||||
myP1AddressLabel->setEnabled(enable);
|
for (uInt32 p = 0; p < HighScoreManager::MAX_PLAYERS; ++p)
|
||||||
myP1Address0->setEnabled(enable);
|
{
|
||||||
myP1Address0->setEditable(enable);
|
enable &= players > p;
|
||||||
myP1Address0Val->setEnabled(enable);
|
myScoreAddressesLabel[p]->setEnabled(enable);
|
||||||
myP1Address1->setEnabled(enable1);
|
|
||||||
myP1Address1->setEditable(enable1);
|
|
||||||
myP1Address1Val->setEnabled(enable1);
|
|
||||||
myP1Address2->setEnabled(enable2);
|
|
||||||
myP1Address2->setEditable(enable2);
|
|
||||||
myP1Address2Val->setEnabled(enable2);
|
|
||||||
|
|
||||||
enable &= players >= 2;
|
for (uInt32 a = 0; a < HighScoreManager::MAX_SCORE_ADDR; ++a)
|
||||||
enable1 &= enable; enable2 &= enable;
|
{
|
||||||
myP2AddressLabel->setEnabled(enable);
|
myScoreAddress[p][a]->setEnabled(enable && numAddr > a);
|
||||||
myP2Address0->setEnabled(enable);
|
myScoreAddressVal[p][a]->setEnabled(enable && numAddr > a);
|
||||||
myP2Address0->setEditable(enable);
|
}
|
||||||
myP2Address0Val->setEnabled(enable);
|
}
|
||||||
myP2Address1->setEnabled(enable1);
|
|
||||||
myP2Address1->setEditable(enable1);
|
|
||||||
myP2Address1Val->setEnabled(enable1);
|
|
||||||
myP2Address2->setEnabled(enable2);
|
|
||||||
myP2Address2->setEditable(enable2);
|
|
||||||
myP2Address2Val->setEnabled(enable2);
|
|
||||||
|
|
||||||
enable &= players >= 3;
|
setAddressVal(myPlayersAddress, myPlayersAddressVal);
|
||||||
enable1 &= enable; enable2 &= enable;
|
setAddressVal(myVarAddress, myVarAddressVal, myVarBCD->getState(), myVarZeroBased->getState() ? 1 : 0);
|
||||||
myP3AddressLabel->setEnabled(enable);
|
|
||||||
myP3Address0->setEnabled(enable);
|
|
||||||
myP3Address0->setEditable(enable);
|
|
||||||
myP3Address0Val->setEnabled(enable);
|
|
||||||
myP3Address1->setEnabled(enable1);
|
|
||||||
myP3Address1->setEditable(enable1);
|
|
||||||
myP3Address1Val->setEnabled(enable1);
|
|
||||||
myP3Address2->setEnabled(enable2);
|
|
||||||
myP3Address2->setEditable(enable2);
|
|
||||||
myP3Address2Val->setEnabled(enable2);
|
|
||||||
|
|
||||||
enable &= players >= 4;
|
for (uInt32 p = 0; p < players; ++p)
|
||||||
enable1 &= enable; enable2 &= enable;
|
for (uInt32 a = 0; a < numAddr; ++a)
|
||||||
myP4AddressLabel->setEnabled(enable);
|
setAddressVal(myScoreAddress[p][a], myScoreAddressVal[p][a], myScoreBCD->getState());
|
||||||
myP4Address0->setEnabled(enable);
|
}
|
||||||
myP4Address0->setEditable(enable);
|
|
||||||
myP4Address0Val->setEnabled(enable);
|
|
||||||
myP4Address1->setEnabled(enable1);
|
|
||||||
myP4Address1->setEditable(enable1);
|
|
||||||
myP4Address1->setEditable(enable1);
|
|
||||||
myP4Address1Val->setEnabled(enable1);
|
|
||||||
myP4Address2->setEnabled(enable2);
|
|
||||||
myP4Address2->setEditable(enable2);
|
|
||||||
myP4Address2Val->setEnabled(enable2);
|
|
||||||
|
|
||||||
if (instance().hasConsole())
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void GameInfoDialog::setAddressVal(const EditTextWidget* addressWidget, EditTextWidget* valWidget, bool isBCD, uInt16 incVal)
|
||||||
|
{
|
||||||
|
if (instance().hasConsole() && valWidget->isEnabled())
|
||||||
{
|
{
|
||||||
System& system = instance().console().system();
|
System& system = instance().console().system();
|
||||||
|
string strAddr;
|
||||||
uInt16 addr;
|
uInt16 addr;
|
||||||
uInt8 val;
|
uInt8 val;
|
||||||
ostringstream ss;
|
|
||||||
|
|
||||||
addr = stoi(myPlayersAddress->getText(), nullptr, 16);
|
strAddr = addressWidget->getText();
|
||||||
myPlayersAddressVal->setText(std::to_string(system.peek(addr)));
|
addr = strAddr == EmptyString ? 0 : stoi(strAddr, nullptr, isBCD ? 10 : 16);
|
||||||
addr = stoi(myVarAddress->getText(), nullptr, 16);
|
val = system.peek(addr) + incVal;
|
||||||
|
valWidget->setText(std::to_string(val));
|
||||||
val = system.peek(addr) + (myVarZeroBased->getState() ? 1u : 0u);
|
cerr << strAddr << ": " << addr << ", " << val << endl;
|
||||||
ss.str("");
|
|
||||||
ss << std::dec << val; // std::dec << std::right << std::setw(3) << std::setfill(' ') << val;
|
|
||||||
myVarAddressVal->setText(ss.str());
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
valWidget->setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -26,10 +26,12 @@ class StaticTextWidget;
|
||||||
class RadioButtonGroup;
|
class RadioButtonGroup;
|
||||||
class TabWidget;
|
class TabWidget;
|
||||||
class SliderWidget;
|
class SliderWidget;
|
||||||
|
class HighScoreManager;
|
||||||
|
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
#include "Command.hxx"
|
#include "Command.hxx"
|
||||||
#include "Props.hxx"
|
#include "Props.hxx"
|
||||||
|
#include "HighScoreManager.hxx"
|
||||||
|
|
||||||
class GameInfoDialog : public Dialog, public CommandSender
|
class GameInfoDialog : public Dialog, public CommandSender
|
||||||
{
|
{
|
||||||
|
@ -59,6 +61,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
||||||
void updateControllerStates();
|
void updateControllerStates();
|
||||||
void eraseEEPROM();
|
void eraseEEPROM();
|
||||||
void handleHighScoresWidgets();
|
void handleHighScoresWidgets();
|
||||||
|
void setAddressVal(const EditTextWidget* address, EditTextWidget* val, bool isBCD = false, uInt16 incVal = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabWidget* myTab{nullptr};
|
TabWidget* myTab{nullptr};
|
||||||
|
@ -118,16 +121,21 @@ class GameInfoDialog : public Dialog, public CommandSender
|
||||||
StaticTextWidget* myVarAddressLabel{ nullptr };
|
StaticTextWidget* myVarAddressLabel{ nullptr };
|
||||||
EditTextWidget* myVarAddress{ nullptr };
|
EditTextWidget* myVarAddress{ nullptr };
|
||||||
EditTextWidget* myVarAddressVal{ nullptr };
|
EditTextWidget* myVarAddressVal{ nullptr };
|
||||||
CheckboxWidget* myVarFormat{ nullptr };
|
CheckboxWidget* myVarBCD{ nullptr };
|
||||||
CheckboxWidget* myVarZeroBased{ nullptr };
|
CheckboxWidget* myVarZeroBased{ nullptr };
|
||||||
|
|
||||||
StaticTextWidget* myScoresLabel{ nullptr };
|
StaticTextWidget* myScoresLabel{ nullptr };
|
||||||
StaticTextWidget* myScoreDigitsLabel{ nullptr };
|
StaticTextWidget* myScoreDigitsLabel{ nullptr };
|
||||||
PopUpWidget* myScoreDigits{nullptr};
|
PopUpWidget* myScoreDigits{nullptr};
|
||||||
StaticTextWidget* myTrailing0sLabel{ nullptr };
|
StaticTextWidget* myTrailingZeroesLabel{ nullptr };
|
||||||
PopUpWidget* myTrailing0s{nullptr};
|
PopUpWidget* myTrailingZeroes{nullptr};
|
||||||
CheckboxWidget* myScoreFormat{nullptr};
|
CheckboxWidget* myScoreBCD{nullptr};
|
||||||
StaticTextWidget* myP1AddressLabel{nullptr};
|
|
||||||
|
StaticTextWidget* myScoreAddressesLabel[HighScoreManager::MAX_PLAYERS]{ nullptr };
|
||||||
|
EditTextWidget* myScoreAddress[HighScoreManager::MAX_PLAYERS][HighScoreManager::MAX_SCORE_ADDR]{nullptr};
|
||||||
|
EditTextWidget* myScoreAddressVal[HighScoreManager::MAX_PLAYERS][HighScoreManager::MAX_SCORE_ADDR]{nullptr};
|
||||||
|
|
||||||
|
/*StaticTextWidget* myP1AddressLabel{nullptr};
|
||||||
EditTextWidget* myP1Address0{nullptr};
|
EditTextWidget* myP1Address0{nullptr};
|
||||||
EditTextWidget* myP1Address0Val{ nullptr };
|
EditTextWidget* myP1Address0Val{ nullptr };
|
||||||
EditTextWidget* myP1Address1{nullptr};
|
EditTextWidget* myP1Address1{nullptr};
|
||||||
|
@ -154,7 +162,7 @@ class GameInfoDialog : public Dialog, public CommandSender
|
||||||
EditTextWidget* myP4Address1{nullptr};
|
EditTextWidget* myP4Address1{nullptr};
|
||||||
EditTextWidget* myP4Address1Val{ nullptr };
|
EditTextWidget* myP4Address1Val{ nullptr };
|
||||||
EditTextWidget* myP4Address2{nullptr};
|
EditTextWidget* myP4Address2{nullptr};
|
||||||
EditTextWidget* myP4Address2Val{ nullptr };
|
EditTextWidget* myP4Address2Val{ nullptr };*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kVCenterChanged = 'Vcch',
|
kVCenterChanged = 'Vcch',
|
||||||
|
|
Loading…
Reference in New Issue