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

Dead or Alive series formats and tools

Post questions about game models here, or help out others!
b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 121 times

Re: Dead or Alive 3,U,X tools [download]

Post by b0ny »

2ganjul
can you make an importer for blender with comments. i want to learn how to do that but too lazy to read python books...

2mariokart64n

the third dword in the obj structure is multiplied by 0x20 to find the first material

mat[1] - the first dword in the material structure is getting in the doau xpr's the following values {80000000,80000001,80000002,80000003,80000005,80000007,90000000}

mat[4] - the fourth dwod in the material structure = {0,1,4,5,8,9,c,d} (?texture different normals)

the dword right after the amount of the textures in the material is getting - {1,3}, and {0} for stages and tengu (?does affect the shadow n ilumination)
ganjul
beginner
Posts: 35
Joined: Wed Nov 16, 2011 4:21 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by ganjul »

I'd be glad to write an importer if you guys could explain me the format.

I don't want to hurt anyones feelings, but all documents I've read till now are confusing, confusing for me but this is not the first format I'm reading specifications of.

Usually I see formats explained like this:

Code: Select all

CHAR        - 1 byte ASCII character
DWORD       - 4 bytes int
SHORT       - 2 bytes int
FLOAT       - 4 bytes float
ANY_TYPE[x] - array of any type from above
0xXX        - hex number, replace "XX" with numbers

------------------------------------------------------------------------
DOAU, DOAX and DOA3 XPRs are a bit different.
This doc is for DOAU XPR files.

File is little endian.

XPR files consist of 2 parts (blocks).

1st part contains:
	
	1) XPR header
	2) Model entry, which contains Object entries, which themselves contain Material entries.
	3) Texture enties.

2nd part contains:

	1) Vertex data (vertex buffers)
	2) Texture data

You find out when the 1st part ended when you read all the entries one after another (use the entry
header to find out what type of entry to read each time) and encounter a 0xFFFFFFFF terminator (instead of a entry header).

The XPR header entry contains "Block 1 size", but this isn't where the 1st part ends as there
is some padding between the two parts, because each part needs to be a size multiple of 2048 bytes.

You use the "Block 1 size" to continue reading the second part of the file. 2nd part has some padding in the end as well.

Below we will find out what each entry contains and how data is stored in the vertex buffers and texture data.
------------------------------------------------------------------------

1) XPR Header

	CHAR[4] - signature "XPR0"
	DWORD   - size of this XPR file
	DWORD   - size of the 1st part of the file, including padding

2) Model entry

	0x80000000 - Model entry offset in file
	DWORD      - Model size
	CHAR[4]    - signature "MDL0"
	DWORD      - number of objects
	DWORD      - number of materials
	DWORD      - unknown
	DWORD      - number of vertex buffers used by this model
	
	for each object (we found the number of objects above):
		DWORD  - object offset (move to this location and read the Object entry, move from start of file)
		
	DWORD      - unknown

3) Object entry
	
	CHAR[4] - signature "OBJ"
	DWORD   - number of vertex weights
	DWORD   - unknown, always 4
	DWORD   - number of indices used by this object
	FLOAT   - object x pos
	FLOAT   - object y pos
	FLOAT   - object z pos
	FLOAT   - unknown (someone calls it "radius")
	
	for i in 4: ( I don't know why 4 myself)
		
		DWORD - number of vertices
		DWORD - vertex buffer offset
		DWORD - number of indices
		DWORD - index buffer offset

	for each material (we found the number of materials above):
		
		0x800000xx - transparency type, if xx = 0, then there is no or 1 bit transparency, if xx = 1, there is 256 bit transparency
		DWORD      - material size
		DWORD      - unknown
		DWORD      - unknown
		FLOAT      - sub-object x pos
		FLOAT      - sub-object y pos
		FLOAT      - sub-object z pos
		FLOAT      - unknown (someone calls it "sub-object radius)
		FLOAT[4]   - diffuse RGBA color
		FLOAT[4]   - ambient RGBA color
		FLOAT[4]   - specular RGBA color
		FLOAT[4]   - emissive RGBA color
		FLOAT      - specular glow power
		DWORD      - number of textures
		DWORD      - unknown
		DWORD      - unknown
(I wrote it for myself and it's not half right).

Or this is a good specification: http://wiki.xentax.com/index.php/GRAF:AFS_AFS

Let's compare it with one of the docs from here (I just use this as example, mariokart and others who edited it, it's nothing personal). https://docs.google.com/spreadsheet/ccc ... qYWc#gid=4

Now of course there is a link to the xentax specs for this one, but assume there wasn't, this hardly explains enough itself. There is no "this chunk of offset and size values is repeated for every file entry", or where the list of names start because it's missing the

Code: Select all

    uint32 {4}   - Filename Directory Offset
    uint32 {4}   - Filename Directory Length
part from the xentax version of the doc.

That's what I feel of all the docs I've seen here. Either you are left guessing what it meant or the author simply forgot something.

Again, I don't want to hurt anyones feelings, passing knowledge is not easy.

So yeah, if you could write a doc like the xentax version of the ASF specification or fix the existing docs, then yeah, I would write a Blender importer (and maybe exporter when the format is completely understood).

mariokart answered many questions, but there is more, and I'm still half way through the format. This is very slow way...

BTW, I'm not a C++/C# programmer so the source code of the viewers isn't very helpful.
AFS dumper Python script: http://pastebin.com/K28RdNvP
b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 121 times

Re: Dead or Alive series formats and tools

Post by b0ny »

2ganjul
xpr is a container that can optionally contain a mdl file, and a virtual directory with vertex and textures.
1. i think you need something to start with, not sure if this is possible, but try first to import from the xpr file all textures of a certain kind, for example "DXT1".
2. later you'll need to import the vertex buffers and take a look in the mdl file - which textures are assigned to which object.
3. after this you can try to properly import the materials and everything else.
4. in the end we'll need to import also all the info we can get from the cat file - like physics, animation etc.
ganjul
beginner
Posts: 35
Joined: Wed Nov 16, 2011 4:21 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by ganjul »

What? That was just a brief overview of the format, not a specification. I already know that stuff.
AFS dumper Python script: http://pastebin.com/K28RdNvP
mariokart64n
ultra-veteran
ultra-veteran
Posts: 586
Joined: Sun Jun 05, 2005 12:00 pm
Location: Ontario, Canada
Has thanked: 36 times
Been thanked: 243 times

Re: Dead or Alive series formats and tools

Post by mariokart64n »

I got no problem reviewing and patching up errors in the spread sheet.

its just a bit confusing when I want to express my loops

because they are mixing many different structures, some loops are carried out by a count. and some others are carried out until a terminator of either -1 or 0 is met

besides just saying that in plain english "loop this structure here until a condition is met" its difficult to express cleaning.
some loops are in other loops which are all conditional. so which ever way you spin it, its not going to be simple

I think thats why b0ny has suggested you attempt to parse the data first before trying to import it. cause franky I don't understand where or how your stuck anywhere.

let me know where your stuck, and I'll completely explain this step by step in plain english
Maxscript and other finished work I've done can be found on my DeviantArt account
ganjul
beginner
Posts: 35
Joined: Wed Nov 16, 2011 4:21 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by ganjul »

Then maybe a pure spreadsheet is not enough to write format specifications? You say that it's hard to express loops here and I agree, but by leaving these stuff out we don't end up with real format specification.
To be honest this is the first time I see people using spreadsheets for format specs, I can't give a good suggestion about how to improve it.
I think thats why b0ny has suggested you attempt to parse the data first before trying to import it.
Sorry I don't understand what you mean. If I don't understand how to parse it, how can I parse it? What is the difference between parsing and reading here anyway? When I hear the word parsing I think of xml or other script files.

Anyway, I'll collect my old questions and post them again.
Thanks for offering to explain everything.
AFS dumper Python script: http://pastebin.com/K28RdNvP
mariokart64n
ultra-veteran
ultra-veteran
Posts: 586
Joined: Sun Jun 05, 2005 12:00 pm
Location: Ontario, Canada
Has thanked: 36 times
Been thanked: 243 times

Re: Dead or Alive series formats and tools

Post by mariokart64n »

:| ..ok lol you know I'm really bending over backwards for you man.
I understand the documents aren't the best.. but thats more documentation then most formats get

most just toss up there source and there done with it. and actually throughout this topic I've uploaded multiple
working sourcecodes from different converters/viewers from different programmers. Its not my problem if your not willing to read them

Though I've detailed the format anyway here as I went through it. And if that wasn't enough I tried to organize it better into a spread sheet to help all of us learn the format.
you know that thing isn't easy to writeup, and now your saying its rubbish. and you wrote up your own spec, rather then correcting or building upon the spreadsheet

I got no problem answering questions, but when you say "you need to re-gather your questions". That leaves me to believe you have no idea what your doing in the format.

I just don't have time to hold someone's hand. part of the problem here is that you need to get your hands dirty in a hex editor.
I don't think any matter of documentation is going to help you, obviously I'm unable to convey my thoughts properly through my explainatations

here is my maxscript, you'll have to figure the rest out on your own, sorry
-mariokart64n

Code: Select all

/*
there are some values in the OBJ bloc which are not understood. they could be related to the models position
theres also ALOT unknown about the material block. the bloc varies in size, and the last 3 LONGS are
required for proper mesh import. right now all I can do is jump to the end of the material bloc and get 
those 3 values. the size of the material bloc seems to increase after the value -1

more research is needed to understand the material bloc
*/
mscale=39.3700787
clearlistener()
-- obj=$*;delete obj


fsource = GetOpenFileName \
caption:"Browse for XPR" \
types: "All Files (*.xpr)|*.xpr|"
if (fsource!=undefined) AND ((doesFileExist fsource)==true) then(
fpath=getFilenamePath fsource
fname=getFilenameFile fsource
fsize=getFileSize fsource
f = fopen fsource "rb"

fn buildmsh fstream mname vtype vtype2 voffset foffset vcount fcount fcountarray foffsetarray vscale rotat=(
counter=0
vertArray=#();vertArray[vcount]=[0,0,0]
uvwArray=#();uvwArray[vcount]=[0,0,0]
normArray=#();normArray[vcount]=[0,0,0]
faceArray=#()

fseek fstream foffsetarray[1] #seek_set
for y = 1 to fcountarray.count do(
fseek fstream foffsetarray[y] #seek_set
flip=1
f1 = readshort fstream #unsigned + 1
f2 = readshort fstream #unsigned + 1
for i = 1 to fcountarray[y] do (flip=-flip
f3 = readshort fstream #unsigned + 1
if (f1!=f2)AND(f2!=f3)AND(f3!=f1) then (face=[f1,f2,f3]
if flip==1 do face=[f1,f3,f2]
append faceArray face
)
f1 = f2;f2 = f3)
)
fseek fstream voffset #seek_set
for i = 1 to vcount do(
vx=readfloat fstream--*vscale
vy=readfloat fstream--*vscale
vz=readfloat fstream--*vscale
nx=readfloat fstream
ny=readfloat fstream
nz=readfloat fstream
tu=readfloat fstream
tv=readfloat fstream
if vtype==1 do fseek fstream 4 #seek_cur
if vtype==2 do fseek fstream 8 #seek_cur
if vtype==3 do fseek fstream 12 #seek_cur
vertArray[i]=[vx,vy,vz]
normArray[i]=[nx,ny,nz]
uvwArray[i]=[tu,tv,0])
msh = mesh vertices:vertArray faces:faceArray
msh.numTVerts = vertArray.count
buildTVFaces msh
msh.displayByLayer = false
msh.backfacecull = on
msh.name = mname
for j = 1 to vertArray.count do setTVert msh j uvwArray[j]
for j = 1 to faceArray.count do setTVFace msh j faceArray[j]
msh.position = vscale
setUserProp msh "Name" mname
setUserProp msh "Type" vtype
setUserProp msh "NumVertices" vcount
setUserProp msh "NumFaces" fcount
setUserProp msh "VertOffset" voffset
setUserProp msh "FaceOffset" foffsetarray[1])

fn writeDDSheader streamin texW texH texM texC = (
texP=0
writelong streamin 0x20534444 #unsigned -- File ID
writelong streamin 0x7C #unsigned -- Header Size
case of( -- dwFlags
(texC=="DXT1"): (writelong streamin 0x00081007 #unsigned;texP=((texW*texH)/0x02))
(texC=="DXT3"): (writelong streamin 0x00081007 #unsigned;texP=(texW*texH))
(texC=="DXT5"): (writelong streamin 0x00081007 #unsigned;texP=(texW*texH))
(texC=="ATI1"): (writelong streamin 0x000A1007 #unsigned;texP=(texW*texH)/2;texM=1)
(texC=="ATI2"): (writelong streamin 0x000A1007 #unsigned;texP=(texW*texH);texM=1)
(texC=="P8"): (writelong streamin 0x000A1007 #unsigned;texP=((texW*texH)/0x02))
(texC=="ARGB16"): (writelong streamin 0x00081007 #unsigned;texP=(((texW*texH)/0x8)*0x10))
(texC=="ARGB32"): (writelong streamin 0x00081007 #unsigned;texP=(((texW*texH)/0x4)*0x10)))
writelong streamin texW #unsigned -- Texture Width
writelong streamin texH #unsigned -- Texture Height
writelong streamin texP #unsigned -- Pitch (#of bytes in a single row across the texture)
writelong streamin 0x00 #unsigned -- Image Depth? Not Used, for Image Volume
writelong streamin texM #unsigned -- Texture MIP Count
for i = 1 to 11 do writelong streamin 0x00 #unsigned -- Reserved Space
writelong streamin 0x20 #unsigned -- Size of PIXEL_FORMAT info, always 32bytes;
case of(
(texC=="DXT1"): (writelong streamin 0x04;writelong streamin 0x31545844 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00001000 #unsigned)
(texC=="DXT3"): (writelong streamin 0x04;writelong streamin 0x33545844 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00001000 #unsigned)
(texC=="DXT5"): (writelong streamin 0x04;writelong streamin 0x35545844 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00001000 #unsigned)
(texC=="ATI1"): (writelong streamin 0x04;writelong streamin 0x31495441 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00401008 #unsigned)
(texC=="ATI2"): (writelong streamin 0x04;writelong streamin 0x32495441 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00401008 #unsigned)
(texC=="P8"): (writelong streamin 0x20;writelong streamin 0x20203850 #unsigned
writelong streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00401008 #unsigned)
(texC=="ARGB16"): (writelong streamin 0x41;writelong streamin 0x00000000 #unsigned
writelong streamin 0x10;writebyte streamin 0x00;writebyte streamin 0x0F;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0xF0;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x0F;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0xF0;writebyte streamin 0x00
writebyte streamin 0x00;writelong streamin 0x00001000 #unsigned)
(texC=="ARGB32"): (writelong streamin 0x41;writelong streamin 0x00000000 #unsigned
writelong streamin 0x20;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0xFF
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0xFF;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0xFF;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00;writebyte streamin 0x00
writebyte streamin 0xFF;writelong streamin 0x00001000 #unsigned))
for i = 1 to 4 do writelong streamin 0x00 #unsigned) -- Reserved Space for CAPS

if (readlong f #unsigned)==0x30525058 then( -- only applicable to DOAU2, DOAX uses a hash, DOAO is stripped
dataLog=#()
dataMDL=#()

fileSize=readlong f #unsigned
dataBuffer=readlong f #unsigned
while ChunkID!=-1 AND (ftell f)!=fileSize do(
chunkID=readshort f
SubID=readshort f #unsigned
case of (
(chunkID==0x0000): (case of (
	(subID==0x8000): ( -- Jump, and Log Data
	jump=readlong f #unsigned
	append dataLog[(ftell f),(ftell f-jump)]
	fseek f jump #seek_cur
	)
);)
(chunkID==0x0001): (case of (
	(subID==0x0001): ( -- ??? bloc found in NG1
	ukn01=readlong f #unsigned -- offset
	ukn02=readlong f #unsigned -- usually 0x00
	)
	(subID==0x0002): ( -- ??? bloc found in NG1
	ukn03=readlong f #unsigned -- usually 0x00
	ukn04=readlong f #unsigned -- usually 0x00
	ukn05=readlong f #unsigned -- usually 0x00
	ukn06=readlong f #unsigned -- usually 0x00
	ukn07=readlong f #unsigned -- usually 0x00
	)
	(subID==0x0004): ( -- Texture Definition Entry
	tex_offset=readlong f #unsigned + dataBuffer
	ukn08=readlong f #unsigned -- usually 0x00
	tex_info=readlong f #unsigned
	ukn09=readlong f #unsigned -- usually 0x00
	)
	(subID==0x0080): ( -- Vertex Buffer Entry
	vbuf_offset=readlong f #unsigned + dataBuffer
	ukn10=readlong f #unsigned -- usually 0x00
	)
	(subID==0x0083): ( -- Texture Buffer Entry
	tex_size=readlong f #unsigned
	ukn11=readlong f #unsigned -- usually 0x00
	)
);)
) -- end switch
chunk_ids = #(-1,0,1,0xFFFF)
if (findItem chunk_ids chunkID)==0 do(messagebox ("New ID Found (0x"+((bit.intAsHex(chunkID))as string)+"): @ "+((bit.intAsHex(ftell f-4))as string));EXIT)
) -- end while loop
if dataLog.count>=1 do (for z = 1 to dataLog.count do(
fseek f dataLog[z][1] #seek_set
dataSize=dataLog[z][2]
chunkID=readlong f #unsigned
case of (
(chunkID==0x004C444D): ( -- MDL
obj_count=readlong f #unsigned
tex_count=readlong f #unsigned
ukn12=readlong f #unsigned -- count unknown
obj_count2=readlong f #unsigned -- duplcated count?
dataMDL[obj_count]=0
for i = 1 to obj_count do(dataMDL[i]=readlong f #unsigned)
)
);)) -- end if/ for empty log array
if dataMDL.count>=0 do(for z = 1 to dataMDL.count do(
fseek f dataMDL[z] #seek_set
Print ("OBJ "+((z-1) as string)+" @ 0x"+((bit.intAsHex(ftell f))as string))
chunkID=readlong f #unsigned -- OBJ
vertType=readlong f #unsigned -- always 0? number of vertex weights
	
if vertType!=0 do Print ("Vertex Type 0x"+((bit.intAsHex(vertType))as string))
ukn09=readlong f #unsigned -- always 4? sometimes 0
count=readlong f #unsigned -- number of faces in face buffer
posx=readfloat f
posy=readfloat f
posz=readfloat f
posw=readfloat f
vert_count=readlong f #unsigned
vert_offset=readlong f #unsigned
face_count=readlong f #unsigned -- number of faces?
face_count_array=#()
face_offset_array=#()
face_offset=readlong f #unsigned

ukn11=readlong f #unsigned
ukn12=readlong f #unsigned
ukn13=readlong f #unsigned
ukn14=readlong f #unsigned
ukn15=readlong f #unsigned
ukn16=readlong f #unsigned
ukn17=readlong f #unsigned
ukn18=readlong f #unsigned
ukn19=readlong f #unsigned
ukn20=readlong f #unsigned
ukn21=readlong f #unsigned
ukn22=readlong f #unsigned
ukn23=readlong f #unsigned
ukn24=readlong f #unsigned
ukn25=readlong f #unsigned
ukn26=readlong f #unsigned
ukn27=readlong f #unsigned
ukn28=readlong f #unsigned
ukn29=readlong f #unsigned
ukn30=readlong f #unsigned
ukn31=readlong f #unsigned
ukn32=readlong f #unsigned
ukn33=readlong f #unsigned
ukn34=readlong f #unsigned
ukn35=readlong f #unsigned
ukn36=readlong f #unsigned
ukn37=readlong f #unsigned
ukn38=readlong f #unsigned

loop=true
mat_count=0
while (loop==true) do (
mat00=readbyte f #unsigned -- 0x00 | 0x01 | 0x02 | 0x03 | 0x05  >> transparency flag?
mat01=readbyte f #unsigned
mat02=readbyte f #unsigned
mat03=readbyte f #unsigned -- 0x80 data present?
if mat03!=0 then( -- 140bytes
mat_count+=1
mat_size=readlong f #unsigned + (ftell f - 8)
mat06=readlong f #unsigned -- always 0
mat07=readlong f #unsigned -- ?? always 8
mat08=readlong f #unsigned -- number? scale or vector?
posX=readfloat f -- float
posY=readfloat f -- float
posZ=readfloat f -- float
mat12=readlong f #unsigned
mat13=readlong f #unsigned
mat14=readlong f #unsigned
mat15=readlong f #unsigned
mat16=readlong f #unsigned
mat17=readlong f #unsigned
mat18=readlong f #unsigned
mat19=readlong f #unsigned
mat20=readlong f #unsigned
mat21=readlong f #unsigned
mat22=readlong f #unsigned
mat23=readlong f #unsigned
mat24=readlong f #unsigned
mat25=readlong f #unsigned
mat26=readlong f #unsigned
mat27=readlong f #unsigned
mat28=readlong f #unsigned
mat29=readlong f #unsigned
mat30=readlong f #unsigned
mat31=readlong f #unsigned
mat32=readlong f #unsigned
mat33=readlong f #unsigned
mat34=readlong f #unsigned
mat35=readlong f #unsigned
mat36=readlong f #unsigned

fseek f (mat_size-12) #seek_set -- too lazy to figure it out, skips mat info
mat_face_offset=readlong f #unsigned*2
mat_face_count=readlong f #unsigned -- num of faces used by material
mat39=readlong f #unsigned -- always 2?

append face_count_array mat_face_count
append face_offset_array (mat_face_offset+face_offset)
fseek f mat_size #seek_set
)else(loop=false))
uknA1=readlong f #unsigned -- always 0x12345678

try(num="";if (z-1)<=99 do num+="0";if (z-1)<=9 do num+="0"
buildmsh f ("OBJ_"+num+((z-1) as string)) vertType posw4 vert_offset face_offset vert_count face_count face_count_array face_offset_array [posx,posy,posz] posw
)catch(messagebox "dingdong!\n import failed :'(";ExIT)))
)else(messagebox "not a yobj file")
)else(Print "Aborted.")

Maxscript and other finished work I've done can be found on my DeviantArt account
ganjul
beginner
Posts: 35
Joined: Wed Nov 16, 2011 4:21 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by ganjul »

mariokart64n wrote::| ..ok lol you know I'm really bending over backwards for you man.
I did say "Thanks for offering to explain everything.".
I understand the documents aren't the best.. but thats more documentation then most formats get
I don't know what most formats you mean, the ones I've came across are decent. The xentax wiki is pretty understandable.
most just toss up there source and there done with it. and actually throughout this topic I've uploaded multiple
working sourcecodes from different converters/viewers from different programmers. Its not my problem if your not willing to read them
Or are you not willing to read all my posts, huh?
BTW, I'm not a C++/C# programmer so the source code of the viewers isn't very helpful.
you know that thing isn't easy to writeup, and now your saying its rubbish.
I did say
Again, I don't want to hurt anyones feelings, passing knowledge is not easy.
mariokart, I'm trying to be as nice as I can, I think you are overreacting. I'm just saying what I "think", it's just my opinion you know and I never say it as harsh as you put it
and you wrote up your own spec, rather then correcting or building upon the spreadsheet
I wrote it few days ago, before you made your own spreadsheets or posted the old DOAU spreadsheet.
I got no problem answering questions, but when you say "you need to re-gather your questions". That leaves me to believe you have no idea what your doing in the format.
Why does it sound weird to you that I need to regather my questions? I edited my old post with few questions so you didn't notice them, so I'm saying I'll repost it.
I just don't have time to hold someone's hand. part of the problem here is that you need to get your hands dirty in a hex editor.
Now here I'll disagree. Reverse enginnering or hacking a format is one thing, writing an importer/exporter is another. A hacker is not a programmer. Should I get offended now? Your "holding my hand"? You say I don't understand what I'm doing with the format? If I was such a noob how could I write the AFS dumper in my siggy?
I don't think any matter of documentation is going to help you, obviously I'm unable to convey my thoughts properly through my explainatations
I don't think there is anyone else here who can give an objective opinion on is it me who can't diguest the information you give me or is it you who isn't very good at passing knowledge.
All I can say is this is not my first importer. And also, there are only parts of your explanations I don't get, so you aren't bad either.
here is my maxscript, you'll have to figure the rest out on your own, sorry
Hm? You changed your mind? I thought you wanted to answer all my questions? OK, I don't understand why you changed your opinion after my previous post, but fine. I'm getting kind of tired myself to be honest.

EDIT: BTW, I just checked your doc edits for AFS and it's alot better now.
AFS dumper Python script: http://pastebin.com/K28RdNvP
Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: Dead or Alive series formats and tools

Post by Darkfox »

Easy guys, calm down, he didn't really call your docs rubbish mariokart64n or was being thankless. He seems to just be confused on a few things is all, he's not really using a disrespectful tone here or it being his intention. But now it is going down a rocky slope so just ease up guys, alright? =/ From my POV it seems pretty early to get irate.
mariokart64n
ultra-veteran
ultra-veteran
Posts: 586
Joined: Sun Jun 05, 2005 12:00 pm
Location: Ontario, Canada
Has thanked: 36 times
Been thanked: 243 times

Re: Dead or Alive series formats and tools

Post by mariokart64n »

I was re-writing my specs to clarify to him when I realized.. poo I do not have time for this :P
maybe I was too harsh?

I supplied docs, spreadsheets, answered questions and now I've posted my own work.

@ganjul
your getting all hyper about this, I don't get why your nit-picking my comments like that
if you have a question post it, and I'll answer to the best of my knowledge.

but my time is up now, and I can't put anymore time into creating a new format spec for you.
you'll have to roll with what you have and figure out whats going on if I'm unable to clarify for you.

Sorry if I was bashing you or whatever, you clearly want the spec in a format better suited to you.
however I can't do this, I'm wasting too much time writing specs up
Maxscript and other finished work I've done can be found on my DeviantArt account
Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: Dead or Alive series formats and tools

Post by Darkfox »

True, I was going to say that as well. Ganjul, just ask the question(s) please. I'm not taking sides here, trying to just cool the atmosphere since was getting a bit antsy.
mariokart64n
ultra-veteran
ultra-veteran
Posts: 586
Joined: Sun Jun 05, 2005 12:00 pm
Location: Ontario, Canada
Has thanked: 36 times
Been thanked: 243 times

Re: Dead or Alive series formats and tools

Post by mariokart64n »

I had a closer look at the 4th bloc of the CAT file. I passed it off as containing joint data.. because the models in DOA are diced into objects, and the objects used for bending are detailed in this 4th bloc.

Anyway this bloc consists of two parts, 1.) A vertex buffer 2.) A table

there were IDs in the table, so I just figured each of the IDs manipulated the vertex buffer differently.

however I investigated it further, and manipulation of the vertex data isn't consistant. so I tossed in another idea. the IDs are weights

here was the result;

here's the neck mesh, I've enabled vertex colours in the 2nd image you can see the VertexIDs are changed into vertex colour. this just merely shows us that the
table is describing vertices for only the lower part of the neck
the last image paints a more interesting picture, converting the IDs. Now you can clearly see that the data described in Bloc4 is vertex weights
Image


the table is giving us 3 sets of data;
1. Weight
2. Buffer Index
3. Vertex Index (Vertex of Mesh Object)

I understand whats 1 and 2 are doing, but the 3rd value is an index to that vertex buffer???
I have no idea what the vertex buffer is for


below is an image of the vertex buffer imported
interestingly vertex 1, and 2 are actually what appears to be node positions. in otherwords its creating bones to apply the vertex weight data to
next you can see some vertices that follow along the seam of the neck. these are vertices which would have had a vertex weight of 1.0

then aside from that why are the remaining vertices pulled or clustered together at the bottom?
Image


everything in the game is strangely pulled to the center, because they've exported the geometry local to the bone or node it was originally attached to.
but this is a bit weird, I can't make sense of the reason behind defining all new vertex positions
Last edited by mariokart64n on Tue Jan 03, 2012 7:30 am, edited 1 time in total.
Maxscript and other finished work I've done can be found on my DeviantArt account
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Dead or Alive series formats and tools

Post by howfie »

Ha ha ha, one of the first things you learn in software engineering is that programmers can't write documentation. That's why they pay the software engineers, who can't program worth a shit, the big bucks!
mariokart64n
ultra-veteran
ultra-veteran
Posts: 586
Joined: Sun Jun 05, 2005 12:00 pm
Location: Ontario, Canada
Has thanked: 36 times
Been thanked: 243 times

Re: Dead or Alive series formats and tools

Post by mariokart64n »

I don't have any background or education in programming or software engineering. <_< so the bad docs are just from inexperience.

I learned all of what I know just from reading others, and practicing modding games over the past 6 years. started making texture mods with paint, and here I am now thanks to chrrox's help in 3dsmax


EDIT
I'm going to explain a bit of the table, since I completely suck at documentation :cry:
I'm not even going to bother updating the spreadsheet, cause I'm just constantly getting shit on for it.

anyway here's three entries from the 4th bloc in the CAT

theres no counts, your just given a offset to this table, and you have to parse it until you return 0 from your weight

the structure would be
LONG: VertexWeight
LONG: VertexIndex

but its a bit confusing and hard to explain, so i've printed out how this looks in hex to give you and idea

you get the vertex weight of 0x10, then followed by Vertex Indices

the Vertex Indices loop until -1 and it moves onto the next entry

your entries stop when the vertex index = -1, twice
then you repeat your structure

the purpose behind defining more then one vertex for a single index, is because there using this to also weld or group overlapping vertices.
I noted before welding is critical to prevent the mesh from separating

10 00 00 00
40 0D 00 00 FF FF FF FF
80 13 00 00 FF FF FF FF
60 0B 00 00 FF FF FF FF
A0 0A 00 00 FF FF FF FF
80 0B 00 00 FF FF FF FF
40 0C 00 00 FF FF FF FF
00 0E 00 00 FF FF FF FF
20 13 00 00 FF FF FF FF
40 0B 00 00 FF FF FF FF
A0 0B 00 00 FF FF FF FF
E0 0A 00 00 FF FF FF FF
E0 08 00 00 FF FF FF FF
00 09 00 00 FF FF FF FF
C0 07 00 00 FF FF FF FF
E0 07 00 00 FF FF FF FF
20 08 00 00 FF FF FF FF
40 07 00 00 FF FF FF FF
60 07 00 00 FF FF FF FF
20 09 00 00 FF FF FF FF
60 08 00 00 FF FF FF FF
00 13 00 00 80 06 00 00 FF FF FF FF
40 06 00 00 FF FF FF FF
A0 05 00 00 FF FF FF FF
80 09 00 00 C0 05 00 00 FF FF FF FF
E0 12 00 00 20 07 00 00 FF FF FF FF
E0 06 00 00 FF FF FF FF
00 06 00 00 FF FF FF FF
80 08 00 00 E0 05 00 00 FF FF FF FF
FF FF FF FF

01 00 00 00
A0 12 00 00 A0 02 00 00 FF FF FF FF
60 0D 00 00 80 02 00 00 FF FF FF FF
FF FF FF FF

02 00 00 00
20 0F 00 00 20 04 00 00 FF FF FF FF
20 10 00 00 A0 01 00 00 FF FF FF FF
A0 0F 00 00 00 01 00 00 FF FF FF FF
00 0F 00 00 60 01 00 00 FF FF FF FF
FF FF FF FF
Maxscript and other finished work I've done can be found on my DeviantArt account
ganjul
beginner
Posts: 35
Joined: Wed Nov 16, 2011 4:21 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by ganjul »

mariokart64n wrote: I supplied docs, spreadsheets, answered questions and now I've posted my own work.
And I'm thankful for that, you know? There are only certain parts I don't understand. Is it so weird that few parts are still confusing when you repost it in another form?
your getting all hyper about this, I don't get why your nit-picking my comments like that
What? I just quoted your single post. How is that nit-picking?
but my time is up now, and I can't put anymore time into creating a new format spec for you.
OK, so? I didn't ask you to rewrite anything did I? :?
Sorry if I was bashing you or whatever, you clearly want the spec in a format better suited to you.
however I can't do this
All I said I have some questions.
I also said I *think* the documentation lacked some important things like what to do with the chunks, how to loop them, etc, which you added later btw. But it was just an opinion to improve the docs (not rewrite them). I wasn't saying for myself, like you said you had posted several docs and I got the missing parts by reading all of them, it was just a constructive criticism, to make it a full format specs by itself and enough to understand the formats. A suggestion. But seems like everytime I say something like that you get all defensive like I'm calling it rubbish. Like here:
I'm not even going to bother updating the spreadsheet, cause I'm just constantly getting shit on for it.
Sorry, I'm probably getting all "hyped" and "nitpicking" by quoting your latest post.
if you have a question post it, and I'll answer to the best of my knowledge.
Okay. Before you said you would help, I thanked and wanted to repost my questions, then you changed your mind, now you changed your mind again.

You know, I'm tired myself. You don't seem to understand what constructive criticism is, you act like I'm not thankful and also constantly act like you posted so much help that everyone else would get it by now, so acting like I'm a total noob. I rather learn file exploring myself than waste more time being called an unthankful noob.

So good luck you you and good bye.
@anyone who wanted a Blender importer: write it yourself. I've wasted too much time here.
AFS dumper Python script: http://pastebin.com/K28RdNvP
Post Reply