Fellow programmers: The first thing you need to keep in mind is that while the first QSRDSSPC.1 record starts in one of only a few standard places, and that the displacements between them are in 528-byte records, the displacements to the DIR and LNK structure, &c., are all in bytes, and they are all MODULO the 26 bytes of stuff at the ends of the records, and that you must assume that ANYTHING can span a record boundary. Therefore, before you can do anything else with an IFS save file, you absolutely MUST be able to both read, and calculate byte displacements, across any arbitrary number of record boundaries, skipping those bytes. Proceed no further until you can do that. As with any save file, the first step is to find the first QSRDSSPC.1 record, and the save type byte. 14 hex (20 decimal) indicates SAV. Get the record displacement to the next QSRDSSPC.1 record, and the byte displacement to the DIR structure. Set the root node of your tree to the directory name, then start picking your way through the LNK structures, adding child nodes to your root node as you go along. (Incidentally, the 6th displacement points to a structure that includes the object type.) Every time you hit a link that is a *DIR, don't just add it to the root node; save it someplace you can grab it by its pathname. (Why does corned beef suddenly come to mind?) Also, you should figure out some way to mark the node so that when your tree is rendered, it gets a "folder" icon, rather than a "file" icon, even if it's empty. When you've run out of LNK structures, jump to the next QSRDSSPC.1 record, and repeat the process, EXCEPT that instead of using the directory path given in the DIR structure to name a root node, you use it to retrieve the node for the corresponding *DIR. Just keep repeating the process until you run out of QSRDSSPC.1 records, and you'll have a tree representing the contents of your save file. That's the algorithm. Implementing it (like inventing the candy-gram) is the real bitch. -- James H. H. Lampert Professional Dilettante http://www.hb.quik.com/jamesl http://members.hostedscripts.com/antispam.html http://www.thehungersite.com Help America's Passenger Trains. http://www.saveamtrak.org Read My Lips: No More Atrocities!
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.