Fixed issue #134
This commit is contained in:
parent
6ea55bd013
commit
b1ce1f5d33
2 changed files with 38 additions and 31 deletions
|
@ -41,7 +41,7 @@ bool DiskCaddy::Empty()
|
|||
|
||||
for (index = 0; index < (int)disks.size(); ++index)
|
||||
{
|
||||
if (disks[index].IsDirty())
|
||||
if (disks[index]->IsDirty())
|
||||
{
|
||||
anyDirty = true;
|
||||
#if not defined(EXPERIMENTALZERO)
|
||||
|
@ -50,7 +50,7 @@ bool DiskCaddy::Empty()
|
|||
x = screen->ScaleX(screenPosXCaddySelections);
|
||||
y = screen->ScaleY(screenPosYCaddySelections);
|
||||
|
||||
snprintf(buffer, 256, "Saving %s\r\n", disks[index].GetName());
|
||||
snprintf(buffer, 256, "Saving %s\r\n", disks[index]->GetName());
|
||||
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||
}
|
||||
#endif
|
||||
|
@ -64,12 +64,13 @@ bool DiskCaddy::Empty()
|
|||
snprintf(buffer, 256, "Saving");
|
||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
|
||||
y += screenLCD->GetFontHeight();
|
||||
snprintf(buffer, 256, "%s ", disks[index].GetName());
|
||||
snprintf(buffer, 256, "%s ", disks[index]->GetName());
|
||||
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||
screenLCD->SwapBuffers();
|
||||
}
|
||||
}
|
||||
disks[index].Close();
|
||||
disks[index]->Close();
|
||||
delete disks[index];
|
||||
}
|
||||
|
||||
if (anyDirty)
|
||||
|
@ -120,6 +121,9 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
|
|||
x = screen->ScaleX(screenPosXCaddySelections);
|
||||
y = screen->ScaleY(screenPosYCaddySelections);
|
||||
|
||||
snprintf(buffer, 256, " \r\n");
|
||||
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||
|
||||
snprintf(buffer, 256, "Loading %s\r\n", fileInfo->fname);
|
||||
screen->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
|
||||
}
|
||||
|
@ -188,82 +192,88 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
|
|||
|
||||
bool DiskCaddy::InsertD64(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenD64(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenD64(fileInfo, diskImageData, size))
|
||||
{
|
||||
diskImage.SetReadOnly(readOnly);
|
||||
diskImage->SetReadOnly(readOnly);
|
||||
disks.push_back(diskImage);
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DiskCaddy::InsertG64(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenG64(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenG64(fileInfo, diskImageData, size))
|
||||
{
|
||||
diskImage.SetReadOnly(readOnly);
|
||||
diskImage->SetReadOnly(readOnly);
|
||||
disks.push_back(diskImage);
|
||||
//DEBUG_LOG("Disks size = %d\r\n", disks.size());
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DiskCaddy::InsertNIB(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenNIB(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenNIB(fileInfo, diskImageData, size))
|
||||
{
|
||||
// At the moment we cannot write out NIB files.
|
||||
diskImage.SetReadOnly(true);// readOnly);
|
||||
diskImage->SetReadOnly(true);// readOnly);
|
||||
disks.push_back(diskImage);
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DiskCaddy::InsertNBZ(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenNBZ(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenNBZ(fileInfo, diskImageData, size))
|
||||
{
|
||||
// At the moment we cannot write out NIB files.
|
||||
diskImage.SetReadOnly(true);// readOnly);
|
||||
diskImage->SetReadOnly(true);// readOnly);
|
||||
disks.push_back(diskImage);
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DiskCaddy::InsertD81(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenD81(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenD81(fileInfo, diskImageData, size))
|
||||
{
|
||||
diskImage.SetReadOnly(readOnly);
|
||||
diskImage->SetReadOnly(readOnly);
|
||||
disks.push_back(diskImage);
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DiskCaddy::InsertT64(const FILINFO* fileInfo, unsigned char* diskImageData, unsigned size, bool readOnly)
|
||||
{
|
||||
DiskImage diskImage;
|
||||
if (diskImage.OpenT64(fileInfo, diskImageData, size))
|
||||
DiskImage* diskImage = new DiskImage();
|
||||
if (diskImage->OpenT64(fileInfo, diskImageData, size))
|
||||
{
|
||||
diskImage.SetReadOnly(readOnly);
|
||||
diskImage->SetReadOnly(readOnly);
|
||||
disks.push_back(diskImage);
|
||||
selectedIndex = disks.size() - 1;
|
||||
return true;
|
||||
}
|
||||
delete diskImage;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
Update();
|
||||
#endif
|
||||
if (selectedIndex < disks.size())
|
||||
return &disks[selectedIndex];
|
||||
return disks[selectedIndex];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -60,24 +60,21 @@ public:
|
|||
DiskImage* NextDisk()
|
||||
{
|
||||
selectedIndex = (selectedIndex + 1) % (u32)disks.size();
|
||||
auto ret = GetCurrentDisk();
|
||||
return GetCurrentDisk();
|
||||
}
|
||||
|
||||
DiskImage* PrevDisk()
|
||||
{
|
||||
if (selectedIndex == 0u)
|
||||
selectedIndex += (u32)disks.size()-1;
|
||||
else
|
||||
--selectedIndex;
|
||||
|
||||
if ((int)selectedIndex < 0)
|
||||
selectedIndex += (u32)disks.size();
|
||||
return GetCurrentDisk();
|
||||
}
|
||||
|
||||
u32 GetNumberOfImages() const { return disks.size(); }
|
||||
u32 GetSelectedIndex() const { return selectedIndex; }
|
||||
|
||||
DiskImage* GetImage(unsigned index) { return &disks[index]; }
|
||||
DiskImage* GetImage(unsigned index) { return disks[index]; }
|
||||
DiskImage* SelectImage(unsigned index)
|
||||
{
|
||||
if (selectedIndex != index && index < disks.size())
|
||||
|
@ -110,7 +107,7 @@ private:
|
|||
|
||||
void ShowSelectedImage(u32 index);
|
||||
|
||||
std::vector<DiskImage> disks;
|
||||
std::vector<DiskImage*> disks;
|
||||
u32 selectedIndex;
|
||||
u32 oldCaddyIndex;
|
||||
#if not defined(EXPERIMENTALZERO)
|
||||
|
|
Loading…
Reference in a new issue