diff --git a/Changes.txt b/Changes.txt
index 76ce4b1e2..86892d6f0 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -31,6 +31,8 @@
* Added another oddball TIA glitch option for score mode color.
+ * Debugger: added PlusROM information.
+
-Have fun!
diff --git a/docs/index.html b/docs/index.html
index 9f5e23ff8..579adba88 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -2856,7 +2856,7 @@
-autopause <1|0> |
- Enable or disable automatic pause/continue of emulation, when
+ | Enable or disable automatic pause/continue of emulation when
Stella loses/gains focus. |
@@ -3972,7 +3972,7 @@
Fast SuperCharger load | Skip progress loading bars for SuperCharger ROMs | -fastscbios |
Show UI messages | Overlay UI messages onscreen | -uimessages |
- Automatic pause | Enable or disable automatic pause/continue of emulation,
+ Automatic pause | Enable or disable automatic pause/continue of emulation
when Stella loses/gains focus. | -autopause
|
Confirm exiting... | Display a popup when emulation is exited | -confirmexit |
diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx
index a3c791639..8a61e196d 100644
--- a/src/debugger/TIADebug.cxx
+++ b/src/debugger/TIADebug.cxx
@@ -1315,7 +1315,7 @@ string TIADebug::toString()
<< "AUDF0: "
<< hexWithLabel("", int(audF0()),
state.aud[0] != oldState.aud[0]) << "/"
- << std::setw(11) << std::right << stringOnly(audFreq0(),
+ << std::setw(9) << std::right << stringOnly(audFreq0(),
state.aud[0] != oldState.aud[0]) << " "
<< "AUDC0: "
<< hexWithLabel("", int(audC0()),
@@ -1327,7 +1327,7 @@ string TIADebug::toString()
<< "AUDF1: "
<< hexWithLabel("", int(audF1()),
state.aud[1] != oldState.aud[1]) << "/"
- << std::setw(11) << std::right << stringOnly(audFreq1(),
+ << std::setw(9) << std::right << stringOnly(audFreq1(),
state.aud[1] != oldState.aud[1]) << " "
<< "AUDC1: "
<< hexWithLabel("", int(audC1()),
diff --git a/src/debugger/gui/CartEnhancedWidget.cxx b/src/debugger/gui/CartEnhancedWidget.cxx
index 32d6ee249..da6caddf6 100644
--- a/src/debugger/gui/CartEnhancedWidget.cxx
+++ b/src/debugger/gui/CartEnhancedWidget.cxx
@@ -15,6 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
+#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx"
#include "OSystem.hxx"
#include "Debugger.hxx"
@@ -35,8 +36,10 @@ CartridgeEnhancedWidget::CartridgeEnhancedWidget(GuiObject* boss, const GUI::Fon
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeEnhancedWidget::initialize()
{
- int ypos = addBaseInformation(size(), manufacturer(), description(), descriptionLines())
- + myLineHeight;
+ int ypos = addBaseInformation(size(), manufacturer(), description(), descriptionLines());
+
+ plusROMInfo(ypos);
+ ypos += myLineHeight;
bankSelect(ypos);
@@ -137,6 +140,41 @@ string CartridgeEnhancedWidget::romDescription()
return info.str();
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void CartridgeEnhancedWidget::plusROMInfo(int& ypos)
+{
+ if(myCart.isPlusROM())
+ {
+ const int xpos = 2,
+ lwidth = _font.getStringWidth("Manufacturer "),
+ fwidth = _w - lwidth - 12;
+
+ new StaticTextWidget(_boss, _font, xpos, ypos + 1, "PlusROM:");
+ ypos += myLineHeight + 4;
+
+ new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Host");
+ myPlusROMHostWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1, fwidth, myLineHeight);
+ myPlusROMHostWidget->setEditable(false);
+ ypos += myLineHeight + 4;
+
+ new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Path");
+ myPlusROMPathWidget = new EditTextWidget(_boss, _font, xpos + lwidth, ypos - 1, fwidth, myLineHeight);
+ myPlusROMPathWidget->setEditable(false);
+ ypos += myLineHeight + 4;
+
+ new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Send");
+ myPlusROMSendWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1, fwidth, myLineHeight);
+ myPlusROMSendWidget->setEditable(false);
+ ypos += myLineHeight + 4;
+
+ new StaticTextWidget(_boss, _font, xpos + _fontWidth * 2, ypos + 1, "Receive");
+ myPlusROMReceiveWidget = new EditTextWidget(_boss, _nfont, xpos + lwidth, ypos - 1, fwidth, myLineHeight);
+ myPlusROMReceiveWidget->setEditable(false);
+ ypos += myLineHeight + 4;
+ }
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEnhancedWidget::bankList(uInt16 bankCount, int seg, VariantList& items, int& width)
{
@@ -278,9 +316,28 @@ void CartridgeEnhancedWidget::saveOldState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEnhancedWidget::loadConfig()
{
+ if(myCart.isPlusROM())
+ {
+ myPlusROMHostWidget->setText(myCart.myPlusROM->getHost());
+ myPlusROMPathWidget->setText(myCart.myPlusROM->getPath());
+
+ ostringstream buf;
+ ByteArray arr = myCart.myPlusROM->getSend();
+
+ for(int i = 0; i < arr.size(); ++i)
+ buf << Common::Base::HEX2 << int(arr[i]) << " ";
+ myPlusROMSendWidget->setText(buf.str());
+
+ buf.str("");
+ arr = myCart.myPlusROM->getReceive();
+
+ for(int i = 0; i < arr.size(); ++i)
+ buf << Common::Base::HEX2 << int(arr[i]) << " ";
+ myPlusROMReceiveWidget->setText(buf.str());
+ }
if(myBankWidgets != nullptr)
{
- if (bankSegs() > 1)
+ if(bankSegs() > 1)
for(int seg = 0; seg < bankSegs(); ++seg)
myBankWidgets[seg]->setSelectedIndex(myCart.getSegmentBank(seg),
myCart.getSegmentBank(seg) != myOldState.banks[seg]);
diff --git a/src/debugger/gui/CartEnhancedWidget.hxx b/src/debugger/gui/CartEnhancedWidget.hxx
index d5401d3b7..061b8225c 100644
--- a/src/debugger/gui/CartEnhancedWidget.hxx
+++ b/src/debugger/gui/CartEnhancedWidget.hxx
@@ -19,6 +19,8 @@
#define CART_ENHANCED_WIDGET_HXX
class CartridgeEnhanced;
+class EditTextWidget;
+class StringListWidget;
class PopUpWidget;
namespace GUI {
@@ -52,6 +54,8 @@ class CartridgeEnhancedWidget : public CartDebugWidget
virtual string romDescription();
+ virtual void plusROMInfo(int& ypos);
+
virtual void bankList(uInt16 bankCount, int seg, VariantList& items, int& width);
virtual void bankSelect(int& ypos);
@@ -92,6 +96,11 @@ class CartridgeEnhancedWidget : public CartDebugWidget
// Distance between two hotspots
int myHotspotDelta{1};
+ EditTextWidget* myPlusROMHostWidget{nullptr};
+ EditTextWidget* myPlusROMPathWidget{nullptr};
+ EditTextWidget* myPlusROMSendWidget{nullptr};
+ EditTextWidget* myPlusROMReceiveWidget{nullptr};
+
std::unique_ptr myBankWidgets{nullptr};
diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx
index 6e7bf3805..3ff131eba 100644
--- a/src/emucore/Cart.hxx
+++ b/src/emucore/Cart.hxx
@@ -18,7 +18,6 @@
#ifndef CARTRIDGE_HXX
#define CARTRIDGE_HXX
-class Cartridge;
class Properties;
class FilesystemNode;
class CartDebugWidget;
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index 52f0cb74d..1e913e914 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -517,21 +517,30 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
myFrameBuffer->showTextMessage(msg.str());
}
// Check for first PlusROM start
- if(myConsole->cartridge().isPlusROM() &&
- settings().getString("plusroms.fixedid") == EmptyString)
+ if(myConsole->cartridge().isPlusROM())
{
- // Make sure there always is an id
- constexpr int ID_LEN = 32;
- const char* HEX_DIGITS = "0123456789ABCDEF";
- char id_chr[ID_LEN] = {0};
- Random rnd;
+ if(settings().getString("plusroms.fixedid") == EmptyString)
+ {
+ // Make sure there always is an id
+ constexpr int ID_LEN = 32;
+ const char* HEX_DIGITS = "0123456789ABCDEF";
+ char id_chr[ID_LEN] = { 0 };
+ Random rnd;
- for(char& c: id_chr)
- c = HEX_DIGITS[rnd.next() % 16];
+ for(char& c : id_chr)
+ c = HEX_DIGITS[rnd.next() % 16];
- settings().setValue("plusroms.fixedid", string(id_chr, ID_LEN));
+ settings().setValue("plusroms.fixedid", string(id_chr, ID_LEN));
- myEventHandler->changeStateByEvent(Event::PlusRomsSetupMode);
+ myEventHandler->changeStateByEvent(Event::PlusRomsSetupMode);
+ }
+
+ string id = settings().getString("plusroms.id");
+
+ if(id == EmptyString)
+ id = settings().getString("plusroms.fixedid");
+
+ Logger::info("PlusROM Nick: " + settings().getString("plusroms.nick") + ", ID: " + id);
}
}
diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx
index 52c68a1ff..c82054a6f 100644
--- a/src/emucore/PlusROM.cxx
+++ b/src/emucore/PlusROM.cxx
@@ -156,6 +156,16 @@ class PlusROMRequest {
return myState;
}
+ const Destination& getDestination() const
+ {
+ return myDestination;
+ }
+
+ const PlusStoreId& getPlusStoreId() const
+ {
+ return myId;
+ }
+
std::pair getResponse() {
if (myState != State::done) throw runtime_error("invalid access to response");
@@ -221,7 +231,7 @@ bool PlusROM::initialize(const ByteBuffer& image, size_t size)
return myIsPlusROM = false; // Invalid host
myHost = host;
- myPath = "/" + path;
+ myPath = path;
reset();
@@ -398,7 +408,7 @@ void PlusROM::send()
{
const string nick = mySettings.getString("plusroms.nick");
auto request = make_shared(
- PlusROMRequest::Destination(myHost, myPath),
+ PlusROMRequest::Destination(myHost, "/" + myPath),
PlusROMRequest::PlusStoreId(nick, id),
myTxBuffer.data(),
myTxPos
@@ -440,8 +450,8 @@ void PlusROM::receive()
#if defined(HTTP_LIB_SUPPORT)
auto iter = myPendingRequests.begin();
- while (iter != myPendingRequests.end()) {
- switch ((*iter)->getState()) {
+ while(iter != myPendingRequests.end()) {
+ switch((*iter)->getState()) {
case PlusROMRequest::State::failed:
myMsgCallback("PlusROM data receiving failed!");
// Request has failed? -> remove it and start over
@@ -456,7 +466,7 @@ void PlusROM::receive()
// and start over
auto [responseSize, response] = (*iter)->getResponse();
- for (uInt8 i = 0; i < responseSize; i++)
+ for(uInt8 i = 0; i < responseSize; i++)
myRxBuffer[myRxWritePos++] = response[i];
myPendingRequests.erase(iter);
@@ -470,3 +480,25 @@ void PlusROM::receive()
}
#endif
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ByteArray PlusROM::getSend() const
+{
+ ByteArray arr;
+
+ for(int i = 0; i < myTxPos; ++i)
+ arr.push_back(myTxBuffer[i]);
+
+ return arr;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ByteArray PlusROM::getReceive() const
+{
+ ByteArray arr;
+
+ for(uInt8 i = myRxReadPos; i != myRxWritePos; ++i)
+ arr.push_back(myRxBuffer[i]);
+
+ return arr;
+}
diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx
index 00c660a58..43a1da6e4 100644
--- a/src/emucore/PlusROM.hxx
+++ b/src/emucore/PlusROM.hxx
@@ -121,6 +121,33 @@ class PlusROM : public Serializable
*/
void reset();
+ /**
+ Retrieve host.
+
+ @return The host string
+ */
+ const string& getHost() const { return myHost; }
+
+ /**
+ Retrieve path.
+
+ @return The path string
+ */
+ const string& getPath() const { return myPath; }
+
+ /**
+ Retrieve send data.
+
+ @return The send data
+ */
+ ByteArray getSend() const;
+ /**
+ Retrieve receive data.
+
+ @return The receive data
+ */
+ ByteArray getReceive() const;
+
/**
Set the callback for displaying messages
*/