View Single Post
Old 03-16-11, 11:03 PM   #1
Black Magic
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5

Default [TEC] SH5.exe patches to fix bugs and add functionality

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 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
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
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.

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

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 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.


The below screenshot will show you what some of the patches can 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). 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!

There are still some colors I'm trying to track down....

Generic patcher application written by moi:

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.

starting with v1.0.22.0 adds support for fixing broken magnetic detonator and sub hull not taking damage. This change resides in it's own patch file (there are now 2 patch files included - one for SH5.exe and one for shcollisions.act)

starting with v1.0.24.0 adds support for fixing CO2 bug. This change resides in 2 patch files - one for SH5 and one for SHSim. You have to enable both patches!

starting with v1.0.27.0 adds support for magnetic detonator range defects

starting with v1.0.37.0 adds support for sub on the bottom

starting with v1.0.39.0 adds support for automatic closing/opening of sub's internal compartment doors when battlestations ability (key F7) is enabled/disabled - Note: There are 2 doors I haven't got working correctly yet but all the others work excellent. This version will also increase the file size of sh5.exe in order to accomodate needed code and future code

starting with v1.0.43.0 removed sub on bottom patch until I can figure out why it causes slowdowns for some users. Added a new patch - Crew wakeup - that 'wakes up' the crew and makes them do their job (contact spotting/reporting)

starting with v1.0.44.0 added patch that fixes the CTD in single missions that happens after some period of time. Revised the Crew wakeup patch. Remove the hydrophone volume patch.

starting with v1.0.45.0 removed patch for CTD in single missions. Updated Crew wakeup patch to work in campaigns.

starting with v1.0.46.0 crew will detect radar signals with crew wakeup patch

starting with v1.0.47.0 a new version of sub on bottom patch is included (old one was removed in previous version). A new patch called Collateral Damage was added that adds the possibility of collateral damage to other zones (boxes) when a unit experiences a collision with something. Current % chance is set at 10%.

starting with v1.0.48.0 a new patch for SHCollisions was made. This patch reduces the AP of the zone (box) when it receives damage.

starting with v1.0.49.0 add a new patch for SH5.exe: ability to exclude certain items from ever being rendered in the game

starting with v1.0.51.0 add a new patch for SH5.exe: ability to run decks awash (~7.5m) with crew on deck and using diesel engines

starting with v1.0.52.0 added a new patch for SHCollisions.act: Crew AI Damage Control

starting with v1.0.54.0 added a new patch for SH5.exe: No crew spotting when submerged. Revised sub on bottom patch

starting with v1.0.55.0 revised the CO2 patch for SH5.exe. Now it ensures that CO2 is 0% when surfaced

starting with v1.0.60.0 the patcher app itself has been revised to be more powerful and easier to use. Some of the patches were revised (code wise)

starting with v1.0.62.0 added a fix for the error some users were getting when the app started. Now instead of throwing the error the app will disable the pretty icons used in the treeview. Error checking added for Updates to ensure no updates are defined for new sections. Added a new entry for Updates - Editable. If set to 1 then user is allowed to enable/disable (if ShowInUpdates=1)

starting with v1.0.63.0 fixed problem some users were having when the patcher tried to apply updates

starting with v1.0.64.0 added a new patch for SHSim and SH5: independent engine controls

starting with v1.0.65.0 added a new command to the independent engine controls that let's the user select both shafts

starting with v1.0.66.0 revised the independent engine controls patch. The bug of selecting new speed (not throttle) overriding the patch and selecting new throttle from keyboard (1,2,3, etc.) overriding the patch has been fixed

starting with v1.0.67.0 added more icons to the app. These icons are for when not all changes of a patch are enabled. Added a new entry to each patch: AllChangesRequired (this entry will control which icon shows when not all changes are enabled)

starting with v1.0.68.0 added a new patch to SH5.exe: there is a 10% chance that Bdu will vector subs (up to 4) to your position when you send in a contact report

starting with v1.0.69.0 revised the Contact reports wolfpack patch

starting with v1.0.70.0 revised the Contact reports wolfpack patch. When Bdu responds back it now uses the radio message window instead of the messagebox. There are 3 possible responses that Bdu can send back. Now using the game's function to determine if able to receive radio messages or not.

starting with v1.0.72.0 revised the Contact reports wolfpack patch. Now when the dispatched subs spawn they will send a radio message to you. There are 5 possible responses. Bdu also has 5 possible responses.

starting with v1.0.73.0 revised the Contact reports wolfpack patch. If Bdu can't dispatch subs to you they will send you a radio message (could take up to an hour to receive). Any unit sending out a radio message is checked to see if it's able to send out a radio message (currently only it's depth is checked to see if it's less than max depth game has for sending/receiving radio messages). Revised some code to prevent possible CTD.

v1.0.74.0 fixes bug of two patches in SHSim.exe having the same change

starting with v1.0.75.0 added a new patch to the SH5.exe that allows the camera on next and previous unit to be able to select air and land units. You also have the ability to select lifeboats

starting with v1.0.76.0 added new patches to the SH5.exe that will disable the Orbit Listener and disable intro movies. There is also a new patch for the SH_NClient.dll that will disable the Orbit Listener completely. By enabling all patches related to Orbit Listener the game will no longer synch save games, no more CTDs because it couldn't reach the client, and the game will not quit because of any problems with Orbit Listener.

starting with v1.0.78.0 added new patches to the SH5.exe that enable user to select color of the calculated torpedo impact time and added lots of new render patches (disable longitude lines, disable lattitude lines, disable view cone, disable torpedo line, disable torpedo line numbers, disable rendering of units (except player's sub) when at high zoom levels, disable rendering of units (except player's sub) when at low zoom levels, disable rendering of player's sub at high zoom levels and disable rendering of unit detection circles). All these new disables can be found under the Render patches.
These new disables will override any game settings.

Starting with v1.0.79.0 added two new patches to the SH5.exe: broken stadimeter fix and a patch that fixes the problem of the TDC AOB and Speed dials resetting when TDC is on and stadimeter is used

Starting with v1.0.80.0 added a new patch to SHSim.act: AI subs no longer cause your crew to speak and or place messages in the messagebox when they are diving and/or recharging batteries

Starting with v1.0.81.0 revised the SHCollisions AI Crew Damage Control patch. The patch now takes crew veterancy level, unit's HPs ratio, and unit's type into consideration. Most effects will stop when crew fixes damage to the zone (box) . I'm still looking for a few controllers so that I can stop them all.

Starting with v1.0.83.0 added more support code to each patch file. Also added new torpedo failures to the SHSim.act file. Fixed bug in sh5.exe when writing DestroyedUnits.ini file. Added new entries to the DestroyedUnits.ini file.

Starting with v1.0.85.0 added patch to SHSim.act and SHCollisions.act that stops destroyed ships and subs from falling through the sea floor and disappearing (1st draft of this patch - more work to do on it). Remove patch Rudder jam on initial turn from SHSim.act. Revised patch Fix circle runner chance in SHSim.act

Starting with v1.0.86.0 revised all the torpedo failures in the game. The code will now follow what the torpedo's .sim file says. The code assumes all values in the torpedo's sim file whose comments say percent or percentage are in the range 0.0-1.0 (0% - 100%)

Starting with v1.0.87.0 Fixed possible CTD that could happen with the AI crew voice patch. Added a new patch to the SHSim.act that prevents destroyed aircraft from being immediately removed from the game

Starting with v1.0.88.0 Fixed CTD that happens when the Battlestations close/open doors patch is enabled and sub is near port

Starting with v1.0.89.0 Fixed problem with the AOB and TDC dials patch. The problem was auto targeting could be messed up because of the patch.

Starting with v1.0.90.0 Added a new patch - SHSound. It currently contains one patch to fix the bug of Python error being thrown when Menu.PlaySound() is called on an unrecognized (hard-coded) sound

Starting with v1.0.91.0 Added a new patch to SH5.exe: Fixes torpedo room's ambient noise heard on hydrophone station. After enabling this patch the only sounds you will hear when manning the hydrophone station are: hydrophone ambient and any contacts

Starting with v1.0.92.0 Added a new patch to the SH5.exe that randomizes the nearest visual contact's distance returned. This new patch will take your sub's crew veterency level into account.

Starting with v1.0.93.0 Revised the randomize nearest visual contact patch. Now the patch takes weather into account (clouds, fog type, and precipitation type)

Starting with v1.0.94.0 Revised the randomize nearest visual contact patch again. Now the patch remembers the last unit it used for the command. If the unit is the same unit as last time and difference between distance to contact now and before < 500m (a variable in the patch file) then it returns last randomized distance else returns new randomized distance. If the unit is different than last unit then it returns a new random distance.

Starting with v1.0.100.0 Revised the Generic Patcher app to load all .s5p files found in the executable's path. Added tooltips to treenodes. Added new treenodes to Patches: Dependencies, Files, Pictures, and Notes. If any of these have entries in them be sure to double click them and read/copy them! The app now checks to ensure those Patches that are enabled and that have dependencies defined have the dependencies enabled.

Starting with v1.0.102.0 You have the ability to create/restore snapshots. Snapshots are a snapshot of all the patch file's patches currently loaded.

Starting with v1.0.105.0 Added the ability to define and use language packs

Starting with v1.0.107.0 Added a new patch to the SH5.exe: New destroyed marks (required for my NewUIs mod v7.5.0 and greater). Fixed bug of clicking cancel after File-->Open was clicked caused treeview items not to show. Added Francais language pack (courtesy of Choum)

Starting with v1.0.109.0 Added the ability to define help files. With each language pack folder there is a folder named Help. Simply placing help files in this folder will cause the app to display them in a listbox to the user when Help is pressed. Then when user clicks any entry in this listbox the user's OS will open the file using the application defined for the file's extension. Added 2 new entries to the existing language packs: 30 and 1513. Added a new entry to each Patch file's Patches: Group=. This new entry will allow patches to be placed into groups. All the torpedoe patches in SHSim have been placed in the Torpedoes group. Added Volodya61's help file to the Russian language pack's Help folder.

Starting with v1.0.110.0 Fixed bug in Help menu item. Those language packs that are missing are set to English language pack.

Starting with v1.0.111.0 Revised language pack entry 1506. Broke it into two stings. Added new language pack entry 1515 which is the second string.

Starting with v1.0.112.0 Added a new patch to SH5.exe: All torpedo tubes set to impact detonation only at game start

Starting with v1.0.113.0 Added a new patch to the SHSim.act: reloaded torpedoes magnetic detonator disabled (if applicable to the torpedo). Can be found under the Torpedoes group. App now supports the following languages: Spanish, French, German, and English. Updated the Russian help files with volodya61's updated manual.

Starting with v1.0.115.0 Added two new patches to SH5.exe: Disable UPlay browser and Show game messages. Disabling the UPlay browser will allow you to play single missions and test campaign only. Campaign progress will NOT be updated while this patch is active (copy protection of game). Show game messages is for Advanced Users and will show a dialog box every time the game adds a new entry to it's internal log.

Starting with v1.0.116.0 Fixed bug in SH5.exe Disable UPlay patch that would prevent command line args from being parsed and if the language chosen for the game wasn't recognized the UPlay browser would still be shown

Starting with v1.0.118.0 Added a new patch to the SH5.exe: Carriers spawning aircraft when they have a contact detected.

Starting with v1.0.119.0 Fixed bug in the Carriers spawning aircraft patch that caused waypoints of units that weren't based from a carrier or were based from a carrier but the carrier had no contacts to be incorrectly set. Added the ablility of the carrier to spawn more than two units. It can spawn 1 additional unit also (for a total of 3). This is a variable in the SH5 patch file that is currently set to 1.

Starting with v1.0.121.0 Revised the Carriers spawning aircraft patch again. See here for details:

Starting with v1.0.122.0 Added two new entries to \data\Cfg\AirStrike.cfg: Carrier Night Modifier and Carrier Default Air Strike Probability. If these entries are found in the file they will override the Carriers spawning aircraft patch's default settings for these.

Starting with v1.0.124.0 Added a new patch to the SH5.exe, SHSim.exe, and SimData.dll: Electric engine properties. This patch will add a new section to the sub's .cfg files named [ElectricEngineProperties]. It allows you to define the engine ratios for the electric engines. See the Notes= of the patch for more info and an example.

Starting with v1.0.125.0 Revised the Carriers spawning aircraft patch. The revision lets airbases spawn aircraft. Units that detect a contact and within the reach of an airbase will radio to the airbase asking for air assistance. If the airbase agrees it will dispatch units to investigate/attack the unit's contact

Starting with v1.0.126.0 Revised the Engine ratios patch to fix bug of AI sub's battery capacity being incorrectly reported to the game

Starting with v1.0.127.0 Added a new patch to the SH5.exe: Max dive depth for messagebox. This patch will have the navigator report the max dive depth possible for the sub's current position and current depth when asking for depth under keel as an entry in the messagebox

Starting with v1.0.128.0 Revised the Carriers/Airbases spawning airplanes patch: fixed bug of player's radioman asking for air assistance when never told so, fixed bug of carriers/airbases using incorrect % chance of spawning units when they have no contacts and/or no units have contact passed to them, revised the code so that I can use whether unit has a radio or not (for determining if unit radioed for assistance and whether units/airbases received that message). Currently this determine if has radio function returns 1 (unit has radio and is operational). I have to code it in yet. When unit asks for air assistance the logic steps value is now set to a random value between 1 and 4 (defined in patch file).

Starting with v1.0.142.0 Added new commands to the game. Added patch to SH5.exe that allows submarines and environmentals to be 'heard' on the hydrophone (Submarine and Environmental will show in hydro box). Fixed CTD that could happen in the Broken hydro patch for SH5.exe when the hydrophone needle passes over a dead unit.

Starting with v1.0.143.0 Added a new patch to the sh5.exe: Stadimeter can only be used at Attack scope or UZO (as Sextant)

Starting with v1.0.144.0 Revised the Stadimeter as Sextant patch so that game can automatically set the zoom level required for the Sextant.

Starting with v1.0.145.0 Finished the radio portion of the Carriers/Airbases spawning aircraft patch. The patch will look for 2 zones: 235 (Radio Room) and 236 (Transmit antenna). It will then check the damage to each one. If the damage is greater than the damage in the patch file (0.5 for both) then the unit was unable to radio for support (air support). This makes it paramount to place your deck gun shells on the radio room and/or it's transmit antenna! The patch also has the 237 zone enabled: receive radio antenna (max damage of 0.5). It's coded to be able to use it but currently nothing is using this feature (to be added here soon!). Added 2 new patches to the sh5.exe: remove yellow designation triangle for deck gun and disable automatic deck gun firing/man the deck gun when target designated for deck gun

Starting with v1.0.146.0 fixed bug in determine whether unit has radio capability code that was incorrectly calculating the current damage to the zone. Add a new patch to SHCollisions.act and SHSim.act: Units must use radio to contact other units about contacts. This new patch forces the units to use their radio to contact other units in regards to a contact they have spotted. If unit spots a new contact: game will see if unit has radio transmit capability. If it does not nothing happens. If it does have radio transmit capability: it will broadcast a message to each unit of it's own nationality in the game. Each unit will be tested to see if it has radio receive capability. If it does not then it does not receive the message. If it does then it will receive the message and set course for the unit that dispatched the message. All this depends on gap's Ship radio damage work. If the unit does not have the zones for radio room or transmit/receive antennas then the patch considers them as available and can be used. Ensure to check the Files= entry for the new patches!

Starting with v1.0.147.0 fixed bug of new radio room and antenna zones not enabled in AI crew damage control patch. Now the AI crew is able to repair these zones (if they aren't damaged too much and/or flooded too much)

Starting with v1.0.148.0 fixed intermittent bug in Units must use radio patch that could cause endless animation looping and possible CTD. Added a new patch to SH5.exe Advanced users: Damage zone debugging. See the patch's Notes= for info on how to use it.

Starting with v1.0.149.0 In the SH5.exe Stadimeter as sextant patch I moved two of the changes to updates so that the Navigator assistant speed calcs feature of my UIs mod will work correctly if Stadimeter as sextant patch is disabled.

Starting with v1.0.151.0 added a new patch to the SHSim.act file: Air-To-Air combat. This patch allows aircraft to target and engage other aircraft. NOTE: in order to work correctly you need to have minimum IRAI v0.0.41.0 installed also.

Starting with v1.0.152.0 added a new patch to the SHSim.act file: Artillery (coastal defenses) and anti-aircraft units able to acquire and track contacts

Starting with v1.0.156.0:
- added some new Updates to sh5.exe
- added a new patch to SH5.exe and SHSim.act: manual diveplane control - this patch allows manual control of the fore and aft diveplanes. BE SURE TO CHECK OUT THE NOTES WITH THIS NEW PATCH!
- added a new patch to SHSim.exe: Air-to-air combat - this patch allows aircraft to target and engage other aircraft.
- added a new patch to SHSim.exe: Coastal defense sub loops - Allows coastal defenses to detect subs that are submerged and/or in heavy fog
- revised new command code in SH5.exe so that it can pass Param1 and Param2 on to functions and to all scripts
- added new code to SH5.exe that allows the defining of commands not recognized by the game to dials

Starting with v1.0.157.0 revised the manual diveplanes control patch to fix the CTD that would happen if you had manual control of any diveplanes enabled and you exited to main menu and then loaded a save game or picked another single mission

Starting with v1.0.158.0 added 3 new patches to the SHSim.act file: searchlights active at dusk when they have a contact, Player's unit visual sensor affected by available light, and Units visual sensor affected by available light (does not affect player's unit)

Starting with v1.0.159.0 rewrote the Player's unit visual sensor affected by available light and Units visual sensor affected by available light (does not affect player's unit) patches due to non-linearity found (not accounting for 0 based numbers) and to add some error checking (in case user enters incorrect values for variables in patch file) and because the code was FUGLY!

Starting with v1.0.160.0:
- added a new patch to the SH5.exe: Increase render distance of units. This new patch will, as it says, increase the render distance of units from the player's unit. Default render distance is 40000.0m. This patch will let you define an additional value to add to this 40000.0m thus increasing the render distance from the player's unit. Default value is an additional 40000.0m. See the Notes= of the new patch to learn how to change the default value.
- revised the Player's unit visual sensor affected by available light and Units visual sensor affected by available light (does not affect player's unit) patches so that if it's nighttime it will use the additional nighttime multiplier specified in the patches.
- Added notes (Notes=) to the Player's unit visual sensor affected by available light, Units visual sensor affected by available light (does not affect player's unit), and searchlights active at dusk when they have a contact patches so that the end-user knows how to adjust the variables for those patches

Starting with v1.0.161.0 added a new Update to the SHSim.act file: Amount of available light that determines when it's nighttime in the game for sensors. Updates are found under the Updates node. This allows the end-user to set the amount of available light that determines nighttime for sensors. See the Notes= of the update for how to adjust.

Starting with v1.0.162.0 added a new game file to the patcher: kernel.dll. Add a new patch to kernel: Objects follow wind direction. This new patch will have any objects that have _FLG in their name (flags for one) AND a GlobalWind controller attached to them take wind direction and speed into consideration. See the Files= and Notes= of the patch for more info.

Starting with v1.0.163.0 added a new game file to the patcher: EnvSim.act. Added two new patches to EnvSim: wind speed allowed to be set to 0m/s and max allowable wind speed increased to 60m/s (stock game was 15m/s). NOTE: MissionEditor2 will only allow you to specify 15m/s for wind speed so you'll have to hand edit the file to attain > 15m/s wind speed

Starting with v1.0.164.0 revised the SH5.exe stadimeter as sextant patch. Now you can take readings on heavenly bodies from +75 to -15 from the waterline.

Starting with v1.0.165.0 added a new patch to SHSim_act: RPM inertia. Player's unit and AI unit's shafts/props will now have inertia and thus will not 'spin up' or 'spin down' at ridiculous speeds. See the Notes= of the patch for how to change the multipliers

Starting with v1.0.166.0 revised the RPM inertia patch in the SHSim_act to fix bug of trying to use invalid pointer that can happen in campaigns and some single missions

Starting with v1.0.168.0 revised the RPM inertia patch again in the SHSim_act to fix CTDs

Generic Patcher v1.0.168.0 available here:
NOTE: DISABLE ALL PATCHES WITH OLD PATCHER BEFORE APPLYING NEW PATCHES WITH NEW PATCHER! THIS APPLIES TO ALL PATCHES! Use the snapshot feature to take a snapshot that you can restore from when you have the new version installed!

How to use the patcher app:

Last edited by TheDarkWraith; 08-20-14 at 01:27 PM.
TheDarkWraith is offline   Reply With Quote