SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SHIII Mods Workshop
Forget password? Reset here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 08-19-15, 02:11 PM   #10
ExFishermanBob
Difficulties Numbing
 
Join Date: Aug 2013
Location: AN19
Posts: 444
Downloads: 43
Uploads: 0


Default

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 numbered subfolders: '0', which, of course, with a slash becomes '\0', the 'NUL' character, and '9' which is a tab might cause problems.


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

Last edited by ExFishermanBob; 08-21-15 at 09:55 AM. Reason: Notes added
ExFishermanBob is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 1995- 2026 Subsim®
"Subsim" is a registered trademark, all rights reserved.