Fixed graphical corruption on the HDMI screen after disk image write back

This commit is contained in:
Stephen White 2019-12-27 15:27:32 +11:00
parent a4379326be
commit 7437e9e16c
3 changed files with 32 additions and 15 deletions

View File

@ -43,6 +43,11 @@ bool DiskCaddy::Empty()
int index; int index;
bool anyDirty = false; bool anyDirty = false;
#if not defined(EXPERIMENTALZERO)
if (screen)
screen->Clear(RGBA(0x40, 0x31, 0x8D, 0xFF));
#endif
for (index = 0; index < (int)disks.size(); ++index) for (index = 0; index < (int)disks.size(); ++index)
{ {
if (disks[index]->IsDirty()) if (disks[index]->IsDirty())
@ -54,7 +59,7 @@ bool DiskCaddy::Empty()
x = screen->ScaleX(screenPosXCaddySelections); x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections); y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, "Saving %s\r\n", disks[index]->GetName()); snprintf(buffer, 256, "Saving %s", disks[index]->GetName());
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
} }
#endif #endif
@ -85,7 +90,7 @@ bool DiskCaddy::Empty()
x = screen->ScaleX(screenPosXCaddySelections); x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections); y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, "Saving Complete \r\n"); snprintf(buffer, 256, " Saving Complete ");
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
} }
#endif #endif
@ -107,6 +112,7 @@ bool DiskCaddy::Empty()
disks.clear(); disks.clear();
selectedIndex = 0; selectedIndex = 0;
oldCaddyIndex = 0;
return anyDirty; return anyDirty;
} }
@ -125,10 +131,10 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
x = screen->ScaleX(screenPosXCaddySelections); x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections); y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, " \r\n"); snprintf(buffer, 256, " ");
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
snprintf(buffer, 256, "Loading %s\r\n", fileInfo->fname); snprintf(buffer, 256, "Loading %s", fileInfo->fname);
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
} }
#endif #endif
@ -293,9 +299,9 @@ void DiskCaddy::Display()
x = screen->ScaleX(screenPosXCaddySelections); x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections); y = screen->ScaleY(screenPosYCaddySelections);
snprintf(buffer, 256, " \r\n"); snprintf(buffer, 256, " ");
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), redDark); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), redDark);
snprintf(buffer, 256, " Emulating\r\n"); snprintf(buffer, 256, " Emulating");
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), redDark); screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), redDark);
y += 16; y += 16;
@ -305,7 +311,7 @@ void DiskCaddy::Display()
const char* name = image->GetName(); const char* name = image->GetName();
if (name) if (name)
{ {
snprintf(buffer, 256, " \r\n"); snprintf(buffer, 256, " ");
screen->PrintText(false, x, y, buffer, grey, greyDark); screen->PrintText(false, x, y, buffer, grey, greyDark);
snprintf(buffer, 256, " %d %s", caddyIndex + 1, name); snprintf(buffer, 256, " %d %s", caddyIndex + 1, name);
screen->PrintText(false, x, y, buffer, grey, greyDark); screen->PrintText(false, x, y, buffer, grey, greyDark);
@ -407,7 +413,7 @@ bool DiskCaddy::Update()
const char* name = image->GetName(); const char* name = image->GetName();
if (name) if (name)
{ {
snprintf(buffer, 256, " \r\n"); snprintf(buffer, 256, " ");
screen->PrintText(false, x, y, buffer, grey, greyDark); screen->PrintText(false, x, y, buffer, grey, greyDark);
snprintf(buffer, 256, " %d %s", oldCaddyIndex + 1, name); snprintf(buffer, 256, " %d %s", oldCaddyIndex + 1, name);
screen->PrintText(false, x, y, buffer, grey, greyDark); screen->PrintText(false, x, y, buffer, grey, greyDark);

View File

@ -553,6 +553,9 @@ FileBrowser::FileBrowser(InputMappings* inputMappings, DiskCaddy* diskCaddy, ROM
folder.AddView(screenLCD, inputMappings, columns, rows, positionX, positionY, true); folder.AddView(screenLCD, inputMappings, columns, rows, positionX, positionY, true);
} }
f_chdir("/1541");
RefreshFolderEntries();
} }
u32 FileBrowser::Colour(int index) u32 FileBrowser::Colour(int index)

View File

@ -596,7 +596,13 @@ void UpdateScreen()
if (emulating != IEC_COMMANDS) if (emulating != IEC_COMMANDS)
{ {
//refreshUartStatusDisplay = //refreshUartStatusDisplay =
#if not defined(EXPERIMENTALZERO)
core0RefreshingScreen.Acquire();
#endif
diskCaddy.Update(); diskCaddy.Update();
#if not defined(EXPERIMENTALZERO)
core0RefreshingScreen.Release();
#endif
} }
//if (options.GetSupportUARTInput()) //if (options.GetSupportUARTInput())
@ -1172,7 +1178,6 @@ void emulator()
diskCaddy.SetScreen(&screen, screenLCD); diskCaddy.SetScreen(&screen, screenLCD);
fileBrowser = new FileBrowser(inputMappings, &diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate()); fileBrowser = new FileBrowser(inputMappings, &diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate());
fileBrowser->DisplayRoot();
pi1541.Initialise(); pi1541.Initialise();
m_IEC_Commands.SetAutoBootFB128(options.AutoBootFB128()); m_IEC_Commands.SetAutoBootFB128(options.AutoBootFB128());
@ -1283,7 +1288,6 @@ void emulator()
break; break;
case IEC_Commands::POP_DIR: case IEC_Commands::POP_DIR:
fileBrowser->PopFolder(); fileBrowser->PopFolder();
fileBrowser->RefeshDisplay();
break; break;
case IEC_Commands::POP_TO_ROOT: case IEC_Commands::POP_TO_ROOT:
fileBrowser->DisplayRoot(); fileBrowser->DisplayRoot();
@ -1329,19 +1333,23 @@ void emulator()
// Clearing the caddy now // Clearing the caddy now
// - will write back all changed/dirty/written to disk images now // - will write back all changed/dirty/written to disk images now
// - TDOO: need to display the image names as they write back #if not defined(EXPERIMENTALZERO)
// - pass in a call back function? core0RefreshingScreen.Acquire();
#endif
if (diskCaddy.Empty()) if (diskCaddy.Empty())
IEC_Bus::WaitMicroSeconds(2 * 1000000); IEC_Bus::WaitMicroSeconds(2 * 1000000);
IEC_Bus::WaitUntilReset(); IEC_Bus::WaitUntilReset();
//DEBUG_LOG("6502 resetting\r\n");
emulating = IEC_COMMANDS; emulating = IEC_COMMANDS;
if ((exitReason == EXIT_RESET) && (options.GetOnResetChangeToStartingFolder() || selectedViaIECCommands)) if ((exitReason == EXIT_RESET) && (options.GetOnResetChangeToStartingFolder() || selectedViaIECCommands))
fileBrowser->DisplayRoot(); // TO CHECK fileBrowser->DisplayRoot(); // TO CHECK
inputMappings->WaitForClearButtons(); inputMappings->WaitForClearButtons();
#if not defined(EXPERIMENTALZERO)
core0RefreshingScreen.Release();
#endif
} }
} }
delete fileBrowser; delete fileBrowser;