mirror of https://github.com/stella-emu/stella.git
Updated VS project file, reworked SaveKey/AtariVox widget, started with implementing trackball widgets for debugger (AmigaMouse working)
This commit is contained in:
parent
01449ddeec
commit
f77cd9ab06
|
@ -71,6 +71,11 @@ class Base
|
|||
os.flags(myHexflags);
|
||||
return os << std::setw(2) << std::setfill('0');
|
||||
}
|
||||
static inline std::ostream& HEX3(std::ostream& os)
|
||||
{
|
||||
os.flags(myHexflags);
|
||||
return os << std::setw(3) << std::setfill('0');
|
||||
}
|
||||
static inline std::ostream& HEX4(std::ostream& os) {
|
||||
os.flags(myHexflags);
|
||||
return os << std::setw(4) << std::setfill('0');
|
||||
|
|
|
@ -44,9 +44,17 @@ void AtariVoxWidget::eraseAll()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool AtariVoxWidget::isPageDetected()
|
||||
bool AtariVoxWidget::isUseDetected()
|
||||
{
|
||||
AtariVox& avox = static_cast<AtariVox&>(myController);
|
||||
|
||||
return avox.myEEPROM->isPageDetected();
|
||||
return avox.myEEPROM->isUseDetected();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool AtariVoxWidget::isPageUsed(int page)
|
||||
{
|
||||
AtariVox& avox = static_cast<AtariVox&>(myController);
|
||||
|
||||
return avox.myEEPROM->isPageUsed(page);
|
||||
}
|
|
@ -31,13 +31,10 @@ class AtariVoxWidget : public FlashWidget
|
|||
private:
|
||||
void loadConfig() override { }
|
||||
|
||||
string getName()
|
||||
{
|
||||
return "AtariVox";
|
||||
}
|
||||
void eraseCurrent();
|
||||
void eraseAll();
|
||||
bool isPageDetected();
|
||||
bool isUseDetected();
|
||||
bool isPageUsed(int page);
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
AtariVoxWidget() = delete;
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, Controller& controller)
|
||||
: ControllerWidget(boss, font, x, y, controller),
|
||||
myGreyIndex(0)
|
||||
myGrayIndex(0)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Driving)" : "Right (Driving)";
|
||||
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
bwidth = font.getStringWidth("Grey code +") + 10,
|
||||
bwidth = font.getStringWidth("Gray code +") + 10,
|
||||
bheight = font.getLineHeight() + 4;
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Driving)");
|
||||
StaticTextWidget* t;
|
||||
|
@ -37,22 +37,22 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
|||
fontHeight, label, kTextAlignLeft);
|
||||
|
||||
ypos += t->getHeight() + 20;
|
||||
myGreyUp = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||
"Grey code +", kGreyUpCmd);
|
||||
myGreyUp->setTarget(this);
|
||||
myGrayUp = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||
"Gray code +", kGrayUpCmd);
|
||||
myGrayUp->setTarget(this);
|
||||
|
||||
ypos += myGreyUp->getHeight() + 5;
|
||||
myGreyDown = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||
"Grey code -", kGreyDownCmd);
|
||||
myGreyDown->setTarget(this);
|
||||
ypos += myGrayUp->getHeight() + 5;
|
||||
myGrayDown = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||
"Gray code -", kGrayDownCmd);
|
||||
myGrayDown->setTarget(this);
|
||||
|
||||
xpos += myGreyDown->getWidth() + 10; ypos -= 10;
|
||||
myGreyValue = new DataGridWidget(boss, font, xpos, ypos,
|
||||
xpos += myGrayDown->getWidth() + 10; ypos -= 10;
|
||||
myGrayValue = new DataGridWidget(boss, font, xpos, ypos,
|
||||
1, 1, 2, 8, Common::Base::F_16);
|
||||
myGreyValue->setTarget(this);
|
||||
myGreyValue->setEditable(false);
|
||||
myGrayValue->setTarget(this);
|
||||
myGrayValue->setEditable(false);
|
||||
|
||||
xpos = x + 30; ypos += myGreyDown->getHeight() + 20;
|
||||
xpos = x + 30; ypos += myGrayDown->getHeight() + 20;
|
||||
myFire = new CheckboxWidget(boss, font, xpos, ypos, "Fire", kFireCmd);
|
||||
myFire->setTarget(this);
|
||||
}
|
||||
|
@ -60,16 +60,16 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DrivingWidget::loadConfig()
|
||||
{
|
||||
uInt8 grey = 0;
|
||||
if(myController.read(Controller::One)) grey += 1;
|
||||
if(myController.read(Controller::Two)) grey += 2;
|
||||
uInt8 gray = 0;
|
||||
if(myController.read(Controller::One)) gray += 1;
|
||||
if(myController.read(Controller::Two)) gray += 2;
|
||||
|
||||
for(myGreyIndex = 0; myGreyIndex < 4; ++myGreyIndex)
|
||||
if(ourGreyTable[myGreyIndex] == grey)
|
||||
for(myGrayIndex = 0; myGrayIndex < 4; ++myGrayIndex)
|
||||
if(ourGrayTable[myGrayIndex] == gray)
|
||||
break;
|
||||
|
||||
myFire->setState(!myController.read(Controller::Six));
|
||||
myGreyValue->setList(0, grey);
|
||||
myGrayValue->setList(0, gray);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -78,17 +78,17 @@ void DrivingWidget::handleCommand(
|
|||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case kGreyUpCmd:
|
||||
myGreyIndex = (myGreyIndex + 1) % 4;
|
||||
myController.set(Controller::One, (ourGreyTable[myGreyIndex] & 0x1) != 0);
|
||||
myController.set(Controller::Two, (ourGreyTable[myGreyIndex] & 0x2) != 0);
|
||||
myGreyValue->setList(0, ourGreyTable[myGreyIndex]);
|
||||
case kGrayUpCmd:
|
||||
myGrayIndex = (myGrayIndex + 1) % 4;
|
||||
myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0);
|
||||
myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0);
|
||||
myGrayValue->setList(0, ourGrayTable[myGrayIndex]);
|
||||
break;
|
||||
case kGreyDownCmd:
|
||||
myGreyIndex = myGreyIndex == 0 ? 3 : myGreyIndex - 1;
|
||||
myController.set(Controller::One, (ourGreyTable[myGreyIndex] & 0x1) != 0);
|
||||
myController.set(Controller::Two, (ourGreyTable[myGreyIndex] & 0x2) != 0);
|
||||
myGreyValue->setList(0, ourGreyTable[myGreyIndex]);
|
||||
case kGrayDownCmd:
|
||||
myGrayIndex = myGrayIndex == 0 ? 3 : myGrayIndex - 1;
|
||||
myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0);
|
||||
myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0);
|
||||
myGrayValue->setList(0, ourGrayTable[myGrayIndex]);
|
||||
break;
|
||||
case kFireCmd:
|
||||
myController.set(Controller::Six, !myFire->getState());
|
||||
|
@ -97,4 +97,4 @@ void DrivingWidget::handleCommand(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 DrivingWidget::ourGreyTable[4] = { 0x03, 0x01, 0x00, 0x02 };
|
||||
uInt8 DrivingWidget::ourGrayTable[4] = { 0x03, 0x01, 0x00, 0x02 };
|
||||
|
|
|
@ -35,17 +35,17 @@ class DrivingWidget : public ControllerWidget
|
|||
|
||||
private:
|
||||
enum {
|
||||
kGreyUpCmd = 'DWup',
|
||||
kGreyDownCmd = 'DWdn',
|
||||
kGrayUpCmd = 'DWup',
|
||||
kGrayDownCmd = 'DWdn',
|
||||
kFireCmd = 'DWfr'
|
||||
};
|
||||
ButtonWidget *myGreyUp, *myGreyDown;
|
||||
DataGridWidget* myGreyValue;
|
||||
ButtonWidget *myGrayUp, *myGrayDown;
|
||||
DataGridWidget* myGrayValue;
|
||||
CheckboxWidget* myFire;
|
||||
|
||||
int myGreyIndex;
|
||||
int myGrayIndex;
|
||||
|
||||
static uInt8 ourGreyTable[4];
|
||||
static uInt8 ourGrayTable[4];
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "KeyboardWidget.hxx"
|
||||
#include "AtariVoxWidget.hxx"
|
||||
#include "SaveKeyWidget.hxx"
|
||||
#include "AmigaMouseWidget.hxx"
|
||||
|
||||
#include "RiotWidget.hxx"
|
||||
|
||||
|
@ -437,7 +438,8 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font&
|
|||
switch(controller.type())
|
||||
{
|
||||
case Controller::AmigaMouse: // TODO - implement this
|
||||
return new NullControlWidget(boss, font, x, y, controller);
|
||||
//return new NullControlWidget(boss, font, x, y, controller);
|
||||
return new AmigaMouseWidget(boss, font, x, y, controller);
|
||||
case Controller::AtariMouse: // TODO - implement this
|
||||
return new NullControlWidget(boss, font, x, y, controller);
|
||||
case Controller::AtariVox:
|
||||
|
|
|
@ -44,9 +44,17 @@ void SaveKeyWidget::eraseAll()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SaveKeyWidget::isPageDetected()
|
||||
bool SaveKeyWidget::isUseDetected()
|
||||
{
|
||||
SaveKey& skey = static_cast<SaveKey&>(myController);
|
||||
|
||||
return skey.myEEPROM->isPageDetected();
|
||||
return skey.myEEPROM->isUseDetected();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SaveKeyWidget::isPageUsed(int page)
|
||||
{
|
||||
SaveKey& skey = static_cast<SaveKey&>(myController);
|
||||
|
||||
return skey.myEEPROM->isPageUsed(page);
|
||||
}
|
|
@ -31,13 +31,10 @@ class SaveKeyWidget : public FlashWidget
|
|||
private:
|
||||
void loadConfig() override { }
|
||||
|
||||
string getName()
|
||||
{
|
||||
return "SaveKey";
|
||||
}
|
||||
void eraseCurrent();
|
||||
void eraseAll();
|
||||
bool isPageDetected();
|
||||
bool isUseDetected();
|
||||
bool isPageUsed(int page);
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
SaveKeyWidget() = delete;
|
||||
|
|
|
@ -38,8 +38,8 @@ class AmigaMouse : public PointingDevice
|
|||
protected:
|
||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
||||
{
|
||||
static constexpr uInt32 ourTableH[4] = { 0x00, 0x80, 0xa0, 0x20 };
|
||||
static constexpr uInt32 ourTableV[4] = { 0x00, 0x10, 0x50, 0x40 };
|
||||
static constexpr uInt32 ourTableH[4] = { 0b0000, 0b1000, 0b1010, 0b0010 };
|
||||
static constexpr uInt32 ourTableV[4] = { 0b0000, 0b0001, 0b0101, 0b0100 };
|
||||
|
||||
return ourTableH[countH] | ourTableV[countV];
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ class AtariMouse : public PointingDevice
|
|||
protected:
|
||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
||||
{
|
||||
static constexpr uInt32 ourTableH[4] = { 0x00, 0x10, 0x30, 0x20 };
|
||||
static constexpr uInt32 ourTableV[4] = { 0x00, 0x80, 0xc0, 0x40 };
|
||||
static constexpr uInt32 ourTableH[4] = { 0b0000, 0b0001, 0b0011, 0b0010 };
|
||||
static constexpr uInt32 ourTableV[4] = { 0b0000, 0b1000, 0b1100, 0b0100 };
|
||||
|
||||
return ourTableH[countH] | ourTableV[countV];
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
|
|||
myDataFile(filename),
|
||||
myDataFileExists(false),
|
||||
myDataChanged(false),
|
||||
myPageDetected(false),
|
||||
myUseDetected(false),
|
||||
jpee_mdat(0),
|
||||
jpee_sdat(0),
|
||||
jpee_mclk(0),
|
||||
|
@ -151,7 +151,7 @@ void MT24LC256::systemReset()
|
|||
myCyclesWhenSDASet = myCyclesWhenSCLSet = myCyclesWhenTimerSet =
|
||||
mySystem.cycles();
|
||||
|
||||
myPageDetected = false;
|
||||
myUseDetected = false;
|
||||
memset(myPageHit, false, sizeof(myPageHit));
|
||||
}
|
||||
|
||||
|
@ -175,6 +175,15 @@ void MT24LC256::eraseCurrent()
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool MT24LC256::isPageUsed(int page) const
|
||||
{
|
||||
if(page < PAGE_NUM)
|
||||
return myPageHit[page];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MT24LC256::jpee_init()
|
||||
{
|
||||
|
@ -243,7 +252,7 @@ void MT24LC256::jpee_data_stop()
|
|||
for (int i=3; i<jpee_pptr; i++)
|
||||
{
|
||||
myDataChanged = true;
|
||||
myPageDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||
myUseDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||
myData[(jpee_address++) & jpee_sizemask] = jpee_packet[i];
|
||||
if (!(jpee_address & jpee_pagemask))
|
||||
break; /* Writes can't cross page boundary! */
|
||||
|
@ -340,7 +349,7 @@ void MT24LC256::jpee_clock_fall()
|
|||
break;
|
||||
}
|
||||
jpee_state=3;
|
||||
myPageDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||
myUseDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||
jpee_nb = (myData[jpee_address & jpee_sizemask] << 1) | 1; /* Fall through */
|
||||
JPEE_LOG2("I2C_READ(%04X=%02X)",jpee_address,jpee_nb/2);
|
||||
[[fallthrough]];
|
||||
|
|
|
@ -42,7 +42,14 @@ class MT24LC256
|
|||
MT24LC256(const string& filename, const System& system);
|
||||
~MT24LC256();
|
||||
|
||||
private:
|
||||
// Sizes of the EEPROM
|
||||
static constexpr uInt32 FLASH_SIZE = 32 * 1024;
|
||||
|
||||
public:
|
||||
static constexpr uInt32 PAGE_SIZE = 64;
|
||||
static constexpr uInt32 PAGE_NUM = FLASH_SIZE / PAGE_SIZE;
|
||||
|
||||
/** Read boolean data from the SDA line */
|
||||
bool readSDA() const { return jpee_mdat && jpee_sdat; }
|
||||
|
||||
|
@ -60,10 +67,9 @@ class MT24LC256
|
|||
void eraseCurrent();
|
||||
|
||||
/** Returns true if at least one EEPROM page has been detected for the current ROM */
|
||||
bool isPageDetected()
|
||||
{
|
||||
return myPageDetected;
|
||||
}
|
||||
bool isUseDetected() const { return myUseDetected; }
|
||||
|
||||
bool isPageUsed(int page) const;
|
||||
|
||||
private:
|
||||
// I2C access code provided by Supercat
|
||||
|
@ -77,11 +83,6 @@ class MT24LC256
|
|||
void update();
|
||||
|
||||
private:
|
||||
// Sizes of the EEPROM
|
||||
static constexpr uInt32 FLASH_SIZE = 32 * 1024;
|
||||
static constexpr uInt32 PAGE_SIZE = 64;
|
||||
static constexpr uInt32 PAGE_NUM = FLASH_SIZE / PAGE_SIZE;
|
||||
|
||||
// Inital state value of flash EEPROM
|
||||
static constexpr uInt8 INIT_VALUE = 0xff;
|
||||
|
||||
|
@ -93,7 +94,7 @@ class MT24LC256
|
|||
|
||||
// Track which pages are used
|
||||
bool myPageHit[PAGE_NUM];
|
||||
bool myPageDetected;
|
||||
bool myUseDetected;
|
||||
|
||||
// Cached state of the SDA and SCL pins on the last write
|
||||
bool mySDA, mySCL;
|
||||
|
|
|
@ -66,17 +66,17 @@ uInt8 PointingDevice::read()
|
|||
myScanCountV += myTrackBallLinesV;
|
||||
}
|
||||
|
||||
myCountH &= 0x03;
|
||||
myCountV &= 0x03;
|
||||
myCountH &= 0b11;
|
||||
myCountV &= 0b11;
|
||||
|
||||
uInt8 portA = ioPortA(myCountH, myCountV, myTrackBallLeft, myTrackBallDown);
|
||||
|
||||
myDigitalPinState[One] = portA & 0x10;
|
||||
myDigitalPinState[Two] = portA & 0x20;
|
||||
myDigitalPinState[Three] = portA & 0x40;
|
||||
myDigitalPinState[Four] = portA & 0x80;
|
||||
myDigitalPinState[One] = portA & 0b0001;
|
||||
myDigitalPinState[Two] = portA & 0b0010;
|
||||
myDigitalPinState[Three] = portA & 0b0100;
|
||||
myDigitalPinState[Four] = portA & 0b1000;
|
||||
|
||||
return (portA >> 4);
|
||||
return portA;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
class Controller;
|
||||
class Event;
|
||||
|
||||
#include "Control.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
/**
|
||||
|
@ -31,6 +32,8 @@ class Event;
|
|||
*/
|
||||
class PointingDevice : public Controller
|
||||
{
|
||||
friend class TrackBallWidget;
|
||||
|
||||
public:
|
||||
PointingDevice(Jack jack, const Event& event,
|
||||
const System& system, Controller::Type type,
|
||||
|
|
|
@ -38,8 +38,10 @@ class TrakBall : public PointingDevice
|
|||
protected:
|
||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8 left, uInt8 down) override
|
||||
{
|
||||
static constexpr uInt32 ourTableH[2][2] = {{ 0x00, 0x10 }, { 0x20, 0x30 }};
|
||||
static constexpr uInt32 ourTableV[2][2] = {{ 0x40, 0x00 }, { 0xc0, 0x80 }};
|
||||
//static constexpr uInt32 ourTableH[2][2] = {{ 0x00, 0x10 }, { 0x20, 0x30 }};
|
||||
//static constexpr uInt32 ourTableV[2][2] = {{ 0x40, 0x00 }, { 0xc0, 0x80 }};
|
||||
static constexpr uInt32 ourTableH[2][2] = { { 0b00, 0b01 },{ 0b10, 0b11 } };
|
||||
static constexpr uInt32 ourTableV[2][2] = { { 0b0100, 0b0000 },{ 0b1100, 0b1000 } };
|
||||
|
||||
return ourTableH[countH & 0x01][left] | ourTableV[countV & 0x01][down];
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
//============================================================================
|
||||
|
||||
#include "FlashWidget.hxx"
|
||||
#include "MT24LC256.hxx"
|
||||
#include "Base.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
||||
|
@ -31,11 +33,23 @@ void FlashWidget::init(GuiObject* boss, const GUI::Font& font, int x, int y)
|
|||
int xpos = x, ypos = y;
|
||||
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
new StaticTextWidget(boss, font, xpos, ypos + 2, (leftport ? "Left (" : "Right (") + getName() + ")");
|
||||
new StaticTextWidget(boss, font, xpos, ypos + 2, (leftport ? "Left (" : "Right (") + myController.name() + ")");
|
||||
|
||||
ypos += lineHeight + 8;
|
||||
ypos += lineHeight + 6;
|
||||
|
||||
myEEPROMEraseCurrent = new ButtonWidget(boss, font, xpos, ypos,
|
||||
new StaticTextWidget(boss, ifont, xpos, ypos, "Pages/Ranges used:");
|
||||
|
||||
ypos += lineHeight + 2;
|
||||
xpos += 8;
|
||||
|
||||
for(int page = 0; page < MAX_PAGES; page++)
|
||||
{
|
||||
myPage[page] = new StaticTextWidget(boss, ifont, xpos, ypos,
|
||||
page ? " " : "none ");
|
||||
ypos += lineHeight;
|
||||
}
|
||||
|
||||
/*myEEPROMEraseCurrent = new ButtonWidget(boss, font, xpos, ypos,
|
||||
"Erase EEPROM range", kEEPROMEraseCurrent);
|
||||
myEEPROMEraseCurrent->setTarget(this);
|
||||
ypos += lineHeight + 8;
|
||||
|
@ -54,7 +68,7 @@ void FlashWidget::init(GuiObject* boss, const GUI::Font& font, int x, int y)
|
|||
ypos += iLineHeight;
|
||||
new StaticTextWidget(boss, ifont, xpos, ypos, "all EEPROM data!");
|
||||
|
||||
updateButtonState();
|
||||
updateButtonState();*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -71,11 +85,44 @@ void FlashWidget::handleCommand(CommandSender*, int cmd, int, int)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FlashWidget::drawWidget(bool hilite)
|
||||
{
|
||||
updateButtonState();
|
||||
int useCount = 0, startPage = -1;
|
||||
for(int page = 0; page < MT24LC256::PAGE_NUM; page++)
|
||||
{
|
||||
if(isPageUsed(page)/* || page == 0x21 || page == 0x22*/)
|
||||
{
|
||||
if (startPage == -1)
|
||||
startPage = page;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(startPage != -1)
|
||||
{
|
||||
int from = startPage * MT24LC256::PAGE_SIZE;
|
||||
int to = page * MT24LC256::PAGE_SIZE - 1;
|
||||
ostringstream label;
|
||||
|
||||
label.str("");
|
||||
label << Common::Base::HEX3 << startPage;
|
||||
|
||||
if(page -1 != startPage)
|
||||
label << "-" << Common::Base::HEX3 << page - 1;
|
||||
else
|
||||
label << " ";
|
||||
label << ": " << Common::Base::HEX4 << from << "-" << Common::Base::HEX4 << to;
|
||||
|
||||
myPage[useCount]->setLabel(label.str());
|
||||
|
||||
startPage = -1;
|
||||
if(++useCount == MAX_PAGES)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//updateButtonState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FlashWidget::updateButtonState()
|
||||
{
|
||||
myEEPROMEraseCurrent->setEnabled(isPageDetected());
|
||||
//myEEPROMEraseCurrent->setEnabled(isUseDetected());
|
||||
}
|
|
@ -43,15 +43,18 @@ private:
|
|||
kEEPROMEraseCurrent = 'eeEC'
|
||||
};
|
||||
|
||||
static constexpr uInt32 MAX_PAGES = 7;
|
||||
StaticTextWidget* myPage[MAX_PAGES];
|
||||
|
||||
private:
|
||||
void loadConfig() override {}
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
void updateButtonState();
|
||||
|
||||
virtual string getName() = 0;
|
||||
virtual void eraseCurrent() = 0;
|
||||
virtual void eraseAll() = 0;
|
||||
virtual bool isPageDetected() = 0;
|
||||
virtual bool isUseDetected() = 0;
|
||||
virtual bool isPageUsed(int page) = 0;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
FlashWidget() = delete;
|
||||
|
|
|
@ -331,6 +331,7 @@
|
|||
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
||||
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
||||
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
|
||||
<ClCompile Include="AmigaMouseWidget.cxx" />
|
||||
<ClCompile Include="FlashWidget.cxx" />
|
||||
<ClCompile Include="FSNodeWINDOWS.cxx" />
|
||||
<ClCompile Include="OSystemWINDOWS.cxx" />
|
||||
|
@ -491,6 +492,7 @@
|
|||
<ClCompile Include="..\libpng\pngwtran.c" />
|
||||
<ClCompile Include="..\libpng\pngwutil.c" />
|
||||
<ClCompile Include="StateList.cxx" />
|
||||
<ClCompile Include="TrackBallWidget.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\common\Base.hxx" />
|
||||
|
@ -621,6 +623,7 @@
|
|||
<ClInclude Include="..\libpng\pnginfo.h" />
|
||||
<ClInclude Include="..\libpng\pnglibconf.h" />
|
||||
<ClInclude Include="..\libpng\pngstruct.h" />
|
||||
<ClInclude Include="AmigaMouseWidget.hxx" />
|
||||
<ClInclude Include="FlashWidget.hxx" />
|
||||
<ClInclude Include="FSNodeWINDOWS.hxx" />
|
||||
<ClInclude Include="HomeFinder.hxx" />
|
||||
|
@ -786,6 +789,7 @@
|
|||
<ClInclude Include="..\libpng\pngconf.h" />
|
||||
<ClInclude Include="..\libpng\pngpriv.h" />
|
||||
<ClInclude Include="StateList.hxx" />
|
||||
<ClInclude Include="TrackBallWidget.hxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="stella.ico" />
|
||||
|
|
|
@ -843,8 +843,14 @@
|
|||
<ClCompile Include="StateList.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrackBallWidget.cxx">
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FlashWidget.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AmigaMouseWidget.cxx">
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1725,7 +1731,13 @@
|
|||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FlashWidget.hxx">
|
||||
<Filter>Header Files</Filter>
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TrackBallWidget.hxx">
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AmigaMouseWidget.hxx">
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue