added PlusROM change tracking

This commit is contained in:
Thomas Jentzsch 2022-02-05 08:51:48 +01:00
parent 645c2fc5bb
commit acf611cb6b
2 changed files with 18 additions and 9 deletions

View File

@ -154,22 +154,26 @@ void CartridgeEnhancedWidget::plusROMInfo(int& ypos)
ypos += myLineHeight + 4; ypos += myLineHeight + 4;
new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Host"); new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Host");
myPlusROMHostWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1, fwidth, myLineHeight); myPlusROMHostWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1,
fwidth, myLineHeight, myCart.myPlusROM->getHost());
myPlusROMHostWidget->setEditable(false); myPlusROMHostWidget->setEditable(false);
ypos += myLineHeight + 4; ypos += myLineHeight + 4;
new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Path"); new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Path");
myPlusROMPathWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1, fwidth, myLineHeight); myPlusROMPathWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1,
fwidth, myLineHeight, myCart.myPlusROM->getPath());
myPlusROMPathWidget->setEditable(false); myPlusROMPathWidget->setEditable(false);
ypos += myLineHeight + 4; ypos += myLineHeight + 4;
new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Send"); new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Send");
myPlusROMSendWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1, fwidth, myLineHeight); myPlusROMSendWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1,
fwidth, myLineHeight);
myPlusROMSendWidget->setEditable(false); myPlusROMSendWidget->setEditable(false);
ypos += myLineHeight + 4; ypos += myLineHeight + 4;
new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Receive"); new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Receive");
myPlusROMReceiveWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1, fwidth, myLineHeight); myPlusROMReceiveWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1,
fwidth, myLineHeight);
myPlusROMReceiveWidget->setEditable(false); myPlusROMReceiveWidget->setEditable(false);
ypos += myLineHeight + 4; ypos += myLineHeight + 4;
} }
@ -305,6 +309,12 @@ void CartridgeEnhancedWidget::saveOldState()
for(uInt32 i = 0; i < myCart.myRamSize; ++i) for(uInt32 i = 0; i < myCart.myRamSize; ++i)
myOldState.internalRam.push_back(myCart.myRAM[i]); myOldState.internalRam.push_back(myCart.myRAM[i]);
if(myCart.isPlusROM())
{
myOldState.send = myCart.myPlusROM->getSend();
myOldState.receive = myCart.myPlusROM->getReceive();
}
myOldState.banks.clear(); myOldState.banks.clear();
if (bankSegs() > 1) if (bankSegs() > 1)
for(int seg = 0; seg < bankSegs(); ++seg) for(int seg = 0; seg < bankSegs(); ++seg)
@ -318,22 +328,19 @@ void CartridgeEnhancedWidget::loadConfig()
{ {
if(myCart.isPlusROM()) if(myCart.isPlusROM())
{ {
myPlusROMHostWidget->setText(myCart.myPlusROM->getHost());
myPlusROMPathWidget->setText(myCart.myPlusROM->getPath());
ostringstream buf; ostringstream buf;
ByteArray arr = myCart.myPlusROM->getSend(); ByteArray arr = myCart.myPlusROM->getSend();
for(int i = 0; i < arr.size(); ++i) for(int i = 0; i < arr.size(); ++i)
buf << Common::Base::HEX2 << int(arr[i]) << " "; buf << Common::Base::HEX2 << int(arr[i]) << " ";
myPlusROMSendWidget->setText(buf.str()); myPlusROMSendWidget->setText(buf.str(), arr != myOldState.send);
buf.str(""); buf.str("");
arr = myCart.myPlusROM->getReceive(); arr = myCart.myPlusROM->getReceive();
for(int i = 0; i < arr.size(); ++i) for(int i = 0; i < arr.size(); ++i)
buf << Common::Base::HEX2 << int(arr[i]) << " "; buf << Common::Base::HEX2 << int(arr[i]) << " ";
myPlusROMReceiveWidget->setText(buf.str()); myPlusROMReceiveWidget->setText(buf.str(), arr != myOldState.receive);
} }
if(myBankWidgets != nullptr) if(myBankWidgets != nullptr)
{ {

View File

@ -88,6 +88,8 @@ class CartridgeEnhancedWidget : public CartDebugWidget
struct CartState { struct CartState {
ByteArray internalRam; ByteArray internalRam;
ByteArray banks; ByteArray banks;
ByteArray send;
ByteArray receive;
}; };
CartState myOldState; CartState myOldState;