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 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 04-07-21, 05:21 PM   #1
Velores
Bilge Rat
 
Join Date: Jan 2021
Posts: 1
Downloads: 13
Uploads: 0
gear Major discovery for UI modding using SH5 Menu editor for Silent Hunter 3

How do you do fellow captains?

Well, I will start from the beginning. Couple days ago was playing good old SH3 with some more or less regular selection of mods including ARB1080 GUI. Game was launched on my secondary side monitor because it is actually 1080p, rather than main monitor which is bigger. While game already runs in much bigger resolution it was originally made, my human nature always asks for better. Most of all I was getting tired looking on that "keyhole" thing called periscope, trying to spot there distant ships, recognize them, recognize flags - you probably familiar what I am talking about. So in one moment one idea appeared in my mind - "If the game is already modded to such degree, it must be also possible to do the same for even bigger screens". Prior to that I actually was messing a bit with interface files and textures here and there to tweak things for personal preference, so I had some minimal basic understanding how it works under hood.

So here is where I started my ALARM dive into the rabbithole. Initial idea was to make "patch" on top of original ARB WideGui 1920x1080 to tune it for new 2560x1440 resolution at least for personal use and if it will work and look at least decent release for public (there is probably a good demand as high resolution monitors more and more affordable from day to day). I was able to launch game in new resolution at first tweaking d3d9.ini. Later I was able to increase map rendering limit once more (4096x4096), thanks to Tycho's patch. Then started moving and repositioning elements on screen in menu_1024_768.ini file, some parts were quite good organized there and editing was painless, while others were showing signs of over 10 years of editing, adding, removing, hiding, placeholders, replacers, links to nonexistent files, made by different people (I guess there are comments in 3 different languages). And even while it probably will be possible to bruteforce all of that, that's one way road, and all my work will be just another layer of complications on top of that. What if we need to revisit this file once more in future? Can we cleanup this file and make it more simply editable? If only there was some tool better than simple text editor...

BUT WAIT I know there is SilentHunter5 menu editor and some people even tried using it in the past
https://www.subsim.com/radioroom/sho...d.php?t=215943

And I started digging in that direction. If you ever was interested it this matter, you probably know that there are two major problems (among many minor problems). First - SH5 uses concept of adaptive interface, so all elements sizes and positions are defined by strange for us Zone argument. And second - because of first it's menu editor always launches in windowed 1024x768 base minimum resolution. Spoiler spoiler those two problems are solved now (while there is a lot of experiments and tests to be done, at first glance I haven't noticed any serious complications) In the matter of minutes I was able to cut "Attack Map" page from SH3, paste it in SH5 folder structure, edit it in different ways (change sizes, positions, textures, colors, parenting, copy/paste/delete elements) and then insert it back in place to SH3 game folder, successfully started the game, started the mission, and opened map screen to see exactly the same what I done in editor (well I got couple error windows, probably deleted some elements that was referenced by dials.cfg file).


So to the main part. How it works and how to do it.
(Keep in mind that I am writing this as it is for now and what I understand at the moment, so new details may arise, stay tuned or feel free to share if you know some useful information)

Required tools:
1. Clean installation of SH3
(I will refer to it as \SH3\... from now)

2. Clean installation of SH5
(I will refer to it as \SH5\... from now)

3. ARB WideGui 1920x1080
https://www.subsim.com/radioroom/sho...d.php?t=232178
(you mainly need DirectX wrapper from there, that's d3d9.dll and d3d9.ini files)

4. A utility program called Borderless Gaming
https://github.com/Codeusa/Borderless-Gaming/releases

5. Optional. Generic Mod Enabler (JSGME)
You should completely understand how it works and what you are doing, so this tool could save you some time rather than moving, copying and renaming folders manually.


Instructions:

0. You installed both games, both games are launching up to actual gameplay and all behaves as expected.


1. Open SH5 configuration file using text editor at this path
C:\Users\%username%\Documents\SH5\data\cfg\main.cf g
where %username% is your name in Windows OS
You should navigate to the part called [DEVELOPING], it could be commented out or it could be set to No or False, anyway you need to enable all developer tools
This is how it need to look the right way:
Quote:
[DEVELOPING]
Modding=Yes
MenuEditor=Yes
DebugScripts=Yes

2. Now when you are trying to launch game \SH5\sh5.exe - a window prompt will appear "Do you want to activate menu editor?" click Yes. Soon "a regular" game window (1024x768 size) will launch alongside with actual menu editor, and you sold see list of all default SH5 UI pages, browse them and preview how it looks in game window. Good, you can close it by now.



3. Next step is to force SH5 even in editor mode to work in other resolution than default 1024x768.
To do so put files d3d9.dll and d3d9.ini from ARB WideGui 1920x1080 archive into the \SH5\ root folder. Open d3d9.ini using text editor and change values DisplayWidth= and DisplayHeight= to desired resolution that you are planning to work on
!!! It should be the same as resolution of your primary screen !!!
(hint you can use JSGME here, just remember to edit .ini file prior to enabling mod)
Mine look like this:
Quote:
[ENGINE]
DisplayWidth=2560
DisplayHeight=1440
Perform test launch of \SH5\sh5.exe - you should notice right from the beginning that loading screen is now cropped weirdly. The game still appears in 1024x768 window but now it's rendering in new resolution internally.


4. Now it's time to fix the window size itself. Install Borderless Gaming, launch it, you will see a small window containing 2 lists and 4 buttons. Next launch \SH5\sh5.exe once more, wait while it fully loaded and ready, locate in Borderless Gaming's left list Silent Hunter 5 process, select it and press 3rd button (square, arrows pointing outwards) to enlarge that window to full desktop resolution.
Well if all done correctly by now you have UI creation tool, showing you a full resolution canvas. But we want to create mods for SH3 right?


5. Navigate to your \SH3\data\Menu\menu_1027_768.ini open in text editor
(rather already modded version of that file or original depends where you want to start from)
Pick a group you are about to edit, lets say for example - 27=27;Page binocular
Serch, select and copy all the content from [G27 I1]...[G27 Ixxx] groups to a new file and save as Page binocular.ini at separate workfolder

!!! It still unclear how SH5 Menu editor interprets names, there is basically 3 things to look at filename itself, groupnumber [G27] which gives ItemID=0x27000000 and also page Name=Page binocular
please pay close attention to those numbers as you will be moving stuff back and forth from SH3 to SH5 and vice versa !!!


Now in \SH5\data\Menu\Pages folder find the original Page binocular.ini backup it somewhere safe, and paste in its place one you just created from SH3.
The same thing need to be performed for the folder that contains textures for corresponding element, usually this is Gui folder.
\SH5\data\Menu\Gui
rename to
\SH5\data\Menu\Gui_original

copy
\SH3\data\Menu\Gui
paste into
\SH5\data\Menu\

Also check \SH5\data\Menu\Pages\menu_1024_768.ini if it contains right linkage for the page you are working on.


6. Launch sh5.exe in editor mode, now you should be able to see contents of corresponding copied group from SH3

!!! IMPORTANT Because SH5 uses different coordinate positioning system expect majority of elements, which have complicated parenting hierarchy, to be completely out of place or even far beyond screen borders upon load. Concluding - you can NOT load 300 items file from SH3 in SH5 editor expecting tweak couple values fast and save it. You'd rather start creating completely from scratch or to be ready review EVERY item on that page and reposition it as needed !!!


7. Now about how to workaround that position/zone/anchor problem.
About what it is and how its works I strongly recommend to familiarise yourself with this thread
https://www.subsim.com/radioroom/sho...d.php?t=163118
As well there is probably many more useful info in SH5 subforum.

From what I found to be working is for every item under "Zone" parameters set Anchor to NULL and all the other parameters there should pop to 0s. This way we using strictly absolute coordinate calculations (same as SH3). Now when you deselected anchor for given item, you will be able to manually enter coordinates in corresponding upper boxes (X, Y, DX, DY) or position it directly in viewport by mouse or keyboard arrows.



!!! Keep in mind that XY position that editor shows you is the final calculated position including parent transformations. For example in SH3 if we have parent A(100,100) and child B(200,200) - final position on screen for item B will be (300,300). In SH5 editor if you place some item B onto (300,300) and parent it to A(100,100) you will still observe (300,300) coordinates, but saving the file will perform all the correct calculations and should give you the same A(100,100), B(200,200).


8. I hope, at this point it just formality to explain how to migrate your edited stuff back to SH3.
Open file you just edited and saved at
\SH5\data\Menu\Pages
Copy its content and paste into (at correct place)
\SH3\data\Menu\menu_1027_768.ini
or rather using JSGME into
\SH3\MODS\YourModName\data\Menu\menu_1027_768.ini

!!! Obviously always check all IDs, group names etc !!!

!!! Note. SH5 editor even we are disabling Zone anchors, tend to leave line Zone=... for every item upon saving file. I have not detected any unusual behavior of Silent Hunter 3 while reading this files. So does it ignores those lines, or maybe it has some support of those anchors? We need to find out.



Well that's about it. As I said in the beginning, I was working on simple adaptation for new resolution, but looking onto new possibilities that's all need to be reconsidered. I will leave a couple of teasing pictures what has been done up to this point anyway.

 





Last edited by Velores; 04-07-21 at 05:31 PM.
Velores is offline   Reply With Quote
Old 04-08-21, 10:34 AM   #2
sublynx
Sea Lord
 
Join Date: Mar 2011
Location: In the conning tower of my VIIC scanning the sea through the periscope
Posts: 1,698
Downloads: 173
Uploads: 7
Default

Marvelous news! Thanks for sharing. That will make it a lot easier to make new UI mods.
__________________
[SIGPIC][/SIGPIC]
NYGM+H.sie v16+Stiebler 4C+MaGui WS
sublynx is offline   Reply With Quote
Old 04-08-21, 01:31 PM   #3
rik007
Seasoned Skipper
 
Join Date: Jan 2002
Location: Holland
Posts: 706
Downloads: 117
Uploads: 0
Default

Great catch! Now we will see the mods flowing in! And welcome in the community!
rik007 is offline   Reply With Quote
Old 04-08-21, 04:32 PM   #4
CapZap1970
Sea Lord
 
Join Date: Mar 2007
Location: La Paz, Bolivia
Posts: 1,956
Downloads: 259
Uploads: 51
Default

Wow!!! This is great! Will give it a try!

Thanks a lot for sharing!


__________________
CapZap1970 is offline   Reply With Quote
Old 04-09-21, 05:59 AM   #5
ericlea
Samurai Navy
 
Join Date: Jan 2014
Location: Strasbourg F
Posts: 572
Downloads: 109
Uploads: 0
Default

ericlea is offline   Reply With Quote
Old 04-09-21, 06:36 PM   #6
divemonkie
Medic
 
Join Date: Aug 2018
Posts: 166
Downloads: 1031
Uploads: 0


Default

would this work to reduce resolution? I like ARB but cant use it. the high res makes reading my solutions imposable without sniffing my screen. I'm using Magui 1360x768 witch works great but ARB does have a few options like full map and radar/uzo/radio up/down that I'd find very handy.

great find, thanks for sharing.
divemonkie 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 10:52 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.