What's new

Melee Arcive Viewer (MAV) in development project.

OP
Tcll

Tcll

Complexity == Fun >:3
now we just need to get the normals fixed...
(I flipped the normals in the last images)
but I think I might know how to do that...

here's the unedited images:



I already have the code...
I think it's just in the wrong place
 
Last edited:

revel8n

New member
Sorry about that. The vertex ordering for tri-strips is normally handled automatically by the hardware/api during rendering so i forgot to take it into account.

i fixed the code in the previous post, but here is the change:

Code:
                        elif (h == '98'): #triangle strip
                            flip = 1
                            while (index > 2):
                                f0 = face(dat.read(2))
                                uv0 = UV(dat.read(2))
                                nor0 = dat.read(2)#normal(dat.read(2))
                                f1 = face(dat.read(2))
                                uv1 = UV(dat.read(2))
                                nor1 = dat.read(2)#normal(dat.read(2))
                                f2 = face(dat.read(2))
                                uv2 = UV(dat.read(2))
                                nor2 = dat.read(2)#normal(dat.read(2))
                                index = index - 1
                                if (index > 2):
                                    seek = dat.seek(-12,1)
                                if (f0 != f1 and f1 != f2 and f2 != f0):
                                  if (int(f0, 10) >= 0 and int(f1, 10) >= 0 and int(f2, 10) >= 0):
                                    if (flip):
                                        print "f "+f0+"/"+uv0+"/"+"1"+' '+f1+"/"+uv1+"/"+"1"+' '+f2+"/"+uv2+"/"+"1"
                                        obj.write("f "+f0+"/"+uv0+"/"+"1"+' '+f2+"/"+uv2+"/"+"1"+' '+f1+"/"+uv1+"/"+"1"+"\n")
                                    else:
                                        print "f "+f0+"/"+uv0+"/"+"1"+' '+f1+"/"+uv1+"/"+"1"+' '+f2+"/"+uv2+"/"+"1"
                                        obj.write("f "+f0+"/"+uv0+"/"+"1"+' '+f1+"/"+uv1+"/"+"1"+' '+f2+"/"+uv2+"/"+"1"+"\n")
                                flip = 1 - flip

Just toggle the initial value of 'flip' between 0 and 1 to change the ordering for you particular application if you dont want to have to flip them again when it doesn't match.
 

revel8n

New member
Just realized that if yu choose to flip outright, this probably need to be used in all the other triangle/quad cases as well, except it would not toggle in those case, but always either flip or not flip. So there would need to be an flipSetting or the like that is used as the default initialization value. That way tri-strips can still toggle the value internally in its if section.


Will have to play around with is some more.
 
OP
Tcll

Tcll

Complexity == Fun >:3
guess what else...
it actually imports into blender without errors. :bouncy:

pl files don't work the same way...
now I have to backtrack to see what I came to that was closest. :angry:

but yea... I'll try that.
it should work.

EDIT: did you ever find out if you had the order correct??
because I'm going by the .obj standards:
(vertex, uv, normal)
I say this because the 1st two columns have almost the same data...
where as the 3rd column does not...
 
Last edited:
OP
Tcll

Tcll

Complexity == Fun >:3
I know what this code is:
(you find it between the face groups)

00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
75 CC 00 00 |
75 F4 00 00 | color
76 2C 00 00 |
7A 44 00 00 .|
79 FC 00 00 .| specular
78 AC 00 00 .|
78 C4 00 00 |
78 DC 00 00 | mirror
79 E4 00 00 |
78 F4 00 00 .| alpha
00 00 00 00
00 00 00 00
D1 EC 00 00 |
7E BC A0 01 |
00 0D 00 00 | ??
CD A0 00 00 |
CF 40 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 00

this is the material index.

I'm not quite sure what that last bit is however...
 
Last edited:

Milun

New member
Well, I guess I missed out on a lot (my Internets been buggy recently). Wow! That's really all I can say. You've made a ton of progress.

I can help however. I noticed, that directly after the vertice data ends, the texture UV begins. I know this because I once changed the whole section to nothing but '00's and the textures went all messed.

I know there's little point to it, but I will continue work on my own C++ converter. It's just easier for me to test things that way. Don't worry, I have it cracked on my side as well.
 
OP
Tcll

Tcll

Complexity == Fun >:3
I'm already working on the UV faces
so yea a little late but whatever :p
thanx anyways

the uv's are a complete mess right now but it's sure to even out later.

I think revel8n might hae had the order correct for the faces:
(vert, nor, uv)
 
Last edited:
OP
Tcll

Tcll

Complexity == Fun >:3
well...
so far...
this is what I have:



if anyone has any ideas on what to do...
fell free to chip in. :p
 
Last edited:

Milun

New member
Hey, could you be able to convert your python into a .exe

No matter what I do, It keeps giving me errors on the 'print' command.

I ask because my C++ thing is a bit more buggy than yours, and I'd like to have both for comparison.

And about your UV, your best bet would be to manually extract a texture for Pichu with Dolphin, and UV map it to the model yourself. Then you can check through your extracted UV for matches.
 
OP
Tcll

Tcll

Complexity == Fun >:3
No matter what I do, It keeps giving me errors on the 'print' command.

do you have "import.dat" in the same directory as the program??
because the program here works perfectly.
(model wize)

yes I could compile it into an exe...
but I havn't done that before...
with python..., compiling sucks. :angry:

And about your UV, your best bet would be to manually extract a texture for Pichu with Dolphin, and UV map it to the model yourself. Then you can check through your extracted UV for matches.

the UV data isn't working yet...
it's just a jumbled, unorganized mess.

I'm working out the kinks in it though...
 
Last edited:
OP
Tcll

Tcll

Complexity == Fun >:3
hey revel8n...

that hex I listed below...
(for material indicies)
that would also be used for object indicies.
(or new objects)

got any idea on how I could interpret this??
I know I could use the obj's:
g object_#
to define a new object...
 
Last edited:
OP
Tcll

Tcll

Complexity == Fun >:3
hey Milun
this code is just as good as the last one...
I just simplified it a little...
Code:
import struct as S
dat = open("import.dat", 'rb')
obj = open("export.obj", 'w')
#mtl = open("export.mtl", 'w')
def HexToDec(h):
    return float(S.unpack("<h", S.pack("<H", int((h.encode('hex')), 16)))[0])
def vert(v): 
    return (HexToDec(v)* 0.01).__str__()
def face(f):
    return int(HexToDec(f)+1).__str__()
def UV(uv):
    return int(HexToDec(uv)+1).__str__()
def normal(nor):
    return int(HexToDec(nor)).__str__()
def f():
    f = face(dat.read(2))
    nor = normal(dat.read(2))
    uv = UV(dat.read(2))
    if (int(f, 10) >= 0):
        return f+"/"+uv+"/"+nor
 
g = 0
t0 = dat.read(32)#header
a = 0
while (a == 0):#verts
    v = "v "+vert(dat.read(2))+" "+vert(dat.read(2))+" "+vert(dat.read(2))
    if (v == 'v 0.0 0.0 0.0'):
        a = 1
        while (a == 1):
            s = dat.read(1).encode('hex')
            if (s =='ff'):
                dat.seek(-1,1)
                a = 2
                while (a == 2):#UV's
                    vt = "vt "+vert(dat.read(2))+" "+vert(dat.read(2))
                    if (vt == 'vt 0.0 0.0'):
                        a = 3
                        obj.write("\n")
                        while (a == 3):#faces
                            h = dat.read(1).encode('hex')+dat.read(1).encode('hex')+dat.read(1).encode('hex')+dat.read(1).encode('hex')
                            if (h == '0000B800'or h == '0000A800'or h == '0000B000'or h == '00009000'or h == '00009800'or h == '0000A000'or h == '00008000'):
                                a = 4
                                s = dat.seek(-2,1)
                                pos = dat.tell()
                                print pos.__str__()+": "+h
                                while (a == 4):
                                    pos = dat.tell()
                                    h = dat.read(1).encode('hex')
                                    print pos.__str__()+": "+h
                                    if (h == 'B8' or h == 'A8' or h == 'B0' or h == '90' or h == '98' or h == 'A0' or h == '80'):
 
                                        index = HexToDec(dat.read(2))
                                        if (h == 'B8'): #point
                                            while (index > 0):
                                                f0 = f()
                                                index = index - 1
                                                print "f "+f0
                                                obj.write("f "+f0+"\n")
 
                                        elif (h == 'A8'): #line
                                            while (index > 1):
                                                f0 = f()
                                                f1 = f()
                                                index = index - 2
                                                print "f "+f0+' '+f1
                                                obj.write("f "+f0+' '+f1+"\n")
 
                                        elif (h == 'B0'): #line strip
                                            while (index > 1):
                                                f0 = f()
                                                f1 = f()
                                                index = index - 1
                                                if (index > 1):
                                                    seek = dat.seek(-6,1)
                                                if (f0 != f1):
                                                    print "f "+f0+' '+f1
                                                    obj.write("f "+f0+' '+f1+"\n")
 
                                        elif (h == '90'): #triangle
                                            while (index > 2):
                                                f0 = f()
                                                f1 = f()
                                                f2 = f()
                                                index = index - 3
                                                print "f "+f0+' '+f1+' '+f2
                                                obj.write("f "+f0+' '+f1+' '+f2+"\n")
 
                                        elif (h == '98'): #triangle strip
                                            flip = 1
                                            while (index > 2):
                                                f0 = f()
                                                f1 = f()
                                                f2 = f()
                                                index = index - 1
                                                if (index > 2):
                                                    seek = dat.seek(-12,1)
                                                if (f0 != f1 and f1 != f2 and f2 != f0):
                                                    if (flip):
                                                        print "f "+f0+' '+f2+' '+f1
                                                        obj.write("f "+f0+' '+f2+' '+f1+"\n")
                                                    else:
                                                        print "f "+f0+' '+f1+' '+f2
                                                        obj.write("f "+f0+' '+f1+' '+f2+"\n")
                                                flip = 1 - flip
 
                                        elif (h == 'A0'): #triangle fan
                                            f0 = f()
                                            index = index - 1
                                            while (index > 1):
                                                f1 = f()
                                                f2 = f()
                                                index = index - 1
                                                if (index > 1):
                                                    seek = dat.seek(-6,1)
                                                if (f0 != f1 and f1 != f2 and f2 != f0):
                                                    print "f "+f0+' '+f1+' '+f2
                                                    obj.write("f "+f0+' '+f1+' '+f2+"\n")
 
                                        elif (h == '80'): #quad
                                            while (index > 3):
                                                f0 = f()
                                                f1 = f()
                                                f2 = f()
                                                f3 = f()
                                                index = index - 4
                                                print "f "+f0+' '+f1+' '+f2+' '+f3
                                                obj.write("f "+f0+' '+f1+' '+f2++' '+f3+"\n")
 
                                        else:
                                            a = 4 
                                    else:
                                        # backtrack over invalid primitive type bytes
                                        a = 3
                                        s = dat.seek(-1,1)
 
                            else:        
    #backtrack over trailing bytes so that
    #the entire file is scanned a byte at a time
                                s = dat.seek(-3,1)
                    else:
                        print vt
                        obj.write(vt+"\n")
    else:
        print v
        obj.write(v+"\n")
and revel8n...
you can use this too if you wanna do something to it. =]
it should be a little easier to edit.
 
Last edited:

Milun

New member
"Invalid syntax" and it highlights 'print'.

I'm using Python Shell to compile it. Sorry I'm such a bother, but I really haven't the faintest of clues on how Python works.
 
OP
Tcll

Tcll

Complexity == Fun >:3
"Invalid syntax" and it highlights 'print'.

I'm using Python Shell to compile it. Sorry I'm such a bother, but I really haven't the faintest of clues on how Python works.

hmm...
what version of python did you say you had again??
I've actually got 2 versions installed here...
5.4 and 6.3

5.4 = normal python usage...
6.3 = for some extra programs (blender 5.0a being one of them)
don't download that as it is only a test version...
my fav is 2.48.

and about being a bother...
don't worry about it cause you aint being one at all. :)

I have no clue how the compiler works because I'm still somewhat of a noob with python...
but if what is happening now should happen again...,
try reinstalling python.

EDIT: there is one other thing I can think of...
try commenting out all of the 'print' commands.
 
Last edited:
OP
Tcll

Tcll

Complexity == Fun >:3
all right... :angry:

I've tried everything I can think of with this code and I'm now drawing a blank...:(
can anyone help me??

I'm also trying to think of a way to create object groups...
 
OP
Tcll

Tcll

Complexity == Fun >:3
look at this:
98 00 08
06 24 04 74 04 4B 00 00 C3
06 24 04 75 04 4C 00 00 C2
00 1E 04 73 04 4A 00 00 C1
06 24 04 77 04 4E 00 00 C5
03 21 04 78 04 4F 00 00 C6
03 21 04 8E 04 62 00 00 DF
0C 2A 04 F2 04 C3 00 01 44
12 30 05 87 05 50 00 01 E3

this was face data pulled straight from an mdl0 file...
(brawl model file)
this is also the same in the pac file...
and I'm noticing melee's format is quite similar to this...
but it's beginning to make me think..., maybe melee's format's arn't compressed...

I'm also starting to think melee uses mdl0 files...
(unspecified in the hex) unlike brawl...
brawl specifies the mdl0 tag within the file.

I'll give you my old dark pikachu texture hack to play around with...
and maybe make a few more comparisons to melee's format...

Dark Pikachu (Basic).zip
(I don't think this is against the rules seeing as it is one of my projects) :p
 
Last edited:

Myuutsuu

forever.
Well, considering how Brawl was supposed to be a Wii-converted Melee 2.0 with online, it's hardly surprising... I've been trying to look for similarities between the two myself; closest I've seen are how the textures have the exact same type formats, only Brawl's specifies where to place them and Melee has all the textures crunched beside one another, just as you noted with the MDL0. They're also placed similarly.

Been trying to use both Mr. Game & Watch's from Melee and Brawl for comparisons, but no dice so far.
 

revel8n

New member
The melee and brawl formats are different. Neither is compressed as far as i can recall. and the 0x9800 blocks are standard gamecube/wii format display lists. All game on the gamecube/wii have to fall back on similar rendering methods at some point for the most part. That is just how the rendering api expects the data to be passed to it for processing. The api also specifies component ordering and flags determining data sizes and types. matrix indexing, vertices, normals, texture coordinates is the general order things appear if they are even present. Of which only vertex position data is actually a required parameter if i remember correctly.

The data you listed in hex as color information (What file is that from by the way?), if i am looking at it correctly, is actually a set of file offsets to various data within the file as well as some of the unknown flag data i have been mentioning that i am working on deciphering.
 
OP
Tcll

Tcll

Complexity == Fun >:3
the data and info you provide never ceases to amaze me.
keep it up... :p

The data you listed in hex as color information (What file is that from by the way?), if i am looking at it correctly, is actually a set of file offsets to various data within the file as well as some of the unknown flag data i have been mentioning that i am working on deciphering.

PlPkNr.dat
(look between the face hex)
that's why I'm so sure it's material indicies...

-material-
--
|
object
|
--

-material-
--
|
|
object
|
|
--

that's what I'm going by right now anyways...
(the material separates a group of linked faces in an object)
 

Top