mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-28 20:50:13 +00:00
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
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
static boolean debug;
|
||||
static boolean showDebugText;
|
||||
|
||||
protected String name;
|
||||
public byte[] buffer;
|
||||
@ -40,14 +40,14 @@ public abstract class AbstractFile implements DataSource
|
||||
public static void setDefaultDebug (boolean value)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
debug = value;
|
||||
showDebugText = value;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static void setDebug (boolean value)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
debug = value;
|
||||
showDebugText = value;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -60,7 +60,7 @@ public class ApplesoftBasicProgram extends BasicProgram
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return debug ? getHexText () : getProgramText ();
|
||||
return showDebugText ? getHexText () : getProgramText ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -26,7 +26,7 @@ public class VisicalcFile extends AbstractFile
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append ("Visicalc : " + name + "\n\n");
|
||||
text.append (sheet.getTextDisplay (debug));
|
||||
text.append (sheet.getTextDisplay (showDebugText));
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
@ -262,25 +262,10 @@ public class DataPanel extends JTabbedPane
|
||||
|
||||
AbstractFile.setDebug (value);
|
||||
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
|
||||
|| currentDataSource instanceof QuickDrawFont)
|
||||
{
|
||||
setDataSource (currentDataSource); // toggles text/image
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -359,6 +344,9 @@ public class DataPanel extends JTabbedPane
|
||||
hexTextValid = false;
|
||||
formattedTextValid = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println ("Unexpected Tab #" + getSelectedIndex ());
|
||||
}
|
||||
|
||||
BufferedImage image = dataSource.getImage ();
|
||||
|
@ -151,7 +151,10 @@ class CodeManager extends AbstractFile
|
||||
|
||||
if (routines.containsKey (ptr))
|
||||
{
|
||||
ptr += getRoutine (ptr).length;
|
||||
int length = getRoutine (ptr).length;
|
||||
if (length == 0)
|
||||
break;
|
||||
ptr += length;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,13 @@ class Dictionary extends AbstractFile
|
||||
int b1 = buffer[ptr + 5] & 0xFF;
|
||||
int b2 = buffer[ptr + 6] & 0xFF;
|
||||
int property = b2 == 0 ? b1 : b2;
|
||||
property &= 0x1F;
|
||||
String propertyName = header.getPropertyName (property);
|
||||
|
||||
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 ())
|
||||
header.propertyNames[property] = string.value;
|
||||
}
|
||||
@ -80,7 +85,7 @@ class Dictionary extends AbstractFile
|
||||
header.propertyNames[i] = i + "";
|
||||
|
||||
// testing (only works in Zork 1)
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
if (header.propertyNames[4].equals ("4"))
|
||||
header.propertyNames[4] = "PSEUDO";
|
||||
|
@ -87,6 +87,8 @@ class Header extends InfocomAbstractFile
|
||||
String getPropertyName (int id)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (id >= propertyNames.length)
|
||||
return "Bad id : " + id;
|
||||
return propertyNames[id];
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class InfocomDisk extends AbstractFormattedDisk
|
||||
|
||||
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
|
||||
|
||||
if (false)
|
||||
|
@ -199,10 +199,13 @@ class ZObject extends AbstractFile implements Comparable<ZObject>
|
||||
|
||||
if (propertyNumber >= 19) // directions
|
||||
{
|
||||
ZObject object = getObject ();
|
||||
String objectName = object == null ? "no object" : object.name;
|
||||
|
||||
switch (length)
|
||||
{
|
||||
case 1: // UEXIT - unconditional exit
|
||||
text.append (getObject ().name);
|
||||
text.append (objectName);
|
||||
break;
|
||||
case 2:
|
||||
text.append ("\"" + header.stringManager.stringAt (offset) + "\"");
|
||||
@ -213,15 +216,15 @@ class ZObject extends AbstractFile implements Comparable<ZObject>
|
||||
appendRoutine (text, address);
|
||||
break;
|
||||
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)));
|
||||
address = header.getWord (ptr + 3) * 2;
|
||||
if (address > 0)
|
||||
text.append ("\"" + header.stringManager.stringAt (address) + "\"");
|
||||
break;
|
||||
case 5:
|
||||
text.append (String.format ("%s : IF G%02X ", getObject ().name,
|
||||
header.getByte (ptr + 2)));
|
||||
text.append (
|
||||
String.format ("%s : IF G%02X ", objectName, header.getByte (ptr + 2)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user