2016-08-08 04:53:29 +00:00
|
|
|
package com.bytezone.diskbrowser.wizardry;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2016-08-09 04:15:44 +00:00
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
import javax.swing.tree.DefaultTreeModel;
|
|
|
|
|
|
|
|
import com.bytezone.diskbrowser.applefile.Relocator;
|
2016-08-08 04:53:29 +00:00
|
|
|
import com.bytezone.diskbrowser.disk.AppleDisk;
|
|
|
|
import com.bytezone.diskbrowser.disk.Disk;
|
2016-08-09 04:15:44 +00:00
|
|
|
import com.bytezone.diskbrowser.pascal.FileEntry;
|
2016-08-08 04:53:29 +00:00
|
|
|
import com.bytezone.diskbrowser.pascal.PascalDisk;
|
|
|
|
import com.bytezone.diskbrowser.utilities.Utility;
|
|
|
|
|
|
|
|
public class Wizardry4BootDisk extends PascalDisk
|
|
|
|
{
|
|
|
|
List<AppleDisk> disks = new ArrayList<AppleDisk> ();
|
2016-08-09 04:15:44 +00:00
|
|
|
protected Disk[] dataDisks;
|
|
|
|
private Relocator relocator;
|
2016-08-08 04:53:29 +00:00
|
|
|
|
|
|
|
public Wizardry4BootDisk (AppleDisk[] dataDisks)
|
|
|
|
{
|
2016-08-09 04:15:44 +00:00
|
|
|
super (dataDisks[0]);
|
|
|
|
|
|
|
|
this.dataDisks = dataDisks;
|
|
|
|
|
|
|
|
DefaultTreeModel model = (DefaultTreeModel) catalogTree.getModel ();
|
|
|
|
DefaultMutableTreeNode currentRoot = (DefaultMutableTreeNode) model.getRoot ();
|
|
|
|
DefaultMutableTreeNode relocNode = findNode (currentRoot, "SYSTEM.RELOC");
|
|
|
|
FileEntry fileEntry = (FileEntry) relocNode.getUserObject ();
|
|
|
|
|
|
|
|
if (fileEntry != null)
|
|
|
|
{
|
|
|
|
relocator =
|
|
|
|
new Relocator (fileEntry.getUniqueName (), fileEntry.getDataSource ().buffer);
|
|
|
|
relocator.createNewBuffer (dataDisks);
|
|
|
|
fileEntry.setFile (relocator);
|
|
|
|
}
|
2016-08-08 04:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isWizardryIV (Disk disk, boolean debug)
|
|
|
|
{
|
|
|
|
byte[] header = { 0x00, (byte) 0xEA, (byte) 0xA9, 0x60, (byte) 0x8D, 0x01, 0x08 };
|
|
|
|
byte[] buffer = disk.readSector (0);
|
|
|
|
|
|
|
|
if (!Utility.matches (buffer, 0, header))
|
|
|
|
return false;
|
|
|
|
buffer = disk.readSector (1);
|
|
|
|
|
|
|
|
if (buffer[510] != 1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|