diff --git a/src/FileBrowser.cpp b/src/FileBrowser.cpp index d5918bb..9dcb9b9 100644 --- a/src/FileBrowser.cpp +++ b/src/FileBrowser.cpp @@ -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(); } diff --git a/src/iec_commands.cpp b/src/iec_commands.cpp index 0d70a2c..c3af2de 100644 --- a/src/iec_commands.cpp +++ b/src/iec_commands.cpp @@ -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) diff --git a/src/main.cpp b/src/main.cpp index af35a7a..44bd790 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(); + fileBrowser->Update(); - // Check selections made via FileBrowser - if (fileBrowser->SelectionsMade()) - emulating = BeginEmulating(fileBrowser, fileBrowser->LastSelectionName()); - } + // 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,8 +774,7 @@ void emulator() m_IEC_Commands.Reset(); selectedViaIECCommands = true; - } - break; + break; case IEC_Commands::DIR_PUSHED: fileBrowser->FolderChanged(); break; @@ -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);