Implemented #163 display the ROM file name and Device Id on the LCD

This commit is contained in:
Stephen White 2019-12-27 16:09:59 +11:00
parent 7437e9e16c
commit 67c82503e6
5 changed files with 42 additions and 9 deletions

View file

@ -26,6 +26,8 @@ extern "C"
#include "rpi-gpio.h" // For SetACTLed
}
extern u8 deviceID;
static const u32 screenPosXCaddySelections = 240;
static const u32 screenPosYCaddySelections = 280;
static char buffer[256] = { 0 };
@ -353,10 +355,12 @@ void DiskCaddy::ShowSelectedImage(u32 index)
x = 0;
y = 0;
snprintf(buffer, 256, " D %d/%d %c "
snprintf(buffer, 256, "D%02d D%d/%d %c %s"
, deviceID
, index + 1
, numberOfImages
, GetImage(index)->GetReadOnly() ? 'R' : ' '
, roms ? roms->GetSelectedROMName() : ""
);
screenLCD->PrintText(false, x, y, buffer, 0, RGBA(0xff, 0xff, 0xff, 0xff));
y += screenLCD->GetFontHeight();

View file

@ -22,6 +22,7 @@
#include <vector>
#include "DiskImage.h"
#include "Screen.h"
#include "ROMs.h"
class DiskCaddy
{
@ -32,14 +33,16 @@ public:
, screen(0)
#endif
, screenLCD(0)
, roms(0)
{
}
void SetScreen(Screen* screen, ScreenBase* screenLCD)
void SetScreen(Screen* screen, ScreenBase* screenLCD, ROMs* roms)
{
#if not defined(EXPERIMENTALZERO)
this->screen = screen;
#endif
this->screenLCD = screenLCD;
this->roms = roms;
}
bool Empty();
@ -114,6 +117,7 @@ private:
ScreenBase* screen;
#endif
ScreenBase* screenLCD;
ROMs* roms;
};
#endif

View file

@ -1438,7 +1438,7 @@ void FileBrowser::ClearSelections()
void FileBrowser::ShowDeviceAndROM()
{
ShowDeviceAndROM( roms->ROMNames[roms->currentROMIndex] );
ShowDeviceAndROM(roms->GetSelectedROMName());
}
void FileBrowser::ShowDeviceAndROM( const char* ROMName )
@ -1447,16 +1447,31 @@ void FileBrowser::ShowDeviceAndROM( const char* ROMName )
u32 textColour = RGBA(0, 0, 0, 0xff);
u32 bgColour = RGBA(0xff, 0xff, 0xff, 0xff);
u32 x = 0; // 43 * 8
#if not defined(EXPERIMENTALZERO)
u32 y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
u32 y;
snprintf(buffer, 256, "Device %2d %*s\r\n"
#if not defined(EXPERIMENTALZERO)
y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
snprintf(buffer, 256, "Device %2d %*s"
, *deviceID
, roms->GetLongestRomNameLen()
, ROMName
);
screenMain->PrintText(false, x, y, buffer, textColour, bgColour);
#endif
if (screenLCD)
{
x = 0;
y = 0;
snprintf(buffer, 256, "D%2d %s"
, *deviceID
, ROMName
);
screenLCD->PrintText(false, x, y, buffer, textColour, bgColour);
screenLCD->SwapBuffers();
}
}
void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForIcon)

View file

@ -24,6 +24,11 @@
class ROMs
{
public:
ROMs() :
currentROMIndex(0)
{
}
void SelectROM(const char* ROMName);
inline u8 Read(u16 address)
@ -51,8 +56,12 @@ public:
unsigned lastManualSelectedROMIndex;
unsigned GetLongestRomNameLen() { return longestRomNameLen; }
unsigned UpdateLongestRomNameLen( unsigned maybeLongest );
unsigned UpdateLongestRomNameLen(unsigned maybeLongest);
const char* GetSelectedROMName() const
{
return ROMNames[currentROMIndex];
}
protected:
unsigned longestRomNameLen;
};

View file

@ -554,6 +554,7 @@ void UpdateScreen()
IEC_Bus::WaitMicroSeconds(100);
snprintf(tempBuffer, tempBufferSize, "D%02d %02d.%d", deviceID, (oldTrack >> 1) + 1, oldTrack & 1 ? 5 : 0);
screenLCD->PrintText(false, 0, 0, tempBuffer, 0, RGBA(0xff, 0xff, 0xff, 0xff));
// screenLCD->SetContrast(255.0/79.0*track);
screenLCD->RefreshRows(0, 1);
@ -1176,7 +1177,7 @@ void emulator()
roms.lastManualSelectedROMIndex = 0;
diskCaddy.SetScreen(&screen, screenLCD);
diskCaddy.SetScreen(&screen, screenLCD, &roms);
fileBrowser = new FileBrowser(inputMappings, &diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate());
pi1541.Initialise();