mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-10 11:29:20 +00:00
Added support for QuickDraw II icon detection; reorganized the
file filter recognition logic a bit; minor enhancement to show the file structure value if not recognized (tree, sapling, etc).
This commit is contained in:
parent
bc4773e4b6
commit
60e20e1782
@ -130,10 +130,14 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
|
|||||||
* according to ProDOS - a "$xx" if unknown.
|
* according to ProDOS - a "$xx" if unknown.
|
||||||
*/
|
*/
|
||||||
public String getFiletype() {
|
public String getFiletype() {
|
||||||
int filetype = AppleUtil.getUnsignedByte(readFileEntry()[0x10]);
|
int filetype = getFiletypeByte();
|
||||||
return getDisk().getFiletype(filetype);
|
return getDisk().getFiletype(filetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getFiletypeByte() {
|
||||||
|
return AppleUtil.getUnsignedByte(readFileEntry()[0x10]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the filetype.
|
* Set the filetype.
|
||||||
*/
|
*/
|
||||||
@ -387,7 +391,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
|
|||||||
list.add(AppleUtil.getFormattedWord(getHeaderPointer()));
|
list.add(AppleUtil.getFormattedWord(getHeaderPointer()));
|
||||||
list.add(AppleUtil.getFormattedWord(getKeyPointer()));
|
list.add(AppleUtil.getFormattedWord(getKeyPointer()));
|
||||||
list.add(isSaplingFile() ? "Sapling" : isSeedlingFile() ? "Seedling" :
|
list.add(isSaplingFile() ? "Sapling" : isSeedlingFile() ? "Seedling" :
|
||||||
isTreeFile() ? "Tree" : "Unknown");
|
isTreeFile() ? "Tree" : "Unknown (" + getFileTypeString() + ")");
|
||||||
list.add(hasChanged() ? "Changed" : "");
|
list.add(hasChanged() ? "Changed" : "");
|
||||||
numberFormat.setMinimumIntegerDigits(1);
|
numberFormat.setMinimumIntegerDigits(1);
|
||||||
list.add(numberFormat.format(getMinimumProdosVersion()));
|
list.add(numberFormat.format(getMinimumProdosVersion()));
|
||||||
@ -403,6 +407,13 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ProDOS file type as a hex string.
|
||||||
|
*/
|
||||||
|
public String getFileTypeString() {
|
||||||
|
return "$" + AppleUtil.getFormattedByte(getStorageType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file data. This handles any operating-system specific issues.
|
* Get file data. This handles any operating-system specific issues.
|
||||||
* Currently, the disk itself handles this.
|
* Currently, the disk itself handles this.
|
||||||
@ -427,51 +438,65 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
|
|||||||
* of guessing the appropriate filter.
|
* of guessing the appropriate filter.
|
||||||
*/
|
*/
|
||||||
public FileFilter getSuggestedFilter() {
|
public FileFilter getSuggestedFilter() {
|
||||||
if ("TXT".equals(getFiletype()) || "SRC".equals(getFiletype())) {
|
int filetype = getFiletypeByte();
|
||||||
|
int auxtype = getAuxiliaryType();
|
||||||
|
int filesize = getSize();
|
||||||
|
|
||||||
|
switch (filetype) {
|
||||||
|
case 0x04: // TXT
|
||||||
|
case 0xb0: // SRC
|
||||||
return new TextFileFilter();
|
return new TextFileFilter();
|
||||||
} else if ("AWP".equals(getFiletype())) {
|
case 0x19: // ADB
|
||||||
return new AppleWorksWordProcessorFileFilter();
|
|
||||||
} else if ("ADB".equals(getFiletype())) {
|
|
||||||
return new AppleWorksDataBaseFileFilter();
|
return new AppleWorksDataBaseFileFilter();
|
||||||
} else if ("ASP".equals(getFiletype())) {
|
case 0x1a: // AWP
|
||||||
|
return new AppleWorksWordProcessorFileFilter();
|
||||||
|
case 0x1b: // ASP
|
||||||
return new AppleWorksSpreadSheetFileFilter();
|
return new AppleWorksSpreadSheetFileFilter();
|
||||||
} else if ("BAS".equals(getFiletype())) {
|
case 0xfc: // BAS
|
||||||
return new ApplesoftFileFilter();
|
return new ApplesoftFileFilter();
|
||||||
} else if ("INT".equals(getFiletype())) { // supposedly not available in ProDOS, however
|
case 0xfa: // INT
|
||||||
return new IntegerBasicFileFilter();
|
return new IntegerBasicFileFilter();
|
||||||
} else if ("PNT".equals(getFiletype())) {
|
case 0xc0: // PNT
|
||||||
if (getAuxiliaryType() == 0x0001) {
|
if (auxtype == 0x0001) {
|
||||||
GraphicsFileFilter filter = new GraphicsFileFilter();
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
filter.setMode(GraphicsFileFilter.MODE_SHR_16);
|
filter.setMode(GraphicsFileFilter.MODE_SHR_16);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
} else if ("PIC".equals(getFiletype())) {
|
break;
|
||||||
int auxType = getAuxiliaryType();
|
case 0xc1: // PIC
|
||||||
int fileSize = getSize();
|
|
||||||
// AUX TYPE $0002 is sometimes mislabeled and should be $0000
|
// AUX TYPE $0002 is sometimes mislabeled and should be $0000
|
||||||
// the OR attempts to identify these
|
// the OR attempts to identify these
|
||||||
if (auxType == 0x0000 || (auxType == 0x0002 && fileSize == 32768) ) {
|
if (auxtype == 0x0000 || (auxtype == 0x0002 && filesize == 32768) ) {
|
||||||
GraphicsFileFilter filter = new GraphicsFileFilter();
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
filter.setMode(GraphicsFileFilter.MODE_SHR_16);
|
filter.setMode(GraphicsFileFilter.MODE_SHR_16);
|
||||||
return filter;
|
return filter;
|
||||||
} else if (auxType == 0x0002 && fileSize == 38400) {
|
} else if (auxtype == 0x0002 && filesize == 38400) {
|
||||||
GraphicsFileFilter filter = new GraphicsFileFilter();
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
filter.setMode(GraphicsFileFilter.MODE_SHR_3200);
|
filter.setMode(GraphicsFileFilter.MODE_SHR_3200);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
} else if ("BIN".equals(getFiletype())) {
|
// fall through to BinaryFileFilter...
|
||||||
int size = getSize();
|
break;
|
||||||
|
case 0x06: // BIN
|
||||||
// the minimum size is guessed a bit - I don't remember, but maybe there
|
// the minimum size is guessed a bit - I don't remember, but maybe there
|
||||||
// are 8 spare bytes at the end of the graphics screen
|
// are 8 spare bytes at the end of the graphics screen
|
||||||
|
if (filesize >= 8184 && filesize <= 8192) {
|
||||||
GraphicsFileFilter filter = new GraphicsFileFilter();
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
if (size >= 8184 && size <= 8192) {
|
|
||||||
filter.setMode(GraphicsFileFilter.MODE_HGR_COLOR);
|
filter.setMode(GraphicsFileFilter.MODE_HGR_COLOR);
|
||||||
return filter;
|
return filter;
|
||||||
} else if (size >= 16377 && size <= 16384) {
|
} else if (filesize >= 16377 && filesize <= 16384) {
|
||||||
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
filter.setMode(GraphicsFileFilter.MODE_DHR_COLOR);
|
filter.setMode(GraphicsFileFilter.MODE_DHR_COLOR);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
// fall through to BinaryFileFilter...
|
// fall through to BinaryFileFilter...
|
||||||
|
break;
|
||||||
|
case 0xca: // ICN
|
||||||
|
{ // This is a trick to fix the scope on the filter variable...
|
||||||
|
GraphicsFileFilter filter = new GraphicsFileFilter();
|
||||||
|
filter.setMode(GraphicsFileFilter.MODE_QUICKDRAW2_ICON);
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new BinaryFileFilter();
|
return new BinaryFileFilter();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user