Log in

View Full Version : [TEC] Torpedo tweak file


SheepOnDrug$
04-22-07, 09:15 AM
After patching SHIV to 1.2 the tweak file for the us_torpedo.sim doesnt seem to work no more :cry:... is a new tweak file required or is there another way to fiddle with the torp speeds ?
i have no clue how to hex edit anything btw :dead:

all other tweak files work just fine :D except for the torpedo sim file

CCIP
04-22-07, 10:28 AM
Oh how I still itch for a tweak file for this that'd include all the torpedo failure settings :doh:

I can probably decode the basic values and adapt nvdrifter's old tweak to 1.2, but I'd really wish someone more experienced took a look at the torpedo failure values as well...

CaptainCox
04-22-07, 10:32 AM
Is there a proper tut for creating Tweak Files?...if not maybe nvdrifter or some veteran SH3 guy could do one when they have a min of spare time. Not a request, just asking in all friendliness ;)

For example how should I know that I need to search for "4,single,>2" in this example
Examples of search line, used when searching for a variable:
//search,WindCoef,4,single,>2,Wind Coefficient
// Description: Look for 4th occurrance 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.

I used to do Hacks/Trainers for BF1942 so I know a little bit of hexing, more using OLLDBG, Tsearch and VB6. But I am very rusty as i have not done any of this stuff for years.

CCIP
04-22-07, 10:41 AM
In fact there is! :D

TimeTraveller wrote one and has it included in the MiniTweaker program folder (it's called hex_editing.htm)

CaptainCox
04-22-07, 10:42 AM
Cheers man will have a look. :up:

CaptainCox
04-22-07, 11:49 AM
OK I think I need one thing explained and i am set to do this stuff.

OK here goes, example from the TUT:

So, to code a sample line in the Tweaker program text file to locate this Crash Depth
value, we would code this:

absolute,single,1BA3,Crash Depth

All that means is look for a single precision float value at location 1BA3 and name it
Crash Depth in the program listing. Pretty simple. Run the program and see the value
displayed. If the value looks weird, it probably is a Long value rather than a Single,
so you can always substritue the word "long" for "single" in the line and try it that
way. No harm is done either way because you won't have changed anything (yet). Once you
get a readable (and reasonable) value, you can be fairly certain that you have got the
right idea.

http://i10.photobucket.com/albums/a138/CaptainCox/chart.jpg

Where does the "1BA3" value come from. I can understand the 1B...but (and I think its how you count hex here) get A3?

CaptainCox
04-22-07, 01:32 PM
Tell me if I am wrong here but is this the way its done?

The line in the code was:
001ba0 74 68 00 66
Line name 0 beginning of the value

As 0 don't count and as 66 is the 3rd byte in the line is it then like this.

1ba3
Line 1st byte in the value is in the 3rd hex

??? or am I totally lost here.:o

nvdrifter
04-22-07, 09:57 PM
I want to make new torpedo tweak files, but I am reluctant to do so until the final SH4 patch. I don't really feel like redoing tweak files each time a new patch is released. I am sure other modders here can appreiciate what I am saying.

nvdrifter
04-22-07, 09:59 PM
Oh how I still itch for a tweak file for this that'd include all the torpedo failure settings :doh:

I can probably decode the basic values and adapt nvdrifter's old tweak to 1.2, but I'd really wish someone more experienced took a look at the torpedo failure values as well...

I thought my previous torpedo tweak file did included all of the torp failure settings. Did I miss some?

CCIP
04-22-07, 10:00 PM
I want to make new torpedo tweak files, but I am reluctant to do so until the final SH4 patch. I don't really feel like redoing tweak files each time a new patch is released. I am sure other modders here can appreiciate what I am saying.

Yea, I see what ya mean. A bit of a bummer for some of us though, admittably. I may get around to it myself sometime again, but unfortunately hex stuff is not as idiot-proof as it needs to be for me :p

CaptainCox
04-22-07, 11:57 PM
Tell me if I am wrong here but is this the way its done?

The line in the code was:
001ba0 74 68 00 66
Line name 0 beginning of the value

As 0 don't count and as 66 is the 3rd byte in the line is it then like this.

1ba3
Line 1st byte in the value is in the 3rd hex

??? or am I totally lost here.:o

Nobody??? :( ... huhuhu:dead:

nvdrifter
04-23-07, 01:00 AM
I want to make new torpedo tweak files, but I am reluctant to do so until the final SH4 patch. I don't really feel like redoing tweak files each time a new patch is released. I am sure other modders here can appreiciate what I am saying.
Yea, I see what ya mean. A bit of a bummer for some of us though, admittably. I may get around to it myself sometime again, but unfortunately hex stuff is not as idiot-proof as it needs to be for me :p
Well, I decided to go ahead and update the torpedo tweak files so they will work with v1.2. Should be released soon. Hopefully the dev team won't add any more lines of code to the torpedoes.sim file in later patches. :doh:

nvdrifter
04-23-07, 01:02 AM
Tell me if I am wrong here but is this the way its done?

The line in the code was:
001ba0 74 68 00 66
Line name 0 beginning of the value

As 0 don't count and as 66 is the 3rd byte in the line is it then like this.

1ba3
Line 1st byte in the value is in the 3rd hex

??? or am I totally lost here.:o
Nobody??? :( ... huhuhu:dead:
I really have no idea what you are asking.

CaptainCox
04-23-07, 01:11 AM
Well to put it plainly. In the TUT by timetraveller, he has the example of
getting "absolute,single,1BA3,Crash Depth" to get the value for "Crash Depth".in the "tweak file" My question is basically as to how he gets the "3" in 1BA3. I posted the example some posts up.

I understand the 1BA, but as to the 3?. That's what I am asking in my previous post.

I am sure its super simple. My thinking was that as "66" is the first hex showing the value for "Crash Depth" and its the 3rd hex on line 1BA the result would be "1BA3"

Is that correct?

Madox58
04-23-07, 01:33 AM
Absolute means you are going to a specific address.
In this case Hex address 1BA3.

There you are looking at a SINGLE value.

Better to do tweaks with the search function.

That way you don't need to change the file for every patch.

CaptainCox
04-23-07, 01:42 AM
Sure I get that, but how do we end up on "that" specific addy?
That's all I want to know. Like I said I understand why we are at "001BA0" in the example by "timtraveller" its the line that holds the value. But my question was how to get the "3" as we are told value for "Crash Depth" is at "1BA3"

http://i10.photobucket.com/albums/a138/CaptainCox/chart.jpg

This is from "timetravellers" tut, just to make it more clear as to what I am talking about.

Madox58
04-23-07, 01:52 AM
1BA0 = 74
1BA1 = 68
1BA2 = 00
1BA3 = 66

and so forth

nvdrifter
04-23-07, 01:56 AM
Sure I get that, but how do we end up on "that" specific addy?
That's all I want to know. Like I said I understand why we are at "001BA0" in the example by "timtraveller" its the line that holds the value. But my question was how to get the "3" as we are told value for "Crash Depth" is at "1BA3"

http://i10.photobucket.com/albums/a138/CaptainCox/chart.jpg

This is from "timetravellers" tut, just to make it more clear as to what I am talking about. I strongly suggest downloading my modding tools pack. In it is a hex editor called XVI32 that does all the numbers figuring for you when you click on each hex address. It's called 'Data Inspector' in the hex editor options menu. It will show singles, longs, integers, etc. Really convenient. Hope this helps. ;)

Here's the link: http://files.filefront.com/SH4_Modding_Tools_Packagezip/;7077578;/fileinfo.html

Madox58
04-23-07, 02:02 AM
@NVDRIFTER

I see we play with the same toys.
:rotfl:

nvdrifter
04-23-07, 02:05 AM
@NVDRIFTER

I see we play with the same toys.
:rotfl:

Trying to figure out the numbers myself makes my head hurt. :dead: :rotfl:

CaptainCox
04-23-07, 03:37 AM
Sure I get that, but how do we end up on "that" specific addy?
That's all I want to know. Like I said I understand why we are at "001BA0" in the example by "timtraveller" its the line that holds the value. But my question was how to get the "3" as we are told value for "Crash Depth" is at "1BA3"

http://i10.photobucket.com/albums/a138/CaptainCox/chart.jpg

This is from "timetravellers" tut, just to make it more clear as to what I am talking about. I strongly suggest downloading my modding tools pack. In it is a hex editor called XVI32 that does all the numbers figuring for you when you click on each hex address. It's called 'Data Inspector' in the hex editor options menu. It will show singles, longs, integers, etc. Really convenient. Hope this helps. ;)

Here's the link: http://files.filefront.com/SH4_Modding_Tools_Packagezip/;7077578;/fileinfo.html Ahhhh SUPER thanks a bunch man! I am at work atm, but I have the game installed here for "testing purposes" :p I will have a look at lunch time. Thanks again man!:up:

RavagerOne
04-24-07, 02:43 AM
Hex value and converting this to Decimal?

I see in the Sim file the item for "Min" may have a value of 803F in hex but this = 1 via the analyzer in decimal, how is the conversion done? as i see this value could be 0.1 say which is CDCCCC3D and -1 is 80BF.

How is this worked out?

Jungman
04-24-07, 03:44 AM
Hex value and converting this to Decimal?

I see in the Sim file the item for "Min" may have a value of 803F in hex but this = 1 via the analyzer in decimal, how is the conversion done? as i see this value could be 0.1 say which is CDCCCC3D and -1 is 80BF.

How is this worked out?

It is a format that is used to store large numbers. IEEE 754 Floating Point Single. It is not the exact thing taught in school, more computer science. It stores the mantissa and exponent and sign as a format. You can study the why and how they get it mathematical theory, real pain in the ass. Use a calculator such as this one. Plus remember the numbers are entered in backwards.

http://babbage.cs.qc.edu/IEEE-754/32bit.html

http://babbage.cs.qc.edu/IEEE-754/Decimal.html

Enter the raw 00 00 80 3F from the hex file as 3F800000 gives you value 1.

Above CaptainCox wanted the crash depth. It looks like this 66 e6 ac 43 in file color yellow.

Enter backwards 43 ac e6 66 two bytes at a time 43ace666. Gives =345.79998779296875 ~rounds to 346 in game.

Negative numbers are stores as the 9's complement. See -1 is 80BF--> BF80 The normal 1 is a '3' there so (F-1)-3 = B. Something like that...:/ 11011 is 00100 computer must use binary and makes it add. IE Subtraction is adding the 9's complemnt in binary. Fast because all 1 are 0 transposed. then remove 1 bit. Darn 24 years ago to remember that stuff.

CaptainCox
04-24-07, 04:39 AM
Cheers "Jungman". My problem now is how to actually find stuff. I asked in this thread http://www.subsim.com/radioroom/showthread.php?p=511587#post511587
I think I got the basics of it, but for e.g. I am after lets say making the plants (grass.dds) and the rocks (rocks.dds) to be smaller on the sea bottom (something I tried to look for whole day, even at work :oops: )

Now I find some stuff in
"undersea.dat"
C:\Program Files\Ubisoft\Silent Hunter 4 Wolves of the Pacific\Data\Library
but I can't seem to pinpoint the size and stuff (only an example, and I am maybe looking in the wrong place) but how the heck do i find this stuff.
I am sort of in Limbo at the mo with this one...

RavagerOne
04-25-07, 02:09 AM
Thanks heaps Jungman :know: will have a look into.. Too much fun...

Have a great day :)

Jungman
04-25-07, 04:46 AM
:yep: Danke! Nvdrifter I found an extra set of data points for the fast mark 14 inside the torpedo_US.sim file. Can you add this:

Mark 14 Torpedo .sim Tweak File .txt

[1]
DropDownName=Mark 14 Main
absolute,byte,7FC,type
absolute,single,80A,depth
absolute,single,821,max_dive_angle
absolute,single,883,max_turn_angle
absolute,single,8A2,impulse
absolute,single,83E,speed ---->slow_speed
absolute,single,86C,range ----> fast_range

absolute,single,85E,fast_speed --> add new
absolute,single,84C,slow_range --> add new

Thanks for making these tweak files, alot of work!:up: For readability just copy paste this:


[1]
DropDownName=Mark 14 Main
absolute,byte,7FC,type
absolute,single,80A,depth
absolute,single,821,max_dive_angle
absolute,single,883,max_turn_angle
absolute,single,8A2,impulse
absolute,single,83E,slow_speed
absolute,single,84C,slow_range
absolute,single,85E,fast_speed
absolute,single,86C,fast_range