changed Maze hex output to debug screen

This commit is contained in:
Denis Molony 2022-03-10 21:06:52 +10:00
parent 2270b1f6db
commit d83ac3afda
3 changed files with 58 additions and 56 deletions

View File

@ -16,14 +16,15 @@ import com.bytezone.diskbrowser.utilities.Utility;
public abstract class HiResImage extends AbstractFile
// -----------------------------------------------------------------------------------//
{
static final String[] auxTypes =
{ "Paintworks Packed SHR Image", "Packed Super Hi-Res Image",
"Super Hi-Res Image (Apple Preferred Format)", "Packed QuickDraw II PICT File",
"Packed Super Hi-Res 3200 color image", "DreamGraphix" };
static final String[] auxTypes = { "Paintworks Packed SHR Image", "Packed Super Hi-Res Image",
"Super Hi-Res Image (Apple Preferred Format)", "Packed QuickDraw II PICT File",
"Packed Super Hi-Res 3200 color image", "DreamGraphix" };
static final int COLOR_TABLE_SIZE = 32;
static final int COLOR_TABLE_OFFSET_AUX_0 = 32_256;
static final int COLOR_TABLE_OFFSET_AUX_2 = 32_000;
public static final int FADDEN_AUX = 0x8066;
private byte[] fourBuf = new byte[4];
private ColorTable defaultColorTable320 = new ColorTable (0, 0x00);
private ColorTable defaultColorTable640 = new ColorTable (0, 0x80);
@ -114,8 +115,7 @@ public abstract class HiResImage extends AbstractFile
static PaletteFactory paletteFactory = new PaletteFactory ();
static final byte[] pngHeader =
{ (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
static final byte[] pngHeader = { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
static boolean colourQuirks;
static boolean monochrome;
@ -275,8 +275,8 @@ public abstract class HiResImage extends AbstractFile
{
String auxText = "";
StringBuilder text = new StringBuilder ();
text.append (String.format ("Image File : %s%nFile type : $%02X %s%n", name,
fileType, ProdosConstants.fileTypes[fileType]));
text.append (String.format ("Image File : %s%nFile type : $%02X %s%n", name, fileType,
ProdosConstants.fileTypes[fileType]));
switch (fileType)
{
@ -393,8 +393,7 @@ public abstract class HiResImage extends AbstractFile
{
if (dataBuffer.getSize () < rgbList.length + element)
{
System.out.printf ("Bollocks: %d %d %d%n", dataBuffer.getSize (), rgbList.length,
element);
System.out.printf ("Bollocks: %d %d %d%n", dataBuffer.getSize (), rgbList.length, element);
return element;
}
@ -463,13 +462,12 @@ public abstract class HiResImage extends AbstractFile
int type = (buffer[ptr] & 0xC0) >>> 6; // 0-3
int count = (buffer[ptr++] & 0x3F) + 1; // 1-64
text.append (String.format ("%04X/%04d: %02X (%d,%2d) ", ptr - 1, size,
buffer[ptr - 1], type, count));
text.append (String.format ("%04X/%04d: %02X (%d,%2d) ", ptr - 1, size, buffer[ptr - 1],
type, count));
if (type == 0)
{
text.append (
String.format ("%s%n", HexFormatter.getHexString (buffer, ptr, count)));
text.append (String.format ("%s%n", HexFormatter.getHexString (buffer, ptr, count)));
ptr += count;
size += count;
}
@ -653,8 +651,8 @@ public abstract class HiResImage extends AbstractFile
if (buffer.length < 4)
return false;
return buffer[0] == (byte) 0xC1 && buffer[1] == (byte) 0xD0
&& buffer[2] == (byte) 0xD0 && buffer[3] == 0;
return buffer[0] == (byte) 0xC1 && buffer[1] == (byte) 0xD0 && buffer[2] == (byte) 0xD0
&& buffer[3] == 0;
}
// ---------------------------------------------------------------------------------//

View File

@ -33,6 +33,7 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.SectorList;
import com.bytezone.diskbrowser.gui.FontAction.FontChangeEvent;
import com.bytezone.diskbrowser.gui.FontAction.FontChangeListener;
import com.bytezone.diskbrowser.wizardry.MazeLevel;
// -----------------------------------------------------------------------------------//
public class OutputPanel extends JTabbedPane
@ -86,8 +87,7 @@ public class OutputPanel extends JTabbedPane
formattedText.setText ("Please use the 'File->Set HOME folder...' command to "
+ "\ntell DiskBrowser where your Apple disks are located."
+ "\n\nTo see the contents of a disk in more detail, double-click"
+ "\nthe disk. You will then be able to select individual files to "
+ "view them.");
+ "\nthe disk. You will then be able to select individual files to " + "view them.");
hexText = new JTextArea (10, TEXT_WIDTH);
setPanel (hexText, "Hex dump");
@ -95,9 +95,8 @@ public class OutputPanel extends JTabbedPane
disassemblyText = new JTextArea (10, TEXT_WIDTH);
setPanel (disassemblyText, "Disassembly");
imagePane =
new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
imagePane = new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
imagePane.setBorder (null);
@ -272,9 +271,10 @@ public class OutputPanel extends JTabbedPane
AbstractFile.setDebug (value);
setText (formattedText, currentDataSource.getText ());
if (currentDataSource instanceof HiResImage
if (currentDataSource instanceof HiResImage //
|| currentDataSource instanceof MazeLevel // Wizardry
|| currentDataSource instanceof QuickDrawFont)
setDataSource (currentDataSource); // toggles text/image
setDataSource (currentDataSource); // toggles text/image
}
// ---------------------------------------------------------------------------------//
@ -493,8 +493,7 @@ public class OutputPanel extends JTabbedPane
public void setAssemblerPreferences (AssemblerPreferences assemblerPreferences)
// ---------------------------------------------------------------------------------//
{
if (currentDataSource instanceof AssemblerProgram
|| currentDataSource instanceof BootSector)
if (currentDataSource instanceof AssemblerProgram || currentDataSource instanceof BootSector)
setDataSource (currentDataSource);
}

View File

@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility;
// -----------------------------------------------------------------------------------//
class MazeLevel extends AbstractFile
public class MazeLevel extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private static final String[] squareType =
@ -34,7 +34,7 @@ class MazeLevel extends AbstractFile
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -421,42 +421,47 @@ class MazeLevel extends AbstractFile
int itemID = -1;
if (cell.messageType == 2 && items != null) // obtain Item
switch (cell.messageType)
{
itemID = messageAddress.level;
cell.itemObtained = items.get (itemID);
case 2: // obtain Item
if (items != null)
{
itemID = messageAddress.level;
cell.itemObtained = items.get (itemID);
}
break;
case 4:
itemID = messageAddress.level;
if (itemID <= 100)
{
cell.monsterID = itemID;
cell.monsters = monsters;
}
else
{
int val = (itemID - 64536) * -1;
// this gives Index error: 20410, Size 104 in Wizardry_III/legacy2.dsk
if (items != null && val < items.size ())
cell.itemObtained = items.get (val); // check this
if (cell.itemObtained == null)
System.out.printf ("Item %d (%d) not found on level %d%n", val, value, level);
}
break;
case 5: // requires Item
if (items != null)
{
itemID = messageAddress.level;
cell.itemRequired = items.get (itemID);
}
break;
}
if (cell.messageType == 5 && items != null) // requires Item
{
itemID = messageAddress.level;
cell.itemRequired = items.get (itemID);
}
if (cell.messageType == 4)
{
itemID = messageAddress.level;
if (value <= 100)
{
cell.monsterID = value;
cell.monsters = monsters;
}
else
{
int val = (value - 64536) * -1;
System.out.println ("Value : " + val);
// this gives Index error: 20410, Size 104 in Wizardry_III/legacy2.dsk
if (items != null && val < items.size ())
cell.itemObtained = items.get (val); // check this
if (cell.itemObtained == null)
System.out.printf ("Item %d not found%n", val);
}
}
break;
case 12: // encounter
MazeAddress monsterAddress = getAddress (b);
// cell.monsterID = HexFormatter.intValue (buffer[832 + b * 2], buffer[833 + b * 2]);
cell.monsterID = monsterAddress.column;
cell.monsters = monsters;
break;