diff --git a/src/diskfiles/dos33/catalogsector.cxx b/src/diskfiles/dos33/catalogsector.cxx index 680cdab..aaf695c 100644 --- a/src/diskfiles/dos33/catalogsector.cxx +++ b/src/diskfiles/dos33/catalogsector.cxx @@ -36,10 +36,20 @@ FileDescriptiveEntry CatalogSector::makeFDE(int offset) fde.firstTSListSector.track = m_data->rawData()[offset + 0x00]; fde.firstTSListSector.sector = m_data->rawData()[offset + 0x01]; fde.fileTypeAndFlags = m_data->rawData()[offset + 0x02]; - //fde.lengthInSectors = m_data->rawData()[offset + 0x21] + (m_data->rawData()[offset + 0x22] * 256); fde.lengthInSectors = makeWord( m_data->rawData()[offset + 0x21], m_data->rawData()[offset + 0x22]); for (int idx = 0x03; idx <= 0x20; idx++) { fde.filename.append(m_data->rawData()[idx+offset]); } + if (fde.firstTSListSector.track == 0xFF) + { + //TODO: Double check this stuff. applevision.dsk is a good example. + qDebug() << "File" << fde.filename.printable() << "is deleted"; + fde.deleted = true; + qDebug() << fde.filename; + fde.firstTSListSector.track = m_data->rawData()[offset + 0x20]; + qDebug() << " New track: " << (quint8) fde.firstTSListSector.track; + qDebug() << " Sector: " << fde.firstTSListSector.sector; + + } return fde; } diff --git a/src/diskfiles/dos33/diskfile.cxx b/src/diskfiles/dos33/diskfile.cxx index 5efe107..16cd53b 100644 --- a/src/diskfiles/dos33/diskfile.cxx +++ b/src/diskfiles/dos33/diskfile.cxx @@ -30,6 +30,14 @@ DiskFile::~DiskFile() bool DiskFile::read(QString filename) { m_imageName = QFileInfo(filename).fileName(); + if (m_imageName.toUpper().contains(".D13")) + { + m_sectors_per_track = 13; + } + else + { + m_sectors_per_track = 16; + } QFile infile(filename); QCryptographicHash hash(QCryptographicHash::Md5); @@ -40,7 +48,7 @@ bool DiskFile::read(QString filename) QDataStream qds(contents); for (int track = 0; track < 35; track++) { - for (int sector = 0; sector < 16; sector++) + for (int sector = 0; sector < m_sectors_per_track; sector++) { char buffer[256]; if (qds.readRawData(buffer,256) == 256) diff --git a/src/diskfiles/dos33/diskfile.h b/src/diskfiles/dos33/diskfile.h index 8a3ad2e..fa1e163 100644 --- a/src/diskfiles/dos33/diskfile.h +++ b/src/diskfiles/dos33/diskfile.h @@ -47,6 +47,7 @@ private: QByteArray m_hash; QString m_imageName; + quint8 m_sectors_per_track; }; diff --git a/src/diskfiles/dos33/filedescriptiveentry.h b/src/diskfiles/dos33/filedescriptiveentry.h index 7143353..c3269b5 100644 --- a/src/diskfiles/dos33/filedescriptiveentry.h +++ b/src/diskfiles/dos33/filedescriptiveentry.h @@ -10,6 +10,13 @@ struct FileDescriptiveEntry { int fileTypeAndFlags; AppleString filename; quint16 lengthInSectors; + bool deleted; + + FileDescriptiveEntry() { + fileTypeAndFlags = 0; + lengthInSectors = 0; + deleted = false; + } bool operator<(const FileDescriptiveEntry& f1) const { return f1.filename < filename; diff --git a/src/ui/catalogwidget.cxx b/src/ui/catalogwidget.cxx index 026681f..444db5d 100644 --- a/src/ui/catalogwidget.cxx +++ b/src/ui/catalogwidget.cxx @@ -82,7 +82,6 @@ void CatalogWidget::processNewlyLoadedDisk(QString diskfilename, DiskFile *disk) QString filetype = fde.fileType(); QString filename = AppleString(fde.filename).printable().trimmed(); quint16 size = fde.lengthInSectors; - qDebug() << "SIZE: " << size; bool locked = fde.isLocked(); QString sizeStr = QString("%1").arg(size,5,10,QChar(' ')).toUpper(); QString text = QString("%1 %2 %3 %4").arg(locked?"*":" ").arg(sizeStr).arg(filetype).arg(filename); diff --git a/src/ui/viewers/applesoftfileviewer.cxx b/src/ui/viewers/applesoftfileviewer.cxx index 923e53d..b07b4bb 100644 --- a/src/ui/viewers/applesoftfileviewer.cxx +++ b/src/ui/viewers/applesoftfileviewer.cxx @@ -59,7 +59,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_showIntsAction) { - m_showIntsAction = new QAction("Show Ints as &Hex",menu); + m_showIntsAction = new QAction("Show Ints as &Hex",this); m_showIntsAction->setCheckable(true); m_showIntsAction->setChecked(settings.value("ASViewer.intsAsHex",false).toBool()); setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(),NoReformat); @@ -70,7 +70,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_reindentCodeAction) { - m_reindentCodeAction = new QAction("&Indent code",menu); + m_reindentCodeAction = new QAction("&Indent code",this); m_reindentCodeAction->setCheckable(true); m_reindentCodeAction->setChecked(settings.value("ASViewer.indentCode",false).toBool()); setIndentCode(settings.value("ASViewer.indentCode",false).toBool(),NoReformat); @@ -81,7 +81,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_blankAfterReturnsAction) { - m_blankAfterReturnsAction = new QAction("Blank &Line after RETURNs",menu); + m_blankAfterReturnsAction = new QAction("Blank &Line after RETURNs",this); m_blankAfterReturnsAction->setCheckable(true); m_blankAfterReturnsAction->setChecked(settings.value("ASViewer.breakAfterReturn",false).toBool()); setIndentCode(settings.value("ASViewer.breakAfterReturn",false).toBool(),NoReformat); @@ -92,7 +92,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_showCtrlCharsAction) { - m_showCtrlCharsAction = new QAction("Show &Control Characters",menu); + m_showCtrlCharsAction = new QAction("Show &Control Characters",this); m_showCtrlCharsAction->setCheckable(true); m_showCtrlCharsAction->setChecked(settings.value("ASViewer.showCtrlChars",false).toBool()); setIndentCode(settings.value("ASViewer.showCtrlChars",false).toBool(),NoReformat); @@ -106,7 +106,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_wordWrapAction) { - m_wordWrapAction = new QAction("&Word Wrap"); + m_wordWrapAction = new QAction("&Word Wrap",this); m_wordWrapAction->setCheckable(true); m_wordWrapAction->setChecked(settings.value("ASViewer.WordWrap",true).toBool()); toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool()); @@ -116,7 +116,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_syntaxHighlightingAction) { - m_syntaxHighlightingAction = new QAction("&Syntax Highlighting",menu); + m_syntaxHighlightingAction = new QAction("&Syntax Highlighting",this); m_syntaxHighlightingAction->setCheckable(true); m_syntaxHighlightingAction->setChecked(settings.value("ASViewer.syntaxHighlighting",false).toBool()); setIndentCode(settings.value("ASViewer.syntaxHighlighting",false).toBool(),NoReformat); @@ -131,7 +131,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) if (!m_showVarExplorerAction) { - m_showVarExplorerAction = new QAction("Show &Variable Explorer...",menu); + m_showVarExplorerAction = new QAction("Show &Variable Explorer...",this); m_showVarExplorerAction->setCheckable(false); connect(m_showVarExplorerAction, SIGNAL(triggered(bool)), SLOT(launchVarBrowser())); } diff --git a/src/ui/viewers/viewerbase.cpp b/src/ui/viewers/viewerbase.cpp index 3efcdc4..234c2bc 100644 --- a/src/ui/viewers/viewerbase.cpp +++ b/src/ui/viewers/viewerbase.cpp @@ -56,7 +56,10 @@ void ViewerBase::setFile(GenericFile *file) QString defaultViewerDescriptor; HexDumpViewer *hdv = new HexDumpViewer(0); - hdv->setFile(file); + if (dynamic_cast(file)) + hdv->setFile(file,0x801); //TODO: Double check this offset. + else + hdv->setFile(file); descriptor = ("Hex Dump Viewer"); addViewer(descriptor,hdv); defaultViewerDescriptor = descriptor;