View Full Version : [TEC] SH5.exe patches to fix bugs and add functionality
Pages :
1
[
2]
3
4
5
6
7
8
9
10
11
12
13
14
TheDarkWraith
11-21-11, 10:32 AM
I've just got the DVD version of SH5. Updated it to 1.2. And when I run SH5Patcher v1.0.21.0 and try to open the .s5p file, I also get this error.
(Running on Vista 32-bit.)
I can patch the .exe manually with a hex editor, but this tool would be helpful.
When do you get the error?
When you run the app and select File-->Open the first thing it wants you to do is select the s5p file (the patch file). After selecting the patch file it then wants you to select the sh5.exe file. Are you able to do this?
When do you get the error?
When you run the app and select File-->Open the first thing it wants you to do is select the s5p file (the patch file). After selecting the patch file it then wants you to select the sh5.exe file. Are you able to do this?
After selecting the patch file it shows this error (error reading patch file)
http://img13.imageshost.ru/img/2011/11/22/image_4ecb88dc03545_small.jpg (http://imageshost.ru/photo/86957/id1070439.html)
Also, i cant find address 0x197A4A in sh5.exe 1.2.0.0., only 0x197A48.
TheDarkWraith
11-22-11, 05:04 PM
After selecting the patch file it shows this error (error reading patch file)
http://img13.imageshost.ru/img/2011/11/22/image_4ecb88dc03545_small.jpg (http://imageshost.ru/photo/86957/id1070439.html)
Also, i cant find address 0x197A4A in sh5.exe 1.2.0.0., only 0x197A48.
The problem you are having is because of an error on my part. I forgot to include two dlls in the zip package.
v1.0.21.1 released. See post #1.
This will fix your problem :up:
damien007
11-30-11, 06:58 AM
Weird... I've applied the patch and I thought it was working perfectly fine however my hydro still doesn't seem to be doing anything in my career/campaign mode. I tested it out and in the historical missions the hydrophone seems to be working fine. However in my career mode I still can't get it to work. I have a save of myself parked approximately 3km away from a freighter but no matter what i try i can detect it with the hydrophones (manually or using sonar man) any ideas?
Magic1111
11-30-11, 07:58 AM
Weird... I've applied the patch and I thought it was working perfectly fine by my hydro still doesn't seem to be doing anything in my career/campaign mode. I tested it out and in the historical missions the hydrophone seems to be working fine. However in my career mode I still can't get it to work. I have a save of myself parked approximately 3km away from a freighter but no matter what i try i can detect it with the hydrophones (manually or using sonar man) any ideas?
:salute::salute::salute:Welcome aboard!!!:salute::salute::salute:
damien007
11-30-11, 08:20 AM
:salute::salute::salute:Welcome aboard!!!:salute::salute::salute:
Thanks, I just recently brought silent hunter 5 after having enjoyed silent hunter 3 so much, and with sufficient modding I'm loving it. I have been lurking this forum gathering mods for a while now but this is the first time I've actually needed help with a mod. I'm finding it very tricky to sneak up on enemy vessels without a hydrophone. Also I'm struggling to find and intercept enemy ships in the campaign so I'm hoping using working hydrophones could extend my maximum range for spotting enemy ships. Any help is appreciated thanks.
damien007
12-01-11, 12:55 AM
Ok quick update, I've tried removing all my mods and it seems to be working so now it just seems to be a matter of seeing which one breaks it.
damien007
12-01-11, 02:11 AM
Wierd it seems Stormys DBSM was the mod cuasing my hydrophone to stop working in the campaign.
TheBeast
12-08-11, 06:12 AM
Any progress linking Schnorchel to replentish O2 and Co2 Ventilation in SH5.exe?
Regards!
TheBeast
THE_MASK
12-08-11, 06:34 AM
In special abilities there is a value .
CO2LevelIncreaseRate
As a work arould you might be able to have an officer have this ability .
Call it Operate schnorkel or something .
AbilityType=CO2LevelIncreaseRate, MaxDiveDepth,
AbilityValue= -10, -100
RunOnActivate= IfIsSubmerged
Trevally.
12-08-11, 12:44 PM
In special abilities there is a value .
CO2LevelIncreaseRate
As a work arould you might be able to have an officer have this ability .
Call it Operate schnorkel or something .
AbilityType=CO2LevelIncreaseRate, MaxDiveDepth,
AbilityValue= -10, -100
RunOnActivate= IfIsSubmerged
Nice idea - could that be linked to the raise schnorkel button to activate:hmmm:
Captain_AJ
12-16-11, 10:30 AM
Thanks For the Informatiom TDW !! I just sank My first Liberty Cargo Only using the Hydrophone .. Its alot easier than plotting with a visual using the plotting method from your scope . However that was at a perfect 78 AOB . but I belive with all the information that is out there . Iam sure I will become a pro at everything .. I am not sure were your print screen files are located i wanted to post a picture from my kill , and post on here .. anyone can help It will be appreciated
Kimura
Captain_AJ
12-22-11, 09:52 AM
I'm a little excited right now, no, I'm really excited! After months of searching and digging through the sh5.exe file I finally found the routine that controls the hydrophone's displaying of the contact. After some more time to partially figure out what the routine was doing (from viewing the assembly language via OllyDebug) I now have an alpha fix for the broken hydrophone station.
As you know the hydrophone station is basically useless in stock form because you get like 0.01 degrees of indicated range to 'find' your contact :nope: And when you do 'find' your contact you get maybe 1-3 seconds before it has changed in bearing and you lose it (no more indicated Unknown, Merchant, or Warship - just the -). What were the devs thinking :timeout:
What I've done is enabled the window to go from 0.01 degrees for the contact to about 20 degrees of bearing (as indicated on the dial). Now the hydrophone station is a useful tool again :rock:
At the faintest sound of the contact the box above the hydrophone will now start displaying Merchant, Warship, or Unknown (It appears that sometimes the class of ship shown isn't correct - possibly due to this patch. I will continue looking into this but for now I'm happy to see SOMETHING pop up from the hydrophone even if it's incorrect than the fast blip of something you got with stock). As I continue to decipher the assembly and learn what it's exactly doing (this is very complicated and hard to do) I will update the patch accordingly.
As I dig deeper into this I hope to also fix the broken sound knob for the hydrophone station. This is another one of those what were the devs thinking??
The goal of these patches are:
- a quick and dirty way to get the hydrophone station working semi-correctly if not correctly
- reference new entries in menu.txt for warship, merchant, unknown, and submarine texts for the hydrophone box (this will allow users of real navigation to see what the contact is in the hydrophone box. Without this change you see nothing with real navigation!)
- be easy to implement (few byte changes)
- easy enough to do so that anyone can do it
These patches achieves all my goals mentioned above.
As I cannot release a modified SH5.exe file you have to patch your SH5.exe file yourself. This works only on unmodified, stock SH5.exe files!!
Link for app can be found at bottom of this post
v0.0.1: fixes broken hydrophone station
v0.0.2: references new entries in menu.txt for merchant, warship, submarine, and unknown texts for hydrophone box (for use with my real navigation add-on mod in UIs mod)
v0.0.3: user can define colors for: marks, ruler, compass, protractor, distance scales on Nav map and TAI map, and lattitude and longitude degrees on the sides and top and bottom of navigation map
v0.0.4: changes default volume of hydrophone station from 0.9 to 1.0 (10% increase in volume). This is still currently not able to be changed in-game
PATCHES ARE NOT CUMULATIVE! YOU APPLY THE PATCHES YOU WANT ENABLED. i.e.: if you want patch 1 and patch 2 then you need to apply both patches
For non-Steam versions of the SH5.exe:
How to patch your sh5.exe file for v0.0.1 (fixes broken hydrophone station):
- make a backup of your SH5.exe file
- open the SH5.exe file with a hex editor
- go to address 0x197A4A and change the byte from 75 to 74
- save the file
- run the game :rock:
How to patch your sh5.exe file for v0.0.2 (references new entries in menu.txt for merchant, warship, submarine, and unknown texts for hydrophone box [for use with my real navigation add-on mod in UIs mod]):
- make a backup of your sh5.exe file
- open the sh5.exe file with a hex editor
- go to address 0xA8C43 and change the byte from 34 to 3A
- go to address 0xA8C4F and change the byte from 35 to 3B
- go to address 0xA8C5B and change the byte from 36 to 3C
- save the file
NOTE: you must now edit your menu.txt file and add the following entries to it after entry 825 (comment out lines 820-825 by adding a leading ; if you don't want the tooltips for these to display on the nav map and TAI):
; sh5.exe patch by TDW - allows texts for units to display in hydrophone box when real navigation enabled
826=Unknown
827=Warship
828=Merchant
829=Submarine
NOTE2: the submarine text will not display for submarines (it will currently display warship IIRC).
- run the game :rock:
How to patch your sh5.exe file for v0.0.3 (can define colors for: marks, ruler, compass, protractor, distance scales on Nav map and TAI map, and lattitude and longitude degrees on the sides and top and bottom of navigation map):
NOTE: color is a hex color defined as AABBGGRR (when viewed in the hex editor) where AA = the alpha component, BB - the blue component, GG = the green component, and RR = the red component. Possible values for each is 0x00-0xFF.
NOTE2: stock values for the color (as seen in hex editor) are either 0xFF222222, 0x4B444444, 0xFE111188, or 0xEE000000
- make a backup of your sh5.exe file
- open the sh5.exe file with a hex editor
- go to address 0x2AE60 and change the 4 bytes to the color wanted for the TAI map distance scale
- go to address 0x2B369 and change the 4 bytes to the color wanted for the Navigation map distance scale
- go to address 0x30465 and change the 4 bytes to the color wanted for the longitude degrees located at top of nav map
- go to address 0x304C7 and change the 4 bytes to the color wanted for the longitude degrees located at bottom of nav map
- go to address 0x3060F and change the 4 bytes to the color wanted for the lattitude degrees located at left side of nav map
- go to address 0x30671 and change the 4 bytes to the color wanted for the lattitude degrees located at right side of nav map
- go to address 0x103F75 and change the 4 bytes to the color wanted. This color defines the color of all the instances of this tool when adding new instances of the tool. Makes these instances of these tools 'stand-out' compared to other tools
- go to address 0x103F95 and change the 4 bytes to the color wanted for the marks
- go to address 0x104489 and change the 4 bytes to the color wanted when placing a new mark
- go to address 0x104A84 and change the 4 bytes to the color wanted when placing new ruler line
- go to address 0x105095 and change the 4 bytes to the color wanted for the ruler
- go to address 0x1055FF and change the 4 bytes to the color wanted when placing new compass
- go to address 0x105945 and change the 4 bytes to the color wanted for the compass
- go to address 0x105DF5 and change the 4 bytes to the color wanted when placing new protractor
- go to address 0x1063E5 and change the 4 bytes to the color wanted for the protractor
- save the file
- run the game :rock:
How to patch your sh5.exe for v0.0.4 (change default hydrophone volume):
NOTE: stock value (as seen in hex editor) is 6666663F (which is 0.9)
- make a backup of your sh5.exe file
- open the sh5.exe file with a hex editor
- go to address 0x346690 and change the 4 bytes to the volume level wanted (0.0 to 1.0 where 0.0 is no volume, 1.0 is max volume)
- save the file
- run the game :rock:
For Steam versions of the SH5.exe:
Unable to provide solution to Steam users. The steam sh5.exe uses a form of self-modifying code copy protection that 'unpacks' the code when the executable is run. This form isn't impossible to read and decipher it just takes longer and quite frankly the reward to time relationship isn't worth it for me (not to mention that I can't run the .exe since I don't own the steam version of the game - I own the boxed version of the game). Sorry all. This is one reason why I never buy Steam based games unless I have to.
TheDarkWraith :|\\
The below screenshot will show you what patch v0.0.1 and v0.0.2 do. Notice the yellow arrows I drew on the hydrophone needle. This represents the range that the hydrophone box in the top left will show something for the ship class (the yellow circled):
http://www.subsim.com/radioroom/picture.php?albumid=446&pictureid=3799
The screenshot below will show you what you can do with patch v0.0.3. Notice that you can read the tools, the lattitude and longitude degrees, and the map scale much more easily now that you can set their colors!
http://www.subsim.com/radioroom/picture.php?albumid=468&pictureid=3834
There are still some colors I'm trying to track down....
SH5Patcher application written by moi:
http://www.subsim.com/radioroom/picture.php?albumid=468&pictureid=3851
Items in red text are double clickable. Thus if double clicked you active it. For the IsColor it will open a color dialog box allowing you to select the new color (and view the current color). The Enabled will either apply/remove the current Change x patch to the sh5.exe file.
SH5 Patcher v1.0.21.1 available here: http://www.gamefront.com/files/21015310/TDW_SH5_Patcher_1_0_21_1_zip
How to use the patcher app: http://www.subsim.com/radioroom/showpost.php?p=1735615&postcount=7773
CAn you tell me were to install this os it will work corectly .. II have done the sh5 exe paych all the way up yo version 3 , But would love the colored tolls and lines on the map since Iam a ojisan .. Old man that can see stuff to well thanks
TheDarkWraith
12-22-11, 03:37 PM
CAn you tell me were to install this os it will work corectly .. II have done the sh5 exe paych all the way up yo version 3 , But would love the colored tolls and lines on the map since Iam a ojisan .. Old man that can see stuff to well thanks
Doesn't have to be installed anywhere in particular. Simply unzip and run the app. You'll have to point it to the patch file and your SH5.exe file :up:
Michal788
01-31-12, 06:53 PM
Is there any solution (hydro fix) for the steam users now?
The DRM is gone now in 2012.:D
TheDarkWraith
01-31-12, 08:07 PM
Is there any solution (hydro fix) for the steam users now?
The DRM is gone now in 2012.:D
The Steam version uses an 'unpacker' to unpack the exe because it has a form of self-modifying copy protection built into the exe. Not worth my time trying to figure it out. #1 reason I never buy Steam games :nope:
Michal788
02-01-12, 06:58 AM
I think the sh5.exe is change.
(If the sh5.exe from the steam is the same as the DVD.)
In the Patcheditor of TDW is says it is a different version of the EXE file.
And in the hexeditor you dont can find 75 anymore.
Any idea?
Charteris
02-16-12, 11:06 AM
Doesn't have to be installed anywhere in particular. Simply unzip and run the app. You'll have to point it to the patch file and your SH5.exe file :up:
Hi TDW,
I hope this isn't a completely dumb question but I haven't seen a reference to it in the thread. The patcher...does it allow one to make the 01 02 03 assembly edits through its interface? Or do the edits have to be done in an editor...and the patcher is for something else?
Cheers,
Charteris :arrgh!:
pedrobas
02-16-12, 11:45 AM
Hi TDW,
I hope this isn't a completely dumb question but I haven't seen a reference to it in the thread. The patcher...does it allow one to make the 01 02 03 assembly edits through its interface? Or do the edits have to be done in an editor...and the patcher is for something else?
Cheers,
Charteris :arrgh!:
My goodness!!
SH5Patcher application written by moi:
http://www.subsim.com/radioroom/picture.php?albumid=468&pictureid=3851
Items in red text are double clickable. Thus if double clicked you active it. For the IsColor it will open a color dialog box allowing you to select the new color (and view the current color). The Enabled will either apply/remove the current Change x patch to the sh5.exe file.
SH5 Patcher v1.0.21.1 available here: http://www.gamefront.com/files/21015310/TDW_SH5_Patcher_1_0_21_1_zip
How to use the patcher app: http://www.subsim.com/radioroom/showpost.php?p=1735615&postcount=7773
Charteris
02-17-12, 03:04 AM
Ok, maybe that was too dumb to ask as it looks like it should do the business...but allow me that one!
Anyway, I used the patcher and it works beautifully. Godly thing to be able to do and thanks to TDW for all the many hours he must have toiled over this problem to make it work.
Cheers,
Charteris
misha1967
02-26-12, 08:34 PM
Alright, I know I'm dense, TDW, so pardon me for this question :DL :
Got just about everything else about my sh5.exe patched to my specs (thanks to YOU! :yeah: ), but there is one of the color alterations that I don't understand the description of:
- go to address 0x103F75 and change the 4 bytes to the color wanted. This color defines the color of all the instances of this tool when adding new instances of the tool. Makes these instances of these tools 'stand-out' compared to other tools
"All the instances of this tool?"
Which tool?
I know. I'm probably not paying attention here, but my hair is turning grayer by the minute :haha:
TheDarkWraith
02-26-12, 08:41 PM
"All the instances of this tool?"
Which tool?
I know. I'm probably not paying attention here, but my hair is turning grayer by the minute :haha:
Any tool. When you add a new mark, ruler, compass, etc. this is the color of the tool (icon) before clicking and adding a new one of it to the map.
misha1967
02-26-12, 09:04 PM
Ahhh... You mean the color of the tool on the toolbar on the left (currently yellow when highlighted, I think)?
TheDarkWraith
02-26-12, 09:14 PM
Ahhh... You mean the color of the tool on the toolbar on the left (currently yellow when highlighted, I think)?
Nope. After you click the tool in the toolbar on the left your mouse cursor turns into the tool's icon. The color of that icon (your mouse cursor) is what is being changed with that memory address.
misha1967
02-26-12, 09:50 PM
Thanks for your patience. Now I see what you mean (after having opened the sim to check it out). I need a slap myself upside the head smiley here :DL
Because the lines for protractors, rulers etc. are red while you're drawing them, I had somehow gotten into my little head that the tool icons themselves were too. Which they're not, of course. Now it all makes perfect sense.
Thanks again! :up:
(Oh, and as a word of "advice" to other people tooling around with changing the colors with TDW's patcher, and you should, I'd recommend making your chosen colors a bit darker than you might at first want. It seems that the sim itself "brightens" your chosen color a bit as compared to what the color selector shows when you're patching. For instance, the nice, bright red that you see in the stock game when drawing new lines is represented in the patcher as something much closer to dark reddish-brown. I just noticed that as the nice, green color that I'd chosen in the patcher almost burned a hole clear through my retina in the actual game :03: Experiment. It's dead easy to change if you don't like it).
Anita1986
03-06-12, 05:39 AM
It might allready been told but since Im a girl, I take the shortcut and just ask.
You tell that to patch the sh5.exe file you open it with a hex editor (like http://www.ntcore.com/exsuite.php) and edit the address, save and start the game. But you keep talking about the patcher (SH5 Patcher v1.0.21.1)?
Should you do both?
THE_MASK
03-06-12, 06:40 AM
It might allready been told but since Im a girl, I take the shortcut and just ask.
You tell that to patch the sh5.exe file you open it with a hex editor (like http://www.ntcore.com/exsuite.php) and edit the address, save and start the game. But you keep talking about the patcher (SH5 Patcher v1.0.21.1)?
Should you do both?The patcher is on the bottom of the first post in this thread . The instructions are underneath that . Ask as many questions as you like . Just use the patcher , forget the hex editing .
Can someone please explain to me what the "Change 7" does? I don't really understand the description :oops:
TheDarkWraith
03-28-12, 02:16 PM
Can someone please explain to me what the "Change 7" does? I don't really understand the description :oops:
start from post #272 and continue
quink99
03-28-12, 02:50 PM
TDW,
I didn't go to high school for nine years for nothing but I'm still having a devil of a time understanding the color change options in the SH5 patcher.
What I'm trying to do is to select one color for each tool, i.e. protracter, compass, ruler, NAV mark, etc., and my initial use of the selected tool will leave the appropriate mark on the TAI and NAV map in the that chosen color. Then after using the tool the selected color will remain on the map mark until it is erased and not turn to a thin, almost unreadable, black line as soon as a different tool is used. How can I accomplish this?
Yes, I've read this entire thread regarding this subject but I guess I'm probably a poster child for the effects of ignorance.
Thanks
TheDarkWraith
03-28-12, 03:03 PM
TDW,
I didn't go to high school for nine years for nothing but I'm still having a devil of a time understanding the color change options in the SH5 patcher.
What I'm trying to do is to select one color for each tool, i.e. protracter, compass, ruler, NAV mark, etc., and my initial use of the selected tool will leave the appropriate mark on the TAI and NAV map in the that chosen color. Then after using the tool the selected color will remain on the map mark until it is erased and not turn to a thin, almost unreadable, black line as soon as a different tool is used. How can I accomplish this?
Yes, I've read this entire thread regarding this subject but I guess I'm probably a poster child for the effects of ignorance.
Thanks
patch v0.0.3:
- go to address 0x103F95 and change the 4 bytes to the color wanted for the marks
- go to address 0x105095 and change the 4 bytes to the color wanted for the ruler
- go to address 0x105945 and change the 4 bytes to the color wanted for the compass
- go to address 0x1063E5 and change the 4 bytes to the color wanted for the protractor
Those will set the color of the tool after you have placed it on the map. The patcher exe can set these also :yep:
quink99
03-28-12, 06:46 PM
patch v0.0.3:
- go to address 0x103F95 and change the 4 bytes to the color wanted for the marks
- go to address 0x105095 and change the 4 bytes to the color wanted for the ruler
- go to address 0x105945 and change the 4 bytes to the color wanted for the compass
- go to address 0x1063E5 and change the 4 bytes to the color wanted for the protractor
Those will set the color of the tool after you have placed it on the map. The patcher exe can set these also :yep:
I'm sorry TDW, I haven't a clue what the quoted "- go to address...." means and having tried the patcher several times in the past prior to my post here I've had no luck whatsoever. See what I mean by poster child for ignorance?
When you've got a moment perhaps you could tell me, step-by-step, "Dick, Jane, and Spot" style, how to do it for one tool with the patcher.
Thanks, Quink
TheDarkWraith
03-28-12, 07:56 PM
I'm sorry TDW, I haven't a clue what the quoted "- go to address...." means and having tried the patcher several times in the past prior to my post here I've had no luck whatsoever. See what I mean by poster child for ignorance?
When you've got a moment perhaps you could tell me, step-by-step, "Dick, Jane, and Spot" style, how to do it for one tool with the patcher.
Thanks, Quink
http://www.subsim.com/radioroom/picture.php?albumid=468&pictureid=5484
For changes 8, 11, 13, and 15 under Map colors double click Enabled to enable/disable, double click IsColor to pick color.
misha1967
03-29-12, 02:50 AM
Quick question, TDW:
As we all know, excessive fiddling with the mod soup can lead to necessary reinstalls of SH5. No problem, as the computer does most of the work. Go have a cup of coffee or a beer and wait for it to finish.
However, I was wondering if I could save myself some time by copying the patched version of sh5.exe to the desktop before uninstalling, then replacing the "fresh" sh5.exe with that one after reinstall? Just to save me some time running the patcher and choosing colors and all that after each reinstall.
Vanilla
03-29-12, 05:47 AM
Quick question, TDW:
As we all know, excessive fiddling with the mod soup can lead to necessary reinstalls of SH5. No problem, as the computer does most of the work. Go have a cup of coffee or a beer and wait for it to finish.
However, I was wondering if I could save myself some time by copying the patched version of sh5.exe to the desktop before uninstalling, then replacing the "fresh" sh5.exe with that one after reinstall? Just to save me some time running the patcher and choosing colors and all that after each reinstall.
I make a 'mod' with the patched exe: I copy sh5.exe into a new folder in MODS, then patch it there with the patcher, then use JGSME to install it. Had no problems so far.
TheDarkWraith
03-29-12, 08:23 AM
I make a 'mod' with the patched exe: I copy sh5.exe into a new folder in MODS, then patch it there with the patcher, then use JGSME to install it. Had no problems so far.
:agree:
misha1967
03-29-12, 02:55 PM
I make a 'mod' with the patched exe: I copy sh5.exe into a new folder in MODS, then patch it there with the patcher, then use JGSME to install it. Had no problems so far.
Excellent! That's even better than what I thought to do and it makes it even easier. I just wanted to make sure that there wasn't a problem with using an "old" patched .exe with a new install. Thanks! :salute:
Bilge_Rat
04-01-12, 07:57 AM
Finally got around to trying this. This is a really great, easy to use mod. Congrats TDW.
TheDarkWraith
04-26-12, 02:12 PM
v1.0.22.0 released. See post #1
This version revamps the patcher app to be generic. It now reads the file and path from patch file that it's supposed to patch.
This version adds a new patch file for shcollisions.act that fixes the broken magnetic detonator
:|\\
volodya61
04-26-12, 02:37 PM
Thank you very much from the sukhoi.ru community :yeah::woot::salute:
volodya61
04-26-12, 03:17 PM
When attempting to run reports message "Error reading patch file C:\-\-\-\TDW_SHCollisions_Patch.s5p"
May be necessary to add files TDWFileUtils.dll and TDWUtils.dll to archive?
Sorry for my English..
EDIT: because if I add these files all works fine...
col_Kurtz
04-26-12, 03:33 PM
@volodya
I think... we should extract these files to old SH5 patcher folder/D:\Games\Silent Hunter 5\SHV MODS\NewUIs_TDC_6_9_0_ByTheDarkWraith\data\Applica tions\SH5 EXE Patcher/. I did this and I could open new files/TDW_SHCollisions_Patch.s5p/ and /TDW_SH5_Patches.s5p/. Not sure about this. Maybe TDW can explain a bit more (please, please - and thank you, thank you).
volodya61
04-26-12, 03:40 PM
@volodya
I think... we should extract these files to old SH5 patcher folder/D:\Games\Silent Hunter 5\SHV MODS\NewUIs_TDC_6_9_0_ByTheDarkWraith\data\Applica tions\SH5 EXE Patcher/. I did this and I could open new files/TDW_SHCollisions_Patch.s5p/ and /TDW_SH5_Patches.s5p/. Not sure about this. Maybe TDW can explain a bit more (please, please - and thank you, thank you).
I don't use TDW Ui (in any case great work) and use patcher by itself...
TheDarkWraith
04-26-12, 03:41 PM
@volodya
I think... we should extract these files to old SH5 patcher folder/D:\Games\Silent Hunter 5\SHV MODS\NewUIs_TDC_6_9_0_ByTheDarkWraith\data\Applica tions\SH5 EXE Patcher/. I did this and I could open new files/TDW_SHCollisions_Patch.s5p/ and /TDW_SH5_Patches.s5p/. Not sure about this. Maybe TDW can explain a bit more (please, please - and thank you, thank you).
Yes the patcher app relies on DLLs from the game. I cannot legally provide those DLLs in a package so you either place the patcher app in your SH5 directory or let them overwrite the existing files in \data\Applications\SH5 exe patcher :up:
volodya61
04-26-12, 03:48 PM
Yes the patcher app relies on DLLs from the game. I cannot legally provide those DLLs in a package so you either place the patcher app in your SH5 directory or let them overwrite the existing files in \data\Applications\SH5 exe patcher :up:
Thanks for the quick reply...
Can I put these files in a separate package for the sukhoi.ru community?
TheDarkWraith
04-26-12, 03:51 PM
Thanks for the quick reply...
Can I put these files in a separate package for the sukhoi.ru community?
v1.0.23.0 released. See post #1
This version adds the missing DLL files of mine that I forgot to package in v1.0.22.0
volodya61
04-26-12, 04:09 PM
v1.0.23.0 released. See post #1
This version adds the missing DLL files of mine that I forgot to package in v1.0.22.0
Thank you very much again from the all sukhoi.ru community :yeah::salute:
PS: We are very glad by the fact that the improvers of this game has such great creators!!! Thank you very much!!!
PPS: May be my English isn't so good, but I'm admire all your creations.. Thank you again!
col_Kurtz
04-26-12, 05:00 PM
Yes the patcher app relies on DLLs from the game. I cannot legally provide those DLLs in a package so you either place the patcher app in your SH5 directory or let them overwrite the existing files in \data\Applications\SH5 exe patcher :up:
We need to learn the enigma code:cool:
Thank you :yeah::salute:
Ps. I forgot to ask. This change in Sh5.exe only at start the new campaign - not in the bunker, am I right?
Captain Joe
04-26-12, 05:46 PM
Hi TDW, i am very happy to report the shcollision patch has fixed the hull integrity not taking damage problem. now works perfect. well done. that has been bugging me and im sure many others for a long time. will continue other tests tomorrow. Once again great job.
TheDarkWraith
04-26-12, 06:09 PM
Hi TDW, i am very happy to report the shcollision patch has fixed the hull integrity not taking damage problem. now works perfect. well done. that has been bugging me and im sure many others for a long time. will continue other tests tomorrow. Once again great job.
Cool, a side benefit :yeah: It makes sense because even the sub GR2 files are missing whatever it is the game is looking for (it appears to be the dmg_col node - but this dmg_col node has to be attached to the root node, not on a sub-node. This is why the dat files worked and the GR2 files didn't). Now I just have to figure out why these ships come to all stop and lose all intelligence in shallow waters :yep:
TheDarkWraith
04-26-12, 07:12 PM
Exploring this ships come to all stop and are lifeless problem has revealed that as soon as the ship switches to alert status and it's in shallow waters the game basically destroys it (I watched a breakpoint fire in SHCollisions.act that tells me when an object has been destroyed). Now I just have to go up the stack trace and figure out what causes this :DL
Hi, this is for magnetic torpedoes?
TheDarkWraith
04-26-12, 07:42 PM
Hi, this is for magnetic torpedoes?
The app uses patch files to tell it what to patch. The patch files contain descriptions of what each patch does. When you load a patch file you'll see what you can 'patch'.
Yes, there is a patch file that corrects the magnetic detonator problem (it also fixes the sub hull not taking damage - aka hull integrity never decreasing)
Sartoris
04-28-12, 04:51 AM
Hmm, whenever I try to change the colors of the tools using the patcher I get this error: Index was outside the bounds of the array.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at TheDarkWraith.SilentHunter5.Form1.SelectColor(Tree Node node)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5448 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
SH5Patcher
Assembly Version: 1.0.23.0
Win32 Version: 1.0.23.0
CodeBase: file:///C:/Games/Silent/MODS/SH5Patcher_v_1_0_23_0%20(1)/SH5Patcher.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5453 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5458 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
TDWFileUtils
Assembly Version: 1.0.5.0
Win32 Version: 1.0.5.0
CodeBase: file:///C:/Games/Silent/MODS/SH5Patcher_v_1_0_23_0%20(1)/TDWFileUtils.DLL
----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.5420 built by: Win7SP1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
volodya61
04-28-12, 07:06 AM
Found the same problem when using the patcher...
quink99
04-28-12, 09:21 AM
Hmm, whenever I try to change the colors of the tools using the patcher I get this error: Index was outside the bounds of the array.
I, too, unfortunately, recieve the same error message.
On another topic, the magnetic detonator now works perfectly! With my first attempt I managed to break the back of a Liberty cargo ship when the depth was set at about .8 of a meter beneath the given keel depth.
This has never worked before...........my thanks, TDW
On another topic, the magnetic detonator now works perfectly! With my first attempt I managed to break the back of a Liberty cargo ship when the depth was set at about .8 of a meter beneath the given keel depth.
This has never worked before...........my thanks, TDW
Hi!
I have been testing this too but i'm not sure if it's working for me. The only time torpedoes have detonated are when they are practically touching the bottom of the ship. The patcher shows that the .act file is changed but i can't be sure, maybe 'i have messed up something. What is the correct depth for the magnetic torp? I thought that it's about 1 meter, but my torps aren't detonating that far from the ship. I have been testing this with custom mission and with docked ships, could that be the reason?
Are you actually seeing the torpedo going under the ship and exploding without contact? If this works then it's just :woot:
col_Kurtz
04-28-12, 11:01 AM
@Rongel
Same here - not sure. When I set the torpedoes depth 11.5 +/- 0.2 (tried to set 0.8 more than draft is too) meters for draft 10.5 (TDWs Historical mission with Cimmaron tanker) torpedoes missed the keel. It was only 1 meter below, not so much IMO. If I remember well in SH4 you can set about 1meter below the keel.
I`ll try again for this mission. Now I`ll switch to external view. Be right back.
:salute:
OK, now I saw this.
1. torp set to 11m - explode and broke this fat fish!
2. 11.2 - missed.
3. 11.3 - missed.
So it`s look like it should be 0.5 meter below the keel.
OK! Thanks for the info :salute:
So could the torpedo detonation value be tweaked to 1m-1,5 meters? I remember too that it was the value used in SH 4. Still, this is already pretty good.
TheDarkWraith
04-28-12, 03:48 PM
OK! Thanks for the info :salute:
So could the torpedo detonation value be tweaked to 1m-1,5 meters? I remember too that it was the value used in SH 4. Still, this is already pretty good.
The default value for the magnetic detonators is 2m (in the .sim file). I set them to 5m for my testing. That way I could shoot torps 3m under the keel and watch them explode!
TheDarkWraith
04-28-12, 03:49 PM
Found the same problem when using the patcher...
It's quite possible I screwed something up with this when I converted it to be generic. I'll look into it :up:
Sniper450
04-28-12, 04:05 PM
For Steam versions of the SH5.exe:
Unable to provide solution to Steam users. The steam sh5.exe uses a form of self-modifying code copy protection that 'unpacks' the code when the executable is run. This form isn't impossible to read and decipher it just takes longer and quite frankly the reward to time relationship isn't worth it for me (not to mention that I can't run the .exe since I don't own the steam version of the game - I own the boxed version of the game). Sorry all. This is one reason why I never buy Steam based games unless I have to.
What about if the game is downloaded from another vendor other than steam? Is it possilbe to mod the the sh5.exe file then?
What about if the game is downloaded from another vendor other than steam? Is it possilbe to mod the the sh5.exe file then?
Just try and U'll see if it works. First try with the map-tool colours (latitude etc.) as this way is the easiest one to detect if the patcher is suitable for your game version or not:salute:
Sniper450
04-28-12, 04:16 PM
Sorry I should have first said that I am looking to get the game asap and i didnt want to wait for the box to arrive. I had planned to downloade it from gamestop or somewhere other than steam and wanted to know if it was known that it would work on not. May bad sorry.
Sartoris
04-28-12, 04:49 PM
My version was downloaded from Direct2Drive (which is now Gamefly) and the patcher works.
Sniper450
04-28-12, 05:06 PM
:yeah:Awesome thank you!
col_Kurtz
04-28-12, 06:17 PM
OK! Thanks for the info :salute:
So could the torpedo detonation value be tweaked to 1m-1,5 meters? I remember too that it was the value used in SH 4. Still, this is already pretty good.
The default value for the magnetic detonators is 2m (in the .sim file). I set them to 5m for my testing. That way I could shoot torps 3m under the keel and watch them explode!
Actually don`t know this. But I found information about G7a. Speed 44kts used only on torpedoe boats - Schnellboot :oops: This is wiki (I know) but I saw the same information somewhere else too.
http://en.wikipedia.org/wiki/G7a_torpedo
"The G7a was of variable speed, running a distance of 6,000 m at 81 km/h (6,600 yd at 44kt), 8,000 m at 74 km/h (8,800 yd at 40 kt), and 14,000 m at 55.6 km/h (15,300 yd at 30 kt). The 44 kt setting was used only by torpedo boats like the Schnellboote."
Really don`t know this value - 2m? Isn`t to far?
volodya61
04-29-12, 03:39 PM
Sorry, TDW.
What about our problem? posts 305-307?
TheDarkWraith
04-29-12, 06:06 PM
Sorry, TDW.
What about our problem? posts 305-307?
I have a new patch in the works and the patcher app will be updated to cure this problem and to support my new upcoming patch.
The new patch will stop CO2 generation when snorkel is raised and sub is underwater. It will not set CO2 to 0, it will simply stop CO2 production (keep it at last value before snorkel was raised). I haven't found the function that reset the CO2 to 0 yet. But this, in itself, it very acceptable solution so far :D
volodya61
04-29-12, 06:29 PM
Thanks for the reply, TDW! And looking forward new patcher!
TheDarkWraith
04-30-12, 02:55 AM
version 1.0.24.0 released. See post #1
This version fixes the problem with selecting colors and adds support for the CO2 bug :D
adds support for the CO2 bug
Another essential breakthrough:rock:
Many thanks TDW, and... keep'em comin':salute:
TheDarkWraith
04-30-12, 08:17 AM
Let me know if you have any problems with the CO2 fix. Here's what the CO2 fix does:
- should fix the problem of CO2 increasing sometimes when surfaced
- fixes problem of CO2 increasing when submerged and snorkel above water
This one was a little tricky because the devs put the CO2 code in SH5.exe and the code for checking when to switch propulsion modes (diesel or battery) in SHSim.act. There's a routine in SH5.exe that determines if sub is surfaced or submerged but that routine never takes the snorkel into account. The routine that checks when to switch propulsion modes does take snorkel into account. The CO2 code uses the is surfaced/submerged result to determine when to increase CO2 amount. What I did was hook into the propulsion mode routine and store it's result in a new variable. Then I hooked into the CO2 routine and added another check that checks this new variable. It's value determines whether to increase CO2 amount or leave as is. This is how the CO2 bug when surfaced has been mitigated (because the game constantly calls the update CO2 function and if this new value says sub is surfaced it cannot add to the CO2 amount anymore).
Notice I said CO2 amount will not increase anymore. It will not zero out when snorkel is raised and you are submerged. The only time it will zero out is when you physically surface the entire sub.
This fix is subject to the time compression bug that plagues many other things in SH5. If you have a high time compression and you submerge and/or raise snorkel when submerged or surface the game will not register this until time compression drops to a low value. I have almost narrowed down this high time compression bug :yep:
One thing I'm looking into is increasing the rate of CO2 production when you have battle stations ordered. This way battle stations has a penalty behind it.
TheDarkWraith
04-30-12, 09:34 AM
I've noticed in other forums that people are misinterpreting the magnetic detonator fix. The magnetic detonator fix allows magnetic torpedoes to detonate on GR2 style ships AND dat style ships (dat style ships already worked because they have the required node attached to the root node). This magnetic detonator fix also fixes the problem of player's sub not incurring hull damage (decrease in hull %) from depth charges and bombs.
The GR2 style ships and some of the dat style ships are missing collision spheres everywhere but the center of the ship. This means magnetic detonators will only detonate near the middle of the ship. Furthermore the stock magnetic detonator range specified in the torpedoes .sim file is set to 2m so magnetic torpedo has to be very near center and very close to keel in order to detonate.
This should clear up any confusions.
Sartoris
04-30-12, 09:55 AM
Thank you soooo much, TDW!
If I modified the exe (used the hydrophone fix) with the previous version, then deactivated it, and am now using the new version of the patcher, do you think it could cause some damage to the game's files? Should I reinstall the game and then use the new version of the patcher or is it safe to patch with different versions?
col_Kurtz
04-30-12, 10:37 AM
I've noticed in other forums that people are misinterpreting the magnetic detonator fix. The magnetic detonator fix allows magnetic torpedoes to detonate on GR2 style ships AND dat style ships (dat style ships already worked because they have the required node attached to the root node). This magnetic detonator fix also fixes the problem of player's sub not incurring hull damage (decrease in hull %) from depth charges and bombs.
The GR2 style ships and some of the dat style ships are missing collision spheres everywhere but the center of the ship. This means magnetic detonators will only detonate near the middle of the ship. Furthermore the stock magnetic detonator range specified in the torpedoes .sim file is set to 2m so magnetic torpedo has to be very near center and very close to keel in order to detonate.
This should clear up any confusions.
Yes - noticed that.
In Historical mission with Cimmaron I sent three torps (11m depth - the tanker draft is 10,5m) So. I aimed and shot 1. at bow, 2. at bridge (under bridge - keel) and 3. rudder. Just for test. Results:
1st torp blow up under bow - good, the 2nd one blow up under the bridge - almost mid of the ship. And the 3rd passed under rudder. No worked. This is kind of lucky, maybe this is very close to realism too I mean another dude torpedo. I think it`s fair IMO :up:
I played to December 1940 last time and I noticed only 3 or 4 dudes torps. This is strange am I right (300 000 Brt +)? I mean should be a bit more. I used only G7a torps.
The only thing I wish for this, it`s a set up torpedo a bit deeper (bigger tolerance ) - I don`t know is it possible - not sure about mechanism discribed by you above. It is really hard to set up by dragging the depth from 10.5 to 11m. 11.1m is to deep I`m affraid.
Anyway I appreciate your hard job and thank you so much,
Kurtz:salute:
volodya61
04-30-12, 10:46 AM
I've noticed in other forums that people are misinterpreting the magnetic detonator fix. The magnetic detonator fix allows magnetic torpedoes to detonate on GR2 style ships AND dat style ships (dat style ships already worked because they have the required node attached to the root node). This magnetic detonator fix also fixes the problem of player's sub not incurring hull damage (decrease in hull %) from depth charges and bombs.
This should clear up any confusions.
Thanks for the explanation.
TheDarkWraith
04-30-12, 02:21 PM
Thank you soooo much, TDW!
If I modified the exe (used the hydrophone fix) with the previous version, then deactivated it, and am now using the new version of the patcher, do you think it could cause some damage to the game's files? Should I reinstall the game and then use the new version of the patcher or is it safe to patch with different versions?
The patcher app does nothing but read the patch files and apply/deapply them. The version of the patcher app has no bearing on it's functionality or lack of. There is no need to reinstall. Different versions can apply/remove another versions patch without problems :up:
TheDarkWraith
04-30-12, 02:22 PM
The only thing I wish for this, it`s a set up torpedo a bit deeper (bigger tolerance ) - I don`t know is it possible - not sure about mechanism discribed by you above. It is really hard to set up by dragging the depth from 10.5 to 11m. 11.1m is to deep I`m affraid.
Anyway I appreciate your hard job and thank you so much,
Kurtz:salute:
I'll release a modifed torpedoes .sim file that increases the magnetic detonator range of the torpedoes to 4m here soon.
TheDarkWraith
04-30-12, 02:32 PM
Thanks for the explanation.
I see your explanation on sukhoi is incorrect. There are two patch files required for the CO2 bug fix. You need to open TDW_SH5_Patches.s5p and apply Patch 5 (both changes). Then you also need to open TDW_SHSim_Patch.s5p and apply Patch 1 (all 3 changes). Then the CO2 bug will be fixed :yep:
volodya61
04-30-12, 03:24 PM
I see your explanation on sukhoi is incorrect. There are two patch files required for the CO2 bug fix. You need to open TDW_SH5_Patches.s5p and apply Patch 5 (both changes). Then you also need to open TDW_SHSim_Patch.s5p and apply Patch 1 (all 3 changes). Then the CO2 bug will be fixed :yep:
Thanks again TDW, but explanation describes changes to both files: sh5.exe and SHSim.act
Look at screen, please:
http://s2.ipicture.ru/uploads/20120501/8R63BU77.jpg
TheDarkWraith
04-30-12, 03:54 PM
Thanks again TDW, but explanation describes changes to both files: sh5.exe and SHSim.act
Look at screen, please:
ah ok! My Russian is non-existent. Google translate is the only way I can read your language :yep:
col_Kurtz
04-30-12, 04:03 PM
I'll release a modifed torpedoes .sim file that increases the magnetic detonator range of the torpedoes to 4m here soon.
Ayey :salute:
TheDarkWraith
04-30-12, 05:20 PM
Torpedo magnetic detonators set to 4m download can be found at bottom of post #1 :DL
volodya61
04-30-12, 05:31 PM
Good news, thanks
EDIT: FX update 0.19 has the same files, overwrite them?
EDIT: FX update :hmmm: that's why I thought that the patch for fixing broken magnetic detonator doesn't work for dat-models
PS: And now everything work great :up: :salute:
TheDarkWraith
04-30-12, 09:00 PM
Today I finally narrowed down the routine that checks the torpedo impact angle when it collides with an object. I have to say my first reaction to the code was a huge WTF? I'm still trying to digest and figure out what the hell they were thinking. There's a lot of multiplication of fractions into the result that I can't for the life of me figure out why. It should be a simple test of:
for all min and max angles defined:
if max angle < torp impact angle < min angle then get random value. If random value < dud % chance torp is dud
But no, they have this complicated mess of multiplications and taking the cos value of something :doh: I have to try and figure out what this mess means.
For testing I set the dud % chance to 100% in the torpedo sim file for every angles defined. That way I know for sure I should have a dud on impact. But stepping through the debugger I always see the code say no dud :nope: So for fun I changed the code so that every torpedo impact was a dud. This is interesting: instead of 'dying' and sinking to the bottom it kept bouncing on the side of the ship until it could get by and then just kept going. I got the message that torpedo was a dud also. Not quite sure what to make of that :hmmm:
Maybe you all can help me figure this out:
So game says collision imminent! Code jumps to routine that checks for impact. Impact detected. Now it checks torpedo impact angle:
first thing it does is appears to store the torpedo impact angle on the floating point stack (-0.9527535438537597656 in this case)
next it stores 0.0174532923847436905 on the floating point stack (does this constant mean anything to anyone?)
then it loads the max angle allowed to the floating point stack (90.0 in this case)
then it multiplies these two values together (0.0174532923847436905 X 90.0). Why? Is this trying to convert to radians?
the result of that multiplication is 1.5707963146269321440 (looks like a radian value)
then it takes the COS of that value
result of that is 1.2167964475064260060E-08
then it swaps the torpedo impact angle ST2 (-0.9527535438537597656) with the result ST0 (1.2167964475064260060E-08) so that the torpedo impact angle is at top of floating point stack (result resides in ST2, torpedo impact angle in ST0)
then a floating point compare is performed of ST2 (1.2167964475064260060E-08) against the stack top ST0 (-0.9527535438537597656) and stores the results in the Integer FLAGS (EFLAGS) register
then ST2 is popped from the floating point stack
then if result of compare is below (CF=1 of EFLAGS register) then it increments a counter and loads pointers to the next set of angles. I see a problem here: the other angle of the set is never checked. The only time the second angle (which would be the min angle) is checked is if the floating compare is above (CF=0). Then if the result of that second angle is not below (CF=0) then jump to calculate dud % chance else torp explodes.
As you can see this will always jump to torpedo impact! Something is wacky here and I'm just not seeing it...
It needs to be coded so that it's checking the min and max angles before jumping to next set of angles. This way if the torp angle falls within the min and max angles then the dud % chance can be calculated. With the code as it is it never even checks the dud % chance thus we never get any duds
first thing it does is appears to store the torpedo impact angle on the floating point stack (-0.9527535438537597656 in this case)
next it stores 0.0174532923847436905 on the floating point stack (does this constant mean anything to anyone?)
then it loads the max angle allowed to the floating point stack (90.0 in this case)
then it multiplies these two values together (0.0174532923847436905 X 90.0). Why? Is this trying to convert to radians?
the result of that multiplication is 1.5707963146269321440 (looks like a radian value)
then it takes the COS of that value
result of that is 1.2167964475064260060E-08
then it swaps the torpedo impact angle ST2 (-0.9527535438537597656) with the result ST0 (1.2167964475064260060E-08) so that the torpedo impact angle is at top of floating point stack (result resides in ST2, torpedo impact angle in ST0)
then a floating point compare is performed of ST2 (1.2167964475064260060E-08) against the stack top ST0 (-0.9527535438537597656) and stores the results in the Integer FLAGS (EFLAGS) register
then ST2 is popped from the floating point stack
then if result of compare is below (CF=1 of EFLAGS register) then it increments a counter and loads pointers to the next set of angles. I see a problem here: the other angle of the set is never checked. The only time the second angle (which would be the min angle) is checked is if the floating compare is above (CF=0). Then if the result of that second angle is not below (CF=0) then jump to calculate dud % chance else torp explodes.
As you can see this will always jump to torpedo impact! Something is wacky here and I'm just not seeing it...
What the heck is that? :hmmm:
man, you are the Watson & Crick of hex code. Sometimes I wonder if even a single bit of devs code will be left, once you will get this game completely debugged...
anyway, trying to answer to one of your questions, 0.0174532923847436905 radians is almost 1 deg, so you could be right in stating that they wanted to convert the angle in radians. Don't ask me more, as I don't understand much of this mess. :nope:
TheDarkWraith
05-01-12, 01:17 PM
I think I understand the problem now with the no duds. We specify the torpedo angles (min and max) as first quadrant coordinates (between 0 and 90 degrees) in the torpedoes .sim file. The game calculates the torpedo impact angle as a true north angle. For example: I placed a NLL ship out 2000m due north from my sub. My sub was @ heading 0. The NLL was @ heading 90. I fired a torpedo at it. When the game said a collision happened the angle it reported for the torpedo impact angle was -0.992 or 172.75 degrees. This 172 degrees is being compared to the min and max torpedo angle values we specified. As we specify those min and max angles as first quadrant coordinates the result will always be torpedo impact (no duds). I have to somehow convert the torpedo angle the game computes into a first quadrant coordinate.
What I'm thinking of doing is taking the absolute value of the torpedo angle reported. This will ensure the angle is always somewhere in quadrant 1 or 4. Abs(-0.992) is 0.992 or 7.25 degrees. Then subtract that value from 90 to ensure value is always in first quadrant (90 - 7.25 = 82.75 degrees). Now that value can be compared to all the min and max torpedo angles specified in torpedoes .sim file.
Let's see what happens if torpedo angle is 260 degrees (glancing blow): 260 degrees * 0.0174532923847436905 = 4.54 radians. Cos(4.54) = -0.1715. So we'll say game reports impact angle as -0.1715. We take the abs of it and get 0.1715. COS-1(0.1715) = 1.3984 radians. 1.3984 / 0.0174532923847436905 = ~80 degrees. 90 - 80 degrees = 10 degrees. Thus the angle the torpedo makes with the plane of the ship's side is 10 degrees. Now we can check for duds :DL
Does anyone see any probems in my thinking and/or math? :06:
next it stores 0.0174532923847436905 on the floating point stack (does this constant mean anything to anyone?)
yes.
1°= pi/180 rad = 0.0174532923847436905
http://img.xrmb2.net/images/306006.jpeg
col_Kurtz
05-01-12, 05:04 PM
Torpedo magnetic detonators set to 4m download can be found at bottom of post #1 :DL
Tested Historical mission with unfortunate Cimmaron. Depth max - 12meters 3 times in a row. I broke she in a half again :cool: Superb! :yeah:
At first time each of three torps blowed up. Next time, two times blowed up. And the last test two times again :rock: All with external view.
Thanks a lot TDW!:salute:
TheDarkWraith
05-01-12, 05:06 PM
alright I finally figured out the needed code to get the duds working :rock: It was close to what I posted above :D
Now there is something else odd for the duds. Once the game decides that the torpedo impact angle falls within a min, max defined set then it goes to calculate the dud % chance. Now how it does it makes no sense:
(these are notes from my debugger)
Gets a random value to compare with torpedo random chance of being a dud
Load the random % chance of being a dud (as defined in sim file) into XMM1
Multiply the % chance of being a dud (XMM1) by 0.4544053 (what is this constant and why is it needed?)
Multiply that result (XMM1) by 0.1507767 (what is this constant and why is it needed?)
Multiply that result (XMM1) by 1.0 (what is this constant and why is it needed?)
converts a signed doubleword from EAX to a single-precision FP value in the low doubleword of the destination operand. The upper 3 doublewords are left unchanged. Stores in XMM0
Multiplies XMM0 by a constant of 0.003051851 (what is this constant and why is it needed?)
compares the low-order single-precision FP values in XMM1 and XMM0. ZF, PF, and CF are set according to the result. OF, AF, and AF are cleared. The unordered result is returned if either source is a NaN (QNaN or SNaN).
Result of this check. If before then torpedo impact, if after then dud (always before thus torpedo impact instead of dud!)
So now I'm trying to figure out what these constants are and why they are needed. A dud should be a dud right? I mean if the game says torpedo impact angle falls within min,max values it should retrieve the % chance of dud and get a random value. Compare the two values. If % chance <= random value then dud, if not then torpedo impact :hmmm:
TheDarkWraith
05-01-12, 07:35 PM
Updated SHSim.act patch to fix the no torpedo duds available at bottom of post #1 (Updated sim patch to fix the no torpedo dud problem) :rock:
I changed the game code to be the torpedo is a dud if it fails the random value test. I have no clue what that other BS of multiplying by all those other constants was for.
You'll like what I did with the torpedo when it is a dud (for those that are impact type) :yep:
:|\\
EDIT: spotted a possible bug. The magnetic detonators will still detonate. Looking into it...
EDIT2: there's no code for even checking for duds on magnetic torpedoes (that I can find). Maybe because magnetic detonators are reliable? Maybe it was only impact type detonators that could be duds (due to angle they collided with unit)? :06: Maybe I need to add some code that can make the magnetic detonates have a random chance of being a dud?
EDIT: spotted a possible bug. The magnetic detonators will still detonate. Looking into it...
EDIT2: there's no code for even checking for duds on magnetic torpedoes (that I can find). Maybe because magnetic detonators are reliable? Maybe it was only impact type detonators that could be duds (due to angle they collided with unit)? :06: Maybe I need to add some code that can make the magnetic detonates have a random chance of being a dud?
Great stuff TDW! :woot:
I think that it's like that with the other SH games too, impact torpedoes cause only duds and magnetic torpedoes cause only premature explosions. And the premature explosions work already like they should, rough seas make them detonate. So in my opinion this is not that critical issue.
Sartoris
05-02-12, 04:14 AM
Yet another major breakthrough! Thank you, TDW!:salute::yeah::woot:
Great stuff TDW! :woot:
I think that it's like that with the other SH games too, impact torpedoes cause only duds and magnetic torpedoes cause only premature explosions. And the premature explosions work already like they should, rough seas make them detonate. So in my opinion this is not that critical issue.
In SH3 magnetic torps do not detonate when strike hull at obtuse angle - saw it many-many times. Magnets only reliably activate when passing under keel.
But, yes, UN-BE-LIEVABLE work, TDW!:o :yeah:
You are a one man army :salute:
Great stuff TDW! :woot:
I think that it's like that with the other SH games too, impact torpedoes cause only duds and magnetic torpedoes cause only premature explosions. And the premature explosions work already like they should, rough seas make them detonate. So in my opinion this is not that critical issue.
Too bad,
it would be nice having magnetic torps premature explosions rate affected by the distance from the magnetic north, as well as duds rate connected with the tonnage of the target ship. Features that probably, as far as SH5 is concerned, have to be dismissed as "sci-fi" :(
Anyway, brilliant job TDW! :yeah:
TheDarkWraith
05-02-12, 07:28 PM
Too bad,
it would be nice having magnetic torps premature explosions rate affected by the distance from the magnetic north, as well as duds rate connected with the tonnage of the target ship. Features that probably, as far as SH5 is concerned, have to be dismissed as "sci-fi" :(
Anyway, brilliant job TDW! :yeah:
Those are actually great ideas. All I have to do is find the memory locations that denote these values then it's just a simple matter of adding some assembly code :yep: The hard part is finding these memory locations as everything is pointer based so you have no idea what so and so pointer is actually pointing to. The ones that load values onto the floating point stack are easy to track down because you can usually discern what they are from the value they load onto the floating point stack. I have more than 50% of the assembly code for the torpedoes mapped out so I have a really good idea what the game is doing with them.
I really like the idea of magnetic torpedoes dud rate controlled by tonnage of unit...I'm going to concentrate on tracking this one down. Seems very logical that this would influence the magnetic detonator on the torp in real life. I can make a controlled experiment where I know what ship is being attacked and I'll know it's tonnage from it's .sim file. Then when game tells me impact imminent I can search for this tonnage value. If I can find the value and one of the CPU registers is pointing to the object that contains this value then this will be possible to do. One of the registers has to be pointing to the object because the game is constantly computing distance to impact. The only way it can compute distance is if it knows where the torp is and where the object being collided with is located.
TheDarkWraith
05-02-12, 08:43 PM
Been looking into the KGrid CTD problem and found out why it causes the game to CTD: it's trying to dereference a null pointer :nope: Great work devs, tell me how in the hell this passed quality control? :stare:
Those are actually great ideas. All I have to do is find the memory locations that denote these values then it's just a simple matter of adding some assembly code :yep: The hard part is finding these memory locations as everything is pointer based so you have no idea what so and so pointer is actually pointing to. The ones that load values onto the floating point stack are easy to track down because you can usually discern what they are from the value they load onto the floating point stack. I have more than 50% of the assembly code for the torpedoes mapped out so I have a really good idea what the game is doing with them.
I really like the idea of magnetic torpedoes dud rate controlled by tonnage of unit...I'm going to concentrate on tracking this one down. Seems very logical that this would influence the magnetic detonator on the torp in real life. I can make a controlled experiment where I know what ship is being attacked and I'll know it's tonnage from it's .sim file. Then when game tells me impact imminent I can search for this tonnage value. If I can find the value and one of the CPU registers is pointing to the object that contains this value then this will be possible to do. One of the registers has to be pointing to the object because the game is constantly computing distance to impact. The only way it can compute distance is if it knows where the torp is and where the object being collided with is located.
Thank you The Dark Wraith, I had forgot that nearly nothing is impossible for you! :D
by the way of magnetic torpedoes dud chance, I've read somewhere that magnetic detonators were reliable only on ships weighting 2,000 tonnes or more. Another common problem plaguing german torps from the outbreak of the conflict up to spring '41 was depth keeping related. Premature explosions and impact pistol dud rates too changed in the course of the war. I wonder if the extent of these problems could be made variable also in game, depending on current date.
Some references to known german torps reliability problems:
http://www.uboataces.com/weapon-torpedo.shtml
http://uboat.net:8080/history/torpedo_crisis.htm
http://www.feldgrau.net/forum/viewtopic.php?f=41&t=3261
http://forum.axishistory.com/viewtopic.php?f=110&t=83029
http://forum.kickinbak.com/viewtopic.php?f=11&t=1103&start=10#p10369
Been looking into the KGrid CTD problem and found out why it causes the game to CTD: it's trying to dereference a null pointer :nope: Great work devs, tell me how in the hell this passed quality control? :stare:
Is it fixable? :Kaleun_Salivating:
TheDarkWraith
05-03-12, 09:09 AM
by the way of magnetic torpedoes dud chance, I've read somewhere that magnetic detonators were reliable only on ships weighting 2,000 tonnes or more. Another common problem plaguing german torps from the outbreak of the conflict up to spring '41 was depth keeping related. Premature explosions and impact pistol dud rates too changed in the course of the war. I wonder if the extent of these problems could be made variable also in game, depending on current date.
Depth keeping problems and heading problems are already modeled and working correctly. Premature explosions based on wave height is also modeled and working correctly. You specify these parameters in the torpedoes .sim file. These parameters are specified via date ranges.
Is it fixable? :Kaleun_Salivating:
Nearly impossible to fix. This is the main pointer for the KGrid map. Everything else related to the KGrid map is based on it. I have no idea what it's actual memory address should be :dead:
Depth keeping problems and heading problems are already modeled and working correctly. Premature explosions based on wave height is also modeled and working correctly. You specify these parameters in the torpedoes .sim file. These parameters are specified via date ranges.
Good!
some more remarks:
- afaik magnetic detonators were more prone than impact pistols to premature detonations;
- magnetic detonators were generally not as sensible as impact pistols to the angle of approach of the torpedo to the target. According to one of your previous posts, this is correctly modelled in game. Nevertheless, due to the fact that magnetic detonators were sensible to the change of magnetic fileld over time, rather than to its absolute value, torpedoes aimed to the stern of target ships had an higher probability to fail detonating, because of the reduced differential speed. In order to model it in game you should compare the vector of the torpedo with the one of its target.
Nearly impossible to fix. This is the main pointer for the KGrid map. Everything else related to the KGrid map is based on it. I have no idea what it's actual memory address should be :dead:
Okay, we will live with it, but shame on ubisoft for it :-?
Been looking into the KGrid CTD problem :stare:
So KGrid is the Kriegsmarine Grid on the maps i assume.
What are the problems with the Kriegsmarine Grid? Never heard of the KGrid CTD.
TheDarkWraith
05-04-12, 12:13 AM
So KGrid is the Kriegsmarine Grid on the maps i assume.
What are the problems with the Kriegsmarine Grid? Never heard of the KGrid CTD.
Exactly what you know, it CTDs the game when you try to turn it on.
Finally found the initializer function that's called when the toredo is launched. This function sets up the torpedo with all the data it needs (values from .sim file, current depth, etc.). There is a conversion factor being used on the speed settings that I can't figure out:
0.05149993
Every speed setting specified in .sim file is multiplied by the value above. Does this value mean anything to anybody? :06:
Finally found the initializer function that's called when the toredo is launched. This function sets up the torpedo with all the data it needs (values from .sim file, current depth, etc.). There is a conversion factor being used on the speed settings that I can't figure out:
0.05149993
Every speed setting specified in .sim file is multiplied by the value above. Does this value mean anything to anybody? :06:
:hmmm: maybe this:
1/10 knot = 0.051(4) m/s
THE_MASK
05-04-12, 06:43 AM
The large grid map squares on the navmap are exactly 10 times larger than the smaller ones .
1/10 knot = 0.0514 m/s - maybe this looks better? :)
EDIT: but 1/10 knot = 0.05144444 m/s, not 0.05149993
yes, I mistyped it. And yes, this conversion factor doesn't equate exactly the figure found by TDW, but it is the best match I've found so far.
Thanks Volodya :DL
TheDarkWraith
05-04-12, 09:57 AM
yes, I mistyped it. And yes, this conversion factor doesn't equate exactly the figure found by TDW, but it is the best match I've found so far.
Thanks Volodya :DL
Ok, but why 1/10 knot? Why the 10 knots? Why not 20 knots? Understand where I'm coming from? Maybe Sober has the best explanation with the large squares being 10 times larger but it still doesn't make sense to me :hmmm:
Madox58
05-04-12, 10:22 AM
The SH Worlds are 1/10 scale.
.1 meters = roughly 1 meter when you check 3D models
So you'd need to scale the speed settings since they are usually close to real life speeds.
This figure you found would scale and convert real knots to scaled (1/10th ) meters per second.
That's my thought.
:)
The SH Worlds are 1/10 scale.
.1 meters = roughly 1 meter when you check 3D models
So you'd need to scale the speed settings since they are usually close to real life speeds.
This figure you found would scale and convert real knots to scaled (1/10th ) meters per second.
That's my thought.
:)
It makes sense to me
TheDarkWraith
05-04-12, 12:10 PM
The SH Worlds are 1/10 scale.
.1 meters = roughly 1 meter when you check 3D models
So you'd need to scale the speed settings since they are usually close to real life speeds.
This figure you found would scale and convert real knots to scaled (1/10th ) meters per second.
That's my thought.
:)
Ok I'll buy that :up: The GR2 files specify UnitsPerMeter as 0.1 so it makes sense now. Thanks all :yeah:
TheDarkWraith
05-04-12, 12:18 PM
Just found an annoying 'bug' with OllyDebug. If you have no breakpoints set and you exit the app it will write new .udd files that are blank :o Another annoying 'feature' is when the file being debugged has changed (via modifications, additions, deletions, etc.) it will not load the udd file for it (it won't load the breakpoints and all). Had to waste a day writing my own app that will take Olly's udd files and read them and write my own udd files (this way I can merge several udd files of the same name into a master udd file). The joys of working with other peoples apps...:shifty:
Madox58
05-04-12, 01:29 PM
0.05149993 also equals some other interesting measurements.
0.05149993 = Earth's equatorial radius, and polar radius of 0.000000008
As does .05144444444
Since the SH World is flat, could those also be special numbers to skew things like latitude and longitude when in the Northern areas??
:hmmm:
If you take the difference between the two, the Earth radius at both points are different.
So if I'm a little North, does the Game engine use this difference to affect things to make it appear as if we are traveling the correct distance at the correct speed?
TheDarkWraith
05-04-12, 05:39 PM
Interesting points :hmmm: I'll be on the look out for things like the above as I dig deeper into the .exe and .act files :up:
I'll be sure to post any other constants I run into that just don't make any sense to me :yep:
TheDarkWraith
05-05-12, 05:47 PM
Another constant that I'm not sure how or why it's value is what it is:
1016.047
This value is multiplied by the torpedoes impulse (which is usually a value of 2000). What are they converting the torpedoes impulse into? :06:
Some little tidbits of info: game restricts min torpedo depth to 1m. Max torpedo depth allowed is 50m (everytime you adjust torpedo depth on the torpedo box a function is called to ensure the value is clamped to these values)
Another constant: 0.1056457
This constant gets multiplied by some huge number (looks to be related to distance from game origin but not exactly sure still)
THE_MASK
05-05-12, 06:06 PM
Another constant that I'm not sure how or why it's value is what it is:
1016.047
This value is multiplied by the torpedoes impulse (which is usually a value of 2000). What are they converting the torpedoes impulse into? :06:
Some little tidbits of info: game restricts min torpedo depth to 1m. Max torpedo depth allowed is 50m (everytime you adjust torpedo depth on the torpedo box a function is called to ensure the value is clamped to these values)I just googled it 1016.047 .
Long Ton to Kilograms
Maybe something to do with realistic measurements checked in the game options .
http://www.google.com.au/url?sa=t&rct=j&q=1016.047&source=web&cd=1&ved=0CF8QFjAA&url=http%3A%2F%2Fwww.ehow.com%2Finfo_8428806_conve rsion-factors-tons-kilograms.html&ei=_rGlT9D1O8aQiQfvrtSqAw&usg=AFQjCNHA-2YAsHZizsJ107FsGP9LohTVsA
TheDarkWraith
05-05-12, 07:22 PM
I just googled it 1016.047 .
Long Ton to Kilograms
Maybe something to do with realistic measurements checked in the game options .
http://www.google.com.au/url?sa=t&rct=j&q=1016.047&source=web&cd=1&ved=0CF8QFjAA&url=http%3A%2F%2Fwww.ehow.com%2Finfo_8428806_conve rsion-factors-tons-kilograms.html&ei=_rGlT9D1O8aQiQfvrtSqAw&usg=AFQjCNHA-2YAsHZizsJ107FsGP9LohTVsA
Interesting :hmmm: So this impulse value (converted to Kgs) seems to be used to determine if the object it hits 'moves' or not probably...I'll flag that for follow up.
Just found where when the torpedo is initialized it's initial speed is multiplied by some factor (probably the torpedo speed ability). My question is just how reliable was the torpedo speed? For instance, if they set the torpedo speed to 30knots did the torpedo actually run at 30knots or was there some known deviation that could take place? This would be the perfect place for me to inject some code to model this deviation (if any happened in real life) :yep:
Found another intersting constant: 9.5
IIRC 9.5 is the acceleration rate in m/s2 right?
The game takes the torpedo speed and divides it by this number (9.5) and stores the result in memory
Madox58
05-06-12, 02:30 PM
9.8 is the accepted rate of free fall depending on several factors.
Do an extreme HALO and that rate is higher until you start getting into thicker air.
Somewhere around 9.72 (but you need to be above 90,000 feet to hit that mark!)
Newton couldn't go high enuff to see that part of the calculations.
:haha:
I don't see why one would use that measurement for a Torpedo which is not in free fall, but on a horizontal travel path.
Even useing that for a sink rate would be wrong considering it's in salt water which has a different sink rate.
My question is just how reliable was the torpedo speed? For instance, if they set the torpedo speed to 30knots did the torpedo actually run at 30knots or was there some known deviation that could take place?
Torpedo speed runs during the entire route of 13km constantly with 30ktn accept at the acceleration phase, which is short and negligible.
TheDarkWraith
05-07-12, 11:11 AM
The one mystery that has always eluded me since SH3 has finally been solved :rock: While deep into the debugger I finally nailed down the function that clones the torpedo when it's launched (akin to Torpedo newtorpedo = new Torpedo() in C# language). This function loads all the default values (same as contructor initializing variables) for the new torpedo. The default heading for new torpedo is 0, the default depth is 2, etc. Now I know why torpedo always spawns heading north (ordered heading is 0). More importantly I have the memory address of where this default value is located :DL Now one could change this memory address before firing a torpedo to ensure torpedo is heading in the right direction say for torpedo PT boats or the likes...:hmmm:
bigboywooly
05-07-12, 01:56 PM
be ideal if the heading could be changed.
Destroyers,PT boats and AI uboats could benefit as well as aircraft.
Maybe make the heading the same as the unit carrying them :hmmm:
TheDarkWraith
05-07-12, 03:08 PM
be ideal if the heading could be changed.
Destroyers,PT boats and AI uboats could benefit as well as aircraft.
Maybe make the heading the same as the unit carrying them :hmmm:
That's exactly my thinking...I've bookmarked that memory address for further follow up. Right now I'm still deep into torpedo code trying to figure out how the game models the magnetic detonator.
TheDarkWraith
05-07-12, 03:14 PM
9.8 is the accepted rate of free fall depending on several factors.
Do an extreme HALO and that rate is higher until you start getting into thicker air.
Somewhere around 9.72 (but you need to be above 90,000 feet to hit that mark!)
Newton couldn't go high enuff to see that part of the calculations.
:haha:
I don't see why one would use that measurement for a Torpedo which is not in free fall, but on a horizontal travel path.
Even useing that for a sink rate would be wrong considering it's in salt water which has a different sink rate.
Some clarification:
There is a constant that is loaded, 95, which is then converted into game units (95 X 0.1 = 9.5)
The current torpedo ordered speed (2.265997 - TI fastest speed in game units) is divided by the constant above (9.5) to yield a result (0.2385260) that is stored away. This result looks like how far torpedo moves in game units every second :hmmm:
Madox58
05-07-12, 03:36 PM
Now that makes alot more sense.
:yep:
Nice work!
:up:
Hi!
I have serious issues getting the new fixes to work... I downloaded the 4 meters magnetic detonation .sim-file, but still the torpedoes explode only when basicly touching the ship's bottom (I aimed at the center of the ship).
And the dud fix makes my computer freeze when there is a dud. Can't figure out why this doesn't work, could it be somekind of language incombatability, I have the european (scandinavian) copy of the game.
Any other results? Do the duds work for others? Must... get... this working...
volodya61
05-12-12, 09:00 AM
Hi!
My torpedoes explode normally (when using magnetic detonators), but
And the dud fix makes my computer freeze when there is a dud.
have the same problem.. (when using only impact detonator)
have the same problem.. (when using only impact detonator)
Nice to know that I'm not alone! I hope there will be some solution to this.
dertien
05-12-12, 03:05 PM
Trying this out, good work; thx
Captain Joe
05-12-12, 03:27 PM
Im getting ctd the second the torp hits the ship if i patch the magnetic impact. i cannot use it either. did not think of trying it with the switch to impact detonation. will try and report.
volodya61
05-13-12, 07:49 PM
http://www.sukhoi.ru/forum/images/smilies/help.gif TDW
I always (too often) get a CTD or freeze when try using only impact detonator :cry: :damn:
Krauter
05-20-12, 10:47 AM
So just to clarify, to use these fixes I must first disable all of my mods, input the patches and then re-enable my mods?
volodya61
05-20-12, 11:29 AM
So just to clarify, to use these fixes I must first disable all of my mods, input the patches and then re-enable my mods?
I think it doesn't matter.
TheDarkWraith
05-20-12, 11:29 AM
So just to clarify, to use these fixes I must first disable all of my mods, input the patches and then re-enable my mods?
No reason to disable mods. The patcher patches the .exe and .act files. If you have a mod that includes the .exe or any of the .act files then you have more difficulties to overcome.
Krauter
05-20-12, 11:31 AM
Ok, was just wondering due to this.
This works only on unmodified, stock SH5.exe files!!
TheDarkWraith
05-20-12, 11:31 AM
Im getting ctd the second the torp hits the ship if i patch the magnetic impact. i cannot use it either. did not think of trying it with the switch to impact detonation. will try and report.
http://www.sukhoi.ru/forum/images/smilies/help.gif TDW
I always (too often) get a CTD or freeze when try using only impact detonator :cry: :damn:
Sounds like a ship problem. Try making a single mission with just one ship (a stock SH5 one - say NLL) and see what happens. I've tested this with stock SH5 ships and the imported ships I made and have had no problems.
volodya61
05-20-12, 11:38 AM
Yes. These were imported ships from the Uekel's MTNS mod.
TheDarkWraith
05-20-12, 11:45 AM
Yes. These were imported ships from the Uekel's MTNS mod.
Try making a single mission using one of the ships that freezes from his mod. If it does still freeze send me the ship (it's entire \data\Sea\x folder) and the single mission so I can fire up the debugger and see what's going on :yep:
volodya61
05-20-12, 11:57 AM
Try making a single mission using one of the ships that freezes from his mod. If it does still freeze send me the ship (it's entire \data\Sea\x folder) and the single mission so I can fire up the debugger and see what's going on :yep:
OK. I'll do it tomorrow and send it to you.
I tried the duds again, put high dud-value to torpedoes_g7a-e.sim, used the patcher, made a single mission with one NLL Liberty ship, but still same results, game freezes when the torpedo is hitting the ship...
I'm using the MMM 0.5 mod.
TheDarkWraith
05-20-12, 12:58 PM
I tried the duds again, put high dud-value to torpedoes_g7a-e.sim, used the patcher, made a single mission with one NLL Liberty ship, but still same results, game freezes when the torpedo is hitting the ship...
I'm using the MMM 0.5 mod.
I'll send you my test mission I used for testing this patch change. Give me a few :up:
TheDarkWraith
05-20-12, 01:08 PM
This is the test mission I used for developing the patches related to magnetic detonators and torpedo duds: http://www.mediafire.com/?chh6kfmi7y7a64o
This single mission has stock SH5 ships and imported ships that I made so it tests GR2 files and dat files.
The torpedoes.sim file is setup for magnetic detonator testing (all premature detonations, guidance problems, depth keeping problems, dud chances, etc. have been removed). You'll need to re-enable some or all of these depending on what kind of testing you want to do (if you want to do dud testing then you'll need to change the % chance for the duds from 0 to some number)
:|\\
Thanks TDW!
Will check this out later, hopefully tonight, or then tomorrow. Really need the duds! :DL
THE_MASK
05-20-12, 04:50 PM
With all the patches enabled the hatch now works as intended .
9.2 Patch 1.2 change list
Bugs and issues
- Fix for CO2 not being saved correctly
-Fix for crew morale
- Fix for weather being reset to clear weather after load
- Fixes for crewmen showing under water under certain conditions
- Fixes for ships exploding in ports or hitting the shore<<<<<<<<<<<doesnt seem to happen as often in the single mission "in spite of everything"
- Now plot course tool is no longer accessible in the bunker
- Several fixes to ship recognition manual
- Man the deck gun / flak gun orders doesn***8217;t cost morale anymore
- No more crewmen on burning ships
- Several crew animation and interaction fixes
- Fixed some performance problems inside submarine
- Fixed selection contour being visible when a character was already selected
- Fixed a bug where the moon was closer than it should
- Fixed a bug where the sun disk would be visible underneath thick cloud cover
- Fixed torpedo doors
- Fixed torpedo propeller not turning
- Fixed electric torpedoes trail
- Fixed several dials that were not working inside the submarine
- Fixed a bug where the player can get stuck in the sub's outer hatch geometry
- Fixed a problem with magnetic detonators didn't work properly
- Fixed several localization problems on the German version
THE_MASK
05-20-12, 07:16 PM
If i have all the patches enabled and dont use any mods and do the tutorial the game goes back to the start of the intro movie when the torps are about to hit the first tutorial ship .
With all the patches enabled the hatch now works as intended .
9.2 Patch 1.2 change list
Never heard of a problem with the hatch?
9.2 Patch 1.2 change list
?
Actual the current exe-patcher is version v.0.0.4.
TheDarkWraith
05-20-12, 07:57 PM
If i have all the patches enabled and dont use any mods and do the tutorial the game goes back to the start of the intro movie when the torps are about to hit the first tutorial ship .
don't understand :06: This is good/bad/?
THE_MASK
05-20-12, 08:07 PM
don't understand :06: This is good/bad/?The game freezes and the desktop shows the start of the intro movie frozen . End SH5 program to fix it . Its not a complaint , just an observation . This only happens with the latest torp fix with the patcher .
TheDarkWraith
05-20-12, 08:14 PM
If i have all the patches enabled and dont use any mods and do the tutorial the game goes back to the start of the intro movie when the torps are about to hit the first tutorial ship .
The game freezes and the desktop shows the start of the intro movie frozen . End SH5 program to fix it . Its not a complaint , just an observation . This only happens with the latest torp fix with the patcher .
That may shed some light on something I saw in the Debugger in SHSim.act. When it says collision happened one of the first things it does is retrieve a pointer to SimData.act. Once it has the pointer it calls a function that returns a value denoting whether the user is playing a tutorial mission or not. I never followed that path to see what it did/lead to but sounds like I need to now :yep:
volodya61
05-20-12, 08:20 PM
The game freezes and the desktop shows the start of the intro movie frozen . End SH5 program to fix it . Its not a complaint , just an observation . This only happens with the latest torp fix with the patcher .
It's look like a problem which I have.
misha1967
05-20-12, 08:45 PM
OK, silly question, TDW:
The way I've been patching the sh5.exe so far is to use the app included in your NewUI 6_9_0. Is that the same as downloading the patch 1.0.24 and Simpatch from the first post in this thread?
TheDarkWraith
05-20-12, 08:58 PM
OK, silly question, TDW:
The way I've been patching the sh5.exe so far is to use the app included in your NewUI 6_9_0. Is that the same as downloading the patch 1.0.24 and Simpatch from the first post in this thread?
Should be. I'd use the new version though as it's more generic in nature and is compatible with the new layout of the S5P files. I'm surprised the version in v6.9.0 can read the new patch files. Hell maybe I made it backwards compatible :rotfl2:I really don't remember. I have to look at the code in VS to know exactly what I did.
volodya61
05-21-12, 07:28 AM
Hi TDW!
Just tried single mission. It's not the imported ships problem. Mods list:
-SH5 RUS
-Magnetic Detonators 4m by TDW
And all the patches enabled.
Game freezes when the torp is about to hit the first ship. Only end program can fix it.
Test single mission - http://www.gamefront.com/files/21735619/Test+Mission.7z (http://www.gamefront.com/files/21735619/Test+Mission.7z)
EDIT: Maybe it is important - torpedo depth is 1 m
TheDarkWraith
05-21-12, 07:53 AM
Hi TDW!
Just tried single mission. It's not the imported ships problem. Mods list:
-SH5 RUS
-Magnetic Detonators 4m by TDW
And all the patches enabled.
Game freezes when the torp is about to hit the first ship. Only end program can fix it.
Test single mission - http://www.gamefront.com/files/21735619/Test+Mission.7z (http://www.gamefront.com/files/21735619/Test+Mission.7z)
EDIT: Maybe it is important - torpedo depth is 1 m
I'll patch my exe and act files and try your single mission and report back :up:
Sorry to ask this here , but get you enter in your private message box :06:
I can't open it :nope: and idem with my user CP :shifty: database error !
TheDarkWraith
05-21-12, 08:10 AM
Sorry to ask this here , but get you enter in your private message box :06:
I can't open it :nope: and idem with my user CP :shifty: database error !
Same thing - database error :o
Ouf ! i have think i am alone :cry:
TDW So, I have not access to your latest version of the editor
But I managed to work with the one before :yeah:
I tried to send a message to Neal, but it does not work :nope:
KarlKoch
05-21-12, 09:12 AM
I tried to send a message to Neal, but it does not work :nope:
Announcement on SUBSIM (http://www.subsim.com/radioroom/announcement.php?f=249)
Looks like it also affects PM messages. :)
TDW confirmed, the amending SHSim.act patch makes the game freeze on impact torpedoes. You can look at it please?
TheDarkWraith
05-21-12, 09:21 AM
Hi TDW!
Just tried single mission. It's not the imported ships problem. Mods list:
-SH5 RUS
-Magnetic Detonators 4m by TDW
And all the patches enabled.
Game freezes when the torp is about to hit the first ship. Only end program can fix it.
Test single mission - http://www.gamefront.com/files/21735619/Test+Mission.7z (http://www.gamefront.com/files/21735619/Test+Mission.7z)
EDIT: Maybe it is important - torpedo depth is 1 m
Patched up my sh5.exe and .act files with all the patches
Ran your single mission
Set sights on 2nd ship from left. Fired tube 1 with magnetic detonator enabled, torp depth set to 1m. Torp hit ship but was dud.
Fired Tube 2 with magnetic detonator enabled, torp depth set to 1.5m below keel. Torp exploded when right under keel.
Set sights on furthest ship to right. Fired tube 3 with magnetic detonator disabled, torp depth set to 1m. Torp hit ship but was dud.
I can't reproduce the problems you or everyone else is having with the patches :hmmm: Everything works fine for me. Are you sure you are enabling all the items of each patch? Some patches have multiple items (2-4) and some require that a patch in another file is enabled also. Double check to ensure you have enabled all the required patches. It sounds like you are missing some :yep:
volodya61
05-21-12, 09:25 AM
To TDW
I disabled Torpedo dud fix and started test mission again.. All works fine.. No freezes, no CTDs..
EDIT: Double check to ensure you have enabled all the required patches. It sounds like you are missing some I enabled all patches :hmmm: :cry:
EDIT2: TDW confirmed, the amending SHSim.act patch makes the game freeze on impact torpedoes. You can look at it please? I think it's the same problem..
TheDarkWraith
05-21-12, 09:28 AM
To TDW
I disabled Torpedo dud fix and started test mission again.. All works fine.. No freezes, no CTDs..
When you enable the torpedo dud fix are you enabling all 4 changes? If not then it will cause problems :yep:
volodya61
05-21-12, 09:33 AM
When you enable the torpedo dud fix are you enabling all 4 changes? If not then it will cause problems :yep:
Yes, of course, all 4 changes.. and checked it again to make sure :yep:
TheDarkWraith
05-21-12, 09:35 AM
Yes, of course, all 4 changes.. and checked it again to make sure :yep:
Can you send me your SHSim.act file (unpatched)? I'd like to see if it's different than mine :yep:
You currently can't send PMs due to subsim maintenance...
THE_MASK
05-21-12, 09:40 AM
Downloaded the latest patcher 1.0.24
Extracted to SH5 game folder.
File\Open , there are 3 s5P files .
TDW_SH5_Patches.s5p
TDW_SHCollisions_Patch.s5p
TDW_SHSim_Patch.s5p
Double click on TDW_SH5_Patches.s5p .
Select path to sh5.exe , there are 5 +
Double click on TDW_SHCollisions_Patch.s5p
Select path to sh5.exe , there are 1 +
Double click on TDW_SHSim_Patch.s5p .
Select path to sh5.exe , there are 2 +
Make all True . I get the game freeze .
volodya61
05-21-12, 09:58 AM
Can you send me your SHSim.act file (unpatched)? I'd like to see if it's different than mine :yep:
You currently can't send PMs due to subsim maintenance...
Yes sure - http://www.mediafire.com/?23a1tpa9hktwox9
TheDarkWraith
05-21-12, 10:08 AM
Yes sure - http://www.mediafire.com/?23a1tpa9hktwox9
I checked the stock one against mine - identical
I checked your patched one against my patched one - identical
:hmmm:
volodya61
05-21-12, 10:21 AM
I checked the stock one against mine - identical
I checked your patched one against my patched one - identical
:hmmm:
I don't know what's wrong too. But I'm not alone. I see Rongel, Sober and others have the same problem.
TheDarkWraith
05-21-12, 10:31 AM
I don't know what's wrong too. But I'm not alone. I see Rongel, Sober and others have the same problem.
Have you tried disabling ALL mods (so you are playing stock SH5) while keeping the patches installed and seeing what happens? :06:
volodya61
05-21-12, 10:38 AM
Have you tried disabling ALL mods (so you are playing stock SH5) while keeping the patches installed and seeing what happens? :06:
I think it's almost stock.
Mods list:
-SH5 RUS
-Magnetic Detonators 4m by TDW
And all the patches enabled.
OK. I'll disable the Magnetic Detonators 4m by TDW and will try it again now.
TheDarkWraith
05-21-12, 10:42 AM
OK. I'll disable the Magnetic Detonators 4m by TDW and will try it again now.
What is SH5 RUS?
volodya61
05-21-12, 10:46 AM
What is SH5 RUS?
It's just Russian translation from the localized version. :)
EDIT: I'll disable it too to make sure)
TheDarkWraith
05-21-12, 11:00 AM
If disabling all mods doesn't work then try patching the files in the game's root folder - don't use JSGME to enable patched files. Make a backup of them first of course.
I've seen JSGME 'hiccup' when it comes to enabling/disabling files :yep:
volodya61
05-21-12, 11:18 AM
If disabling all mods doesn't work then try patching the files in the game's root folder - don't use JSGME to enable patched files. Make a backup of them first of course.
I've seen JSGME 'hiccup' when it comes to enabling/disabling files :yep:
Just tried the stock game. Only Test mission was enabled.
First torp is dud, second torp is dud, third torp while hitting the target.. and game freeze.
All files were patched in the game's root folder. I haven't used the JSGME to enable patched files.
I think, I'll try to reinstall the game and look again.
TheDarkWraith
05-21-12, 11:31 AM
Just tried the stock game. Only Test mission was enabled.
First torp is dud, second torp is dud, third torp while hitting the target.. and game freeze.
All files were patched in the game's root folder. I haven't used the JSGME to enable patched files.
I think, I'll try to reinstall the game and look again.
Is this different behavior than before? Did the game always freeze on first torp? Have you ever had duds before?
volodya61
05-21-12, 11:46 AM
Is this different behavior than before?
No, the same
Did the game always freeze on first torp?
No, sometimes second, sometimes third, sometimes other
Have you ever had duds before?
Yes
Nothing has changed :nope:
TheDarkWraith
05-21-12, 12:14 PM
I finally got the game to hang with the dud patch enabled. It only hung when I enabled a salvo. If I always shot single torpedoes it never hung. Don't use the dud patch anymore till I figure out why salvos cause the game to hang with this patch enabled :-?
volodya61
05-21-12, 12:26 PM
Unfortunately, not only salvo..
TheDarkWraith
05-21-12, 03:37 PM
Unfortunately, not only salvo..
Looks like I figured out why the game was being hung...appears I didn't clean up the floating point stack in my new functions (one reason) :shifty: Main reason is because I forgot to increase the size of the code section for my new functions :damn: Sometimes the windows loader would allocate more than enough space for the new functions, sometimes it wouldn't. Explains why sometimes it works, sometimes it doesn't (it would either interpret the bytes it found as code or as data - if as data game hung). Now that the code section size has been increased this problem is eliminated.
I'm testing the new patch file currently...
volodya61
05-21-12, 03:41 PM
I'm testing the new patch file currently...
Good news :yep:
Because I've reinstalled the game and it doesn't help :D
TheDarkWraith
05-21-12, 04:05 PM
Good news :yep:
Because I've reinstalled the game and it doesn't help :D
Much better! I've fired 12 salvos of 4 torps and not a single hang. Fired mutliple single torps also with no hang. Should have new version of patcher available soon :yeah:
volodya61
05-21-12, 04:33 PM
Much better! I've fired 12 salvos of 4 torps and not a single hang. Fired mutliple single torps also with no hang. Should have new version of patcher available soon :yeah:
Did you tested it with yours Magnetic Detonators 4m?
EDIT: Sometimes I get confused with the verbs :oops:
TheDarkWraith
05-21-12, 04:39 PM
Did you tested it with yours Magnetic Detonators 4m?
EDIT: Sometimes I get confused with the verbs :oops:
Sure did :up:
No problems :yeah:
Final testing now. I just updated the patch file and re-enabled the patch. Ensuring code looks correct in Debugger and game functions without error and then I'll post new version for download.
THE_MASK
05-21-12, 04:41 PM
Much better! I've fired 12 salvos of 4 torps and not a single hang. Fired mutliple single torps also with no hang. Should have new version of patcher available soon :yeah:Thankyou :salute:
TheDarkWraith
05-21-12, 04:52 PM
V1.0.25.0 released. See post #1
This version fixes the hang problem with the torpedo dud patch.
NOTE: DISABLE ALL PATCHES WITH OLD PATCHER BEFORE APPLYING NEW PATCHES WITH NEW PATCHER! THIS APPLIES ONLY TO PATCHES RELATED TO SHSIM.ACT AND SHCOLLISIONS.ACT
:|\\
volodya61
05-21-12, 04:55 PM
V1.0.25.0 released. See post #1
This version fixes the hang problem with the torpedo dud patch.
NOTE: DISABLE ALL PATCHES WITH OLD PATCHER BEFORE APPLYING NEW PATCHES WITH NEW PATCHER! THIS APPLIES ONLY TO PATCHES RELATED TO SHSIM.ACT AND SHCOLLISIONS.ACT
:|\\
Thank you very much! :woot: :yeah:
TheDarkWraith
05-21-12, 04:56 PM
Thank you very much! :woot: :yeah:
Let me know if you still have any problems with it :up:
THE_MASK
05-21-12, 05:24 PM
Could you redownload it please . I cannot access the file .
volodya61
05-21-12, 05:30 PM
Could you redownload it please . I cannot access the file .
:yep: me too.
TheDarkWraith
05-21-12, 05:31 PM
Could you redownload it please . I cannot access the file .
Freakin gamefront is always having issues :nope:
I posted an Alternate link at post #1 :up:
Someone just give me confirmation that everything is ok with this now. Everything works for me perfectly but I need to know it works perfectly for you all also :yep:
volodya61
05-21-12, 08:29 PM
Someone just give me confirmation that everything is ok with this now. Everything works for me perfectly but I need to know it works perfectly for you all also :yep:
Thank you TDW!
Everything works fine!
Brains already shut down.. for the first time didn't saw the fifth change and thought that nothing works.. reinstalled the game again.. :har:
already 5:30 AM, It's time to sleep :DL
Thanks again.. :salute:
THE_MASK
05-21-12, 08:48 PM
Thank you TDW!
Everything works fine!
Brains already shut down.. for the first time didn't saw the fifth change and thought that nothing works.. reinstalled the game again.. :har:
already 5:30 AM, It's time to sleep :DL
Thanks again.. :salute:You can call me the doctor . I jumped ahead in time , its 11:45 AM here .
TheDarkWraith
05-21-12, 09:26 PM
Thank you TDW!
Everything works fine!
I'll take that as the hang/freeze problem is fixed then :yeah:
I have noticed that even though I set the duds to 100% I still get non-duds occassionally. I'll have to do more digging in SHSim.act to figure out why. I'm almost 100% certain it has to do with the code that gets the random number. The code calls MSVCR90.rand to get a random number. It then converts the value returned into a single-precision floating point number. Then it multiplies that number by what appears to be a conversion factor. Everywhere throughout SH5.exe and all the other .act files when MSVCR90.rand is called it's return value is always multiplied by this conversion factor. It's this conversion factor that throws me for a loop. I don't understand where they got it's value from. I need to figure out how MSVCR90.rand returns the random number (what registers it affects). I know EAX is affected and it appears ECX is also...
EDIT:
Found an old reference book of mine that gave me the info needed: rand returns the random value in EAX (31 bit number - high bit is always 0). The call to rand always trashes the ECX register - that's why ECX is always affected.
31 bits gives a max integer number of 4294967295. They are multiplying the random number returned by 0.003051851 (this value seems to change with every game load). What I need to do is scale the max 31 bit number to 100. So 4294967295 * x = 100. Do a little algebra....x = ~0.0000000232831...
EDIT2:
well MSVCR90.rand acts a little differently than my reference book says. The game always take the value in EAX and converts that to a floating point number. The high 16 bits of EAX are always 0 thus the maximum integer value is 65535. So 65535 * x = 100. Algebra says x = 0.0015259021896696. Time for a new version of the patcher again!
Great news TDW! Will test this in the evening!
The dud probability is a strange one, it really doesn't follow the percentage values in torpedo.sim. Of course it gives some direction, but like in previous games, we have put the percentage really high if we wan't to see duds.
But this sounds just great, thanks!
TheDarkWraith
05-22-12, 01:54 AM
Great news TDW! Will test this in the evening!
The dud probability is a strange one, it really doesn't follow the percentage values in torpedo.sim. Of course it gives some direction, but like in previous games, we have put the percentage really high if we wan't to see duds.
But this sounds just great, thanks!
I see why the dud probability is a 'strange one'. They load in the % chance for dud as read from .sim file, then they multiply it by some float value, then they multiply it by another float value, then they finally multiply it by another float value (looks to be related to some kind of skill). After all that multiplication it's no longer near it's original value (it's much less) :nope: That's why I'm changing it! When I'm done with it:
- it will read in % chance for dud as read from sim file (value is between 0 and 100)
- it will get a random number
- it will scale that random number to be between 0 and 100
- it will compare % chance for dud to scaled random number to determine if dud or not
That is how it should've been done in the first place :shifty:
THE_MASK
05-22-12, 02:13 AM
The only random numbers i have seen are in .
Silent Hunter 5\data\UPCDataGE\UserPlayerSettings
Documents\SH5\data\cfg\UPCInitial\UserPlayerSettin gs
misha1967
05-22-12, 02:30 AM
NOTE: DISABLE ALL PATCHES WITH OLD PATCHER BEFORE APPLYING NEW PATCHES WITH NEW PATCHER! THIS APPLIES ONLY TO PATCHES RELATED TO SHSIM.ACT AND SHCOLLISIONS.ACT
Now how exactly do you do that, other than uninstalling and reinstalling SH5?
Unfortunately the "how to use patcher" picture links are dead!:hmmm:
http://www.subsim.com/radioroom/showpost.php?p=1735615&postcount=7773
col_Kurtz
05-22-12, 04:46 AM
Now how exactly do you do that, other than uninstalling and reinstalling SH5?
Maybe I`m wrong.
Open by old SH5patcher and set these values (True) to False = Not patched?
After this try to patch with newest one, again from False to True?
THE_MASK
05-22-12, 04:50 AM
double click on the sh5patcher\file\open\TDW_SH5_Patches.s5p
select path to sh5exe ending with silent hunter 5
click ok
make all False
do the same for all the patches
Extract the new patcher to your sh5 main game folder overwriting the old patcher . Repeat the process to enable true on all the patches . Copy the blue exe icon (4.17mb) to your desktop and launch from that .
Trevally.
05-22-12, 07:00 AM
You can call me the doctor . I jumped ahead in time , its 11:45 AM here .
Doctor:hmmm: who
volodya61
05-22-12, 07:07 AM
Doctor:hmmm: who
Dr. Hannibal Lecter? :D
I see why the dud probability is a 'strange one'. They load in the % chance for dud as read from .sim file, then they multiply it by some float value, then they multiply it by another float value, then they finally multiply it by another float value (looks to be related to some kind of skill). After all that multiplication it's no longer near it's original value (it's much less) :nope:
There had to be a rationale making devs to implement such a convoluted method. I wonder wich one... :hmmm:
That's why I'm changing it! When I'm done with it:
- it will read in % chance for dud as read from sim file (value is between 0 and 100)
- it will get a random number
- it will scale that random number to be between 0 and 100
- it will compare % chance for dud to scaled random number to determine if dud or not
That is how it should've been done in the first place :shifty:
That's the most obvious method, indeed! :up:
By the way, I've found a quite comprehensive essay on the torpedo crisis. Here's the link, just in case some willing person wants to dig in it, looking for facts and figures:
http://eaglescholar.georgiasouthern.edu:8080/jspui/bitstream/10518/3627/1/Wright_David_H_201005_MA.pdf
Doctor:hmmm: who
Herr Dkt. Zober, the most controversial scientist of the Third Reich. Several years after the German defeat, his time machine was found abandoned in the parking of a supermarket in Fremantle, Australia. From then on, no other proof of his existence was found, at least until yesterday at 11:45 AM, local time of Adelaide.
TheDarkWraith
05-22-12, 09:06 AM
Maybe I`m wrong.
Open by old SH5patcher and set these values (True) to False = Not patched?
After this try to patch with newest one, again from False to True?
double click on the sh5patcher\file\open\TDW_SH5_Patches.s5p
select path to sh5exe ending with silent hunter 5
click ok
make all False
do the same for all the patches
Extract the new patcher to your sh5 main game folder overwriting the old patcher . Repeat the process to enable true on all the patches . Copy the blue exe icon (4.17mb) to your desktop and launch from that .
Correct :up:
TheDarkWraith
05-22-12, 09:11 AM
There had to be a rationale making devs to implement such a convoluted method. I wonder wich one... :hmmm:
That's kind of the fun part when using RE methods on software. Many times you see some code and you try to think what were the programmers thinking? :hmmm: It's just like a giant jig-saw puzzle. Every little piece you discover adds to your understanding of the whole :yep:
TheDarkWraith
05-22-12, 12:14 PM
v1.0.26.0 released. See post #1
This version correctly computes the impact dud random number to compare against the dud % chance specified in torpedoes .sim file. There is no reason to use high values for the dud % chance in the torpedoes .sim file anymore - only need values in range of 0 to 100 :rock:
Even if you set the dud % chance to 100 (or higher) in the torpedoes .sim file you could still have impact detonations :shifty: The reason is because the game sometimes 'jumps over' the impact dud check :nope: I haven't narrowed down exactly what the trigger is that causes this 'jumping over' of the dud check yet. When I do you can bet I'll release a patch to fix it :up:
Magnetic torpedoes duds I'm still working on :yep:
Heed the warning in yellow under the download link at post #1 or the patcher app will tell you the file has problems.
:|\\
elanaiba
05-22-12, 02:24 PM
I think there's supposed to be some accounting for angle of impact for dud chance?
TheDarkWraith
05-22-12, 03:20 PM
I think there's supposed to be some accounting for angle of impact for dud chance?
Well Hello! You think that the angle of impact is a factor in the dud chance? That might explain one of the multiplications :hmmm:
For an impact (non-magnetic) the game says torpedo impacted something, then it checks the impact angle to those defined in the torpedoes .sim file. If the impact angle falls within a max_angle, min_angle combo defined in .sim file then it jumps to do a dud % check. In the dud % check the game loads the % dud chance defined in .sim file into XMM register. The game then retrieves a random number and stores it into another XMM register. Now here's where stock code does 3 multiplications on that random value. Two of them are fractional values, the third is always 1.0 (I believe this one is related to a skill?). Any idea what these 2 fractional values are for? I haven't been able to track them down yet. From what you're saying one of those fractional values could be related to impact angle? :hmmm: So game gets random number, reduces the random number by some fractional % based on impact angle, multiplies that by another fractional number, then finally multiplies that by 1.0...the final 'random' number is so small you never get any duds! I'll have to think this one over more :hmmm:
Any idea as to why the game skips the impact angle check (and thus the dud % chance check) sometimes on impact detonations?
TheDarkWraith
05-22-12, 03:31 PM
ok magnetic detonator duds...here's my idea:
- have a set % chance that every torpedo with magnetic detonator can be a dud (let's say we set it at 10% failure rate)
- when game says magnetic impact happened get a random number. If this random number falls within the % chance of magnetic failure then get another random number. Scale this random number to fall within 0.0 to 1.0 value. Multiply this scaled random number by the magnetic detonator range defined in torpedoes .sim file. Let's say scaled magnetic detonator random value is 0.63, magnetic detonator range is 2m. 2 * 0.63 = 1.26m. Recheck for magnetic detonator collision with new magnetic detonator range. If check fails to show collision do not detonate. If check says collision still happened:
- do an impact angle check like impact torpedoes do. If the angle is 90 to x degrees (torpedo passing at right angle to ship's course) get a random number. If this random number is greater than some preset value then torpedo is allowed to detonate. If not, torpedo continue on it's merry way. We could define many ranges for this magnetic impact angle check.
What do you think?
THE_MASK
05-22-12, 04:20 PM
Do you have dud torpedoes checked in the ingame options ?
TheDarkWraith
05-22-12, 04:25 PM
Do you have dud torpedoes checked in the ingame options ?
You asking me? If so, yes I do :hmmm:
ok magnetic detonator duds...here's my idea:
- have a set % chance that every torpedo with magnetic detonator can be a dud (let's say we set it at 10% failure rate)
- when game says magnetic impact happened get a random number. If this random number falls within the % chance of magnetic failure then get another random number. Scale this random number to fall within 0.0 to 1.0 value. Multiply this scaled random number by the magnetic detonator range defined in torpedoes .sim file. Let's say scaled magnetic detonator random value is 0.63, magnetic detonator range is 2m. 2 * 0.63 = 1.26m. Recheck for magnetic detonator collision with new magnetic detonator range. If check fails to show collision do not detonate. If check says collision still happened:
- do an impact angle check like impact torpedoes do. If the angle is 90 to x degrees (torpedo passing at right angle to ship's course) get a random number. If this random number is greater than some preset value then torpedo is allowed to detonate. If not, torpedo continue on it's merry way. We could define many ranges for this magnetic impact angle check.
What do you think?
according to the information I've read so far, detonation chance for magnetic torpedoes was affected by the change of magnetic field over time. This factor, on turn, should depend on:
target mass;
torpedo depth, i.e. distance of the torpedo from the targets' keel;
relative speed of the torpedo compared to the speed of the target*.
*here comes into the picture the angle of impact.
By assuming that:
S = relative speed
S(tp) = torpedo speed
S(tg) = target speed
A = angle of impact, where 0° = impact from stern
then:
S = S(tp) - S(tg) * (|A-180|-90)/90
for A = 0, i.e. torpedo aimed to stern, S = S(tp) - S(tg); reduced relative speed of torpedoes fired astearn of the target ship was a well documented cause of missed detonation.
for A = 180, i.e. torpedo aimed to stern S = S(tp) + S(tg); increased relative speed could lead to higher chance of premature explosion, but this is just my deduction.
for A = 90 or 270, i.e. 90 deg shot, S = S (tp); as for impact torpedoes, 90 deg shot had to be the best solution ;)
In my opinion you should integrate these factors in a single variable, and compare it with the dud chance for deciding wether the detonation will happen or not.
TheDarkWraith
05-22-12, 06:13 PM
I have to 'find' all these variables first...that's the hardest part! I like the idea but whether can be implemented or not depends on whether I can find all the variables needed :yep:
In the meantime I have a magnetic detonator defect check coded in. When the player launches the torpedo I added a hook into the torpedo initialization routine that will check for magnetic detonator defect. The current defect rate is set at 10%. This defect is a failure of the magnetic detonator to detect at the range specified. So if the game determines that this torpedo has a defect it will get a random number, scale it to between 0.0 and 1.0, and multiply that scaled random number by the magnetic detonator range specified in the torpedo .sim. This new value will be the torpedo's new magnetic detonator range :D
I have to 'find' all these variables first...that's the hardest part! I like the idea but whether can be implemented or not depends on whether I can find all the variables needed :yep:
some of those variables can be read directly from ships cfg, others are stored in torpedo.sim, still others are user defined or context dependent. I hope (or better I trust) one day you will find their memory addresses, or whatever you need for giving the last touches to your excellent work. :DL
In the meantime I have a magnetic detonator defect check coded in. When the player launches the torpedo I added a hook into the torpedo initialization routine that will check for magnetic detonator defect. The current defect rate is set at 10%. This defect is a failure of the magnetic detonator to detect at the range specified. So if the game determines that this torpedo has a defect it will get a random number, scale it to between 0.0 and 1.0, and multiply that scaled random number by the magnetic detonator range specified in the torpedo .sim. This new value will be the torpedo's new magnetic detonator range :D
yeah, this is the method you described in your previous post. Brilliant! :up:
EDIT:
I've tested your sailboat test mission. Soon I will post my report in the relevant thread
TheDarkWraith
05-22-12, 07:05 PM
v1.0.27.0 released. See post #1.
This version adds support for magnetic detonator range defects. When enabled there is a 10% chance that the torpedo has a magnetic detonator defect that causes it's sensing range to be less than actual.
If the torpedo has a defect and does not detonate because of this defect when under a unit there will be NO reports from anyone saying torpedo is a dud or the likes :D The torpedo will just continue on it's merry way!
Looking into adding an impact angle calculator for the magnetic torpedoes.
Spoiler: if you have the round torpedo circles enabled, when the torpedo's head is right in the middle of the first circle (1) it has reached arming distance and is live....found that by accident today!
:|\\
volodya61
05-22-12, 07:28 PM
TDW you're just one man team. :DL
I haven't time to manage the changes :yeah:
EDIT: Looking into adding an impact angle calculator for the magnetic torpedoes.
:hmmm: Where to look?
misha1967
05-23-12, 01:01 AM
double click on the sh5patcher\file\open\TDW_SH5_Patches.s5p
select path to sh5exe ending with silent hunter 5
click ok
make all False
do the same for all the patches
Extract the new patcher to your sh5 main game folder overwriting the old patcher . Repeat the process to enable true on all the patches . Copy the blue exe icon (4.17mb) to your desktop and launch from that .
Thanks, sober, and you too, Kurtz!
Now it makes perfect sense!
Now, next silly question: The "dud fix", does that mean that now magnetic detonators might actually work occasionally too? Because up until now I haven't really needed a fix to make some of my magnetic eel duds since they all were. Never once managed to get one to detonate under the keel, and I've tried many times, including using test missions with stationary targets firing the whole load at different depths under the keel.
TheDarkWraith
05-23-12, 02:28 AM
Thanks, sober, and you too, Kurtz!
Now it makes perfect sense!
Now, next silly question: The "dud fix", does that mean that now magnetic detonators might actually work occasionally too? Because up until now I haven't really needed a fix to make some of my magnetic eel duds since they all were. Never once managed to get one to detonate under the keel, and I've tried many times, including using test missions with stationary targets firing the whole load at different depths under the keel.
If you enable magnetic torp fix patch the magnetic detonators will work (your sub will also take hull damage from DCs with this patch)!
The dud fix fixes the problem with impact duds
I added a new patch that will give a 10% chance for magnetic 'duds' :DL It's available in newest version released.
volodya61
05-23-12, 03:02 AM
...Never once managed to get one to detonate under the keel, and I've tried many times, including using test missions with stationary targets firing the whole load at different depths under the keel.
Hi Misha!
Try to use Magnetic detonators set to 4m at the bottom of the post #1. If you use FX Update let them overwrite FX Update's files.
my post about this problem - http://www.subsim.com/radioroom/showpost.php?p=1877862&postcount=336
THE_MASK
05-23-12, 03:11 AM
Found a medium sized convoy at night . Fired a fan of 4 magnetic torps . No external cam so all i can report is 1 hit . Then fired 4 impact torps . No problems .
TheDarkWraith
05-23-12, 11:00 AM
Found a medium sized convoy at night . Fired a fan of 4 magnetic torps . No external cam so all i can report is 1 hit . Then fired 4 impact torps . No problems .
Are you saying there is a problem with the magnetic torps? Depth keeping and guidance problems are probably why 3 of them never 'hit'. Since you couldn't view them that was probably why.
Tested the new dud version in historical mission, and still some problems, am I doing this right?
-No more freezing
-Every hit is a dud!
-Torpedoes continue their path, they bounce to the ships hull and after a while continue forward. Normally they should stop and fall to the bottom of the sea.
Any ideas?
volodya61
05-23-12, 02:39 PM
Tested the new dud version in historical mission, and still some problems, am I doing this right?
Tested in game (Baltic Operations, OH-II)
-No more freezing
No more freezing, no more hanging
-Every hit is a dud!
Any ideas?40/60 - (40% dud or premature detonation, 60% - OK)
No ideas, just for information
TheDarkWraith
05-23-12, 02:53 PM
Tested the new dud version in historical mission, and still some problems, am I doing this right?
-No more freezing
-Every hit is a dud!
-Torpedoes continue their path, they bounce to the ships hull and after a while continue forward. Normally they should stop and fall to the bottom of the sea.
Any ideas?
Sounds like you are not using the newest version of the patcher (because you say every hit is a dud).
The torpedoes will not stop and fall to the bottom anymore when they are a dud. They will continue on as you've seen :up:
THE_MASK
05-23-12, 03:14 PM
Are you saying there is a problem with the magnetic torps? Depth keeping and guidance problems are probably why 3 of them never 'hit'. Since you couldn't view them that was probably why.They didnt hit because it was a fan shot and 3 missed there target . Bad captain , great mod .
Sounds like you are not using the newest version of the patcher (because you say every hit is a dud).
The torpedoes will not stop and fall to the bottom anymore when they are a dud. They will continue on as you've seen :up:
Ok, thanks for the info. Must double check all the settings concerning the dud ratio, must have messed something up. But the torpedo behaviour (when it's a dud) is a pretty strange looking and it makes a quite awful noise when in camera mode and underwater, just keeps clanging to the hull. Is this more realistic behaviour, and if so, is there a way to make the noise more subtle? Small things, I know!
TheDarkWraith
05-23-12, 05:06 PM
Ok, thanks for the info. Must double check all the settings concerning the dud ratio, must have messed something up. But the torpedo behaviour (when it's a dud) is a pretty strange looking and it makes a quite awful noise when in camera mode and underwater, just keeps clanging to the hull. Is this more realistic behaviour, and if so, is there a way to make the noise more subtle? Small things, I know!
I have no idea currently. I'm trying to figure out what tells the torpedo to 'die' when it impacts something so that I can setup some kind of random thing that will determine whether torpedo continues on it's merry way when a dud or stops and sinks to bottom when a dud.
Good news on the problem I was looking into regarding setting % chance of duds to 100 in the torpedoes .sim file and still getting impact detonations: the reason for the impact detonations was the magnetic detonator triggering :D Makes total sense! Sometimes when the game says torpedo collision is a dud it checks to see if magnetic detonator detects the unit, if so then torpedo impact! I need more people to test this to ensure 100%. To test: edit the torpedoes .sim file and set the % dud chances all to 100. Set Magnetic detonator to No. You have to do this for all entries of that torpedo. Now everytime you fire a torpedo it should be a dud no matter what.
EDIT:
some posts back I mentioned something about following something dealing with is tutorial mission in the torpedo initializer. It checks to see if tutorial mission because if so the game totally disables any chance for premature detonations. So tutorial mission = no premature detonations.
EDIT2:
Anyone interested in a patch that would remove the torpedo speed ability? I found where it multiplies this ability by the torpedo's selected speed in the torpedo initializer. What I would do is remove this multiplication of selected torpedo speed by ability in the code.
EDIT3:
Is there an ability that can increase the maximum range of the torpedo? It appears there is because I found another thing that looks like an ability.
THE_MASK
05-23-12, 06:00 PM
Looking at the torpedo sim file with S3D i see there is wave heights that impact on duds chance , nice feature . Also no duds after a certain date .
TheDarkWraith
05-23-12, 06:05 PM
Looking at the torpedo sim file with S3D i see there is wave heights that impact on duds chance , nice feature . Also no duds after a certain date .
Wave heights should only be influencing premature detonations. Where are you seeing wave heights influencing duds chance?
elanaiba
05-23-12, 06:13 PM
Just out of my head and I'm really really sleepy, I think the duds are influenced by some skills (maintenance of torpedoes etc) but also by the impact angle and torpedo speed.
Regarding magnetic premature detonation i think we took into account running depth, speed and wave state.
Also there was at least one torpedo speed ability supposed to simulate pre-heating the G7e-s, the electric ones.
TheDarkWraith
05-23-12, 06:53 PM
I'm kinda sick and tired of these uber reliable torpedoes we have in SH5. I want to see more failures :D So some questions:
- how reliable were the torpedoes in regards to set speed? Did they maintain this speed all throughout it's run or did the speed vary a little bit? Any records of torpedoes not running at set speed when launched? I'm thinking of adding a small chance (say 1%) that the torpedo does not run at selected speed when launched.
- how reliable were the torpedoes in regards to maximum range at selected speed? Any record of some going farther/shorter? I'm thinking of adding a small chance (say 1%) that the torpedo's maximum range is shorter (maybe add longer also) than intended maximum range
- Any records of torpedoes guidance system freezing after making initial turn (like it's rudder jams)? I'm thinking about adding a small chance (say 1%) that the torpedo's rudder can jam after making initial turn
- Any records of just total failure in general during it's run (not accounting for premature detonations)? I'm thinking of adding a small chance (say 1%) that the torpedo's propulsion system fails at some point during it's run. Torpedo would then be a dud for game account.
What other possible failures could there be? :06:
I just found some pieces of information
in this link check description of G7a
http://www.navweaps.com/Weapons/WTGER_WWII.htm
next one is more about damage torpedo could cos
http://www.defence.gov.au/sydneyii/SUBM/SUBM.003.0042.pdf
influence of preheating here
http://www.uboat.net/technical/torpedoes.htm
yadda yadda about everything
http://www.uboataces.com/weapon-torpedo.shtml
real life account
http://books.google.ca/books?id=LJJez91DyYcC&pg=PA75&lpg=PA75&dq=g7a+torpedo+failure&source=bl&ots=TuEcHJCqEE&sig=OoYg_6BtpcY3NCh2H2fAgfs-_FI&hl=en&sa=X&ei=V669T8zgLdLciALFwcGJDg&ved=0CEwQ6AEwADgK#v=onepage&q=g7a%20torpedo%20failure&f=false
If that's the case sorry for discovering wheel and gunpowder again
nynek
misha1967
05-24-12, 12:33 AM
Hi Misha!
Try to use Magnetic detonators set to 4m at the bottom of the post #1. If you use FX Update let them overwrite FX Update's files.
my post about this problem - http://www.subsim.com/radioroom/showpost.php?p=1877862&postcount=336
Spasibo vam bolshoye! :yeah:
TheDarkWraith
05-24-12, 12:36 AM
I just found some pieces of information
in this link check description of G7a
http://www.navweaps.com/Weapons/WTGER_WWII.htm
next one is more about damage torpedo could cos
http://www.defence.gov.au/sydneyii/SUBM/SUBM.003.0042.pdf
influence of preheating here
http://www.uboat.net/technical/torpedoes.htm
yadda yadda about everything
http://www.uboataces.com/weapon-torpedo.shtml
real life account
http://books.google.ca/books?id=LJJez91DyYcC&pg=PA75&lpg=PA75&dq=g7a+torpedo+failure&source=bl&ots=TuEcHJCqEE&sig=OoYg_6BtpcY3NCh2H2fAgfs-_FI&hl=en&sa=X&ei=V669T8zgLdLciALFwcGJDg&ved=0CEwQ6AEwADgK#v=onepage&q=g7a%20torpedo%20failure&f=false
If that's the case sorry for discovering wheel and gunpowder again
nynek
I will give it a read :up:
More patches coded in:
- removed the kiddy factor from the torpedo circle runner chance. Now you will have a chance of getting circle runners (game sometimes multiplies circle runner chance read from torpedoes .file with 0 - so you never got a circle runner. If it wasn't 0 it was some fractional value thus the value specified in torpedoes .sim file was never really used)
- added some cool code that gives a 5% chance of the torpedoe's rudder jamming as it is making it's initial turn. Once jammed it's effectively a circle runner. Torpedo has to have moved 100m before it can do it's initial turn (game design - I can change that value though ;)). This is checked once and then never checked again (so it's checked at the 100m point and no more)
All these patches have used up the available 'space' in the code (.text) section of the SHSim.act file. Thus I have to revise the patcher app so that it can add more free space to any section (.text, .bss, etc.) in a file it's patching (not free space in memory but physical free space in the file itself on your hard drive). Once the patcher app is updated I'll release the new version.
I'm planning on adding 3 torpedo failures to this upcoming next version:
- 3% chance that torpedoe's max range is less than actual (could be up to 25% less)
- 5% chance that torpedoe's speed is less than actual (could be up to 5% less)
- 2% chance that torpedo experiences propulsion failure and thus dies (comes to stop and sinks to bottom). When torpedo is initialized a random value will be asked for and scaled to 0-100. If this random value is <= 2 then another random value will be asked for scaled to 0.0-1.0. This 0.0-1.0 random scaled value will be multiplied by the torpedoes max range. The result will be stored as the new torpedo max range.
I'm also toying with the idea of adding some drift to the torpedo's ordered heading. I have a very hard time believing that the torpedo ran a perfectly straight line to the target. Wind, waves, and currents could cause it to drift. Thus a very very small amount of drift (a signed value + or -) could be added to the ordered heading every frame update or every 10 frame updates or more? :06:
I have almost all the variables mapped out for the torpedo so I can do just about anything I want with them :D
:|\\
Sailor Steve
05-24-12, 03:09 AM
I want to see more failures :D So some questions:
The 1% chance of various failures sounds good to me, but as for accurate records of short/long runs and inaccurate speeds, how would anyone know? From inside the boat one couldn't tell how far the fish ran, or how fast. They would only know that it missed. I don't think anyone ever did the kind of extensive testing this would require. :sunny:
I have no idea currently. I'm trying to figure out what tells the torpedo to 'die' when it impacts something so that I can setup some kind of random thing that will determine whether torpedo continues on it's merry way when a dud or stops and sinks to bottom when a dud.
I really hope that you have succes with this issue, it feels strange that the dyd torpedo tries to push it's way through the hull that way after impact. The stock effect seems more realistic to me. Otherwise all sounds really good :yeah:
EDIT2:
Anyone interested in a patch that would remove the torpedo speed ability? I found where it multiplies this ability by the torpedo's selected speed in the torpedo initializer. What I would do is remove this multiplication of selected torpedo speed by ability in the code.There are already some mods that take out the torpedo speed ability, it causes problems because TDC doesn't take account of it. But it's done by editing the specialablilty.aix file in UPGEdata.
The 1% chance of various failures sounds good to me, but as for accurate records of short/long runs and inaccurate speeds, how would anyone know? From inside the boat one couldn't tell how far the fish ran, or how fast. They would only know that it missed. I don't think anyone ever did the kind of extensive testing this would require. :sunny:
With all due respect but it was done every time with device shown on every sub movie. In case of Germany it is called Junghans.
nynek
By the way, I've found a quite comprehensive essay on the torpedo crisis. Here's the link, just in case some willing person wants to dig in it, looking for facts and figures:
http://eaglescholar.georgiasouthern.edu:8080/jspui/bitstream/10518/3627/1/Wright_David_H_201005_MA.pdf
thanks for sharing this gap, very interesting to read, especially the failure rates at the beginning of the war and all the reasons for the failures :yeah:
THE_MASK
05-24-12, 06:11 PM
It would be good to have a random dud failure between 20% and 80% by campaign date 1\1\1938 - 24\12\1942
Every torpedo launch gives a possible random failure % in that range between those dates .
25\12\1942 - 31\12\1949
random dud failure between 10% and 40% for every torpedo launch .
or does this already work using the file torpedoes_g7a-e.sim
I will send you a file of the torpedoes_g7a-e.sim
I interpret some of the values diffrently than you .
It is the amun_torpedo Type 1
TheDarkWraith
05-24-12, 07:54 PM
I amaze myself sometimes :o
New patcher app is almost complete. It now allows you to specify new sections to add to the file you are patching :D Adding a new section is as simple as:
- adding a [Section x] header
- adding a Name= and giviting it a name (8 characters max - limitation of PE format)
- adding a Size= and specifying the size (size needs to be SectionAlignment size as specified in PE header - use a tool like PEDumper to view PE header). This is a hex value
- adding a Characteristics= and specifying the characteristics (Read, Write, Executable, etc.). This is a hex value.
If you're not familiar with PE format you should read up on it :yep:
SHSim is getting two new sections - a code section and a data section. This will allow me to store my own data in my own section and place all my patch code in it's own code section :rock:
TheDarkWraith
05-24-12, 08:48 PM
It would be good to have a random dud failure between 20% and 80% by campaign date 1\1\1938 - 24\12\1942
Every torpedo launch gives a possible random failure % in that range between those dates .
25\12\1942 - 31\12\1949
random dud failure between 10% and 40% for every torpedo launch .
or does this already work using the file torpedoes_g7a-e.sim
I will send you a file of the torpedoes_g7a-e.sim
I interpret some of the values diffrently than you .
It is the amun_torpedo Type 1
You can define dates ranges for duds types. Click on Pistols. Add more entries to define the date ranges wanted (right click on Pistols and select add new entry) :up:
TheDarkWraith
05-24-12, 10:51 PM
Patcher app got an overhaul. There is a new node, NT, which lists all the NT data read from the file. There is another new node, Sections, which lists all the sections found in the file. Each section has sub-nodes that tell about the section. And finally there is another new node, Patches, which has all the patches listed under it. You can now right click on Patches and select Enable all patches or Disable to patches. You can also right click on each patch under patches and select Enable all changes or Disable all changes. And finally you can right click on each change and select Enable change or Disable change. Makes it really easy to enable/disable now. I was getting sick and tired of having to click every single one to enable/disable :dead: Much easier now.
I don't have the new patch files ready but I will release the new version of the patcher app as it much more user friendly :yep:
Oh yeah, biggest change is it's target audience - it's now generic in nature. Thus you can write patch files for any file now (and with the new ability to add sections to a file it's a snap to create your own code/data sections in a file now!) :D
THE_MASK
05-24-12, 11:06 PM
Thanks for the sdk then :rotfl2:
TheDarkWraith
05-24-12, 11:13 PM
Thanks for the sdk then :rotfl2:
Gives you some insight into the NT structure and PE format in general :up:
v1.0.29.0 released. See post #1
Major overhaul to the patcher app. One, it's now generic so can be used to patch any file. Two, it's much more user friendly. Three, you can add you own sections now (and the Windows loader will load them in) :yep:
Gives you some insight into the NT structure and PE format in general :up:
v1.0.29.0 released. See post #1
Major overhaul to the patcher app. One, it's now generic so can be used to patch any file. Two, it's much more user friendly. Three, you can add you own sections now (and the Windows loader will load them in) :yep:
Hi TDW,
long time ago I was a member of the GPx modding community. I remember one of its most respected members was a certain SDI, in the world René Smit. He was the author of GPxPatch (http://rsdi.home.xs4all.nl/gpxpatch.html): a real time extension of GP3/GP4 fixing many bugs and adding several new features to the game.
In my opinion its best feature was not to change any executable: it was changing the code of the game after it was loaded in memory, allowing full configuration by the player. Furthermore, the patch was enabling third parties custom extensions to be loaded and executed within the game. For what I can understand, he was "injecting" his code in the game as you did with dll's with your dll injector.
Knowing your love for neat solutions, and seeing the you are moving in the same direction, I wonder if the same can be done with a future release of your patcher.
TheDarkWraith
05-25-12, 08:42 AM
In my opinion its best feature was not to change any executable: it was changing the code of the game after it was loaded in memory, allowing full configuration by the player. Furthermore, the patch was enabling third parties custom extensions to be loaded and executed within the game. For what I can understand, he was "injecting" his code in the game as you did with dll's with your dll injector.
Knowing your love for neat solutions, and seeing the you are moving in the same direction, I wonder if the same can be done with a future release of your patcher.
You want the patcher to be able to inject code into an active process? I wrote a piece of software than can do that already. But you want that functionality included in the patcher?
Let me ask you this: why inject code into an active process when you can take it's .exe or .dll file, add a section or multiple new sections to it, dump your code into the new section (or sections) in the file, and let the Windows loader do the loading for you? With the adding new sections your code is guaranteed to be where you want it thus making it very easy to get to the other sections. With code injection you have Windows create a new pool of memory for you and you dump your code into that pool. Where that pool of memory ends up being located you have no control over. The only reason I can see for not adding new sections and dumping your code into them in the .exe or .dll file is if the .exe or .dll checks itself when loaded to see if anything is different. But then again one can remove this check from ever happening.
If the process is already active (loaded) and you don't have access to the .exe or .dll files then code injection is necessary if one wants to add anything new to it.
Looking at GPxPatch I wouldn't like that you have to launch the app wanting to patch from the patch app itself. There's no reason to do this. You can easily get a list of all active processes from Windows and 'attach' to any of them very easily.
The patcher has been morphing into something I've been wanting to do for a long time: take an active process and grab all of it's in memory data. Since the PE header is in the process's memory one can theoretically read this PE header and construct an .exe or .dll from the memory read in (a reverse Windows loader). For self-modifying exes this would be one way to 'capture' the image of it in it's modified state thus removing the obfuscation. That's the theory anyway. I'm slowly making my way to see if this theory is correct or not :DL The only real hole in this theory is if a section was marked as discardable and the Windows loader didn't load that section into memory...
I can dump memory from any active process, modify it, and inject it back in and the process has no idea anything happened. The patcher is heading in that direction as another way to patch (basically taking functionality from another app I wrote).
I've been really ambitious lately and have been trying to modify the sections already defined in an .exe or .dll file. The new version of the patcher allows you to add new sections. These sections are added to the end of the .exe or .dll file. That's cool and all but I want to be able to extend sections already defined :cool: The problem with extending sections already defined is relocations, fix-ups, and the likes. While not an impossible task to do it's not for the faint of heart. I'm learning about relocations, fix-ups, and all the other things I need to know (data structures) to be able to pull this off. I've searched for tools that already do this and haven't found any. When I've posed this question in some forums the response back was impossible or you need the source code...well I always love to prove that nothing is impossible :D
Another thing I've been working on is being able to 'add' a process to another process. You may ask why would one want/need something like this? Well I have one reason: the Enigma app. The app is perfect replica of an Enigma machine. It works great as a stand-alone process. It cannot be used in any app that does full screen rendering. I've written an app that can 'steal' the main window away from another process and modify it so that it thinks it's the child of the 'stealing' process. Works beautifully. You minimize the 'stealing' process and the other process minimizes also. Now I just have to modify it (Enigma) so that it renders it's window over the full screen app. This is where I need to be able to attach the Enigma process to the full screen process.
You want the patcher to be able to inject code into an active process? I wrote a piece of software than can do that already. But you want that functionality included in the patcher?
Let me ask you this: why inject code into an active process when you can take it's .exe or .dll file, add a section or multiple new sections to it, dump your code into the new section (or sections) in the file, and let the Windows loader do the loading for you?
If the process is already active (loaded) and you don't have access to the .exe or .dll files then code injection is necessary if one wants to add anything new to it.
Looking at GPxPatch I wouldn't like that you have to launch the app wanting to patch from the patch app itself. There's no reason to do this. You can easily get a list of all active processes from Windows and 'attach' to any of them very easily.
The patcher has been morphing into something I've been wanting to do for a long time: take an active process and grab all of it's in memory data. Since the PE header is in the process's memory one can theoretically read this PE header and construct an .exe or .dll from the memory read in (a reverse Windows loader). For self-modifying exes this would be one way to 'capture' the image of it in it's modified state thus removing the obfuscation. That's the theory anyway. I'm slowly making my way to see if this theory is correct or not :DL
I can dump memory from any active process, modify it, and inject it back in and the process has no idea anything happened. The patcher is heading in that direction as another way to patch.
I've been really ambitious lately and have been trying to modify the sections already defined in an .exe or .dll file. The new version of the patcher allows you to add new sections. These sections are added to the end of the .exe or .dll file. That's cool and all but I want to be able to extend sections already defined :cool: The problem with extending sections already defined is relocations, fix-ups, and the likes. While not an impossible task to do it's not for the faint of heart. I'm learning about relocations, fix-ups, and all the other things I need to know to be able to pull this off. I've searched for tools that already do this and haven't found any. When I've posed this question in some forums the response back was impossible or you need the source code...well I always love to prove that nothing is impossible :D
it sounds very challengig! :up:
I was asking if it was possible to inject code in the active process rather than modifying its files for two main reasons:
- out of curiosity; :D
- because I think it would be a cleaner approach than modifing the executable: the lesser common users deal with it, the lesser they risk to screw up things;
Anyway, if code injection demonstrated to be a valid approach, my next question was going to be:
- would your patcher allow us to change the injected code on the fly, while the game is running, i.e. enabling/disabling patches, changing some fixed parameters, etc?
TheDarkWraith
05-25-12, 09:33 AM
Anyway, if code injection demonstrated to be a valid approach, my next question was going to be:
- would your patcher allow us to change the injected code on the fly, while the game is running, i.e. enabling/disabling patches, changing some fixed parameters, etc?
Code injection is a very valid approach. It's used by MANY people to do whatever it is they want to achieve/discover. :yep:
The patcher, in it's current state, won't allow you to do what you are wanting (on the fly). I can add that functionality though as it's just merely taking code I've already written and adding it to the patcher app. What I do need to add to the patcher app is a way to dump memory from a process and reload that memory back in. This would allow you to say dump the initialized data from SHSim, modify it, load it back in and see what effect your changes have. Alright I just convinced myself to do this :D The more people playing around and discovering things the faster we map out where all the variables are located and what they do!
Code injection is a very valid approach. It's used by MANY people to do whatever it is they want to achieve/discover. :yep:
The patcher, in it's current state, won't allow you to do what you are wanting (on the fly). I can add that functionality though as it's just merely taking code I've already written and adding it to the patcher app. What I do need to add to the patcher app is a way to dump memory from a process and reload that memory back in. This would allow you to say dump the initialized data from SHSim, modify it, load it back in and see what effect your changes have. Alright I just convinced myself to do this :D The more people playing around and discovering things the faster we map out where all the variables are located and what they do!
Thank you! :DL
For sure adding such a functionality would boost significantly our knowledge of SH5 and indeed our modding potential: just think of how many parameters we could experiment with, without having to exit to windows, apply our changes, load again SH5, start a new game... cycle this process for n times, and you will just get sick :shifty:
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.