Skip to content

Instantly share code, notes, and snippets.

@badvision
Last active December 28, 2015 21:56
Show Gist options
  • Save badvision/46e1eb9255b8b196586d to your computer and use it in GitHub Desktop.
Save badvision/46e1eb9255b8b196586d to your computer and use it in GitHub Desktop.
import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk
import com.webcodepro.applecommander.storage.Disk
import com.webcodepro.applecommander.storage.physical.DosOrder
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout
import java.io.File
def baseDir="/Users/blurry/Downloads/ac33"
def outDir="/Users/blurry/Downloads/ac33_extracted"
def sourceFolder = baseDir as File
sourceFolder.eachFile{file ->
def disk = new Disk(file.path)
disk.formattedDisks[0].files.each{dosFile->
if (dosFile.filename == "HELLO") return
def data = dosFile.fileData
def offset = data[0] - 1
while (data[offset] == 0) {
offset++;
}
def newName = dosFile.filename.replaceAll("[^A-Z0-9]", ".") + ".bin#" + Integer.toHexString(0x0801 + offset)
def output = new FileOutputStream("${outDir}/${newName}")
output.write(data, offset, data.length-offset)
output.flush()
output.close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment