mirror of https://github.com/stella-emu/stella.git
Consolidate and refactor some code (mostly string conversions).
This commit is contained in:
parent
217f52822d
commit
301f20889e
|
@ -27,10 +27,10 @@ BankRomCheat::BankRomCheat(OSystem& os, string_view name, string_view code)
|
||||||
if(myCode.length() == 7)
|
if(myCode.length() == 7)
|
||||||
myCode = "0" + string{code};
|
myCode = "0" + string{code};
|
||||||
|
|
||||||
bank = unhex(myCode.substr(0, 2));
|
bank = BSPF::stoi_16(myCode.substr(0, 2));
|
||||||
address = 0xf000 + unhex(myCode.substr(2, 3));
|
address = 0xf000 + BSPF::stoi_16(myCode.substr(2, 3));
|
||||||
value = static_cast<uInt8>(unhex(myCode.substr(5, 2)));
|
value = static_cast<uInt8>(BSPF::stoi_16(myCode.substr(5, 2)));
|
||||||
count = static_cast<uInt8>(unhex(myCode.substr(7, 1)) + 1);
|
count = static_cast<uInt8>(BSPF::stoi_16(myCode.substr(7, 1)) + 1);
|
||||||
|
|
||||||
// Back up original data; we need this if the cheat is ever disabled
|
// Back up original data; we need this if the cheat is ever disabled
|
||||||
for(int i = 0; i < count; ++i)
|
for(int i = 0; i < count; ++i)
|
||||||
|
|
|
@ -40,23 +40,6 @@ class Cheat
|
||||||
|
|
||||||
virtual void evaluate() = 0;
|
virtual void evaluate() = 0;
|
||||||
|
|
||||||
protected:
|
|
||||||
static uInt16 unhex(string_view hex)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
for(const auto c: hex)
|
|
||||||
{
|
|
||||||
ret *= 16;
|
|
||||||
if(c >= '0' && c <= '9')
|
|
||||||
ret += c - '0';
|
|
||||||
else if(c >= 'A' && c <= 'F')
|
|
||||||
ret += c - 'A' + 10;
|
|
||||||
else
|
|
||||||
ret += c - 'a' + 10;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OSystem& myOSystem;
|
OSystem& myOSystem;
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CheetahCheat::CheetahCheat(OSystem& os, string_view name, string_view code)
|
CheetahCheat::CheetahCheat(OSystem& os, string_view name, string_view code)
|
||||||
: Cheat(os, name, code),
|
: Cheat(os, name, code),
|
||||||
address{static_cast<uInt16>(0xf000 + unhex(code.substr(0, 3)))},
|
address{static_cast<uInt16>(0xf000 + BSPF::stoi_16(code.substr(0, 3)))},
|
||||||
value{static_cast<uInt8>(unhex(code.substr(3, 2)))},
|
value{static_cast<uInt8>(BSPF::stoi_16(code.substr(3, 2)))},
|
||||||
count{static_cast<uInt8>(unhex(code.substr(5, 1)) + 1)}
|
count{static_cast<uInt8>(BSPF::stoi_16(code.substr(5, 1)) + 1)}
|
||||||
{
|
{
|
||||||
// Back up original data; we need this if the cheat is ever disabled
|
// Back up original data; we need this if the cheat is ever disabled
|
||||||
for(int i = 0; i < count; ++i)
|
for(int i = 0; i < count; ++i)
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
RamCheat::RamCheat(OSystem& os, string_view name, string_view code)
|
RamCheat::RamCheat(OSystem& os, string_view name, string_view code)
|
||||||
: Cheat(os, name, code),
|
: Cheat(os, name, code),
|
||||||
address{static_cast<uInt16>(unhex(myCode.substr(0, 2)))},
|
address{static_cast<uInt16>(BSPF::stoi_16(myCode.substr(0, 2)))},
|
||||||
value{static_cast<uInt8>(unhex(myCode.substr(2, 2)))}
|
value{static_cast<uInt8>(BSPF::stoi_16(myCode.substr(2, 2)))}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -539,12 +539,13 @@ HSM::ScoreAddresses HighScoresManager::getPropScoreAddr(const json& jprops)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt16 HighScoresManager::fromHexStr(string_view addr)
|
uInt16 HighScoresManager::fromHexStr(string_view addr)
|
||||||
{
|
{
|
||||||
|
// TODO: convert away from using string
|
||||||
string naked{addr};
|
string naked{addr};
|
||||||
|
|
||||||
if(const int pos = naked.find("0x") != std::string::npos)
|
if(const auto pos = naked.find("0x") != std::string::npos)
|
||||||
naked = naked.substr(pos + 1);
|
naked = naked.substr(pos + 1);
|
||||||
|
|
||||||
return stringToIntBase16(naked);
|
return static_cast<uInt16>(BSPF::stoi_16(naked));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -193,20 +193,26 @@ namespace BSPF
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert string to integer, using default value on any error
|
// Convert string to integer, using default value on any error
|
||||||
inline int stringToInt(string_view s, const int defaultValue = 0)
|
// TODO: reimplement stoi so only 'string_view' version is needed
|
||||||
|
inline int stoi(string_view s, const int defaultValue = 0)
|
||||||
{
|
{
|
||||||
try { return std::stoi(string{s}); }
|
try { return std::stoi(string{s}); }
|
||||||
catch(...) { return defaultValue; }
|
catch(...) { return defaultValue; }
|
||||||
}
|
}
|
||||||
// TODO: remove this once we reimplement stoi
|
inline int stoi(const string& s, const int defaultValue = 0)
|
||||||
inline int stringToInt(const string& s, const int defaultValue = 0)
|
|
||||||
{
|
{
|
||||||
try { return std::stoi(s); }
|
try { return std::stoi(s); }
|
||||||
catch(...) { return defaultValue; }
|
catch(...) { return defaultValue; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert string with base 16 to integer, using default value on any error
|
// Convert string with base 16 to integer, using default value on any error
|
||||||
inline int stringToIntBase16(const string& s, const int defaultValue = 0)
|
// TODO: reimplement stoi so only 'string_view' version is needed
|
||||||
|
inline int stoi_16(string_view s, const int defaultValue = 0)
|
||||||
|
{
|
||||||
|
try { return std::stoi(string{s}, nullptr, 16); }
|
||||||
|
catch(...) { return defaultValue; }
|
||||||
|
}
|
||||||
|
inline int stoi_16(const string& s, const int defaultValue = 0)
|
||||||
{
|
{
|
||||||
try { return std::stoi(s, nullptr, 16); }
|
try { return std::stoi(s, nullptr, 16); }
|
||||||
catch(...) { return defaultValue; }
|
catch(...) { return defaultValue; }
|
||||||
|
|
|
@ -822,8 +822,8 @@ string CartDebug::loadListFile()
|
||||||
buf >> addr >> addr_s;
|
buf >> addr >> addr_s;
|
||||||
if(addr_s.length() == 0)
|
if(addr_s.length() == 0)
|
||||||
continue;
|
continue;
|
||||||
const char* const p = addr_s[0] == 'U' ? addr_s.c_str() + 1 : addr_s.c_str();
|
|
||||||
addr = static_cast<int>(strtoul(p, nullptr, 16));
|
addr = BSPF::stoi_16(addr_s[0] == 'U' ? addr_s.substr(1) : addr_s);
|
||||||
|
|
||||||
// For now, completely ignore ROM addresses
|
// For now, completely ignore ROM addresses
|
||||||
if(!(addr & 0x1000))
|
if(!(addr & 0x1000))
|
||||||
|
|
|
@ -151,7 +151,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
||||||
myCart->setStartBankFromPropsFunc([this]() {
|
myCart->setStartBankFromPropsFunc([this]() {
|
||||||
const string_view startbank = myProperties.get(PropType::Cart_StartBank);
|
const string_view startbank = myProperties.get(PropType::Cart_StartBank);
|
||||||
return (startbank == EmptyString || BSPF::equalsIgnoreCase(startbank, "AUTO"))
|
return (startbank == EmptyString || BSPF::equalsIgnoreCase(startbank, "AUTO"))
|
||||||
? -1 : BSPF::stringToInt(startbank);
|
? -1 : BSPF::stoi(startbank);
|
||||||
});
|
});
|
||||||
|
|
||||||
// We can only initialize after all the devices/components have been created
|
// We can only initialize after all the devices/components have been created
|
||||||
|
@ -636,7 +636,7 @@ void Console::togglePhosphor()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::changePhosphor(int direction)
|
void Console::changePhosphor(int direction)
|
||||||
{
|
{
|
||||||
int blend = BSPF::stringToInt(myProperties.get(PropType::Display_PPBlend));
|
int blend = BSPF::stoi(myProperties.get(PropType::Display_PPBlend));
|
||||||
|
|
||||||
if(direction)
|
if(direction)
|
||||||
{
|
{
|
||||||
|
@ -801,7 +801,7 @@ void Console::toggleCorrectAspectRatio(bool toggle)
|
||||||
void Console::setTIAProperties()
|
void Console::setTIAProperties()
|
||||||
{
|
{
|
||||||
const Int32 vcenter = BSPF::clamp(
|
const Int32 vcenter = BSPF::clamp(
|
||||||
static_cast<Int32>(BSPF::stringToInt(myProperties.get(PropType::Display_VCenter))), TIAConstants::minVcenter, TIAConstants::maxVcenter
|
static_cast<Int32>(BSPF::stoi(myProperties.get(PropType::Display_VCenter))), TIAConstants::minVcenter, TIAConstants::maxVcenter
|
||||||
);
|
);
|
||||||
|
|
||||||
if(gameRefreshRate() == 60)
|
if(gameRefreshRate() == 60)
|
||||||
|
@ -976,8 +976,8 @@ unique_ptr<Controller> Console::getControllerPort(
|
||||||
else if(type == Controller::Type::PaddlesIAxDr)
|
else if(type == Controller::Type::PaddlesIAxDr)
|
||||||
swapAxis = swapDir = true;
|
swapAxis = swapDir = true;
|
||||||
|
|
||||||
Paddles::setAnalogXCenter(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesXCenter)));
|
Paddles::setAnalogXCenter(BSPF::stoi(myProperties.get(PropType::Controller_PaddlesXCenter)));
|
||||||
Paddles::setAnalogYCenter(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesYCenter)));
|
Paddles::setAnalogYCenter(BSPF::stoi(myProperties.get(PropType::Controller_PaddlesYCenter)));
|
||||||
Paddles::setAnalogSensitivity(myOSystem.settings().getInt("psense"));
|
Paddles::setAnalogSensitivity(myOSystem.settings().getInt("psense"));
|
||||||
|
|
||||||
controller = make_unique<Paddles>(port, myEvent, *mySystem,
|
controller = make_unique<Paddles>(port, myEvent, *mySystem,
|
||||||
|
@ -1108,7 +1108,7 @@ void Console::toggleSwapPaddles(bool toggle)
|
||||||
void Console::changePaddleCenterX(int direction)
|
void Console::changePaddleCenterX(int direction)
|
||||||
{
|
{
|
||||||
const int center =
|
const int center =
|
||||||
BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesXCenter)) + direction,
|
BSPF::clamp(BSPF::stoi(myProperties.get(PropType::Controller_PaddlesXCenter)) + direction,
|
||||||
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
|
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
|
||||||
myProperties.set(PropType::Controller_PaddlesXCenter, std::to_string(center));
|
myProperties.set(PropType::Controller_PaddlesXCenter, std::to_string(center));
|
||||||
Paddles::setAnalogXCenter(center);
|
Paddles::setAnalogXCenter(center);
|
||||||
|
@ -1123,7 +1123,7 @@ void Console::changePaddleCenterX(int direction)
|
||||||
void Console::changePaddleCenterY(int direction)
|
void Console::changePaddleCenterY(int direction)
|
||||||
{
|
{
|
||||||
const int center =
|
const int center =
|
||||||
BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesYCenter)) + direction,
|
BSPF::clamp(BSPF::stoi(myProperties.get(PropType::Controller_PaddlesYCenter)) + direction,
|
||||||
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
|
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
|
||||||
myProperties.set(PropType::Controller_PaddlesYCenter, std::to_string(center));
|
myProperties.set(PropType::Controller_PaddlesYCenter, std::to_string(center));
|
||||||
Paddles::setAnalogYCenter(center);
|
Paddles::setAnalogYCenter(center);
|
||||||
|
|
|
@ -2345,7 +2345,7 @@ void EventHandler::setComboListForEvent(Event::Type event, const StringList& eve
|
||||||
const int combo = event - Event::Combo1;
|
const int combo = event - Event::Combo1;
|
||||||
for(uInt32 i = 0; i < EVENTS_PER_COMBO; ++i)
|
for(uInt32 i = 0; i < EVENTS_PER_COMBO; ++i)
|
||||||
{
|
{
|
||||||
const uInt32 idx = BSPF::stringToInt(events[i]);
|
const uInt32 idx = BSPF::stoi(events[i]);
|
||||||
if(idx < ourEmulActionList.size())
|
if(idx < ourEmulActionList.size())
|
||||||
myComboTable[combo][i] = EventHandler::ourEmulActionList[idx].event;
|
myComboTable[combo][i] = EventHandler::ourEmulActionList[idx].event;
|
||||||
else
|
else
|
||||||
|
|
|
@ -332,7 +332,7 @@ FBInitStatus FrameBuffer::createDisplay(string_view title, BufferType type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_blend = BSPF::stringToInt(myOSystem.console().properties().get(PropType::Display_PPBlend));
|
p_blend = BSPF::stoi(myOSystem.console().properties().get(PropType::Display_PPBlend));
|
||||||
enable = myOSystem.console().properties().get(PropType::Display_Phosphor) == "YES";
|
enable = myOSystem.console().properties().get(PropType::Display_Phosphor) == "YES";
|
||||||
}
|
}
|
||||||
myTIASurface->enablePhosphor(enable, p_blend);
|
myTIASurface->enablePhosphor(enable, p_blend);
|
||||||
|
|
|
@ -67,7 +67,7 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[])
|
||||||
|
|
||||||
if (splitPoint == string::npos) run.runtime = RUNTIME_DEFAULT;
|
if (splitPoint == string::npos) run.runtime = RUNTIME_DEFAULT;
|
||||||
else {
|
else {
|
||||||
const int runtime = BSPF::stringToInt(arg.substr(splitPoint+1, string::npos));
|
const int runtime = BSPF::stoi(arg.substr(splitPoint+1, string::npos));
|
||||||
run.runtime = runtime > 0 ? runtime : RUNTIME_DEFAULT;
|
run.runtime = runtime > 0 ? runtime : RUNTIME_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ void Properties::set(PropType key, string_view value)
|
||||||
|
|
||||||
case PropType::Display_PPBlend:
|
case PropType::Display_PPBlend:
|
||||||
{
|
{
|
||||||
const int blend = BSPF::stringToInt(myProperties[pos]);
|
const int blend = BSPF::stoi(myProperties[pos]);
|
||||||
if(blend < 0 || blend > 100)
|
if(blend < 0 || blend > 100)
|
||||||
myProperties[pos] = ourDefaultProperties[pos];
|
myProperties[pos] = ourDefaultProperties[pos];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -796,10 +796,10 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
|
||||||
myPhosphor->setLabel("Phosphor");
|
myPhosphor->setLabel("Phosphor");
|
||||||
|
|
||||||
const string& blend = props.get(PropType::Display_PPBlend);
|
const string& blend = props.get(PropType::Display_PPBlend);
|
||||||
myPPBlend->setValue(stringToInt(blend));
|
myPPBlend->setValue(BSPF::stoi(blend));
|
||||||
|
|
||||||
// set vertical center
|
// set vertical center
|
||||||
const Int32 vcenter = stringToInt(props.get(PropType::Display_VCenter));
|
const Int32 vcenter = BSPF::stoi(props.get(PropType::Display_VCenter));
|
||||||
myVCenter->setValueLabel(vcenter);
|
myVCenter->setValueLabel(vcenter);
|
||||||
myVCenter->setValue(vcenter);
|
myVCenter->setValue(vcenter);
|
||||||
myVCenter->setValueUnit(vcenter ? "px" : "");
|
myVCenter->setValueUnit(vcenter ? "px" : "");
|
||||||
|
@ -827,8 +827,8 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
|
||||||
mySwapPaddles->setState(props.get(PropType::Controller_SwapPaddles) == "YES");
|
mySwapPaddles->setState(props.get(PropType::Controller_SwapPaddles) == "YES");
|
||||||
|
|
||||||
// Paddle centers
|
// Paddle centers
|
||||||
myPaddleXCenter->setValue(BSPF::stringToInt(props.get(PropType::Controller_PaddlesXCenter)));
|
myPaddleXCenter->setValue(BSPF::stoi(props.get(PropType::Controller_PaddlesXCenter)));
|
||||||
myPaddleYCenter->setValue(BSPF::stringToInt(props.get(PropType::Controller_PaddlesYCenter)));
|
myPaddleYCenter->setValue(BSPF::stoi(props.get(PropType::Controller_PaddlesYCenter)));
|
||||||
|
|
||||||
// MouseAxis property (potentially contains 'range' information)
|
// MouseAxis property (potentially contains 'range' information)
|
||||||
istringstream m_axis(props.get(PropType::Controller_MouseAxis));
|
istringstream m_axis(props.get(PropType::Controller_MouseAxis));
|
||||||
|
@ -850,7 +850,7 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
|
||||||
myMouseY->setEnabled(!autoAxis);
|
myMouseY->setEnabled(!autoAxis);
|
||||||
if(m_axis >> m_range)
|
if(m_axis >> m_range)
|
||||||
{
|
{
|
||||||
myMouseRange->setValue(stringToInt(m_range));
|
myMouseRange->setValue(BSPF::stoi(m_range));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1061,19 +1061,19 @@ void GameInfoDialog::saveHighScoresProperties()
|
||||||
string strAddr;
|
string strAddr;
|
||||||
|
|
||||||
strAddr = myVarAddress->getText();
|
strAddr = myVarAddress->getText();
|
||||||
info.varsAddr = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
|
info.varsAddr = BSPF::stoi_16(strAddr, HSM::DEFAULT_ADDRESS);
|
||||||
strAddr = mySpecialAddress->getText();
|
strAddr = mySpecialAddress->getText();
|
||||||
info.specialAddr = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
|
info.specialAddr = BSPF::stoi_16(strAddr, HSM::DEFAULT_ADDRESS);
|
||||||
|
|
||||||
for (uInt32 a = 0; a < HSM::MAX_SCORE_ADDR; ++a)
|
for (uInt32 a = 0; a < HSM::MAX_SCORE_ADDR; ++a)
|
||||||
{
|
{
|
||||||
strAddr = myScoreAddress[a]->getText();
|
strAddr = myScoreAddress[a]->getText();
|
||||||
info.scoreAddr[a] = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
|
info.scoreAddr[a] = BSPF::stoi_16(strAddr, HSM::DEFAULT_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
const string strVars = myVariations->getText();
|
const string strVars = myVariations->getText();
|
||||||
|
|
||||||
HighScoresManager::set(myGameProperties, stringToInt(strVars,
|
HighScoresManager::set(myGameProperties, BSPF::stoi(strVars,
|
||||||
HSM::DEFAULT_VARIATION), info);
|
HSM::DEFAULT_VARIATION), info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1347,7 +1347,7 @@ void GameInfoDialog::updateHighScoresWidgets()
|
||||||
myVarAddress->setEnabled(enableVars);
|
myVarAddress->setEnabled(enableVars);
|
||||||
myVarAddress->setEditable(enableVars);
|
myVarAddress->setEditable(enableVars);
|
||||||
myVarAddressVal->setEnabled(enableVars && enableConsole);
|
myVarAddressVal->setEnabled(enableVars && enableConsole);
|
||||||
myVarsBCD->setEnabled(enableVars && stringToInt(myVariations->getText(), 1) >= 10);
|
myVarsBCD->setEnabled(enableVars && BSPF::stoi(myVariations->getText(), 1) >= 10);
|
||||||
myVarsZeroBased->setEnabled(enableVars);
|
myVarsZeroBased->setEnabled(enableVars);
|
||||||
|
|
||||||
myScoreLabel->setEnabled(enable);
|
myScoreLabel->setEnabled(enable);
|
||||||
|
@ -1386,7 +1386,7 @@ void GameInfoDialog::updateHighScoresWidgets()
|
||||||
|
|
||||||
// update variations RAM value
|
// update variations RAM value
|
||||||
setAddressVal(myVarAddress, myVarAddressVal, myVarsBCD->getState(),
|
setAddressVal(myVarAddress, myVarAddressVal, myVarsBCD->getState(),
|
||||||
myVarsZeroBased->getState(), stringToInt(myVariations->getText(), 1));
|
myVarsZeroBased->getState(), BSPF::stoi(myVariations->getText(), 1));
|
||||||
|
|
||||||
setAddressVal(mySpecialAddress, mySpecialAddressVal, mySpecialBCD->getState(),
|
setAddressVal(mySpecialAddress, mySpecialAddressVal, mySpecialBCD->getState(),
|
||||||
mySpecialZeroBased->getState());
|
mySpecialZeroBased->getState());
|
||||||
|
@ -1400,7 +1400,7 @@ void GameInfoDialog::updateHighScoresWidgets()
|
||||||
{
|
{
|
||||||
setAddressVal(myScoreAddress[a], myScoreAddressVal[a]);
|
setAddressVal(myScoreAddress[a], myScoreAddressVal[a]);
|
||||||
const string strAddr = myScoreAddress[a]->getText();
|
const string strAddr = myScoreAddress[a]->getText();
|
||||||
scoreAddr[a] = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
|
scoreAddr[a] = BSPF::stoi_16(strAddr, HSM::DEFAULT_ADDRESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myScoreAddressVal[a]->setText("");
|
myScoreAddressVal[a]->setText("");
|
||||||
|
@ -1427,7 +1427,7 @@ void GameInfoDialog::setAddressVal(const EditTextWidget* addressWidget, EditText
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
|
|
||||||
// convert to number and read from memory
|
// convert to number and read from memory
|
||||||
const uInt16 addr = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
|
const uInt16 addr = BSPF::stoi_16(strAddr, HSM::DEFAULT_ADDRESS);
|
||||||
uInt8 val = instance().highScores().peek(addr);
|
uInt8 val = instance().highScores().peek(addr);
|
||||||
val = HighScoresManager::convert(val, maxVal, isBCD, zeroBased);
|
val = HighScoresManager::convert(val, maxVal, isBCD, zeroBased);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue