Each disk write back is now displayed on screen(s) when modified images are unmounted.

This commit is contained in:
Stephen White 2018-06-11 19:31:24 +10:00
parent a838a57a5f
commit 3e83a57349
4 changed files with 70 additions and 10 deletions

View File

@ -32,6 +32,69 @@ static char buffer[256] = { 0 };
static u32 white = RGBA(0xff, 0xff, 0xff, 0xff);
static u32 red = RGBA(0xff, 0, 0, 0xff);
void DiskCaddy::Empty()
{
int x;
int y;
int index;
for (index = 0; index < (int)disks.size(); ++index)
{
if (disks[index].IsDirty())
{
if (screen)
{
x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, "Saving %s\r\n", disks[index].GetName());
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
}
if (screenLCD)
{
RGBA BkColour = RGBA(0, 0, 0, 0xFF);
screenLCD->Clear(BkColour);
x = 0;
y = 0;
snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += 16;
snprintf(buffer, 256, "%s ", disks[index].GetName());
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers();
}
}
disks[index].Close();
}
if (screen)
{
x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, "Saving Complete \r\n");
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
}
if (screenLCD)
{
RGBA BkColour = RGBA(0, 0, 0, 0xFF);
screenLCD->Clear(BkColour);
x = 0;
y = 0;
snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += 16;
snprintf(buffer, 256, "Complete ");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers();
}
disks.clear();
selectedIndex = 0;
}
bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
{
int x;

View File

@ -35,16 +35,7 @@ public:
void SetScreen(Screen* screen, ScreenBase* screenLCD) { this->screen = screen; this->screenLCD = screenLCD; }
void Empty()
{
int index;
for (index = 0; index < (int)disks.size(); ++index)
{
disks[index].Close();
}
disks.clear();
selectedIndex = 0;
}
void Empty();
bool Insert(const FILINFO* fileInfo, bool readOnly);

View File

@ -113,6 +113,8 @@ public:
unsigned LastTrackUsed();
bool IsDirty() const { return dirty; }
static unsigned char readBuffer[READBUFFER_SIZE];
private:

View File

@ -868,6 +868,10 @@ void emulator()
// - TDOO: need to display the image names as they write back
// - pass in a call back function?
diskCaddy.Empty();
IEC_Bus::WaitMicroSeconds(2 * 1000000);
fileBrowser->ClearSelections();
fileBrowser->RefeshDisplay(); // Just redisplay the current folder.
IEC_Bus::WaitUntilReset();
//DEBUG_LOG("6502 resetting\r\n");