SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   GR2 Editor/Viewer/Extractor/Importer (https://www.subsim.com/radioroom/showthread.php?t=188290)

Madox58 10-26-11 07:59 PM

7A loads fine for me with your last version.

Would a defined version of the UnderSea gr2 file help you?

TheDarkWraith 10-27-11 08:35 AM

Quote:

Originally Posted by privateer (Post 1775069)
7A loads fine for me with your last version.

Would a defined version of the UnderSea gr2 file help you?

I'd be willing to look it over. The problem currently is I have to get rid of the hard-coded items I have. I know where the ArtToolInfo resides and how to read it but I need the app to be dynamic and let the pointers tell it where to read this from. Once I get over this hurdle then the rest should be cake. I have it reading the embedded strings dynamically. Now I'm making it read any data associated with those strings dynamic. This is proving to be a little on the challenging side though.
I've coded in the checking of the file size in bytes and the auto correcting of it. Adding the CRC checker and auto correcting of it also :DL

7A has always loaded fine. It's the IIA and undersea that won't load due to some additional data contained in them that I haven't figured out what the purpose is for yet. Because of my current hard-coded reading of the ArtToolInfo these will always fail. That is why I'm moving to dynamic reading of information. Live and learn.

tonschk 10-28-11 07:43 AM

:DL Thank you very much :salute: TheDarkWraith for this Magnificent Work you are doing :yeah:

Madox58 10-28-11 05:42 PM

Quote:

Originally Posted by TheDarkWraith (Post 1775302)
I'd be willing to look it over. The problem currently is I have to get rid of the hard-coded items I have. I know where the ArtToolInfo resides and how to read it but I need the app to be dynamic and let the pointers tell it where to read this from. Once I get over this hurdle then the rest should be cake. I have it reading the embedded strings dynamically. Now I'm making it read any data associated with those strings dynamic. This is proving to be a little on the challenging side though.
I've coded in the checking of the file size in bytes and the auto correcting of it. Adding the CRC checker and auto correcting of it also :DL

7A has always loaded fine. It's the IIA and undersea that won't load due to some additional data contained in them that I haven't figured out what the purpose is for yet. Because of my current hard-coded reading of the ArtToolInfo these will always fail. That is why I'm moving to dynamic reading of information. Live and learn.

SummaryInfo in the Undersea.gr2 is blank.
Appears to be for comments which is probably useless anyway.

IIA has an animation which adds info to the Section 0 stuff as a start.

I'll finish up some things and send you a link.

urfisch 10-29-11 04:34 AM

:salute:

:up:

TheDarkWraith 10-29-11 08:42 AM

Quote:

Originally Posted by privateer (Post 1776111)
SummaryInfo in the Undersea.gr2 is blank.
Appears to be for comments which is probably useless anyway.

IIA has an animation which adds info to the Section 0 stuff as a start.

I'll finish up some things and send you a link.

:up:

The file size checker/fixer has been coded in.
The CRC-32 checker/fixer has been coded in.

These two items will be checked when the file is first loaded. If either/both are incorrect it will ask if you want to fix each one. The fix will be immediately written to the file :DL

TheDarkWraith 10-30-11 12:41 AM

Recursion can be a powerful thing. It is sometimes very difficult to setup/get correct. This was the case for the reading of the extended data for items. On my plane flight home from Portland, OR I was single stepping through the debugger in Visual Studio trying to get the recursion correct for item's extended data. I finally have it working correctly for the extended data now :rock: I had the reading of the item's extended data 'hard-coded' for I knew basically what to expect. This was not acceptable to me because there are probably files that contain more or less in extended data. I needed this to be dynamic and let the file tell me what it has.
I didn't fully understand at first how say GrannyViewer knew how to read everything that it did (and thus was why many things were 'hard-coded'). This took some time to figure out. Now I fully understand :D Nothing (currently) is hard-coded in the app. It is fully dynamic and it knows what to read from those magical pointers (and some other new pointers that I call data type pointers).
Just because it's fully dynamic doesn't mean it can read everything. If it doesn't 'understand' something (it reads something and the app doesn't know what it read/how to interpret it) then it will fail. This is currently the case with any GR2 file that has animations in it. I have not told the app how to handle animations. The mystery data in undersea and VIIA it doesn't know how to handle either (yet). Those I am still working on :yep:

This new version (1.0.322.0) includes the above and also the file size checker and CRC-32 checker. You'll notice new text in the DbgView output for these and also for the ArtToolInfo's extended data (it will look like GrannyViewer shows it because that's how it told me to read it ;))

New version 1.0.322.0 released. See post #1

:|\\

TheDarkWraith 10-31-11 12:10 AM

Version 1.0.335.0 released. See post #1.

This version fixes the offsets reported wrong in the FileHeader and InfoHeader debug output.

Fixed bug in the extendeddata recursion function where if an item had no subitems you would get an exception.

More error checking added in this version. As a result of some of this I somehow totally overlooked not reading ALL the pointers for section 0. All this time I thought I was reading them all but the error checker told me differently. When I did the math it was quite evident that I've been overlooking pointers in section 0. I will be looking into what these 'new' pointers do now.

This version will now read just about any GR2 file in SH5 (except for Undersea). That means it will now read the VIIA sub :yeah: I know why Undersea will not read and it's because I found a small part of hard-coded reading of ArtToolInfo:ExtendedData in the app. I will fix this in the next version :yep: I was able to open air units, sub units, land units, and files in the \data\Library folder.

If you find a file that will not open please let me know (except for \data\Library\Undersea.gr2) :DL

When looking over the Debug output if you see any offsets (or actual file positions) or values that look suspicious/strange let me know. I hope I've corrected all the errors in those. If you can, compare random items in the Debug output to the actual file and see if they match or not.

Next version I hope to have the ability to change just about anything in the extendeddata of an item coded in. I also hope to have coded in the ability to adjust properties of items also (position, rotation, color, etc.)

If I have time and haven't coded in too much (I don't like to add too much to each version) I'll start working on the exporter so you can rip whatever you want from the GR2 file. I plan on making the exporter rip to OBJ format for now. I plan on adding Microsoft's X format to it in time. Additional formats might happen depending on the information available on them (so I know how to make the format).

:|\\

tonschk 10-31-11 02:43 AM

Quote:

Originally Posted by TheDarkWraith (Post 1777298)

Version 1.0.335.0 released. See post #1.

This version will now read just about any GR2 file in SH5 (except for Undersea). That means it will now read the VIIA sub :yeah: I know why Undersea will not read and it's because I found a small part of hard-coded reading of ArtToolInfo:ExtendedData in the app. I will fix this in the next version :yep:

:|\\

Very Good :salute: TheDarkWraith :yeah: Well done

TheDarkWraith 10-31-11 12:17 PM

v1.0.342.0 released. See post #1

This version removed the hard-coded reading of some items in the ArtToolInfo:ExtendedData. Now the file tells it what to read based on the pointers. As a result of this the Undersea.gr2 file can now be read :up: There is currently only one file I've found that it can't open still - \data\Library\ShipParts\guns_radars_01.gr2. Looking into why currently....

TheDarkWraith 10-31-11 03:34 PM

Was single stepping the guns_radars_01.GR2 file in the Visual Studio debugger and noticed something interesting. It is a special GR2 file (pointers come before data) but it doesn't want to follow the 'rules' that these type of files have followed in the past (NSS_Undine for example). Now I have to figure out what makes the rules change and why :shifty: Maybe someone might know the answer to this? Beuhler? :06:

Normally in these type of files (these 'special' GR2 files) you have a pointer to say a model. That pointer then references a table (think of it as a virtual function table in exe files). The table points it to where the actual model is. This one doesn't want to use the table - it wants to go straight to the model.....

In normal GR2 files when you have a pointer to something (say a model) it points to the actual item. There is no table or indirect pointer for it.

TheDarkWraith 10-31-11 04:22 PM

didn't take as long as I thought to figure out the above problem.
There are two 'rules' (so far) to special GR2 files (pointers before data):
- if section 0's unknown2 is 0x0 then the pointer to the model will access the pointer table (think of it as v-table in exe files)
- if section 0's unknown2 > 0x0 then the pointer to the model points to the model (acts like a normal GR2 file in this regard)

I wonder what other interesting little things like this will rear their ugly head :hmmm:

Version 1.0.348.0 released. See post #1.

You should be able to open ANY SH5 GR2 file now. Let me know if you come across one that won't open :yeah:

Will-Rommel 10-31-11 04:42 PM

Impressive sir, i hope there wont be to much of those "exceptions" you encountered. (Must be a nightmare to treat) :salute:

Vanilla 10-31-11 04:44 PM

That's just awesome progress! Well done!

As of problems: I cannot open \data\Characters\CharacterBodyParts.gr2 due to errors in section 0 endpointersfileoffset being not equal to filesizeinbytes.
When I try to open NSS_Uboat*.gr2 files - the EVEI gives me a lot of
Code:

Exception
C:\Ubisoft\Silent Hunter 5\data\Submarine\NSS_Uboat2a\NSS_Uboat2a.GR2 closed
********* Exception while presenting
Exception is ***1054;***1096;***1080;***1073;***1082;***1072; ***1074; ***1087;***1088;***1080;***1083;***1086;***1078;***1077;***1085;***1080;***1080;.
-2005530516 (D3DERR_INVALIDCALL)
  ***1074; Microsoft.DirectX.Direct3D.Device.BeginScene()
  ***1074; TheDarkWraith.SilentHunter5.Graphics.Render() *********
...

which goes in endless loop. (WindowsXP 32 locale is RU)

None of the animations' gr2s can be opened either due to skeleton's data absence, but I recon - animations are thing of the future as of yet. When I open 'waypoints' files - I see nothing but no errors either, though I guess this is normal.
I am still hoping to create fully functioning crew and it appears that only you can make it possible, TDW, thanks for all your hard work.

THE_MASK 10-31-11 05:14 PM

Yay , i can open the trees and the undersea rocks . Thats all i need :O:


All times are GMT -5. The time now is 09:11 AM.

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.