resource fork in DefaultAppleFile

This commit is contained in:
Denis Molony 2021-07-21 21:17:43 +10:00
parent f92fe5b57e
commit 8ea18c8cc1
5 changed files with 22 additions and 3 deletions

View File

@ -17,9 +17,9 @@ public abstract class AbstractFile implements DataSource
protected String name; protected String name;
public byte[] buffer; public byte[] buffer;
protected AssemblerProgram assembler; AssemblerProgram assembler;
protected BufferedImage image; protected BufferedImage image;
protected int loadAddress; int loadAddress;
ResourceFork resourceFork; ResourceFork resourceFork;
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
@ -35,7 +35,16 @@ public abstract class AbstractFile implements DataSource
public String getText () // Override this to get a tailored text representation public String getText () // Override this to get a tailored text representation
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
return "Name : " + name + "\n\nNo text description"; StringBuilder text = new StringBuilder ();
text.append ("Name : " + name + "\n\nNo text description");
if (resourceFork != null)
{
text.append ("\n\n");
text.append (resourceFork);
}
return text.toString ();
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//

View File

@ -18,6 +18,7 @@ public class DefaultAppleFile extends AbstractFile
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
this.text = "Name : " + name + "\n\n" + text; this.text = "Name : " + name + "\n\n" + text;
} }
@ -35,8 +36,10 @@ public class DefaultAppleFile extends AbstractFile
{ {
if (text != null) if (text != null)
return text; return text;
if (buffer == null) if (buffer == null)
return "Invalid file : " + name; return "Invalid file : " + name;
return super.getText (); return super.getText ();
} }
} }

View File

@ -70,6 +70,8 @@ public class OriginalHiResImage extends HiResImage
for (int ptr = base; ptr < max; ptr++) for (int ptr = base; ptr < max; ptr++)
{ {
int value = buffer[ptr] & 0x7F; int value = buffer[ptr] & 0x7F;
if ((buffer[ptr] & 0x80) != 0)
System.out.printf ("bit shift pixel found in %s%n", name);
for (int px = 0; px < 7; px++) for (int px = 0; px < 7; px++)
{ {
int val = (value >> px) & 0x01; int val = (value >> px) & 0x01;

View File

@ -459,6 +459,10 @@ class FileEntry extends CatalogEntry implements ProdosConstants
file = new DeviceDriver (name, exactBuffer, auxType); file = new DeviceDriver (name, exactBuffer, auxType);
break; break;
case FILE_TYPE_TIF:
file = new DefaultAppleFile (name, exactBuffer);
break;
case FILE_TYPE_ICN: case FILE_TYPE_ICN:
file = new IconFile (name, exactBuffer); file = new IconFile (name, exactBuffer);
break; break;

View File

@ -21,6 +21,7 @@ public interface ProdosConstants
static int FILE_TYPE_IIGS_SOURCE = 0xB0; static int FILE_TYPE_IIGS_SOURCE = 0xB0;
static int FILE_TYPE_IIGS_OBJECT = 0xB1; static int FILE_TYPE_IIGS_OBJECT = 0xB1;
static int FILE_TYPE_IIGS_APPLICATION = 0xB3; static int FILE_TYPE_IIGS_APPLICATION = 0xB3;
static int FILE_TYPE_TIF = 0xB7;
static int FILE_TYPE_IIGS_DEVICE_DRIVER = 0xBB; static int FILE_TYPE_IIGS_DEVICE_DRIVER = 0xBB;
static int FILE_TYPE_LDF = 0xBC; static int FILE_TYPE_LDF = 0xBC;
static int FILE_TYPE_GS_BASIC = 0xAB; static int FILE_TYPE_GS_BASIC = 0xAB;