Merge pull request #57 from penfold42/cleanup

Browser oled, add '<' for readonly files + cleanups
This commit is contained in:
Stephen White 2018-08-02 12:21:56 +10:00 committed by GitHub
commit 0d64664cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 33 deletions

View File

@ -88,8 +88,8 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
RGBA BkColour = RGBA(0, 0, 0, 0xFF); //palette[VIC2_COLOUR_INDEX_BLUE];
u32 columnsMax = columns;
if (columnsMax > sizeof(buffer1))
columnsMax = sizeof(buffer1);
if (columnsMax > sizeof(buffer1)-1)
columnsMax = sizeof(buffer1)-1;
if (entryIndex < list->entries.size())
{
@ -102,10 +102,17 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
}
else
{
char ROstring[8] = { 0 };
if (entry->filImage.fattrib & AM_RDO)
strncpy (ROstring, "<", 8);
if (entry->caddyIndex != -1)
snprintf(buffer2, 256, "%d>%s", entry->caddyIndex, entry->filImage.fname);
snprintf(buffer2, 256, "%d>%s%s"
, entry->caddyIndex
, entry->filImage.fname
, ROstring
);
else
snprintf(buffer2, 256, "%s", entry->filImage.fname);
snprintf(buffer2, 256, "%s%s", entry->filImage.fname, ROstring);
}
}
else
@ -150,7 +157,7 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
}
else
{
memset(buffer1, ' ', 80);
memset(buffer1, ' ', columnsMax);
screen->PrintText(false, x, y, buffer1, BkColour, BkColour);
}
}
@ -196,10 +203,17 @@ void FileBrowser::BrowsableListView::RefreshHighlightScroll()
}
else
{
char ROstring[8] = { 0 };
if (entry->filImage.fattrib & AM_RDO)
strncpy (ROstring, "<", 8);
if (entry->caddyIndex != -1)
snprintf(buffer2, 256, "%d>%s", entry->caddyIndex, entry->filImage.fname);
snprintf(buffer2, 256, "%d>%s%s"
, entry->caddyIndex
, entry->filImage.fname
, ROstring
);
else
snprintf(buffer2, 256, "%s", entry->filImage.fname);
snprintf(buffer2, 256, "%s%s", entry->filImage.fname, ROstring);
}
}
else
@ -514,7 +528,7 @@ void FileBrowser::FolderChanged()
void FileBrowser::DisplayRoot()
{
f_chdir("\\1541");
f_chdir("/1541");
FolderChanged();
}

View File

@ -1100,9 +1100,6 @@ void IEC_Commands::New(void)
{
FILINFO filInfo;
if(!(strstr(filenameNew, ".d64") || strstr(filenameNew, ".D64")))
strcat(filenameNew, ".d64");
int ret = CreateD64(filenameNew, ID, true);
if (ret==0)

View File

@ -635,17 +635,12 @@ static void PlaySoundDMA()
write32(DMA0_BASE + DMA_CS, DMA_ACTIVE);
}
static void SetVIAsDeviceID(u8 id)
{
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL0, id & 1);
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, id & 2);
}
void GlobalSetDeviceID(u8 id)
{
deviceID = id;
m_IEC_Commands.SetDeviceId(id);
SetVIAsDeviceID(id);
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL0, id & 1);
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, id & 2);
}
void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
@ -736,17 +731,14 @@ void emulator()
CheckAutoMountImage(EXIT_UNKNOWN, fileBrowser);
break;
case IEC_Commands::NONE:
{
fileBrowser->Update();
// Check selections made via FileBrowser
if (fileBrowser->SelectionsMade())
emulating = BeginEmulating(fileBrowser, fileBrowser->LastSelectionName());
}
break;
case IEC_Commands::IMAGE_SELECTED:
{
// Check selections made via FileBrowser
// Check selections made via IEC commands (like fb64)
fileBrowserSelectedName = m_IEC_Commands.GetNameOfImageSelected();
@ -768,8 +760,10 @@ void emulator()
DEBUG_LOG("IEC mounting %s\r\n", filInfoSelected->fname);
bool readOnly = (filInfoSelected->fattrib & AM_RDO) != 0;
if (diskCaddy.Insert(filInfoSelected, readOnly)) emulating = BeginEmulating(fileBrowser, filInfoSelected->fname);
else fileBrowserSelectedName = 0;
if (diskCaddy.Insert(filInfoSelected, readOnly))
emulating = BeginEmulating(fileBrowser, filInfoSelected->fname);
else
fileBrowserSelectedName = 0;
}
else
{
@ -780,7 +774,6 @@ void emulator()
m_IEC_Commands.Reset();
selectedViaIECCommands = true;
}
break;
case IEC_Commands::DIR_PUSHED:
fileBrowser->FolderChanged();
@ -798,7 +791,6 @@ void emulator()
case IEC_Commands::DEVICEID_CHANGED:
GlobalSetDeviceID( m_IEC_Commands.GetDeviceId() );
fileBrowser->ShowDeviceAndROM();
SetVIAsDeviceID(deviceID); // Let the emulated VIA know
break;
default:
break;
@ -1346,10 +1338,9 @@ extern "C"
f_chdir("/1541");
m_IEC_Commands.SetDeviceId(deviceID);
m_IEC_Commands.SetStarFileName(options.GetStarFileName());
SetVIAsDeviceID(deviceID);
GlobalSetDeviceID(deviceID);
pi1541.drive.SetVIA(&pi1541.VIA[1]);
pi1541.VIA[0].GetPortB()->SetPortOut(0, IEC_Bus::PortB_OnPortOut);