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)

TheDarkWraith 10-21-11 12:48 AM

v1.0.181.0 released. See post #1.

Started reading the bone extended data. Currently can only read one type of extended data for the bones.

If you run DbgView before the app you'll catch where this bone extended data resides in the file. Try opening the file with hex editor and changing some of the bone extended data values based on the (0x__) given. Then fire up SH5 and see what happens :up:

Working on the rest of the bone extended datas (currently I've found there are 2 more types)

Plan is after I can read all the bone extended data to have a screen in the app available for editing this data. Once edited you'll be able to save the changes to the GR2 file.

tonschk 10-21-11 05:18 AM

Quote:

Originally Posted by TheDarkWraith (Post 1771845)

Once edited you'll be able to save the changes to the GR2 file.


Great Work :salute: :up: TheDarkWraith :DL

urfisch 10-21-11 05:41 AM

sounds nice...

:woot:

TheDarkWraith 10-21-11 10:40 AM

coding the second type of bone extended data and was wondering what does this have anything to do with the game? This data appears to be for some kind of 3D modelling app or something:

[1048] Bone extended data found at 0xC1C (0xDE4)
[1048] Extended data is type 1
[1048] Select By Vertex=0 0xC1C (0xDE4)
[1048] Ignore Backfacing In Selections=0 0xC20 (0xDE8)
[1048] Select By Angle=0 0xC24 (0xDEC)
[1048] Selection Angle=0.785398 0xC28 (0xDF0)
[1048] Use Soft Selection=0 0xC2C (0xDF4)
[1048] Use Edge Distance=0 0xC30 (0xDF8)
[1048] Edge Distance=1 0xC34 (0xDFC)
[1048] Affect Backfacing=1 0xC38 (0xE00)
[1048] Falloff=20.000000 0xC3C (0xE04)
[1048] Pinch=0.000000 0xC40 (0xE08)
[1048] Bubble=0.000000 0xC44 (0xE0C)
[1048] Lock Soft Selection=0 0xC48 (0xE10)
[1048] Paint Mode=0 0xC4C (0xE14)
[1048] Selection Value=1.000000 0xC50 (0xE18)
[1048] Brush Size=10.000000 0xC54 (0xE1C)
[1048] Brush Strength=1.000000 0xC58 (0xE20)
[1048] Vertex Constraint Type=0 0xC5C (0xE24)
[1048] Delete Isolated Vertices=1 0xC60 (0xE28)
[1048] Fully Interactive=1 0xC64 (0xE2C)
[1048] Show Cage=1 0xC68 (0xE30)
[1048] Split=0 0xC6C (0xE34)
[1048] Preserve UVs=0 0xC70 (0xE38)
[1048] Subdivide Surface=0 0xC74 (0xE3C)
[1048] Smooth Subdivision Result=1 0xC78 (0xE40)
[1048] Isoline Display=1 0xC7C (0xE44)
[1048] Iterations=1 0xC80 (0xE48)
[1048] Surface Smoothness=1.000000 0xC84 (0xE4C)
[1048] Use Render Iterations=0 0xC88 (0xE50)
[1048] Render Iterations=0 0xC8C (0xE54)
[1048] Use Render Smoothness=0 0xC90 (0xE58)
(snip)

:06:

urfisch 10-21-11 11:36 AM

maybe you ask hans wittemann for some light on that...he´s a professional 3d artist.

TheDarkWraith 10-21-11 12:18 PM

Quote:

Originally Posted by urfisch (Post 1772086)
maybe you ask hans wittemann for some light on that...he´s a professional 3d artist.

Excellent idea :up:


v1.0.188.0 released. See post #1.

This version reads the second kind of bone extended data. One more to go....

Madox58 10-21-11 04:34 PM

Depending on if you want to make this secure to SH5 GR2 files or not.
Do a check on the textures path as a lock.
You could also lock to 3DMax version as a step check.

Reason I point this out?
I test many different GR2 files from different Games.
The ones that do not load at this time?
You give me the information to correct them so that they do load.
:03:
Examples would be the CRC check which I can correct and the file size check which is also easily fixed.

For early testing?
It might help to disable both at this time.

In the over all design?
Many things will not need to be checked and placed into a strict structure.
Who gives a Rats ass if 3D Max was used, or Maya, or XSI?
Much of the Section 0 information is just junk that will not be modified or overlooked anyway.
:03:

TheDarkWraith 10-21-11 05:20 PM

Quote:

Originally Posted by privateer (Post 1772388)
Depending on if you want to make this secure to SH5 GR2 files or not.
Do a check on the textures path as a lock.
You could also lock to 3DMax version as a step check.

Reason I point this out?
I test many different GR2 files from different Games.
The ones that do not load at this time?
You give me the information to correct them so that they do load.
:03:
Examples would be the CRC check which I can correct and the file size check which is also easily fixed.

For early testing?
It might help to disable both at this time.

In the over all design?
Many things will not need to be checked and placed into a strict structure.
Who gives a Rats ass if 3D Max was used, or Maya, or XSI?
Much of the Section 0 information is just junk that will not be modified or overlooked anyway.
:03:

I'm not making this secure to only SH5 files. Because of how it reads the file it *should* open just about any GR2 file. I say should because I don't know for sure.

Glad to see this app is useful to someone so far :up:

Haven't coded in the CRC checker yet. It's on my to-do list. Checking file size it already does in the error checker.

So far I don't have it checking that many things. I'm only having it check the important things (but who's to say what is important? I'm still learning!)

Much of the information it spits out in DbgView is just for informational purposes. It helps me to 'see' the file and where everything is :yep:

Madox58 10-21-11 05:27 PM

I can send you a GR2 from a Beta Game if you would like to see it.
:D
(Hell, even older Games if you wish a cross section.)

The CRC is not correct nor is the file size setting.
I think that may be a way the Devs figured simpletons would not be able to look at the files with GrannyViewer.
:haha:

STUPID DEVS if that's the case.
:har:

As far as useful?
I'd say yes for the many Modders of SH5.(Possibly more Game Modders!)
For me?
You know I don't need it just as I didn't need S3D.
:03:
You also know I'll use it just as I use S3D. Once it's finished to a useable state.
:up:

TheDarkWraith 10-21-11 05:52 PM

Quote:

Originally Posted by privateer (Post 1772431)
I can send you a GR2 from a Beta Game if you would like to see it.
:D
(Hell, even older Games if you wish a cross section.)

The CRC is not correct nor is the file size setting.
I think that may be a way the Devs figured simpletons would not be able to look at the files with GrannyViewer.
:haha:

STUPID DEVS if that's the case.
:har:

As far as useful?
I'd say yes for the many Modders of SH5.(Possibly more Game Modders!)

Sure send away :yep: The more files of different types of games I can try the better this app will be!

You'll probably find this information useful then. Starting in version 1.0.193.0 it tells you the start of the major items in the file:

[3760] Reading section 7 (unknown7) data starting at 0x19C
[3760] Unknown=0x0 0x1A0 always 0x0
[3760] Section file offset=0x66ACE4 0x1A4 where this section starts in the file
[3760] Compressed size=0 0x1A8 compressed size and uncompressed sizes should equal for SH5 GR2s
[3760] Uncompressed size=0 0x1AC compressed size and uncompressed sizes should equal for SH5 GR2s
[3760] Alignment=0x4 0x1B0 what the alignment boundary is in the file
[3760] Start of data fileoffset=0x0 0x1B4 start of data
[3760] Start of data fileoffset2=0x0 0x1B8 start of data
[3760] Pointers file offset=0x6732A0 0x1BC where the pointers for this section are located
[3760] Number of pointers=0 0x1C0
[3760] End of pointers file offset=0x6732A0 0x1C4 where the pointers for the file end
[3760] Unknown2=0x0 0x1C8
[3760] Current position in file is 0x1C8
[3760]
[3760] File info offset at 0x8 (0x1D0)
[3760] Number of textures=8 0xC (0x1D4)
[3760] Start of textures pointer found at 0x14 (0x1DC)
[3760] Start of textures pointer points to 0x390 (0x558)
[3760] Number of materials=17 0x14 (0x1DC)
[3760] Start of materials pointer found at 0x1C (0x1E4)
[3760] Start of materials pointer points to 0x610 (0x7D8)
[3760] Number of skeletons=1 0x1C (0x1E4)
[3760] Start of skeletons pointer found at 0x24 (0x1EC)
[3760] Start of skeletons pointer points to 0x198C (0x1B54)
[3760] Number of vertex datas=47 0x24 (0x1EC)
[3760] Start of vertex datas pointer found at 0x2C (0x1F4)
[3760] Start of vertex datas pointer points to 0xBA5C (0xBC24)
[3760] Number of tritopologies=47 0x2C (0x1F4)
[3760] Start of tritopologies pointer found at 0x34 (0x1FC)
[3760] Start of tritopologies pointer points to 0xC4A4 (0xC66C)
[3760] Number of meshes=47 0x34 (0x1FC)
[3760] Start of meshes pointer found at 0x3C (0x204)
[3760] Start of meshes pointer points to 0xD4E4 (0xD6AC)
[3760] Number of models=1 0x3C (0x204)
[3760] Start of models pointer found at 0x44 (0x20C)
[3760] Start of models pointer points to 0x1477C (0x14944)
[3760] Number of trackgroups=0 0x44 (0x20C)
[3760] Start of trackgroups not found in file pointers
[3760] Number of animations=0 0x4C (0x214)
[3760] Start of animations not found in file pointers
[3760] Number of unknown=0 0x54 (0x21C)
[3760] Start of unknown not found in file pointers
[3760] Current position in file is 0x224
[3760]
[3760] Reading all the pointers for section 0
[3760] Pointer 0 is type str with offsetinsectiondata of 0x5C (0x224) and unknown of 0x0 and offsetinsectionvalue of 0x14898 (0x14A60)
[3760] string=3D Studio MAX

Notice start of textures, start of models, start of materials, etc. Very handy :yep: I keep learning more the more I play with this :up:

That little bit of information made a light bulb click for a problem I was having. It tells me how the file is layed out from top to bottom....

Madox58 10-21-11 06:17 PM

I saw the Section info long ago and put it together pretty quickly after that.
I never finished a full app because I just didn't find it that interesting after I figured things out on the uncompressed GR2 files.

That's the saveing grace of SH5 GR2 files.
They are not compressed and they did not modify the standard export.

More and more Games will change from this habit and are doing so even now.
Most of the stupid things I see is messing up the CRC and file size settings so GrannyViewer can not open them.
That may be totally by accident useing a half assed tool after exporting the 3D stuff?
But that would be something I'd think no slightly GOOD programmer did by accident!

I'll pack up a few GR2 files I have and send you a link by PM.

Madox58 10-21-11 07:11 PM

PM sent.

TheDarkWraith 10-21-11 09:06 PM

v1.0.209.0 released. See post #1.

This version now reads all the bone extended data. I had it reading the mesh extended data till I found a model that had different mesh extended data. So now I have to figure out how the mesh extended data changes (what defines it).

This version also lists the start of each major section in the FileInfo header section (in the debug output).

I finished up the mesh class and thus each mesh is now reading it's bone bindings (there is only 1 don't know why GrannyViewer shows this as plural). Since it has it's bone binding and each bone has extended data then I can set the visibility of the mesh based on the bone binding's (bone) extended data (Hide). I did hard code to set any mesh that starts with LNK@ to hide (not visible).

Working on figuring out how the mesh extended data is determined :hmmm:

Just tried opening the bunker with the new version and discovered another type of bone extended data. If you get an error message saying 'Currently can't read extended data for this bone' let me know which GR2 file you were trying to open.

TheDarkWraith 10-21-11 10:58 PM

v1.0.211.0 released. This removes the bone extended data reading. Reason is because it will read all bone extended data correctly for most GR2 files. Those GR2 files that have bone extended data that is 'exotic' (max properties defined, camera info defined, etc.) throw it all out of whack for the last bone's extended data. I know why but it will take time to sort out. It deals with where these max properties and camera info are placed in regards to the bone's extended data. It's not where I thought it was... :up:

This means I've gone back to hard coding of what's visible or not initially. The FileInfo header still shows the start of each major section.

TheDarkWraith 10-22-11 01:57 AM

I was puzzled for the longest time as to how the GrannyViewer knew how many embedded strings to read for an item's extended data. I was also puzzled by how it knew the data type for those items. I'm not puzzled any longer :rock:

Another careful look at the pointers showed the error in my ways. The pointer for an item's extended data always had an unknown of 0x6 (my pointer structure is offsetinsectiondata, unknown, offsetinsectionvalue) and the offsetinsection value made absolutely no sense. Once you know what the unknown value is for it all makes perfect sense :yep: This unknown will now get its proper name!

That unknown is used along with that offsetinsectionvalue to read another set of pointers. These pointers are how the GrannyViewer knows a) how many embedded strings to read and b) what the data type is for those embedded strings. Mystery solved :D

wow this clears up many things...:cool:

Overall I'm very impressed with the GR2 format. It's slick, it's elegant, and it's beautiful from a programmer's perspective!


All times are GMT -5. The time now is 07:19 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.