tcopy v1 by RAF_Roy 4/21/2008

Not really a 'copy' program , as it remakes your tardata and targets.dat

primary use;
The program effectively shrinks your tardata.dat if possible.
Reorders the tardata records.

It makes a new tardata.dat and targets.dat from the old.
The originals will be untouched.


**************************  Use: *******************************************************
1. ----> prior to running the program 
-> Place your targets.dat and tardata.dat in this program's folder.

The program just runs and does the work immediately, there are no options, you wait and it signals when done.


2. End product:

A new folder named "newdats" will be created in this folder (if it does not exist) when the program runs.
The "newtargets.dat" and "newtardata.dat" it makes will be placed in that folder.

(Note; You must use both files; the old targets.dat records will not match this newtardata.dat since the "pointer bytes" are rewritten)

simply rename them to use in EAW.

That's it!

**************************************

*************************************
 Notes;

---> Don't throw out your old files! <---

--> This program does no error checking at all. <----

It seems to have no problems AFAIK

But how it works you should be aware:

The program reads the targets.dat in sequence from the first record to the last.

In each of these targets.dat records, it reads the "pointer bytes" to the tardata record (bytes 20-21 of 0-31), and also the "tmods number record byte" (byte 19 of 0-31) for the number of record lines (i.e target objects) supposed to be present in the tardata.

Then, solely based on that "tmods number record byte" and the "pointer bytes" it goes to the address in tardata and copies the number of lines supposed to be there to the new tardata.

((If the "tmods number record byte" or the "pointer bytes" in the original is wrong you will get errors - as there is no error checking at all.
If there was error you could find both the new .dats would be unuseable))


In any case.. in sequence it writes the new tardata data

How the shrinking works is for any record that the "tmods number record byte" is 0, it only reads the first line of that record from the tardata and writes a single 32 byte record 
(for safety and convenience, it may be that actually no record would be needed by EAW but no reason to get experimental now!)
But keeps the "tmods number record byte" = 0

((So of course if you have used the conventional EAW editing methods of moving records to the bottom of tardata or have many "zeroed" (0) "tmods number record byte" your new tardata will be much smaller ..in example; my OAW Mission 1 can be shrunk from > 122kb to 31kb !))

-> the program writes the new "pointer bytes" to the new targets.dat records, writes the new tardata with the correct header byte for the new records, and writes the new files.

******************************************
other note:
For files that do not have many zeroed bytes or default EAW you will not really save space, but you will get a reordered tardata anyway, if that is useful for you. 
******************



-S!
RAF_Roy
4/21/2008



































