mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-06 04:29:56 +00:00
Initial MagicWindow support
This commit is contained in:
parent
1b7be1189d
commit
0637f526ca
52
src/com/bytezone/diskbrowser/applefile/MagicWindowText.java
Normal file
52
src/com/bytezone/diskbrowser/applefile/MagicWindowText.java
Normal file
@ -0,0 +1,52 @@
|
||||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class MagicWindowText extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public MagicWindowText (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append ("Name : " + name + "\n");
|
||||
text.append (String.format ("End of file : %,8d%n%n", buffer.length));
|
||||
|
||||
int ptr = 0x100;
|
||||
while (ptr < buffer.length && buffer[ptr] != 0x00)
|
||||
{
|
||||
String line = getLine (ptr);
|
||||
text.append (line + "\n");
|
||||
ptr += line.length () + 1;
|
||||
if (ptr < buffer.length && buffer[ptr] == 0x0A)
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getLine (int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder line = new StringBuilder ();
|
||||
|
||||
// added check for 0x00 eol 17/01/17
|
||||
while (ptr < buffer.length && buffer[ptr] != (byte) 0x8D && buffer[ptr] != 0x00)
|
||||
{
|
||||
line.append ((char) (buffer[ptr++] & 0x7F));
|
||||
}
|
||||
|
||||
return line.toString ();
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import com.bytezone.diskbrowser.applefile.ErrorMessageFile;
|
||||
import com.bytezone.diskbrowser.applefile.FontFile;
|
||||
import com.bytezone.diskbrowser.applefile.HiResImage;
|
||||
import com.bytezone.diskbrowser.applefile.IntegerBasicProgram;
|
||||
import com.bytezone.diskbrowser.applefile.MagicWindowText;
|
||||
import com.bytezone.diskbrowser.applefile.MerlinSource;
|
||||
import com.bytezone.diskbrowser.applefile.OriginalHiResImage;
|
||||
import com.bytezone.diskbrowser.applefile.PrintShopGraphic;
|
||||
@ -271,6 +272,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
||||
|| name.endsWith (".SET") || name.startsWith ("ASCII."))
|
||||
&& FontFile.isFont (exactBuffer))
|
||||
appleFile = new FontFile (name, exactBuffer, loadAddress);
|
||||
else if (name.endsWith (".MW"))
|
||||
appleFile = new MagicWindowText (name, exactBuffer);
|
||||
else if (ShapeTable.isShapeTable (exactBuffer))
|
||||
appleFile = new ShapeTable (name, exactBuffer);
|
||||
else if (name.endsWith (".S"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user