fixed some infocom bugs
This commit is contained in:
parent
e7c4423ebf
commit
0b13adbee9
|
@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
public abstract class AbstractFile implements DataSource
|
public abstract class AbstractFile implements DataSource
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
static boolean debug;
|
static boolean showDebugText;
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
public byte[] buffer;
|
public byte[] buffer;
|
||||||
|
@ -40,14 +40,14 @@ public abstract class AbstractFile implements DataSource
|
||||||
public static void setDefaultDebug (boolean value)
|
public static void setDefaultDebug (boolean value)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
debug = value;
|
showDebugText = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public static void setDebug (boolean value)
|
public static void setDebug (boolean value)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
debug = value;
|
showDebugText = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ApplesoftBasicProgram extends BasicProgram
|
||||||
public String getText ()
|
public String getText ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return debug ? getHexText () : getProgramText ();
|
return showDebugText ? getHexText () : getProgramText ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class VisicalcFile extends AbstractFile
|
||||||
StringBuilder text = new StringBuilder ();
|
StringBuilder text = new StringBuilder ();
|
||||||
|
|
||||||
text.append ("Visicalc : " + name + "\n\n");
|
text.append ("Visicalc : " + name + "\n\n");
|
||||||
text.append (sheet.getTextDisplay (debug));
|
text.append (sheet.getTextDisplay (showDebugText));
|
||||||
|
|
||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,25 +262,10 @@ public class DataPanel extends JTabbedPane
|
||||||
|
|
||||||
AbstractFile.setDebug (value);
|
AbstractFile.setDebug (value);
|
||||||
setText (formattedText, currentDataSource.getText ());
|
setText (formattedText, currentDataSource.getText ());
|
||||||
// if (currentDataSource instanceof VisicalcFile)
|
|
||||||
// {
|
|
||||||
// VisicalcFile visicalcFile = (VisicalcFile) currentDataSource;
|
|
||||||
// VisicalcFile.setDebug (value);
|
|
||||||
// setText (formattedText, visicalcFile.getText ());
|
|
||||||
// }
|
|
||||||
// else if (currentDataSource instanceof ApplesoftBasicProgram)
|
|
||||||
// {
|
|
||||||
// ApplesoftBasicProgram basicProgram = (ApplesoftBasicProgram) currentDataSource;
|
|
||||||
// ApplesoftBasicProgram.setDebug (value);
|
|
||||||
// setText (formattedText, basicProgram.getText ());
|
|
||||||
// }
|
|
||||||
// // should implement an interface for this
|
|
||||||
// else
|
|
||||||
if (currentDataSource instanceof HiResImage
|
if (currentDataSource instanceof HiResImage
|
||||||
|| currentDataSource instanceof QuickDrawFont)
|
|| currentDataSource instanceof QuickDrawFont)
|
||||||
{
|
|
||||||
setDataSource (currentDataSource); // toggles text/image
|
setDataSource (currentDataSource); // toggles text/image
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -359,6 +344,9 @@ public class DataPanel extends JTabbedPane
|
||||||
hexTextValid = false;
|
hexTextValid = false;
|
||||||
formattedTextValid = false;
|
formattedTextValid = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
System.out.println ("Unexpected Tab #" + getSelectedIndex ());
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedImage image = dataSource.getImage ();
|
BufferedImage image = dataSource.getImage ();
|
||||||
|
|
|
@ -151,7 +151,10 @@ class CodeManager extends AbstractFile
|
||||||
|
|
||||||
if (routines.containsKey (ptr))
|
if (routines.containsKey (ptr))
|
||||||
{
|
{
|
||||||
ptr += getRoutine (ptr).length;
|
int length = getRoutine (ptr).length;
|
||||||
|
if (length == 0)
|
||||||
|
break;
|
||||||
|
ptr += length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,13 @@ class Dictionary extends AbstractFile
|
||||||
int b1 = buffer[ptr + 5] & 0xFF;
|
int b1 = buffer[ptr + 5] & 0xFF;
|
||||||
int b2 = buffer[ptr + 6] & 0xFF;
|
int b2 = buffer[ptr + 6] & 0xFF;
|
||||||
int property = b2 == 0 ? b1 : b2;
|
int property = b2 == 0 ? b1 : b2;
|
||||||
|
property &= 0x1F;
|
||||||
String propertyName = header.getPropertyName (property);
|
String propertyName = header.getPropertyName (property);
|
||||||
|
|
||||||
System.out.printf ("%02X %s%n", property, string.value);
|
System.out.printf ("%02X %s%n", property, string.value);
|
||||||
|
// if (property >= header.propertyNames.length)
|
||||||
|
// System.out.println ("Illegal property");
|
||||||
|
// else
|
||||||
if (propertyName == null || propertyName.length () > string.value.length ())
|
if (propertyName == null || propertyName.length () > string.value.length ())
|
||||||
header.propertyNames[property] = string.value;
|
header.propertyNames[property] = string.value;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +85,7 @@ class Dictionary extends AbstractFile
|
||||||
header.propertyNames[i] = i + "";
|
header.propertyNames[i] = i + "";
|
||||||
|
|
||||||
// testing (only works in Zork 1)
|
// testing (only works in Zork 1)
|
||||||
if (true)
|
if (false)
|
||||||
{
|
{
|
||||||
if (header.propertyNames[4].equals ("4"))
|
if (header.propertyNames[4].equals ("4"))
|
||||||
header.propertyNames[4] = "PSEUDO";
|
header.propertyNames[4] = "PSEUDO";
|
||||||
|
|
|
@ -87,6 +87,8 @@ class Header extends InfocomAbstractFile
|
||||||
String getPropertyName (int id)
|
String getPropertyName (int id)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
|
if (id >= propertyNames.length)
|
||||||
|
return "Bad id : " + id;
|
||||||
return propertyNames[id];
|
return propertyNames[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class InfocomDisk extends AbstractFormattedDisk
|
||||||
|
|
||||||
setInfocomSectorTypes ();
|
setInfocomSectorTypes ();
|
||||||
|
|
||||||
data = disk.readBlock (3, 0); // read first sector to get file size
|
data = disk.readBlock (3, 0); // read first sector to get file size
|
||||||
data = getBuffer (getWord (26) * 2); // read entire file into data buffer
|
data = getBuffer (getWord (26) * 2); // read entire file into data buffer
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
|
|
|
@ -199,10 +199,13 @@ class ZObject extends AbstractFile implements Comparable<ZObject>
|
||||||
|
|
||||||
if (propertyNumber >= 19) // directions
|
if (propertyNumber >= 19) // directions
|
||||||
{
|
{
|
||||||
|
ZObject object = getObject ();
|
||||||
|
String objectName = object == null ? "no object" : object.name;
|
||||||
|
|
||||||
switch (length)
|
switch (length)
|
||||||
{
|
{
|
||||||
case 1: // UEXIT - unconditional exit
|
case 1: // UEXIT - unconditional exit
|
||||||
text.append (getObject ().name);
|
text.append (objectName);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
text.append ("\"" + header.stringManager.stringAt (offset) + "\"");
|
text.append ("\"" + header.stringManager.stringAt (offset) + "\"");
|
||||||
|
@ -213,15 +216,15 @@ class ZObject extends AbstractFile implements Comparable<ZObject>
|
||||||
appendRoutine (text, address);
|
appendRoutine (text, address);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
text.append (String.format ("%s : IF G%02X ELSE ", getObject ().name,
|
text.append (String.format ("%s : IF G%02X ELSE ", objectName,
|
||||||
header.getByte (ptr + 2)));
|
header.getByte (ptr + 2)));
|
||||||
address = header.getWord (ptr + 3) * 2;
|
address = header.getWord (ptr + 3) * 2;
|
||||||
if (address > 0)
|
if (address > 0)
|
||||||
text.append ("\"" + header.stringManager.stringAt (address) + "\"");
|
text.append ("\"" + header.stringManager.stringAt (address) + "\"");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
text.append (String.format ("%s : IF G%02X ", getObject ().name,
|
text.append (
|
||||||
header.getByte (ptr + 2)));
|
String.format ("%s : IF G%02X ", objectName, header.getByte (ptr + 2)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue