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 01-03-12, 04:27 PM   #1
rocker_lx
Watch
 
Join Date: May 2005
Posts: 27
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
I did one better. I included a new menu item:



If this is unchecked it will use US regional settings (thus the . for decimal notation). If this is checked then it will use your current regional settings. This gives the most flexibility
This is saved to the cfg file at app end and read from cfg file and applied at app start.

and with that....

v1.0.499.0 released. See post #1

Let me know if the export problem is fixed and whether this decimal 'problem' is cured or not

Also fixed the problem that the texture coordinates were not being saved to the current size of the render window when you selected to save render window.
Yep, decimal problem is fixed also select save location now also exports mtl and tga files.
I still get the error with the bounding spere, but it does not cause a problem.
rocker_lx is offline   Reply With Quote
Old 01-03-12, 04:47 PM   #2
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by rocker_lx View Post
Yep, decimal problem is fixed also select save location now also exports mtl and tga files.
I still get the error with the bounding spere, but it does not cause a problem.
Good to hear

Yes I've noticed that error in some of the doors. I'm investigating why currently. So far it appears the mesh (as read from the file) is messed up...
TheDarkWraith is offline   Reply With Quote
Old 01-03-12, 10:48 PM   #3
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Started making the architectural changes necessary for the new importer. This is major reworking when it comes to coding There really was no way to prevent it because during planning I had no idea I would make it to this stage.

When it's all said and done the new importer will allow you to import anything (note 1) into a GR2 file.

Now note 1:
The pointers used in the GR2 files are a godsend and a hinderance at the same time. I've been unable to come up with an algorithm that manages to remap every pointer needed 100% of the time for whatever you want to do. The number of different combinations of what one could do are hard to fathom. So I took a step back and took another look at what one could do. What we want to accomplish is:
- importing new vertex data to replace existing
- change material names to reflect material needed for new vertex data
- change bones to match new vertex data

We can already edit bones to reposition/rotate them. All that is really needed for this is ability to change names. The new importer will allow you to change names BUT the length of the name cannot exceed the length of the old name (shorter names are fine).

Same thing above applies to new material names. We'll use existing materials and edit them.

Vertex data...the biggie. Using the exploit I mentioned some posts ago this can be done. Now I haven't coded in this part yet but in theory it should work. If you think about how the GR2 file lays out vertex data you'll notice that it all sits in one big chunk of space (except for skin data and animations). There are pointers to data in there from PrimaryVertexData defines. These pointers are managable in regards to changing. By changing the PrimaryVertexData's pointers and using the exploit, theoretically, one can put anything they want in that chunk of space.

Above applies to indicies also.

So with this we can think of the GR2 file as a shell. We can hollow out a shell and fill it with what we need. If we don't use all the space no big deal.

I have added a new class to the app - Registry. Everything that gets made (read in/saved to file) or destroyed ('hollowed out') has to go through the registry (like Windows). Thus this class is the overall master of the file. It knows where everything is, how much space is between things, what can be added, what can be removed, how big something is, etc.

With this we can take a GR2 file and replace it's 'guts' with the new vertex data, indicies, and names required. Thus we are not making new GR2 files per se, we are using existing ones as a host.

That's my course of action that I'm heading down currently
TheDarkWraith is offline   Reply With Quote
Old 01-04-12, 05:55 AM   #4
urfisch
Sea Lord
 
Join Date: Mar 2005
Location: Deep down in Germany
Posts: 1,944
Downloads: 42
Uploads: 0
Default

sounds as if someone founds his destiny...

__________________


urfisch is offline   Reply With Quote
Old 01-04-12, 05:10 PM   #5
redcoat22
Sailor man
 
Join Date: Apr 2008
Posts: 48
Downloads: 8
Uploads: 0
Default

I follow this post with glee yet have little idea what everyone is saying. Good work lads.
redcoat22 is offline   Reply With Quote
Old 01-05-12, 03:10 AM   #6
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

v1.0.507.0 released. See post #1

Almost all the architectural changes to the code are complete. I changed the name of the Registry class to Sentinel because it better describes what it's doing (looking out for and protecting the GR2 file).

Now when you open a file you will see the file's sentinel activated

The sentinel adds some overhead to loading, saving, and making changes. You'll see loading times increase some. It's needed though

If you want a small glimpse of what the sentinel is doing under the hood enable debug output under the misc tab. Once a file is loaded it will spit out what it's tracking (I disabled some items from the status report).

As there were a ton of changes I'm hoping for no bugs but realistically I expect some. Hopefully they are minor in nature.

Let me know if the sentinel is too sensitive (keeps 'barking' saying there's problems). It never 'barked' at me once and I tried many different files.

TheDarkWraith is offline   Reply With Quote
Old 01-09-12, 01:36 AM   #7
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

I found this very interesting:

Items in section -1:
No items found in registry
Section -1 is contiguous
Items in section 0:
arttoolinfo NRTW_NRTW_ArtToolInfo Starting offset=0x0 (0x1C8) Ending offset=0xA8 (0x270)
extendeddata NRTW_NRTW_ArtToolInfo_ExtendedData Starting offset=0xA8 (0x270) Ending offset=0x2C0 (0x488)
exporterinfo NRTW_NRTW_ExporterInfo Starting offset=0x2C0 (0x488) Ending offset=0x2DC (0x4A4)
pointer Texture Starting offset=0x2DC (0x4A4) Ending offset=0x2E0 (0x4A8)
pointer Texture Starting offset=0x2E0 (0x4A8) Ending offset=0x2E4 (0x4AC)
pointer Texture Starting offset=0x2E4 (0x4AC) Ending offset=0x2E8 (0x4B0)
pointer Texture Starting offset=0x2E8 (0x4B0) Ending offset=0x2EC (0x4B4)
pointer Texture Starting offset=0x2EC (0x4B4) Ending offset=0x2F0 (0x4B8)
texture E:\SilentHunter5\Units\_Common\Textures\ship_hull_ N02.dds Starting offset=0x2F0 (0x4B8) Ending offset=0x33C (0x504)
texture E:\SilentHunter5\Units\_Common\Textures\ship_hull_ T03.dds Starting offset=0x33C (0x504) Ending offset=0x388 (0x550)
texture E:\SilentHunter5\Units\_Common\Textures\ship_N04.D DS Starting offset=0x388 (0x550) Ending offset=0x3D4 (0x59C)
texture E:\SilentHunter5\Units\NRTW\NRTW_AO01.dds Starting offset=0x3D4 (0x59C) Ending offset=0x420 (0x5E8)
texture E:\SilentHunter5\Units\_Common\Textures\ship_T04.d ds Starting offset=0x420 (0x5E8) Ending offset=0x46C (0x634)
pointer Material Starting offset=0x46C (0x634) Ending offset=0x470 (0x638)
pointer Material Starting offset=0x470 (0x638) Ending offset=0x474 (0x63C)
pointer Material Starting offset=0x474 (0x63C) Ending offset=0x478 (0x640)
pointer Material Starting offset=0x478 (0x640) Ending offset=0x47C (0x644)
pointer Material Starting offset=0x47C (0x644) Ending offset=0x480 (0x648)
pointer Material Starting offset=0x480 (0x648) Ending offset=0x484 (0x64C)
pointer Material Starting offset=0x484 (0x64C) Ending offset=0x488 (0x650)
pointer Material Starting offset=0x488 (0x650) Ending offset=0x48C (0x654)
pointer Material Starting offset=0x48C (0x654) Ending offset=0x490 (0x658)
pointer Material Starting offset=0x490 (0x658) Ending offset=0x494 (0x65C)
pointer Material Starting offset=0x494 (0x65C) Ending offset=0x498 (0x660)
pointer Material Starting offset=0x498 (0x660) Ending offset=0x49C (0x664)
material Standard_3 Starting offset=0x49C (0x664) Ending offset=0x4B4 (0x67C)
extendeddata NRTW_NRTW_Standard_3_ExtendedData Starting offset=0x4B4 (0x67C) Ending offset=0x6DC (0x8A4)
material DMG Starting offset=0x6DC (0x8A4) Ending offset=0x6F4 (0x8BC)
extendeddata NRTW_NRTW_DMG_ExtendedData Starting offset=0x6F4 (0x8BC) Ending offset=0x91C (0xAE4)
material NM Starting offset=0x91C (0xAE4) Ending offset=0x934 (0xAFC)
extendeddata NRTW_NRTW_NM_ExtendedData Starting offset=0x934 (0xAFC) Ending offset=0x9E0 (0xBA8)
material NM Starting offset=0x9E0 (0xBA8) Ending offset=0x9F8 (0xBC0)
extendeddata NRTW_NRTW_NM_ExtendedData Starting offset=0xA00 (0xBC8) Ending offset=0xA24 (0xBEC)
material AO Starting offset=0xA24 (0xBEC) Ending offset=0xA3C (0xC04)
extendeddata NRTW_NRTW_AO_ExtendedData Starting offset=0xA3C (0xC04) Ending offset=0xAE8 (0xCB0)
material Diffuse Starting offset=0xAE8 (0xCB0) Ending offset=0xB00 (0xCC8)
extendeddata NRTW_NRTW_Diffuse_ExtendedData Starting offset=0xB00 (0xCC8) Ending offset=0xBAC (0xD74)
material cfg#TXRChila Starting offset=0xBAC (0xD74) Ending offset=0xBC4 (0xD8C)
extendeddata NRTW_NRTW_cfg#TXRChila_ExtendedData Starting offset=0xBDC (0xDA4) Ending offset=0xE04 (0xFCC)
material NM Starting offset=0xE04 (0xFCC) Ending offset=0xE1C (0xFE4)
extendeddata NRTW_NRTW_NM_ExtendedData Starting offset=0xE1C (0xFE4) Ending offset=0xEC8 (0x1090)
material NM Starting offset=0xEC8 (0x1090) Ending offset=0xEE0 (0x10A8)
extendeddata NRTW_NRTW_NM_ExtendedData Starting offset=0xEE8 (0x10B0) Ending offset=0xF0C (0x10D4)
material AO Starting offset=0xF0C (0x10D4) Ending offset=0xF24 (0x10EC)
extendeddata NRTW_NRTW_AO_ExtendedData Starting offset=0xF24 (0x10EC) Ending offset=0xFD0 (0x1198)
material Diffuse Starting offset=0xFD0 (0x1198) Ending offset=0xFE8 (0x11B0)
extendeddata NRTW_NRTW_Diffuse_ExtendedData Starting offset=0xFE8 (0x11B0) Ending offset=0x1094 (0x125C)
material cfg#TXRStructuri Starting offset=0x1094 (0x125C) Ending offset=0x10AC (0x1274)
extendeddata NRTW_NRTW_cfg#TXRStructuri_ExtendedData Starting offset=0x10C4 (0x128C) Ending offset=0x12EC (0x14B4)
pointer Skeleton Starting offset=0x12EC (0x14B4) Ending offset=0x12F0 (0x14B8)
bone NRTW Starting offset=0x1308 (0x14D0) Ending offset=0x13A0 (0x1568)
bone NRTW_hull_01 Starting offset=0x13A0 (0x1568) Ending offset=0x1438 (0x1600)
bone NRTW_hull_03 Starting offset=0x1438 (0x1600) Ending offset=0x14D0 (0x1698)
bone NRTW_hull_02 Starting offset=0x14D0 (0x1698) Ending offset=0x1568 (0x1730)

Finally have the sentinel working good. It's a seperate DOS like command window that you can type commands into. Right now it doesn't know too many commands - I have more to add. The above was a small tidbit of a status command on the arttoolinfo, material, texture, bone, pointer, and extendeddata sections.

I can now finally 'see' how the file is exactly laid out.

The reason there's a gap between the skeleton pointer and the first bone is because I didn't ask for status on skeleton in my request.

The gap between the end of the last material and the beginning of it's extended data is interesting. Wonder why?

Work continues...

EDIT:
ok, this is beyond hilarious...You would think I would know how to use my own app! Found the reason for the gap between the last material and it's extendeddata. If I include mapreference in the status command all is well:

material Diffuse Starting offset=0xFD0 (0x1198) Ending offset=0xFE8 (0x11B0)
extendeddata NRTW_NRTW_Diffuse_ExtendedData Starting offset=0xFE8 (0x11B0) Ending offset=0x1094 (0x125C)
material cfg#TXRStructuri Starting offset=0x1094 (0x125C) Ending offset=0x10AC (0x1274)
mapreference NRTW_NRTW_cfg#TXRStructuri_Diffuse Color Starting offset=0x10AC (0x1274) Ending offset=0x10B4 (0x127C)
mapreference NRTW_NRTW_cfg#TXRStructuri_Self-Illumination Starting offset=0x10B4 (0x127C) Ending offset=0x10BC (0x1284)
mapreference NRTW_NRTW_cfg#TXRStructuri_Bump Starting offset=0x10BC (0x1284) Ending offset=0x10C4 (0x128C)
extendeddata NRTW_NRTW_cfg#TXRStructuri_ExtendedData Starting offset=0x10C4 (0x128C) Ending offset=0x12EC (0x14B4)

Man this sure is handy

Last edited by TheDarkWraith; 01-09-12 at 02:02 AM.
TheDarkWraith is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 05:20 PM.


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