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

[PS3] Knight Contract .hxt models

Post questions about game models here, or help out others!
Post Reply
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

[PS3] Knight Contract .hxt models

Post by zaramot »

Could someone help me to figure out [PS3]Knights Contract .hxt format? I see face indices and something like a vertex buffer. Though I can't parse them, I'm missing something. Need some tips from people experienced in format reversing.
http://www.mediafire.com/?r3dla86uicf7gsm
Making model-import scripts, PM
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [PS3] Knight Contract .hxt models

Post by zaramot »

Figure out vertices , should work fine now. Still have issue with face indices, can't find face count to parse them right.
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: [PS3] Knight Contract .hxt models

Post by shakotay2 »

zaramot wrote:Still have issue with face indices, can't find face count to parse them right.
For chr053.hxt this should be vertex cnt (511) and face indices count (1318) for a submesh (hand and forearm):

Code: Select all

Offset    0  1  2  3  4  5   6  7   8  9   A  B  C   D  E  F

027330   01 00 00 00 08 <00 00 01  FF> 00 00 00 12 <00 00 05
027340   26> 00 00
Max face index is 511 so this seems to be ok, but1318/3= 439.33 leaves a reminder and the mesh appears full of holes.
...
f 511 504 508
f 505 505 501
f 501 502 510
2d533:
# face index min/max: 1 / 511
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [PS3] Knight Contract .hxt models

Post by zaramot »

Yes, you're totally right. Mesh full of holes, it's the same problem I've had, thought indices count is bad.
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: [PS3] Knight Contract .hxt models

Post by shakotay2 »

I thought the faces might be quads instead of triangles but that's not the solution.

So I would recommend to examine a small and simple mesh (a box for example) to get a clue what's going on here.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [PS3] Knight Contract .hxt models

Post by zaramot »

Yes, I already checked small model, it's a character's blade model the one on the first pic. It appears each model has second face indices count at the end of the file? It's always -2, for example first one is 1060 - second one 1058, 2082/2080. Here's blade model.

EDIT: count 1158 fits nicely since 1158/3=386. Still sword mesh full of holes. Any ideas?
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: [PS3] Knight Contract .hxt models

Post by chrrox »

did you try triangle strips?
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [PS3] Knight Contract .hxt models

Post by zaramot »

No I didn't, since I'm new in formats reversing, could you please, give an example of maxscript?
Making model-import scripts, PM
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: [PS3] Knight Contract .hxt models

Post by shakotay2 »

@chrrox: good idea! thx. :)
zaramot wrote:No I didn't, since I'm new in formats reversing, could you please, give an example of maxscript?
I'm not a maxscripter but here's the idea:
After reading the face indices 1 2 3 4 5 6 7 8 9 for example
build 7 faces such as
f 1 2 3
f 2 3 4
f 3 4 5
...
f 7 8 9

This is the result:
Image

Still little errors (?). Maybe groups of ten face indices to be read?
Or use reverse order of face indices for every 2nd face?
Maybe chrrox will know...

These are the faces I got for chr176.hxt:
# 0x7ecf:

f 1 2 3
f 2 3 3
f 3 3 4
f 3 4 4
f 4 4 4 // hmm, confusing
f 4 4 5
f 4 5 6
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: [PS3] Knight Contract .hxt models

Post by chrrox »

something like this

Code: Select all

FaceIndexTableStart = ftell f
fseek f FaceIndexOffset#seek_set
FaceDirection = 1
f1 = ReadBEword f + 1   --read face indices, games are start form 0, but Max start from 1
f2 = ReadBEword f  + 1   --so we add 1 to each index
for i = 3 to FaceBytes do (    --already readf 2 verts, so start from 3	
f3 = ReadBEword f  + 1
FaceDirection *= -1	
if (f3 != f1) AND (f3 != f2) then (   --if not idential verts, create face
if FaceDirection > 0 then append Face_array [f1,f2,f3]     --base on face direction to create face
else append Face_array [f1,f3,f2]
)
f1 = f2     --shift the verts
f2 = f3
)
fseek f FaceIndexTableStart#seek_set
)
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: [PS3] Knight Contract .hxt models

Post by shakotay2 »

Perfect! :) thx, chrrox.
The sword faces look now like this:

# 0x1763:
f 1 3 2
f 3 4 3
f 4 4 5
f 4 6 5
f 5 6 7
f 7 6 8
f 8 6 3
f 6 9 3
f 3 9 2
f 9 10 2
f 2 10 11
f 10 12 11
f 11 12 13
f 13 12 14
f ... ... ...

edit: chr053.hxt
Image
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [PS3] Knight Contract .hxt models

Post by zaramot »

Thank you very much chrrox :) . It helped with the sword mesh, will try with other models.

EDIT: Works fine, guess I found where are UV's.
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
Szkaradek123
mega-veteran
mega-veteran
Posts: 292
Joined: Wed May 05, 2010 8:21 pm
Location: Poland Głogów
Has thanked: 21 times
Been thanked: 742 times

Re: [PS3] Knight Contract .hxt models

Post by Szkaradek123 »

about hxt format:

1.beginning

Code: Select all

go to offset 140
int32 - imageCount
skip 20 bytes
int32 - charCount
string = get charCount bytes
skip 108 bytes

repeat*imageCount {
	int32 - charCount
	string = get charCount bytes
	skip 44 bytes
	int32 - count
	skip count bytes
	skip 168 bytes
	}
	
#section .ddm	
string = get 4 bytes
skip 164 bytes
int32 - unk
int32 - type of data for skeletons (get from python script)
int32 - boneCount
start - get current offset
boneNameList = get boneCount bytes #numbers as  bone names
parentNameList = get boneCount bytes #numbers as bone parent names

here was problem with ending this section and i tried absolute padding (from 0 offset), but without success.
Finally i used relative padding (from start offset) and it works. In this case pad = 8 bytes.
I have problems with skeleton ,bone map for vertex groups, vertex items.
Here is script for importing textured meshes (not all are supported) without skinning and skeleton.
It requires Blender 249 and Python 26.
How use:
1. run Blender249.blend
2. in Blender Text Window press alt+p and select hxt file

For unpacking models from archive: viewtopic.php?f=10&t=6949
For unpacking textures: viewtopic.php?f=18&t=7026
You do not have the required permissions to view the files attached to this post.
raykingnihong
mega-veteran
mega-veteran
Posts: 179
Joined: Sun Apr 06, 2014 8:06 pm
Has thanked: 216 times
Been thanked: 6 times

Re: [PS3] Knight Contract .hxt models

Post by raykingnihong »

Hi Szkaradek123,Thank you very much for the great work, the script runs very well.
You do not have the required permissions to view the files attached to this post.
Post Reply