SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (
-   SH4 Mods Workshop (
-   -   [REL] S3D - Silent 3ditor (

skwasjer 08-07-2007 08:45 PM

As promised, and prior to the upcoming release, I wrote up a brief explanation of the mechanism I coded into S3D for property data type detection. This is actually the primary reason why the application will still be alpha. I need help from the community to make the parser foolproof. As my modding skills are absolute zero, I can't guarantee detection is accurate, and this is where you (should) step in. Read up on this if you are interested.

Warning: skip if you don't have some technical background...

PS: this doc is focused on the next release, some things I discuss are not in the current public alpha...!!!

A word on automatic property data type detection
Auto detection of property data types is not foolproof. Remember this. There are even scenarios possible when (especially regarding string types, more on this later), where a property may be detected as one type today, and as another the next (because you changed it's value). This is why I recommend 'predefining' as much properties as possible (the ones you change!!!). I have not done this yet, because I'm not 100% sure about certain data types, because there's so many of them, and because I'm lazy ;) You can help out by providing feedback on each value that gives problems, so I can predefine more data types over time.

So how does it work:
  • First, S3D checks the xml config file with predefined data types. If a property is predefined, it is used, and autodetection is skipped. You'll see this in the editor by the label 'predefined'.
  • Next, S3D checks if the property is possibly a string. My criteria (although it is not perfect, but it's the best I can do for now, without affecting performance) is:
    • Every byte (except the last) must be greater than or equal to 32. If only one byte is less than 32 (non-printable control characters) then it is not considered a string. Silent Hunter uses the Windows-1252 encoding:
    • The last byte must be 0 (the null terminating character).
  • Next, S3D checks the data size of the property:
    • 1 byte = 'byte' type. This can also be a 'bool' type (true or false, 0 or 1) but in that case you have to predefine it.
    • 2 bytes = 'ushort' type. This can also be a 'short' but in that case you have to predefine it.
    • 4 bytes = 'float' type. This can also be an 'int' or 'uint' but in that case you have to predefine it.
    • 8 bytes = 'ulong' type (often they are id's). This can also be a 'long', 'double', or 'vector2' but in that case you have to predefine it.
    • 12 bytes = vector3.
  • If all else fails, S3D assumes the property is a collection. It could however also be an 'array', a 'stringCollection', or another available type. Sometimes, one of the above autodetection rules can even be incorrect (for example, 12 bytes could also be a stringCollection!!!). We can never know for sure using this technique. This is when a data type must explicitly be defined in the xml config file, to either overrule wrong detection or overrule the final default 'collection' type.
So why do strings in particular pose a problem? Well, say you have a string of arbitrary length. Say, you decide to clear the value to no string (empty). In the file structure, an empty string is written back as a single byte, the null terminating char, or '0'. Once the file is read again, and if the property is not predefined as a string, my auto detection rules will fail to identify it as a string again, it will in fact see it as a byte value this time (see the rules above again). There are more similar scenario's possible and should be avoided at all cost.

The biggest benefit of this mechanism is that S3D is able to open most files without problems, for reading even though not 100% accurate. I recommend that you never modify autodetected property values though, just because of the problems described above. Before modifying, analyse each property you want to change for it's datatype. Is it correct? What should it be if not? Next, ask me or try yourself to add definitions for them. Try to stay away from global definitions as much as possible, unless absolutely sure (they may cause other files to read incorrectly!). Once they work, change the values as per your wish, and feedback the definitions back to the community, and also me so I can include them in next updates. You are then helping out to improve S3D's property parser and editor. Over the months to come, the parser should rely less and less on autodetection, and only use definitions, resulting in less parse mistakes in the long run...

PS: a how-to on property data type definitions is described in the xml config file 'propertydefinitions.xml' in the installation folder.

Hope this clears up a few things. I guess it will raise questions too though, so ask away if you have any... :cool:

Bed time now.

Go4It 08-07-2007 09:22 PM

Here's another DL for MS Net 2.0 @ 22 mb stand alone, not a distribution pack but with the file one needs:

skwasjer 08-09-2007 07:57 PM

New version available... :)

New key features:
  • properties are editable.
  • all SH3/SH4 files tested using test scripts. No more parse errors on stock/patched files.
  • and many other improvements (see changelog)
As its still alpha, be carefull releasing mods for now! Also, tweak files (MiniTweaker) made for original game files are NOT compatible with files saved using S3D.

Please see my first post for more updated details, requirements, etc.

Let me know how it works!!! Have fun... :up:

Excerpt from updated first post:


Warning: Always uninstall previous versions using Control Panel. If for some reason installed files get mixed up, S3D can crash or worse, behave unexpectedly.

Current version is 0.2. Still alpha, but much more stable. If you don't like it to be alpha, go bughunting...

Click to download

Do NOT distribute the download through other sites. You can provide a direct link though.


View here or in the \Help folder of the installation dir.

Fearless 08-09-2007 08:59 PM

Awesome:up: All i got to do now is have the nerve to try it out :smug:

THE_MASK 08-09-2007 09:14 PM

The most awesome mod ever , thanks. I must be your control person because if i can use it then anyone can LOL .

Bando 08-10-2007 06:57 AM

Thanks a lot Skwasjer

WilhelmTell 08-10-2007 07:45 AM

Properties can be saved now! Yeeehaa! :rock:
Great job, skwasjer!


skwasjer 08-10-2007 08:21 AM


Hope it works ok... I don't test changed values myself :oops:. To be safe (for releasing a mod) you must test the files very strictly in the game, and you would best WinDiff source and target files too, or use a similar tool (

jaketoox 08-10-2007 03:24 PM

Works for me..changed something in my cameras.dat and it worked thing would be cool...if yor prog would make backup of the current file before modifying it..
It would help people like me to NOT SCREWING UP everythig when you forget to make backup of the file...not happened for me yet, but it is VERY possible...:oops:

anyway..nice program...:up:


__________________________________________________ _

When a girl is under 21, she's protected by law. When she's over 65, she's protected by nature. Anywhere in between, she's fair game. (Lt.Cmdr.Matt T. Sherman:Operation Petticoat)

Go4It 08-11-2007 02:07 AM

Will net 3.0 work???

If so: Microsoft .NET Framework Redistributable (NFR) 32 + 64 bit for Windows XP SP2/2003 SP1/Vista x64 (64-bit) [90.1 MB]. for Windows XP SP2/2003 SP1/Vista [50.3 MB].

skwasjer 08-11-2007 05:28 AM


Don_Vipre 08-11-2007 03:09 PM

Very nice TOOL!!!!!!!!!!!!!!!!:rock:


Digital_Trucker 08-11-2007 04:32 PM

Many thanks
muchos gracias, Viele Dank, merci beaucoup, molti ringraziamenti, Vele bedanken, muito obrigado, большое спасибо, mange takker, 本当にありがとう

for this wonderful tool! It just made child's play of combining three camera mods into one camera.dat (a feat I would not have even wanted to tackle without it).:up:

CaptainCox 08-12-2007 06:06 AM

Cheers for the update and all the hard work on this!.
Gonna check out the new features pronto.:yep:

ReallyDedPoet 08-12-2007 06:14 AM

Just saw the update for this, nice work on continuing to develop this :yep:


All times are GMT -5. The time now is 04:40 AM.

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