├── .gitignore ├── extract-adf.c ├── Makefile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | extract-adf 2 | -------------------------------------------------------------------------------- /extract-adf.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mist64/extract-adf/HEAD/extract-adf.c -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | cc -lz -o extract-adf extract-adf.c 3 | 4 | clean: 5 | rm extract-adf 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # extract-adf 2 | 3 | *extract-adf* is a tool that extracts files from (broken) Amiga _OFS_ ADF/ADZ/DMS disk images. 4 | 5 | It will create all files with the correct directory hierarchy and the correct timestamps on the local filesystem. 6 | 7 | It is specially optimized for broken filesystems, and can recover as much as possible even on those. One use case is to extract the [leftover files on the Kickstart 1.0 disk](http://www.pagetable.com/?p=34). 8 | 9 | ## Usage 10 | 11 | Extract-ADF 4.0 Originally (C)2008 Michael Steil with many further additions by Sigurbjorn B. Larusson 12 | DMS extraction code (C) 1998 David Tritscher 13 | 14 | Usage: ./extract-adf [-D] [-a] [-z] [-d] [-s ] [-e ] [-o ] 15 | 16 | -a will force ADF extraction (if the filename ends in adf ADF will be assumed 17 | -z will force ADZ extraction (if the filename ends in adz or adf.gz ADZ will be assumed 18 | -d will force DMS extraction (if the filename ends in dms DMS format will be assumed 19 | -D will activate debugging output which will print very detailed information about everything that is going on 20 | -s along with an integer argument from 0 to 1760 (DD) or 3520 (HD), will set the starting sector of the extraction process 21 | -e along with an integer argument from 0 to 1760 (DD) or 3520 (HD), will set the end sector of the extraction process 22 | -o along with an outputfilename will redirect output (including debugging output) to a file instead of to the screen 23 | Finally the last argument is the ADF/ADZ or DMS filename to process 24 | 25 | The defaults for start and end sector are 0 and 1760 respectively, this tool was originally 26 | created to salvage lost data from kickstart disks (which contain the kickstart on sectors 0..512) 27 | in order to skip the sectors on kickstart disks which might contain non OFS data, set the start sector to 513 28 | 29 | To use this tool on a HD floppy, the end sector needs to be 3520 30 | 31 | If you get a Bus error it means that you specificed a non-existing end sector 32 | 33 | This program does not support FFS floppies(!), it only supports OFS style Amiga Floppies 34 | 35 | Happy hunting! 36 | 37 | 38 | ## Authors 39 | 40 | * Michael Steil 41 | * Sigurbjorn B. Larusson 42 | 43 | ## History 44 | 45 | ### Version 1.0, 2008, Michael Steil 46 | 47 | Original version for extracting the leftover files on the Kickstart 1.0 disk. 48 | 49 | ### Version 2.0, 2011, Sigurbjorn B. Larusson 50 | 51 | * Hack to restore the file path and to pass the adf file and start sector/end sector used as an argument. This makes it possible to use on any OFS adf file and on HD OFS floppies and to tune where to start and end the process for any other purpose 52 | 53 | * Orphaned files still end up where ever you launched the binary, you'll have to manually move them into the structure if you know where the files should be located 54 | 55 | * Killed all output unless DEBUG is defined as 1 or higher, you can easily enable it (along with even more debugging output from all the stuff I added) by defining DEBUG as 1... 56 | 57 | ### Version 3.0, 2017, Sigurbjorn B. Larusson 58 | 59 | * Changed the default start sector to 0 60 | * Now uses getopt to retrieve command line options 61 | * Added a commandline option flag (-s) to specifiy a start sector, you can now place this in any order on the command line 62 | * Added a commandline option flag (-e) to specify an end sector, you can now place this in any order on the commandline 63 | * Added a commandline option flag (-d) to turn on debugging from the command line instead of having to recompile with the debug flag on 64 | * Added a commandline option flag (-o) to specify writing the output to a file instead of to stdout, this is usefull due to the amount of debugging that has been built into the program 65 | * Added quite a bit of additional debugging output, it now goes through significant detail for every sector it works on, this can help puzzle together the filesystem, I highly recommend writing to a file! 66 | * Significantly altered the progress of creating directories, it now creates orphaned directories at the CWD so that the directory tree present on disk is always restored as close to the original as possible 67 | * Significantly altered the progress of writing orphaned files 68 | * It now tries to extract the original filename as well as the parent filename before making up a filename 69 | * It also tries to place them in their respective directories 70 | * It now creates files when parsing the headers, so even files that have no recoverable data get created and you know where they would have been placed in the hierarchy 71 | * Added a much better ascii/hexdumper function which now dumps both ascii and hex, 20 characters per line (20 ascii characters + FF format for the hex codes) 72 | * Added many additional segmentation checks and cleaned up the memory allocation, it should be fairly rare for this utility to crash now, even with badly mangled filesystems 73 | 74 | ### Version 4.0, 2019 Sigurbjorn B. Larusson 75 | 76 | * Added support for compressed ADF files (gzip compressed) 77 | * Added support for DMS files 78 | * This uses a lot of code borrowed from undmz.c, (C) David Tritscher and available on Aminet http://aminet.net/package/misc/unix/undms-1.3.c 79 | * It also uses header information for DMS files from http://lclevy.free.fr/amiga/DMS.txt 80 | * Added support for ZIP files containing an ADF 81 | * Added commandline option to force treating file as a ADF file 82 | * Added commandline option to force treating file as a ADZ file (gzip compressed ADF) 83 | * Added commandline option to force treating file as a DMS file 84 | * Added function to automagically determine format from file extension 85 | * Added support for re-creating original file timestamps 86 | * Added support to detect endianness and checks to not convert msb to lsb if we're running on a big endian system, it should therefore now be possible to compile and use this on a big endian machine, if you try it, tell me about it 87 | * Fixed some minor bugs 88 | 89 | ## TODO 90 | * The source code could do with a cleanup and even a rewrite, I'll leave that for the next time I have time to work on it 91 | --------------------------------------------------------------------------------