Important information: this site is currently scheduled to go offline indefinitely by end of the year.

[Request] Guild Wars 2 DAT

The Original Forum. Game archives, full of resources. How to open them? Get help here.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: [Request] Guild Wars 2 DAT

Post by chrrox »

Demonsangel wrote:Image
Fun part starts again, does anyone know the exact order of calculations for the armature?
did you try switch from left to right handed matrix.
if it is using quats you just invert the w.
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

chrrox wrote:
did you try switch from left to right handed matrix.
if it is using quats you just invert the w.
Genious, it worked.

Good to know this for other formats.
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

Has anyone encountered a bonemap?
I just used an (i++) loop to connect the bones to eachother which works fine, but the the boneID's in the vertex data for the weights don't match the actual boneID's
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: [Request] Guild Wars 2 DAT

Post by chrrox »

yeah i have worked with bone maps if you want pm me the model your trying and the script and what info you have and i can help with the bone map.
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

We found the bonemaps so moving on to the next part: animations

When following the file reference for the animations I got F2 B4 44 58 01 00 (13854.pf)
but it ends on 0100 which according to the algorythm you guys reversed gives an assertion.

Is there another algorythm or did I stumble upon the wrong reference? And if any of you do find the correct one, could you send the file over to me since I don't have the archive.
ral
beginner
Posts: 24
Joined: Mon Apr 23, 2012 5:26 pm
Has thanked: 9 times
Been thanked: 5 times

Re: [Request] Guild Wars 2 DAT

Post by ral »

I'll send you a pm in some mins containing some data + files if I can do it fast ;) Just gotta do it by hand with hex editor fast to get filenumbers.

EDIT:// Mhh weird .. Sorry but I'm getting wrong info too .. I'll look more into it now but it can take a bit more time than i expected :/

EDIT2:// Ahh got it now :P I was counting wrong .. do you have all chunk structs btw?

EDIT3:// You got a pm with some info ;)
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

I don't know anything about the ANIM struct, I was basically trying a lot of combinations to try and get the file reference.
ral
beginner
Posts: 24
Joined: Mon Apr 23, 2012 5:26 pm
Has thanked: 9 times
Been thanked: 5 times

Re: [Request] Guild Wars 2 DAT

Post by ral »

I sent you all structures from the ida script that is on Loumie's git repo. Now you should know everything about the structures, at least where the data is for everything ;)

Good luck getting stuff done now :)
Rhoot
beginner
Posts: 26
Joined: Fri May 04, 2012 11:01 pm
Has thanked: 2 times
Been thanked: 17 times

Re: [Request] Guild Wars 2 DAT

Post by Rhoot »

Demonsangel wrote:When following the file reference for the animations I got F2 B4 44 58 01 00 (13854.pf)
but it ends on 0100 which according to the algorythm you guys reversed gives an assertion.

Is there another algorythm or did I stumble upon the wrong reference? And if any of you do find the correct one, could you send the file over to me since I don't have the archive.
That should be the only file reference algorithm, aside from files that just use the plain fileId as an uint32. The bytes you gave are definitely not a file reference. They are easy to spot:

- They're three 16-bit integers long (totalling 6 bytes).
- The first integer is always >= 0x100
- The second integer is always >= 0x100, but still very low. It's usually 0x100 or 0x101.
- The third integer must always be 0 since it's used as a utf-16 string terminator.

About those structs you got from ral (from Loumie's IDA script); if you want to know what the TSTRUCT_ARRAY_PTR_START and friends are, they're defined in TypesDef.bt in Loumie's repository. How the defines work is not entirely obvious just from glancing at them (especially if you're unfamiliar with 010 templates), but those defines basically deal with offsets in files.
Loumie
beginner
Posts: 24
Joined: Thu Apr 12, 2012 8:00 am
Been thanked: 6 times

Re: [Request] Guild Wars 2 DAT

Post by Loumie »

For those who are too lazy to run the script or don't want to download IDA Pro Free, here is the output of the current build 14762.
It contains structures classified by ChunkName and VersionNumber, it also prints the address it was taken from in the exe if you think something is weird.

ANStructs.txt
TypesDef.bt
PackFile.bt

It looks like this:

Code: Select all

==================================================
 Chunk: eula (chunkname), versions: 1 (number of versions for this chunk), strucTab: 0x1527F78
==================================================
=> Version: 0 (version 0)
typedef struct 
{
    byte Language;
    wchar_ptr Text;
} PackEulaLanguageV0<optimize=false>;

typedef struct 
{
    TSTRUCT_ARRAY_PTR_START PackEulaLanguageV0 Language TSTRUCT_ARRAY_PTR_END;
    byte Version;
} PackEulaV0<optimize=false>; (last struct in version is the starting struct)
They are meant to be usable templates for 010 editor, in conjunction with Types.bt and PackFile.bt you don't have really anything to do just some glue code like this:

Code: Select all

#include <TypesDef.bt>
#include <PackFile.bt>

<insert the structures you want from the script here...>

PackFile MODLPackFile(0, FileSize()); // Declare and parse the PackFile at offset 0 and of size FileSize()

local uint32 lLoopIndex = 0;
local string lMagic;
while (exists(MODLPackFile.chunk[lLoopIndex])) // Loop on all the chunks
{
    FSeek(startof(MODLPackFile.chunk[lLoopIndex].data)); // Put the cursor at the start of the chunk
    
    lMagic = MODLPackFile.chunk[lLoopIndex].header.magic;

    if (lMagic == "MODL") // If chunk is MODL apply the right struct
    {
        ModelFileDataV65 MODLChunk;
    }
    if (lMagic == "SKEL")
    {
        ModelFileSkeletonV1 SKELChunk;
    }

    <blabla...>

    lLoopIndex = lLoopIndex + 1;
}
Keep in mind that one type is not handled by the script, the 0x1C one, the definition of this type is known but it is pain to implement inside 010 templates and as we didn't need it, I didn't bother writing the code for it.
As Rhoot explained the strange defines in TypesDef.bt are here to handle various offsets, it is quite hard to handle them properly in 010 template as they don't allow MACROS with variables nor C++ templates definitions. If anyone as a more elegant and easy to use solution please share. ;D

Please also note that there are some other struct definitions in the EXE, but they are not tied to any chunk and as such they are not parsed.

Cheers,
Loumie
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

Ok so

when i have

Code: Select all

0A 00 00 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
for
typedef struct 
{
    TSTRUCT_PTR_ARRAY_PTR_START ModelAnimationDataV32 animations TSTRUCT_PTR_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START ModelCompoundAnimationDataV24 compoundAnimations TSTRUCT_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START qword fallbacks TSTRUCT_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START ModelAnimationImportDataV32 imports TSTRUCT_ARRAY_PTR_END;
} ModelFileAnimationBankV24<optimize=false>;
The last 3 don't get parsed because offset and count == 0, so it doesn't parse a filereference. Does it mean the animation data is in the pf file itself?
I did notice a lot of bytes being put into ModelAnimationDataV32, but 3 animations does seem too few for such a model.

And this is just nitpicking but in

Code: Select all

typedef struct 
{
    filename filename;
    TSTRUCT_ARRAY_PTR_START ModelAnimationImportSequenceV24 sequences TSTRUCT_ARRAY_PTR_END;
} ModelAnimationImportDataV32<optimize=false>;
010 editor doesn't like twice the same name, so filename Filename;
Rhoot
beginner
Posts: 26
Joined: Fri May 04, 2012 11:01 pm
Has thanked: 2 times
Been thanked: 17 times

Re: [Request] Guild Wars 2 DAT

Post by Rhoot »

Demonsangel wrote:The last 3 don't get parsed because offset and count == 0, so it doesn't parse a filereference. Does it mean the animation data is in the pf file itself?
I did notice a lot of bytes being put into ModelAnimationDataV32, but 3 animations does seem too few for such a model.
Judging by the bytes you posted, you should be having 10 animations, not 3. The first uint32 is the count for the animations array.
Demonsangel wrote: And this is just nitpicking but in

Code: Select all

typedef struct 
{
    filename filename;
    TSTRUCT_ARRAY_PTR_START ModelAnimationImportSequenceV24 sequences TSTRUCT_ARRAY_PTR_END;
} ModelAnimationImportDataV32<optimize=false>;
010 editor doesn't like twice the same name, so filename Filename;
Those structs are auto-generated from the exe, so they sometimes require some changes. Another example is in the exe fields can have periods in their names.
ral
beginner
Posts: 24
Joined: Mon Apr 23, 2012 5:26 pm
Has thanked: 9 times
Been thanked: 5 times

Re: [Request] Guild Wars 2 DAT

Post by ral »

Example on 13854.pf (which you got)

Code: Select all

Chunk Header:
41 4E 49 4D  BC C6 01 00  18 00 10 00  CC C5 01 00

typedef struct 
{
    TPTR_START ModelFileAnimationBankV24 bank TPTR_END;
    PackGrannyAnimationType anim;
} ModelFileAnimationV24<optimize=false>;
-> in that file: 0C 00 00 00  00 00 00 00  00 00 00 00

ModelFileAnimationBankV24
Offset: 0C 00 00 00

PackGrannyAnimationType:
typedef struct 
{
    TSTRUCT_ARRAY_PTR_START byte animation TSTRUCT_ARRAY_PTR_END;
} PackGrannyAnimationType<optimize=false>;
animation:
Count:00 00 00 00
Offset: 00 00 00 00
(so no animation data)


ModelFileAnimationBankV24 has an offset so let's go on with that one:

typedef struct 
{
    TSTRUCT_PTR_ARRAY_PTR_START ModelAnimationDataV32 animations TSTRUCT_PTR_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START ModelCompoundAnimationDataV24 compoundAnimations TSTRUCT_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START qword fallbacks TSTRUCT_ARRAY_PTR_END;
    TSTRUCT_ARRAY_PTR_START ModelAnimationImportDataV32 imports TSTRUCT_ARRAY_PTR_END;
} ModelFileAnimationBankV24<optimize=false>;

You know the offset was 0C 00 00 00 (so 12 bytes) and that was at byte 27,952 so now let's go on at byte 27,964:

03 00 00 00  1C 00 00 00
00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00

So that means for
ModelAnimationDataV32: 
count: 03 00 00 00
offset: 1C 00 00 00
ModelCompoundAnimationDataV24
count: 00 00 00 00
offset: 00 00 00 00
(no Data for that)
etc.

Now at that offset the struct ModelAnimationDataV32 starts which is big again etc.
So you have 3 times that ModelAnimationDataV32 struct with a lot of data. And it goes on and on like that till you're done with all structs
Hope that helped a bit how it works. There's a lot of data in the ANIM chunk so I think everything for the animation of 1 model can be in 1 MODL file.

(P.S I never had TSTRUCT_PTR_ARRAY_PTR_START so far for the stuff I did so if it's wrong that it's 8 bytes too please correct me)
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: [Request] Guild Wars 2 DAT

Post by Demonsangel »

lol, I was thinking about 13854.pf but had the bytes from 216211.pf on my clipboard.
216211 does indeed have 10 entries.

Ral posted the right bytes, but as you can see it only has 3 entries, which surely can't be enough for the model in the picture I posted at the top of the page.
(zeropose,walk,idle)
unless ofcourse I managed to get a useless npc model at my disposal. :P
ral
beginner
Posts: 24
Joined: Mon Apr 23, 2012 5:26 pm
Has thanked: 9 times
Been thanked: 5 times

Re: [Request] Guild Wars 2 DAT

Post by ral »

Demonsangel wrote: unless ofcourse I managed to get a useless npc model at my disposal. :P
That indeed is possible.

I sent you a pm with some stuff. Now you can get more models, textures and whatever else you want ;)
Post Reply