SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 02-26-11, 11:10 PM   #1
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default SH5 DLL Injection

I've written a little application in managed C# that allows you to pick a DLL to inject into SH5. You can also remove injected DLLs and remove currently loaded DLLs from the SH5 process. I call this application 'SH5 Injector'. This is a scaled down version of my 'DLL Injector' (DLL Injector can inject/remove DLLs into/from ANY process running on your computer)

This app is a 64bit application and thus will not work on 32bit OSs. It is also targeted at the .NET 3.5 framework or higher.

This application is very handy for injecting custom DLLs into SH5 to monitor, replace, extend, or modify in-game code or variables. It can also be used to create DLL hooks on modules loaded into the game (through code in a custom DLL injected into the SH5 process). There are many uses for this Due to the way that I do the injecting and removing of the DLLs it's very hard to detect and counter (SH5 has no idea that anything happens at all!). Shouldn't trip any anti-virus software either.

As this does not modify the SH5.exe or any game files it is completely legal What it does is inject the dll selected into the current SH5 process or removes the selected DLL from the SH5 process. This is all done using the Win32 API which is part of Windows for those that are not familiar with it.

The UI for the application is very intuitive and easy to use

This is the first step to extending, modifying, and/or creating new code for the game

In a future release I plan on adding the ability to inject straight code into the SH5 process. I plan on letting you type assembly instructions right into the UI and then the app will compile those into machine code and inject into the process (in it's own memory space ).

To use:
- fire up SH5
- fire up SH5 Injector

32bit version: http://www.gamefront.com/files/20051...Injector32_exe

64bit version: http://www.gamefront.com/files/20049...Injector64_exe


Last edited by TheDarkWraith; 02-28-11 at 10:44 AM.
TheDarkWraith is offline   Reply With Quote
Old 02-27-11, 12:19 AM   #2
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,226
Downloads: 901
Uploads: 73


Default

Sounds like the next step . I think and hope this game will be around for a long time .
THE_MASK is offline   Reply With Quote
Old 02-27-11, 01:12 AM   #3
mobucks
Seasoned Skipper
 
Join Date: Jan 2010
Posts: 713
Downloads: 209
Uploads: 0
Default

dude awesome!
mobucks is offline   Reply With Quote
Old 02-27-11, 02:59 AM   #4
jean74
Medic
 
Join Date: May 2006
Location: Near Lake Leman and Geneva, FRANCE
Posts: 162
Downloads: 150
Uploads: 0
Default

Thank you Sir
jean74 is offline   Reply With Quote
Old 02-27-11, 03:14 AM   #5
dcb
Grey Wolf
 
Join Date: Apr 2005
Location: Bucharest, Romania
Posts: 845
Downloads: 544
Uploads: 0
Default

This looks like a huge breakthrough for this game, the next gen in modding the game.
dcb is offline   Reply With Quote
Old 02-27-11, 04:02 AM   #6
stoianm
Ocean Warrior
 
Join Date: Dec 2010
Location: Montreal, Canada
Posts: 2,776
Downloads: 833
Uploads: 11
Default

fantastic

maybe it is the time for somebody to start to think how to add snow in the sh5 now

manny thanks TDW
stoianm is offline   Reply With Quote
Old 02-27-11, 04:18 AM   #7
BigBANGtheory
Officer
 
Join Date: Dec 2009
Location: British Waters
Posts: 243
Downloads: 98
Uploads: 0
Default

If I understand correctly this means you could potentially change core game features to a large extent!

Choosing my words carefully here... : How would one go about creating a new dll for SH5.exe injection?
BigBANGtheory is offline   Reply With Quote
Old 02-27-11, 06:23 AM   #8
kemeri
Seaman
 
Join Date: Mar 2006
Posts: 39
Downloads: 34
Uploads: 0
Default

I don't understand a word, but sounds great!

Will it be possible with such an injections to do/mod, for example:
- snow
- independent control of engines
- complex your own sub damage/trim system
- further IRAI improvements
- .....?

By the way, TDW, how much time have you actually just played the SH5?
Take a break, you are unlocking doors faster then people enter
kemeri is offline   Reply With Quote
Old 02-27-11, 09:07 AM   #9
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by BigBANGtheory View Post
If I understand correctly this means you could potentially change core game features to a large extent!

Choosing my words carefully here... : How would one go about creating a new dll for SH5.exe injection?
Yes one can change core game features to a large extent and one can add new features to the game. It's not as easy as it sounds though. Your new content would be in the dll to inject and you hook into the game to have it execute your new code. You add the hook via code in your dll.

I use Visual Studio 2008 C# or C++ to do my programming and my DLL creating. One could use Visual Basic if they wanted to. A DLL is an exe with one bit changed in the PE header to 'make' it a DLL. Any computer language can be used as long as you can compile the source code into a dll.
I'm going to make a sample dll file and include source code so that you can see what this app can do for SH5
TheDarkWraith is offline   Reply With Quote
Old 02-27-11, 01:45 PM   #10
urfisch
Sea Lord
 
Join Date: Mar 2005
Location: Deep down in Germany
Posts: 1,969
Downloads: 42
Uploads: 0
Default

nice!

but what does this injection method make possible?
__________________


urfisch is offline   Reply With Quote
Old 02-27-11, 01:52 PM   #11
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by urfisch View Post
nice!

but what does this injection method make possible?
Anything that you can code in. You can create hooks, replace code, add code, view code, etc. It's just a matter of writing the .dll and injecting it in.
When a dll is loaded into a process the windows loader automatically calls the DLLMain function of the dll. This means your dll is 'run' as soon as it's injected into the process
TheDarkWraith is offline   Reply With Quote
Old 02-27-11, 02:12 PM   #12
cherbert
Engineer
 
Join Date: Apr 2005
Posts: 210
Downloads: 86
Uploads: 0
Default

Quote:
Originally Posted by urfisch View Post
nice!

but what does this injection method make possible?
I think an extreme example would be that should you have unlimited time, desire and resources to apply to such an undertaking you could use this DLL method to write a whole new Silent Hunter 6 using the existing core 3D engine. This example is far fetched but it helps explain the power now available to the community with this break through. We could be seeing proper un-official patches to the core game engine -however, it will require some highly skilled expert coders. This really is very exciting for Silent Hunter 5!

Not sure if this solves the importing of new 3D models though?
cherbert is offline   Reply With Quote
Old 02-27-11, 02:39 PM   #13
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

one could write a .dll to replace an entire function in the sh5.exe by using dll injection. The hardest part is deciphering the assembly language and figuring out what it's doing in the game.
Using OllyDebug you can attach to the SH5 process and suspend the game and 'look inside'. There you can figure out what you want to change/replace/add and write a .dll to replace the code wanted (make note of the RVA so you can modify the correct code!)
I'll try and make a dll (with source) that hooks into the main sh5.exe code and executes a function in that dll. Basically what this dll would do is:
- modify the ingame code to 'jump' to your function and execute it
- once the function in the dll is complete it 'jumps' back to the ingame code like nothing ever happened.
- As this new function is now part of the game code it will be called everytime the code comes to that spot
TheDarkWraith is offline   Reply With Quote
Old 02-27-11, 03:23 PM   #14
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,226
Downloads: 901
Uploads: 73


Default

This is prolly lame , but with this could you click on a button in game and bring up google earth and look at your navmarks on google earth while playing the game .
THE_MASK is offline   Reply With Quote
Old 02-27-11, 03:31 PM   #15
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by sober View Post
This is prolly lame , but with this could you click on a button in game and bring up google earth and look at your navmarks on google earth while playing the game .
I wouldn't say it's not possible but it would be hard to do. It could be done though. You could do this easier with a game's .py file
TheDarkWraith is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:55 PM.


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