added PlusROM info to debugger (resolves #844)

added PlusROM user info to System log
This commit is contained in:
Thomas Jentzsch 2022-02-04 20:12:59 +01:00
parent 2ff5fffe37
commit 645c2fc5bb
9 changed files with 159 additions and 24 deletions

View File

@ -31,6 +31,8 @@
* Added another oddball TIA glitch option for score mode color. * Added another oddball TIA glitch option for score mode color.
* Debugger: added PlusROM information.
-Have fun! -Have fun!

View File

@ -2856,7 +2856,7 @@
</tr> </tr>
<tr> <tr>
<td><pre>-autopause &lt;1|0&gt;</pre></td> <td><pre>-autopause &lt;1|0&gt;</pre></td>
<td>Enable or disable automatic pause/continue of emulation, when <td>Enable or disable automatic pause/continue of emulation when
Stella loses/gains focus.</td> Stella loses/gains focus.</td>
</tr> </tr>
<tr> <tr>
@ -3972,7 +3972,7 @@
<tr><td>Fast SuperCharger load</td><td>Skip progress loading bars for SuperCharger ROMs</td><td>-fastscbios</td></tr> <tr><td>Fast SuperCharger load</td><td>Skip progress loading bars for SuperCharger ROMs</td><td>-fastscbios</td></tr>
<tr><td>Show UI messages</td><td>Overlay UI messages onscreen</td><td>-uimessages</td></tr> <tr><td>Show UI messages</td><td>Overlay UI messages onscreen</td><td>-uimessages</td></tr>
<tr><td> <tr><td>
Automatic pause</td><td>Enable or disable automatic pause/continue of emulation, Automatic pause</td><td>Enable or disable automatic pause/continue of emulation
when Stella loses/gains focus.</td><td>-autopause when Stella loses/gains focus.</td><td>-autopause
</td></tr> </td></tr>
<tr><td>Confirm exiting...</td><td>Display a popup when emulation is exited</td><td>-confirmexit</td></tr> <tr><td>Confirm exiting...</td><td>Display a popup when emulation is exited</td><td>-confirmexit</td></tr>

View File

@ -1315,7 +1315,7 @@ string TIADebug::toString()
<< "AUDF0: " << "AUDF0: "
<< hexWithLabel("", int(audF0()), << hexWithLabel("", int(audF0()),
state.aud[0] != oldState.aud[0]) << "/" 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]) << " " state.aud[0] != oldState.aud[0]) << " "
<< "AUDC0: " << "AUDC0: "
<< hexWithLabel("", int(audC0()), << hexWithLabel("", int(audC0()),
@ -1327,7 +1327,7 @@ string TIADebug::toString()
<< "AUDF1: " << "AUDF1: "
<< hexWithLabel("", int(audF1()), << hexWithLabel("", int(audF1()),
state.aud[1] != oldState.aud[1]) << "/" 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]) << " " state.aud[1] != oldState.aud[1]) << " "
<< "AUDC1: " << "AUDC1: "
<< hexWithLabel("", int(audC1()), << hexWithLabel("", int(audC1()),

View File

@ -15,6 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
@ -35,8 +36,10 @@ CartridgeEnhancedWidget::CartridgeEnhancedWidget(GuiObject* boss, const GUI::Fon
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeEnhancedWidget::initialize() int CartridgeEnhancedWidget::initialize()
{ {
int ypos = addBaseInformation(size(), manufacturer(), description(), descriptionLines()) int ypos = addBaseInformation(size(), manufacturer(), description(), descriptionLines());
+ myLineHeight;
plusROMInfo(ypos);
ypos += myLineHeight;
bankSelect(ypos); bankSelect(ypos);
@ -137,6 +140,41 @@ string CartridgeEnhancedWidget::romDescription()
return info.str(); 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) void CartridgeEnhancedWidget::bankList(uInt16 bankCount, int seg, VariantList& items, int& width)
{ {
@ -278,6 +316,25 @@ void CartridgeEnhancedWidget::saveOldState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEnhancedWidget::loadConfig() 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(myBankWidgets != nullptr)
{ {
if(bankSegs() > 1) if(bankSegs() > 1)

View File

@ -19,6 +19,8 @@
#define CART_ENHANCED_WIDGET_HXX #define CART_ENHANCED_WIDGET_HXX
class CartridgeEnhanced; class CartridgeEnhanced;
class EditTextWidget;
class StringListWidget;
class PopUpWidget; class PopUpWidget;
namespace GUI { namespace GUI {
@ -52,6 +54,8 @@ class CartridgeEnhancedWidget : public CartDebugWidget
virtual string romDescription(); virtual string romDescription();
virtual void plusROMInfo(int& ypos);
virtual void bankList(uInt16 bankCount, int seg, VariantList& items, int& width); virtual void bankList(uInt16 bankCount, int seg, VariantList& items, int& width);
virtual void bankSelect(int& ypos); virtual void bankSelect(int& ypos);
@ -92,6 +96,11 @@ class CartridgeEnhancedWidget : public CartDebugWidget
// Distance between two hotspots // Distance between two hotspots
int myHotspotDelta{1}; int myHotspotDelta{1};
EditTextWidget* myPlusROMHostWidget{nullptr};
EditTextWidget* myPlusROMPathWidget{nullptr};
EditTextWidget* myPlusROMSendWidget{nullptr};
EditTextWidget* myPlusROMReceiveWidget{nullptr};
std::unique_ptr<PopUpWidget* []> myBankWidgets{nullptr}; std::unique_ptr<PopUpWidget* []> myBankWidgets{nullptr};

View File

@ -18,7 +18,6 @@
#ifndef CARTRIDGE_HXX #ifndef CARTRIDGE_HXX
#define CARTRIDGE_HXX #define CARTRIDGE_HXX
class Cartridge;
class Properties; class Properties;
class FilesystemNode; class FilesystemNode;
class CartDebugWidget; class CartDebugWidget;

View File

@ -517,8 +517,9 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
myFrameBuffer->showTextMessage(msg.str()); myFrameBuffer->showTextMessage(msg.str());
} }
// Check for first PlusROM start // Check for first PlusROM start
if(myConsole->cartridge().isPlusROM() && if(myConsole->cartridge().isPlusROM())
settings().getString("plusroms.fixedid") == EmptyString) {
if(settings().getString("plusroms.fixedid") == EmptyString)
{ {
// Make sure there always is an id // Make sure there always is an id
constexpr int ID_LEN = 32; constexpr int ID_LEN = 32;
@ -533,6 +534,14 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
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);
}
} }
return EmptyString; return EmptyString;

View File

@ -156,6 +156,16 @@ class PlusROMRequest {
return myState; return myState;
} }
const Destination& getDestination() const
{
return myDestination;
}
const PlusStoreId& getPlusStoreId() const
{
return myId;
}
std::pair<size_t, const uInt8*> getResponse() { std::pair<size_t, const uInt8*> getResponse() {
if (myState != State::done) throw runtime_error("invalid access to response"); 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 return myIsPlusROM = false; // Invalid host
myHost = host; myHost = host;
myPath = "/" + path; myPath = path;
reset(); reset();
@ -398,7 +408,7 @@ void PlusROM::send()
{ {
const string nick = mySettings.getString("plusroms.nick"); const string nick = mySettings.getString("plusroms.nick");
auto request = make_shared<PlusROMRequest>( auto request = make_shared<PlusROMRequest>(
PlusROMRequest::Destination(myHost, myPath), PlusROMRequest::Destination(myHost, "/" + myPath),
PlusROMRequest::PlusStoreId(nick, id), PlusROMRequest::PlusStoreId(nick, id),
myTxBuffer.data(), myTxBuffer.data(),
myTxPos myTxPos
@ -470,3 +480,25 @@ void PlusROM::receive()
} }
#endif #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;
}

View File

@ -121,6 +121,33 @@ class PlusROM : public Serializable
*/ */
void reset(); 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 Set the callback for displaying messages
*/ */