SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH4 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=219)
-   -   Hex editing & Mini Tweaker tutorials (https://www.subsim.com/radioroom/showthread.php?t=124338)

swdw 10-31-07 09:48 AM

Hex editing & Mini Tweaker tutorials
 
Will Break these up because of the character per post limit:

Note: When Silent 3ditor is farther along, hopefully hex editing will be a thing of the past.

Below is a collection of mini tweaker and hex editing tutorials.

You can also download a copy of this file for offline reference from
Hex_editing_Mini_Tweaker_s.pdf

Lets start with hex editing first. It will make the Mini Tweaker tutorials make more sense.

----------------------------------Hex Editing---------------------------------------

HEX EDITING TUTORIAL - By DI at http://www.campaigncreations.org/development/hex.shtml

Before I begin, I'm going to have to ask you to bare with me, because not only is this subject somewhat complicated if you've never done anything like it before, but I am not extremely experienced in it myself. I am also going to skip over some of the subjects which are important to know about if you are planning to do new "research" into files, but will probably not need to know if you are just using other peoples' research to implement changes. In short, this tutorial will just teach you how to read and edit a file that someone else has already dechipered. It will not really help you decipher new files yourself. With that said, let's begin to hex edit. =)

Introduction to Hexadecimal

Hex is short for hexadecimal, which just means a number system which uses base-16 digits. The number system we normally use is called the decimal system, which uses base-10 digits. In other words, in the "normal" decimal system, there are ten different "symbols" that each digit can have: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Since the hexadecimal system is base-16, it has 6 more symbols for digits than the decimal system. In particular, it uses the decimal 0-9 and also A, B, C, D, E, and F to represent decimal equivalents of 10, 11, 12, 13, 14, and 15.

In the decimal system, each digit "place-holder" can only go from 0 to 9. So, the decimal number "ten" must have two place holders: a 1 in the tens-place and a 0 in the ones-place (10). The tens-place is followed by the hundreds-place, then the thouands-place, then the ten thousands-place, etc. And because it is a base-10 number system, each place can be represented by a power of 10. For example: (the carrot ^ symbol means "to the power of" -- in other words, it denotes an exponent)

1 = 10^0 or 1
10 = 10^1 or 10
100 = 10^2 or 10*10
1000 = 10^3 or 10*10*10
10000 = 10^4 or 10*10*10*10

In the hexadecimal system, each digit place-holder can go from 0-F. Unlike the decimal number "ten," the hexidecimal number ten only needs one place-holder because it is already represented just by the symbol "A." Because there are sixteen different symbols each digit can take, the hexidecimal ones-place can actually hold all the numbers from zero to fifteen:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

That means that the next place-holder is not the "tens-place" as it is in the decimal system, but the "sixteens-place." However, it looks exactly the same as the ten in the decimal system. "10" in hexadecimal translates to 16 in decimal. Get it? Since the ones-place goes from zero to fifteen, we don't move a place over until the number sixteen. Really, 10 in hex means one "sixteen" and zero "ones" since there is a one in the "sixteens"-place and a zero in the ones place. Correspondingly, there is no "hundreds"-place or "thousands"-place in hexadecimal because those places only exist in the decimal system because they are powers of the number ten. In hexadecimal each place-holder is a power of sixteen, and thus the sixteens-place is followed by the "two hundred-fifty sixes"-place and then the "four thousand-ninety sixes"-place and then the "sixty five thousand-five hundred-thirty sixes"-place, etc. Like how the places in the decimal system are represented by powers of ten, each place in the hexadecimal system is a power of sixteen. For example:

1 = 16^0 or 1 in decimal
10 = 16^1 or 16 in decimal
100 = 16^2 or 16*16 = 256 in decimal
1000 = 16^3 or 16*16*16 = 4096 in decimal
10000 = 16^4 or 16*16*16*16 = 65536 in decimal

Still a little confused? Well, read it over again and see if these examples help: (hex is used to abbreviate hexadecimal and dec is used to abbreviate decimal)

1 in dec = 1 in hex
10 in dec = A in hex
100 in dec = 64 in hex
1000 in dec = 3E8 in hex

Now, take that last example and see if you can figure out why 3E8 in hex is equal to 1000 in decimal. Figure it out? O.K., let's compute this. First, there is a 3 in the "two hundred-fifty sixes"-place, right? In decimal, if you have 3 in the hundreds place, that means you have 3 hundreds, right? So, in hexadecimal, a 3 in the two hundred-fifty sixes"-place means there are 3 two hundred-fifty sixes -- in other words:

3*256 or 768 (for the decimal equivalent)

Now that takes care of the "two hundred-fifty sixs"-place. Now, the next place-holder, the "sixteens"-place has a E in it. Now what is E?... Well, if you forgot already, E in hexadecimal means fourteen. So, that means there are fourteen sixteens or:

14*16 or 224 (for the decimal equivalent)

Now, finally for the ones-place. In the ones place there is a 8, which means...? Don't think too hard. 8 just means eight. =)

8*1 or 8 (for the decimal equivalent)

Finally, we add all those decimal equivalents up and we get... 768+224+8 = 1000, which is what we expected in the beginning.

Now, what about converting a decimal number into hex? Well, the process is the same, just in reverse. For example, 289 in decimal is equal to 121 in hexadecimal. Let's test it.

We start by finding the largest power of sixteen that will go into our decimal number, 289. Well, 289 is between 16^2 or 256 and 16^3 or 4096, so 256 is the largest power of 16 that will go into 289. Then, we find how many 256's go into 289. In this case there is only one. So, what do we know now? Well, in the hexadecimal number we are looking for, there is a 1 in the "two hundred-fifty sixes place" because there is only one "two hundred-fifty six" in that number (just as in the decimal 100, there is only one hundred; decimal 200, two hundreds; decimal 756, seven hundreds; etc.).

Now that we have taken care of the "two hundred-fifty sixes"-place we can go ahead and subtract that one 256 from our original number.

289 - 256 = 33

The next hex place we have to fill in is the sixteens-place. How many sixteens are in 33? Take a wild guess: two. =) So, we put a 2 in the sixteens-place and subtract those two sixteens.

33 - 16*2 = 1

Finally, we have to fill in the ones place. So, how many ones go into 1? =) ... Now we subtract that 1:

1 - 1 = 0

And we know we're done because we have zero left. Now, its just a matter of putting that hex number together. Let's see, we have:

1 two hundred-fifty six or 100 in hex
2 sixteens or 20 in hex
1 one or 1 in hex

Adding those together, we get 121. A 1 in the "two hundred-fifty sixes"-place, a 2 in the sixteens-place, and a 1 in the ones-place, as we expected. Note that adding those numbers in hex works just the same way as it does in decimal. In fact, all hex adding works like that. But remember, if you have 9+1 in hex, you get the single digit A and thus you do not carry over a place (because you don't have a second digit to carry over). You only carry over a place when you have something like F+1 because that cannot be expressed by a single hex digit (sixteen in hex is 10). In decimal you carry over every ten because the system is base-ten. In hexidecimal you carry over every sixteen because the system is base-sixteen.

So now, hopefully you understand the basics of the hexadecimal system. Now, the trouble is, you also have to think like the hexadecimal system. In other words 5+5 doesn't equal 10, it equals A, and 4*4 doesn't equal 16, it equals 10. B+A+D doesn't mean BAD, it equals 22. =) While you probably will use a "hexadecimal calculator" most of the time to compute values and switch them between decimal and hexadecimal, it is still important to be able to do these basic calculations either in your head or at least on a sheet of paper so that you don't forget what it all means (and so you understand it when people talk like that =).

Here are some practice excercises. Do them without the aid of a hex calculator, otherwise you're wasting your time. You may use a regular decimal calculator, but try to compute as much as you can in your head, and for the third section, see if you can do the computation "in hex"; in other words, don't convert the numbers to decimal, then compute, then convert back -- see if you can do it all in one step:

Convert the following hex values into dec:

1) 64
2) 16D
3) 7CF
4) F4240
5) 75BCD15

Convert the following dec values into hex:

6) 22
7) 209
8) 2748
9) 52685

Compute the following hex values: (all numbers in hex)

10) 6 + A =
11) 78 + AB =
12) 10 * 10 =
13) 10 * F =
14) 100 / 10 =
15) F5000 / F5 =
16) (6 + A) * (1000 / 10) * (115 - 20) =

Yes, its all very tedious business, but that's what hex editing is all about. =)

Answers: 1) 100; 2) 365; 3) 1999; 4) 1000000; 5) 123456789; 6) 16; 7) D1; 8) ABC; 9) CDCD; 10) 10; 11) 123; 12) 100; 13) F0; 14) 10; 15) 1000; 16) F5000.

swdw 10-31-07 09:49 AM

HEX EDITING TUTORIAL - PART II By DI at http://www.campaigncreations.org/development/hex.shtml

Well, now you know how to add, subtract, multiply, divide, convert, and generally deal with hexadecimal numbers, right? No?... Well, if you are still not totally clear about the hex number system or just can't seem to do calculations in hex, that's O.K. That's not good, but you can still probably manage. I do suggest that you try to understand it though, as it makes everything else tremendously simpler. Anyway, you'll be happy to hear that Part I is probably the most difficult part of the tutorial, and if you can understand the concept of hex reasonably well, the rest will be a snap. Nevertheless, right now I do suggest you also enlist the aid of a calculator that can convert numbers between hex and dec since you will not be able to compute the bigger values in your head even if you're good. [Windows 95 comes with such a calculator program; you can find it in the Programs/Accessories section of your Start menu. Just input a number and click the radio buttons to switch it between formats -- you can even to calculations in hex =]

Terminology

This section will deal primarily with the words people use when they talk about hex editing, like "byte" or "offset." All of it is really just fancy programming jargon that defines very simple things. And all you have to do is remember a few definitions, use the words a little bit yourself, and you'll be understanding everything in a jiffy.

When you open a file in a hex editor, you are likely to see something like this:

0000 2353 ABC3 0000 9000 B122 000A
ABC3 0000 9000 B122 000A 2353 ABC3
0000 2353 ABC3 0000 9000 B122 000A
9000 B122 000A 2353 ABC3 0000 2353
etc...

And then you're likely to think, "WTF?" Well, its not all that confusing as it seems. If you'll notice, the "blob" above is nothing more than a lot of numbers in hexadecimal. That's how "data" is stored in files (or at least how you see the data in a hex editor). Now, let's break it up and define the parts:

Byte - this is the basic unit in hex editing. It simply refers to a hex number which has two places like 23, B1, 0A, and 00. You know when they say some thing is 100 kilobytes or something like that? All that means is 100 thousand (kilo- means thousand) of these little two digit numbers. Thankfully, you probably will never have to deal with something that big, but even if you do, there are easy and fast ways to find the bytes you are looking for. A byte can hold any value from 00 to FF, or 0 to 255 in decimal.

Integer / Word / Short Integer (Short) - these three words all refer to the same thing: 2 bytes, or a hex number with four places. For example, 2353, 000A, B122, and 0000, are all integers. Usually people use the term "short," though don't expect it to be universal. A short can hold any value from 0000 to FFFF, or 0 to 65535 in decimal.

Long Integer (Long) / Dword / Double Word - Again, multiple words defining the same thing: four bytes, or a hex number with eight places. For example, 2353000A, 00009000, ABC30000, and 9000B122 are "long"s (which is the preferred abbreviation). A long can hold any value from 00000000 to FFFFFFFF, or 0 to 4294967296 in decimal.

Those three "variable" types are basically all you need to know about. Now, here's where the stuff from previous section of this tutorial comes in. While the data appears in hex form, values are still normally used in decimal (normal) form. For example, if a game looks at a certain byte to determine, say, how much damage a unit will do, and it finds 0A, you will still probably see the decimal number "10" in the game. Thus, when looking at and editing a file, you are usually instructed to edit a certain byte, short, or long in terms of a decimal value, not in a hexadecimal one. For example, if someone tells you to change the value of a certain byte to 12, they probably mean put a 0C there, not a literal 12 unless specifically stated. Thus you need to know how to switch between decimal and hexadecimal, or at least have a calculator handy to do that for you.

I'm going to digress for a moment to point out a very important fact. Most files you will edit have their data stored in a notation called Little Endian or Intel Notation. This means that the "numbers" are not really in order as you would think they are. In fact, each value is actually stored backwards in terms of their bytes. I.E., the value for a long (four bytes) is actually read with the last byte first, then the third byte, then the second byte, then the first byte. For example, the short:

10 00

does not store the value of 4096 as you might think. You first have to reverse the order of the bytes to get the actual hex number:

00 10

So actually, that short stores the value 16. Note that each byte "pair" of hex digits don't change; in other words, you don't reverse the order of all the digits, you only reverse the order of the bytes, while keeping the individual two-digit numbers the same. Let's do another example just so you're clear:

0000 2353

is read as:

53 23 00 00

That's 1394802688 in decimal if you're keeping track. =)

O.K., now you should be able to read values from a hex editor pretty well. I suggest you pick a few blocks at random from that big blob of numbers above and try to figure out their values (or just do the exercises at the end of this lesson). Here's some more hex terms you should know:

Offset - this just refers to the location of a byte in a file. In other words, it refers to the number of a byte. It is important to note that hex editors will start numbering bytes from 0, not 1, so the first byte would be at offset 0. For example, if I told you to go to offset 101 in a file, I mean go to the 100th byte (assuming my 101 is in decimal). Let's do an example. Assume this is a file:

2353 ABC3 0000 9000 B122 000A

Offset 6 (decimal) in this file is where?...

2353 ABC3 0000 9000 B122 000A
0 1 2 3 4 5 6 7 8 9 10 etc.

Get it? File offsets are sometimes given in hexadecimal. For example, you may be told to go to offset 2ACD, which means go to the 10958th byte (2ACD hex = 10957 dec, but we add 1 to find the actual byte number because numbering starts at 0). If a offset number is given to you with a 0x prepended to it (i.e., 0x2ACD), you know its in hex. Of course, if it has letters in it, it must be in hex. =) Hex offsets are often given with a couple of zeros (00) prepended to the number just so all of them line up (i.e., 0012, 0123, 0001, etc.). These are normal hex numbers (in other words, you don't have to switch the order of the bytes and the zeros in front don't mean anything). You should be comfortable working with offsets in decimal or hexadecimal, and a good hex editor will display and allow you to search for offsets in both.

Signed and Unsigned - Sometimes you will come across things like a "signed long" or an "unsigned short." A "signed" variable means it can hold both positive and negative values (i.e., it can have a + or - sign). "Unsigned" means it can only hold positive values. I am going to omit the method of calculating the value of a signed variable because it is a little complicated and will take quite a bit of back tracking. Most variables you encounter (in data files) will be unsigned so it will not matter. Just understand what the terms mean.

ASCII - This refers to your standard set of "characters." This includes all the letters a-b, A-B, numbers 0-9, and other miscellaneous symbols like !, @, #, ", etc. Each character or ASCII symbol is represented by one byte. For example, the byte 31 refers to the character 1. A hex editor will usually display the ASCII equivalent of the hex you are looking at off to the side, because sometimes the data is just plain text (as in a text file =). A lot of byte values don't correspond to any ASCII character, however, which is why you're likely to see lots of "period" . characters where there is just raw data.

String - A string is just a series of ASCII characters. "dog" is a string, and so is "you suck ****". =)

Tag - This is usually a string in a file that denotes the start of a section. For example, the string tag STR (in ASCII) in a chk file (uncompressed SCM/SCX) denotes the start of where the map's text (or strings) are stored. A hex editor will allow you to search for these tags in the ASCII of a file so you can easily find where certain parts of a file begin (assuming that the file has tags in it of course). Remember that the tag does not actually contain the actual data, it just shows where the data starts. And remember that the tag is not part of the data -- so you would not edit any of the bytes which make up the tag itself, only the bytes which follow after the tag. For example:

FF53 5452 20A5 8200

The tag STR corresponds to the red bytes. So the data does not actually start until the 20 byte.

Excercises:

Name the variable: (byte, short, or long)

1) 0395 9275
2) 01
3) AB90

Calculate the decimal value: (all hex in Intel notation)

4) 0010
5) E803
6) C78A A900

Take the following hex file: (Intel notation)

0000 0000 9475 ABCD 0123 4444 0010 1000 8800

7) What hex value does the byte at offset 9 (dec) hold?
8) How many offsets are there in this file? (00 counts as one)
9) There is an unsigned short that begins at offet 0C (hex). What is its decimal value?
10) There is a three character (ASCII) tag that begins at offset 04 (hex). What is the hex value of the next byte (directly following the tag)?
11) There is an unsigned long that begins at offset 07 (hex). Change the value of that long to 16 (dec). Overwrite the current value and write out the entire modified file.

Answers: 1) long; 2) byte; 3) short; 4) 4096; 5) 1000; 6) 11111111; 7) 23; 8) 18 dec or 12 hex; 9) 4096; 10) CD; 11) 0000 0000 9475 AB10 0000 0044 0010 1000 8800

O.K. Now, you should already know the basics of hex editing. The first thing you should do now is get yourself a hex editor.



. . . . . . . . . . . . . . . . . . . . . . . . . additional tutorials. . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . .

In addition, here are links to a couple other hex editing tutorials:
http://www.flexhex.com/docs/howtos/hex-editing.phtml

http://www.tamriel-rebuilt.org/?p=mo...tuts/dblad/hex


On to mini tweaker

swdw 10-31-07 09:49 AM

---------------------- MINI-TWEAKER INSTRUCTIONS:----------------------------------

Mini Tweaker tips by U-Bones


As usual, back up any file you plan to change before doing this (Although the Mini Tweaker will create a backup for you anyway).

Assume an install of the Mini-Tweaker in
C:\Program Files\SH3 Mini Tweaker\
With your Tweak Files located in
C:\Program Files\SH3 Mini Tweaker\Tweakfiles

Here is the most important thing to know to get started with the program.

The "File You Want To Tweak" is determined by two things.

1. The game folder.
If you have installed SH III, the game folder is read directly from your computers registry. This is the directory that contains the Data folder, C:\SH3 on my computer.

If you do not have SH III installed, the application will ask you to select an alternate game folder.

In either case, you can reset the game folder once in the program.
2. The relative path to the "File You Want To Tweak".
This is set by a parameter in the tweak file you load. For example my tweak file NSS_Gato.zon.txt contains the line:
PATH=..\SH4\MODS\My_Uber_Subs\Data\Submarine\NSS_G ato\NSS_G ato.zon
.................................................. ..........................................^ no idea why this space is here
Notice how I first back up to the root from my default game folder of C:\SH3, then change up into C:\SH4\... this means I never have to change the game folder in the tweak program. I had to edit all my tweak files to do this however. If you would rather not do that, then you can simply reset the game folder every time you use it.

Also notice that I went into the \SH4\MODS\ directory to modify files - it is not a good idea to edit in the live Data\* area.

The game folder should be set to a folder that contains a Data folder, the tweak file PATH should take care of the rest of the path (relative to the game folder).

Hope this helps, I have seen a lot of confusion on this topic lately.
1.Download and install Mini-Tweaker by:
1A. Download nvdrifter's collection of modding tools as modtools.rar from here:
http://www.savefile.com/files/684634

and unzip modtools.rar,
then unzip SH4_Modding_Tools_and_Utie.zip
To point mini tweaker to a specific folder by U-Bones
Consider this registry export file...


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Ubisoft\Silent Hunter III]
"InstalledPath"="C:\\SH3\\"

This is what Mini Tweaker reads from the registry. You could hack this back and forth with regedit if you ran mini-tweaker from a script. I never bothered with it myself as I tended to work all over the place anyway. For those of you who do not have SH3 on your disk, just set it to your SH4 path permanantly.

-------------------------------------------------------------------------------------------------------

Getting started with Mini Tweaker by Steppenwolf:

Not quite a tutorial, but it should get anyone started.

MINI-TWEAKER INSTRUCTIONS:
As usual, back up any file you plan to change before doing this (Although the Mini Tweaker will create a backup for you anyway).

1. Download and install Mini-Tweaker by:
1A. Download nvdrifter's collection of modding tools as modtools.rar from here:
http://www.savefile.com/files/684634

and unzip modtools.rar,
then unzip SH4_Modding_Tools_and_Utie.zip

1B. Unzip SH3MiniTweaker_build104.zip
1C. Run setup.exe
NOTE: The default installation folder is \SH3 Mini Tweaker, but you can install it wherever you want. We will assume you leave it as \SH3 Mini Tweaker.
1D. Create a subfolder under the \Sh3 Mini Tweaker folder called \SH4Tweakfiles.
1E. (OPTIONAL) If you are going to be using Mini Tweaker on an SH3 installation as well as an SH4 installation, create another subfolder under the \SH3 Mini Tweaker folder called \SH3Tweakfiles.

2. Install the SH4 Tweak files by:
(NOTE: These Step 2 instructions are a little complicated because not all of the zipped tweak files use the same directory structure. But its easier to sort them out now, rather than deal with the additional time it takes to change directories, every time you run Mini-Tweaker and load a tweak file later).
2A. Unzip "SH4 Aircraft .zon and .sim Tweak Files.zip" to a temporary directory (we'll assume you call it \SH4temp).
Copy all of the files in the \SH4temp\SH4 Aircraft .zon and .sim Tweak files folder to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2B. Unzip "SH4 Sub .sim and .zon Tweak files.zip" to \SH4temp.
Copy all of the files in the \SH4temp\SH4 Sub .sim and .zon Tweak files folder to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2C. Unzip "AI Sensors.dat Tweak File.zip" to \SH4temp.
Copy all of the files in the \SH4temp\AI Sensors.dat Tweak File folder to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2D. Unzip "scene.dat_Tweak_File.zip" to \SH4temp.
Copy all of the files in the \SH4temp\scene.dat Tweak File folder to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2E. Unzip "SH4_Ship.sim_Tweak_Files.zip" to \SH4temp.
Copy all of the files in the \SH4temp\SH4 Ship.sim Tweak files\SH4 Ship.sim Tweak files folder (Yes there are two identically named folders) to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2F. Unzip "Sub Gun .sim Tweak Files.zip" to \SH4temp.
Copy all of the files in the \SH4temp\Sub Gun .sim Tweak Files\Sub Gun .sim Tweak Files folder (Yes, again there are two identically named folders) to the \SH3 Mini Tweaker\SH4Tweakfiles folder.
2G. (OPTIONAL) If you are going to be using Mini-Tweaker on an SH3 installation as well as an SH4 installation, download the SH3 tweak files (in a file called tweakfiles.zip) from:
http://www.delraydepot.com/tt/sh3sdk.htm#tweaker
Then unzip tweakfiles.zip into the \SH3 Mini Tweaker\SH3Tweakfiles folder.


3. Run Sh3 Mini Tweaker
NOTE: If you do not have SH3 installed on your system you will get a pop-up saying, "Unable to find SH3 registry key. Manually choose this or another game folder path". Just ignore it and click OK.

4. Pick the SH4 installation you want to make changes in by:
4A. In the upper right corner of the screen where it says, "Locate alternate game folder", click the "..." button. Browse to the \Silent Hunter Wolves of the Pacific folder of the installation you want to make changes in and select it.
NOTE FOR SH3: If making changes to an SH3 installation, you would instead browse to the \SilentHunterIII folder of the installation you want to make changes in and select it.

5. Pick the file you want to change by:
5A. Click on the "Load Tweak File" button at the top middle of the screen. This brings up the "Select Tweak file" screen. Browse to your \SH3 Mini Tweaker\SH4Tweakfiles folder.
NOTE FOR SH3: If making changes to an SH3 installation, browse to your \SH3 Mini Tweaker\SH3Tweakfiles folder instead. The rest of the instructions below apply equally whether you are editing an SH3 or SH4 installation. Just susbstitute SH3 for SH4 in the descriptions.

5B. All of the SH4 files are shown here in one directory. You don't have to browse down through subdirectories. Just choose the one you want.
TECHNICAL NOTE: You will note that the files all have a .txt extension tacked onto them. This is because technically these are the "tweak" files (files used to map Mini Tweaker to the real files), but pick them just as if they were the real files.
SECOND NOTE: Many, but not all, SH4 files are listed here. To change a file not listed here you would have to create your own tweak file, which is a whole other subject.

6. Pick the Category and field you wish to change within the file by:
6A. From the drop down list at the upper left, pick a category. These change from file to file.
EXAMPLE: If you were changing the Deck_Gun_3_50.sim file, the categories shown are "Shell storage amounts", "shell specs" and "gun barrel movement and recoil". To edit the reload time pick "shell specs" from the menu.
6B. The "Names and Values" box will now show a list of all of the fields within that category you can change. Click on the one you want.
EXAMPLE: Under "shell specs" you will see seven fields, Shell Speed, Clip Size, Reload Time, Maximum Range, Angle, Travel tolerance, Elevation Tolerance. Click on the Reload Time field (This field influences, obviously, the amount of time to reload).
6C. Enter the new value you want for that field in the "New Value" box on the middle right of the screen. Click on the "Save new value" box.
EXAMPLE: Enter 6 into the box and click "Save new value" (This would increase the reload time).
6D. Exit Mini Tweaker

7. The Mini Tweaker created a backup copy of the file you just changed, in the same directory as the original file. The name is the usual "Copy of ...." name. You should move this to some other directory (otherwise the game sometimes gets confused and still uses this copy with the old values in it).

You're done. Test your change.

NOTE: Various modders periodically issue additional tweak files. Use the search function to find them.

Just follow the same procedure you did in Step2 above, to unpack and use them. Make sure that the ".txt" files go directly into the \SH3 Mini Tweaker\SH4Tweakfiles folder, or each time you click "Load tweak file" you'll have to change the directory to wherever you put them.

Here is a link to a thread for the shells.zon file:
http://www.subsim.com/radioroom/show...ells.zon+tweak

There is currently no link for the additional Torpedoes_US.zon file, so I have put the contents into the thread listed below, so you can cut and paste the contents into your own text file.
http://www.subsim.com/radioroom/show...d=1#post534957

------------------------------------------------------------------------------------------------------------------------

Creating Tweaker files by CAPTAIN COX

1.You need a hexeditor to look at the stuff
2.Windows/XP/VISTA Notepad
3.You need a lot of patience and coffee!

There is a small tut in the top of the tweak files from timetraveller.
Quote:
Examples of search lines, used when searching for a variable:
// search,WindCoef,4,single,>2,Wind Coefficient
// Description: Look for 4th occurrence of the term WindCoef.
// The floating point single variable starts at 2 bytes past the end of the
// search term. Name the list item Wind Coefficient.
// search,WindCoef,2,single,+9,Wind Coefficient
// Description: Look for 2nd occurrence of the term WindCoef.
// The floating point single variable starts at 9 bytes past the first byte
// of the search term (the same as using >2 above).
// Name the list item Wind Coefficient.
// search,WindCoef,1,single,-4,Wind Coefficient
// Description: Look for 1st occurrence of the term WindCoef.
// The floating point single variable starts at 4 bytes before the first byte
// of the search term. Name the list item Wind Coefficient.


Lets say i want to tweak the crash depth of a sub.

Where could this data be?, this is where you have to use a bit of imagination and logic (logic sometimes don't work, but its good to have)

It should be something with subs so lets look in the sub files for it.
C:\Program Files\Ubisoft\Silent Hunter 4 Wolves of the Pacific\Data\Submarine\NSS_Gato

Ok there are a lot of stuff there, but normally it should be in the .sim .dat .zon etc, we have to look plain and simple (here also the tweak files already made by various ppl will give you clues as to where these are)

Lets check the NSS_Gato.zon using a hex editor. I am using the search function in the hexeditor and do a search for "crash"

http://img185.imageshack.us/img185/2347/crashqb7.jpg

WOW! we found it directly

Ok what does this tell us

http://img295.imageshack.us/img295/5...shdepthgg4.jpg

Well it tells us that we a have a "SINGLE FLOAT VALUE of 190 AT THE 2ND BYTE PAST!!!! the SEARCH TERM, in this case "CrashDepth" ( I think the high value here is due to a mod I am using, no matter)

Ok so how does one put this info in to a tweak file.


1. You have to specify the version of the game
In this case 1.2
Quote:
Version=1.2

2. You have to specify the "PATH" in the document
in this Case it would be
Quote:
Path=data\Submarine\NSS_Gato\NSS_Gato.zon
If you check existing tweak files you will see similar paths (just for reference) this path tells the MiniTweaker what .dat .sim etc etc to modify. In this case "Gato.zon"

3. We have to specify in the tweak file what line of code we want to change (elementary) So we wanted to change the "Crush Depth".
So lets start.

3.1 We will have to put in a drop down name, this is the name of the group or part that will appear when we start the Minitweaker, this can contain as many groups as you like but as we only have one "Crush depth" we will settle with that for now.


So in this case we put
Quote:
[1]
DropDownName=CRASH DEPTH
The [1] is the 1st group, again elementary.

3.2 Lets put in the search string to get the " Crash depth"
Quote:
search,CrashDepth,1,single,>2,CRASH DEAPTH
Now what is all this. Well again pretty elementary if you start to understand each element. Lets look at each one.
Quote:
search
tells the code to search for xxxx
Quote:
CrashDepth
Specifying the search to CrashDeapth
Quote:
1
This means the FIRST instance of the search word in the file
If there are more instances we make another search line and put 2 in that case etc etc
Quote:
single
floating point single variable ( if its a byte or a integer we put that, this you can see in the hexeditor, this is also where the imagination bit comes in to play. Sometimes you have to really strain your eyes to find the right one, trial and error is sometimes needed )
Quote:
>2
Past 2 bytes past the end of the search word
Quote:
CRASH DEAPTH
This will be shown in the minitweaker as an identifier as to what we are tweaking

So the code looks like this (including all of above)
Quote:
Version=1.2
Path=data\Submarine\NSS_Gato\NSS_Gato.zon
[1]
DropDownName=CRASH DEAPTH
search,CrashDepth,1,single,>2,CRASH DEAPTH


Ok lets save this and check it out. (save as "NSS_Gato_zon.txt")

http://img177.imageshack.us/img177/5171/tweakpiczc6.jpg

Now look at that its 190!!!!! we are ready to set it to 1000 if we want

swdw 10-31-07 07:32 PM

Saving on more spot in case I find another good tutorial to plug in here that might exceed the character limit if I try to plug it into a previous post.

BTW, if you wonder why this was posted since we now have silent 3ditor, it's becaus there are still features skwajer hasn't had a chance to implement yet that require using a hex editor. If you read the Pack3D thread you can see one of the uses.

So if there things you want to do that haven't been implemented in Silent 3ditor yet, you'll need to fall back on a hex editor for the time being.

With skwasjer's help, there will be a time in the future when this post will no longer be needed.


All times are GMT -5. The time now is 03:26 AM.

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