Thread: [TEC] In-game save date
View Single Post
Old 08-19-15, 03:01 PM   #11
areo16
Sonar Guy
 
Join Date: Oct 2013
Posts: 377
Downloads: 64
Uploads: 0
Default

Quote:
Originally Posted by ExFishermanBob View Post
The ISF file has a section starting with the submarine's type-name (e.g. SSTypeVIIB) and ending with the same.

So, it looks a bit like this (but bigger):

................
.............SST
ypeVIIB.........
................
....007400110004
00200043........
................
.....SSTypeVIIB.

extract_bytes() looks for the first occurrance of the type-name (SSTypeVIIB), and gets all the bytes following,

.........
................
....007400110004
00200043........
................
.....SSTypeVIIB.

then looks in what it has got and removes the second type-name (SSTypeVIIB), leaving a 'snip' of the required bytes.

.........
................
....007400110004
00200043........
................
.....

The year, month, date, hour and minute start at 461 bytes back from the end of the 'snip', so that bit is put into self.extract.

007400110004
00200043

extract_date_and_time() uses the values in self.extract and computes the integer values from the bytes using big-endian conversion.

To use it:-
Code:
isf = ISFFile()
isf.look_for = b"SSTypeVIIB"
isf.extract_bytes(r"some_file_path\some_filename.isf")
isf.extract_date_and_time()
isf.year, isf.month, isf.day, isf.hour and isf.minute then hold the values.

NOTES:
The look_for value must be bytes (note the leading b)
In Windows, you need to make sure the path is 'raw' or reverse the slashes because the career saves are stored in the subfolder '0', which, of course, with a slash becomes '\0', the 'NUL' character.


The code / algorithm should be easily convertable into your favourite programming language.

I thought career saves are put in the "CareerName"\"Patrol number minus 1" folder?
So the 0 sub folder is actually the 1st patrol of the career, 5 subfolder is 6 patrol, etc...

I'm excited about the script!
areo16 is offline   Reply With Quote