Kitty Corp Meow Mix Forums

Super Smash Bros. Brawl Hacking => General Hacking Discussion => Topic started by: ForOhFor Error on April 06, 2011, 06:40:57 PM



Title: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: ForOhFor Error on April 06, 2011, 06:40:57 PM
We already have working programs to hex imports from games with MDL0s into usable models. However, these programs are fairly slow, only fix one MDL0 at a time, and, well, there's 3 of the things thatn eed to be run separately.

I am doing my first full program, based in python, to remedy that situation. It will combine the 3 steps (header, materials, polygons) into one program, which will hex every model in a brres file.

And, since it's in Python instead of Gamemaker, it's much faster than the existing programs.

It will be useful for, say, hexing those bothersome okami models.

UPDATE LOG:

V 2.0:
-Added a GUI
-Added multi-BRRES support
-Now overwrites input files


Program completed, download here:

http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%202%20%28GUI%29.zip

Old version:
http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%20-%20Complete.zip

TO DO BEFORE FULL RELEASE:
Done
In progress
Bug fixing
Not started

- Opening file, translating into a usable string
- Locating all MDL0s and logging their locations
- Creation of a module to store long functions
- MDL0 header fixing function
- MDL0 material fixing function
- MDL0 polygon fixing function
- Launching these functions through a main program
- Translating usable hex back to a savable format
- Saving the file


I may need some help along the way, just for the locating of specific values in the hex data.


Title: Re: [Python] All-in-one import hexer.
Post by: BlackJax96 on April 06, 2011, 06:50:00 PM
Nice. This will help a lot.
Good luck, if you need it ;)


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 06, 2011, 07:30:41 PM
Thanks!
(Also, note that, not only being my first utility program, I've never really manually hexed anything before :P)

I've made some progress, but have a small problem:

How a certain block should look like after the header fix (From the existing fixing program):
4D444C30 00066040 00000009 FFFFFF80 000000A0 000000E8 00000140 00000258 00000340 00000448 00000560 00000648 00000730 00000848 00000000 00826C44 00000040 FFFFFFC0 00000000 00000000 00005C8E 00003294 00000000 00000004 01000000 00000040 C24EAAEF BFC2D6FE C394B4AF 437DC28A 40E99CA8 42B804D7 00000004 00000001 00000002 00000003 00000000 FFFFFFFF FFFFFFFF FFFFFFFF

How it does look:
4D444C30 00066040 00000009 FFFFFF80 000000A0 000000E8 00000140 00000258 00000340 00000448 00000560 00000648 00000730 00000848 00000000 00000000 00000000 FFFFFFC0 00826C44 00000040 FFFFFFB4 00000000 00000000 00000000 00003294 00000000 00000003 01000000 00000040 C24EAAEF BFC2D6FE C394B4AF 437DC28A 40E99CA8 42B804D7 00000004 00000001 FFFFFFFF FFFFFFFF FFFFFFFF

No clue what's causing it...
but that's the only difference once both have been header fixed.


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 01:53:51 PM
how are you handeling the values??
are the values being handeled floats or ints??

it's possible you could be handeling a float as an int


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 07, 2011, 02:05:14 PM
as a string...


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 02:28:25 PM
ah

here, the full mdl0 header should look like this:
note: this is reading from it

        #<<header>>
        magic = fr.read(4)
        if  magic == 'MDL0': #check if valad
            print  'MDL0 file is valad' #check
            #--header (part1)--
            strtbl_offset = ui(fr.read(4))
            sections = ui(fr.read(4))
            nodes_offset = si(fr.read(4))*(0-1)
            #list offsets to relocation table groups
            definits_list = ui(fr.read(4))
            bones_list = ui(fr.read(4))
            vertices_list = ui(fr.read(4))
            normals_list = ui(fr.read(4))
            colors_list = ui(fr.read(4))
            uv_points_list = ui(fr.read(4))
            materials_list = ui(fr.read(4))
            shader_conf_list = ui(fr.read(4))
            objects_list = ui(fr.read(4))
            textures_list = ui(fr.read(4))
            pallets_list = ui(fr.read(4))
            #--header (part2)--
            string_offset = ui(fr.read(4))
            header_length = ui(fr.read(4)) #64
            header_offset = ui(fr.read(4))
            #--displayed in brawlbox:--
            unknown_1 = fr.read(4)
            unknown_2 = fr.read(4)
            NumVertices = ui(fr.read(4))
            NumFaces = ui(fr.read(4))
            unknown_3 = fr.read(4)
            NumNodes = ui(fr.read(4))
            version = hex(fr.read(4)) #no idea how to handle
            unknown_4 = fr.read(4)
            MinX,MinY,MinZ = fl(fr.read(4)),fl(fr.read(4)),fl(fr.read(4))
            MaxX,MaxY,MaxZ = fl(fr.read(4)),fl(fr.read(4)),fl(fr.read(4))
            NumNodes2 = fr.read(4) #(Copy?)
        #<</header>>


here's the common functions being used:

#--<<common functions>>--
import  struct as  St
def  L(this): return  St.unpack('>l', this)[0] #return a long int
def  hex(this): return  this.encode('hex') #return the hex value of a char
def  ui(this): return  int(this.encode('hex'),16) #return an unsigned 8bit, 16bit, or 32bit int (most common)
def  si(this): return  int(long(this.encode('hex'),16)-2**32) #return a signed 8bit, 16bit, or 32bit int
def  bfl(this): return  St.unpack("<f", this)[0] #return a big endian 32bit float
def  fl(this): return  St.unpack(">f", this)[0] #return a 32bit float (highly common)
#--<</common functions>>--


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 07, 2011, 02:36:13 PM
That code from your Universal Model Converter?
Thing is, I'm just using this here (the tutorial):
http://www.smashboards.com/showthread.php?t=263127
as a guide for what to change, using code to do the steps.
:/


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 02:37:57 PM
if you're having any problems understanding how to code for the MDL0,
you can look into my WIP template for HexEdit:
http://brawlimports.proboards.com/index.cgi?board=templates&action=display&thread=12


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 02:42:43 PM
That code from your Universal Model Converter?
yea...

you can use it to see how to write the values

btw,
use St.pack
not St.unpack as in the functions

use the L() function when writing something like '00 00 00 09'
if you use ui(), you'll just get '09'
I like to use chr(int(h,16)) alot,
and I use chr(0) for padding


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 07, 2011, 02:56:41 PM
Well, here's the code I'm using in the MDL0 fixing module:
Code:
import string
def fixHeader(Data,indexNum):
    data2 = Data
    logThis = Data[indexNum+88:indexNum+96]
    newDat = Data[0:indexNum+16]
    newDat += "00000009ffffff80"
    newDat += Data[len(newDat):len(newDat)+(8*6)]
    newDat += Data[len(newDat)+16:len(newDat)+56]
    newDat += Data[len(newDat)+8:len(newDat)+24]
    newDat += "ffffffc0"
    newDat += Data[len(newDat):len(newDat)+40]
    newDat += logThis
    newDat += Data[len(newDat):]
    return newDat
def fixHeaderPt2(Data,indexNum):
    savey = Data[indexNum+(4*8):indexNum+(5*8)]
    startOfDefHead = int(savey,16)-12
    newDat = Data[0:indexNum+startOfDefHead*2]
    newDat += "ffffffff"*3
    newDat += Data[len(newDat):]
    return newDat

I call fixHeader() first, with my logged position of the MDL0 file (indexNum) and the data of the brres file, saved as a string (Data) as arguments (This does all the steps in the text tutorial, excluding adding 3 'FFFFFFFF's), set a new data string (newdata) to the returned string then call fixHeaderPt2() to add the 3 'FFFFFFFF's and set newdata to that. Here's the main program's code:

Code:
import os
import string
import ___MDL0Fix___
from tkFileDialog import askopenfilename
from tkFileDialog import asksaveasfilename
newData = ""
brres = askopenfilename( filetypes=[
('Brawl Resource Archive','*.brres')
] , )
f = open(brres,'rb')
data = f.read().encode('hex')
if data[0:8] == "62726573":
    print("Valid BRRES confirmed")
else:
    print "Not a valid file. Passing exception to end program."
    x = 1/0
numMdl0s = data.count("4d444c30")
indexLoc = []
start = 0
print numMdl0s,"MDL0 format models found"
for x in range(0,numMdl0s):
    offset = data[start+8:len(data)].find("4d444c30")
    start += offset+8
    indexLoc.append(start)
    print "MDL0 found at",start
print numMdl0s,"MDL0 format models found"
newdata = data
for x in range(0,numMdl0s):
    print "Fixing MDL0 header...(1/2)"
    newdata = ___MDL0Fix___.fixHeader(newdata,indexLoc[x])
    print "Fixing MDL0 header...(2/2)"
    newdata = ___MDL0Fix___.fixHeaderPt2(newdata,indexLoc[x])
    print "MDL0 header fixed!"
f.close()
outputName = asksaveasfilename( filetypes=[
('Brawl Resource Archive','*.brres')
] , )+'.brres'
f = open(outputName, 'wb')
print "Saving Output..."
f.write(newdata.decode('hex'))
f.close()
print "Output Saved!"
quity = input("Press enter to quit!")

Of course, that's just what I have so far.
The problematic part is that the output from this program differs from the fixed product of the existing MDL0 header fixer :/


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 03:13:43 PM

that's some complicated code you got there
it'd be a shame if something were to happen to it... lol

but I see you're storing the file in a var...
that might be your complication...

you'll notice I'm just using:
fr.read(4)
fr.read(4)
fr.read(4)

you could use:
fw.write(var1)
fw.write(var2)
fw.write(var3)

I find it alot more simpler and organized to do than all that fancy code-work with a stored data var

I'm not too sure of your prob since I'm seeing that :/
that would take me a while to figure out...

I'm on a minecraft server right now,
so I'm not too into the coding stuff...

doesn't mean I can't lend over some info though :)

use my code to figure out how to write the specific data types to the header
(weather to write int(), float(), long(), etc...)
glad your using len() for alot of it

btw, been wanting to say this for so long:
your ava is freakin WIN!!! <3 <3


Title: Re: [Python] All-in-one import hexer.
Post by: Difegue on April 07, 2011, 03:20:21 PM
I don't know if it can be of any use to you, but I have the Game Maker source files of FortWaffles' original programs >.> (GM8 decompiler works wonders)


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 03:22:35 PM
I don't know if it can be of any use to you, but I have the Game Maker source files of FortWaffles' original programs >.> (GM8 decompiler works wonders)

I can haz plz =D

I've been wanting to look at FW's src codes for quite a while :D


Title: Re: [Python] All-in-one import hexer.
Post by: Difegue on April 07, 2011, 03:34:54 PM
Sure, I'll copy-paste the scripts... They're written in Game Maker Code, so ask me if you don't understand a function or something:

mdl0headerfix
Code:
//Initialisation
aaa=0
bbb=0
global.mdl0file=file_bin_open(get_open_filename('Brres File|*.brres',m),2)
curpoly=0
curmatr=0
//script_execute(getoffs)
//script_execute(getnumbers)
state=0
curbone=0
curvertex=0
vvv=file_text_open_write(program_directory+"/game.txt")

Code: (Getoffset)
//def
file_bin_seek(global.mdl0file,mdl0spot+16)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.defoffset=aaa+bbb+ccc+ddd
//bones
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.boneoffset=aaa+bbb+ccc+ddd
//vertexs
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.vertexoffset=aaa+bbb+ccc+ddd
//material1
file_bin_seek(global.mdl0file,mdl0spot+40)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.matoffset=aaa+bbb+ccc+ddd
//polygon
file_bin_seek(global.mdl0file,mdl0spot+48)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.polyoffset=aaa+bbb+ccc+ddd
state=2

Code: (Getnumber)
//material1
file_bin_seek(global.mdl0file,global.matoffset+4+mdl0spot)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.nummat=aaa+bbb+ccc+ddd
//polygons
file_bin_seek(global.mdl0file,global.polyoffset+4+mdl0spot)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
global.numpoly=aaa+bbb+ccc+ddd
tempcount=0
tempcount2=0


state=6

Code: (getmdl0)
aaa=file_bin_read_byte(global.mdl0file)
if(aaa==77){
tempcount=file_bin_position(global.mdl0file)
aaa=file_bin_read_byte(global.mdl0file)
if(aaa==68){
aaa=file_bin_read_byte(global.mdl0file)
if(aaa==76){
aaa=file_bin_read_byte(global.mdl0file)
if(aaa==48){
mdl0spot=tempcount-1
set_automatic_draw(true)
state=1
}
}
}
}

Code: (Checkmove)
tgt=0
tempcount=0
movetype=0
file_bin_seek(global.mdl0file,mdl0spot+40)
aaa=0
bbb=0
while(bbb<8){
aaa+=file_bin_read_byte(global.mdl0file)
bbb+=1
}
if(aaa>0) tgt=1
file_bin_seek(global.mdl0file,mdl0spot+68)
bbb=0
while(bbb<4){
aaa+=file_bin_read_byte(global.mdl0file)
bbb+=1
}
if(aaa>0) movetype=1
state=3

Code: (Fixheader)
file_bin_seek(global.mdl0file,mdl0spot+8)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,9)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,128)
file_bin_seek(global.mdl0file,mdl0spot+80)
if(movetype==1) file_bin_seek(global.mdl0file,mdl0spot+76)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,192)

state=4
if(tgt==1) state=5

Code: (moveheader)
qqq=file_bin_position(global.mdl0file)

file_bin_seek(global.mdl0file,mdl0spot+48+tempcount)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
file_bin_seek(global.mdl0file,mdl0spot+40+tempcount2)
file_bin_write_byte(global.mdl0file,aaa)
file_bin_write_byte(global.mdl0file,bbb)
file_bin_write_byte(global.mdl0file,ccc)
file_bin_write_byte(global.mdl0file,ddd)
tempcount+=4
tempcount2+=4
if(tempcount==20){
if(movetype==0) tempcount2-=4




}
if(movetype==0){
if(file_bin_position(global.mdl0file)==global.defoffset+mdl0spot-12){
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
state=5
}
}
if(movetype==1){
if(file_bin_position(global.mdl0file)==global.defoffset+mdl0spot-8){
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
file_bin_write_byte(global.mdl0file,255)
state=5
}
}

Code: (Fixpoly)
file_bin_seek(global.mdl0file,mdl0spot+global.polyoffset+36+(curpoly*16))
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
curpolyoffset=aaa+bbb+ccc+ddd

file_text_write_real(vvv,mdl0spot+global.polyoffset+curpolyoffset)
file_text_writeln(vvv)
file_bin_seek(global.mdl0file,mdl0spot+global.polyoffset+curpolyoffset+96)
aaa=file_bin_read_byte(global.mdl0file)
if(aaa==255){
while(eee<>2128){
file_bin_seek(global.mdl0file,mdl0spot+global.polyoffset+curpolyoffset+100+tempcount)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)

file_bin_seek(global.mdl0file,mdl0spot+global.polyoffset+curpolyoffset+96+tempcount2)
file_bin_write_byte(global.mdl0file,aaa)
file_bin_write_byte(global.mdl0file,bbb)
file_bin_write_byte(global.mdl0file,ccc)
file_bin_write_byte(global.mdl0file,ddd)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
eee=aaa+bbb+ccc+ddd
tempcount+=4
tempcount2+=4
}
file_bin_seek(global.mdl0file,file_bin_position(global.mdl0file)-4)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
}
curpoly+=1
tempcount=0
tempcount2=0
if(curpoly==global.numpoly) state=8

Code: (FixMat)
if(curmatr<global.nummat){
file_bin_seek(global.mdl0file,mdl0spot+global.matoffset+36+(curmatr*16))
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
aaa=aaa*256*256*256
bbb=bbb*256*256
ccc=ccc*256
curmatoffset=aaa+bbb+ccc+ddd
file_bin_seek(global.mdl0file,mdl0spot+global.matoffset+curmatoffset+56)
while(file_bin_position(global.mdl0file)<mdl0spot+global.matoffset+curmatoffset+1044){
file_bin_seek(global.mdl0file,mdl0spot+global.matoffset+curmatoffset+60+tempcount)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
file_bin_seek(global.mdl0file,mdl0spot+global.matoffset+curmatoffset+56+tempcount2)
file_bin_write_byte(global.mdl0file,aaa)
file_bin_write_byte(global.mdl0file,bbb)
file_bin_write_byte(global.mdl0file,ccc)
file_bin_write_byte(global.mdl0file,ddd)
tempcount+=4
tempcount2+=4
}
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
file_bin_write_byte(global.mdl0file,0)
curmatr+=1
tempcount=0
tempcount2=0
}
if(curmatr==global.nummat) state=7

Code: (FixLast)
file_bin_seek(global.mdl0file,mdl0spot+128)
aaa=file_bin_read_byte(global.mdl0file)
bbb=file_bin_read_byte(global.mdl0file)
ccc=file_bin_read_byte(global.mdl0file)
ddd=file_bin_read_byte(global.mdl0file)
file_bin_seek(global.mdl0file,mdl0spot+92)
file_bin_write_byte(global.mdl0file,aaa)
file_bin_write_byte(global.mdl0file,bbb)
file_bin_write_byte(global.mdl0file,ccc)
file_bin_write_byte(global.mdl0file,ddd)
game_end()

And the script which is repeating every step:

if(state==0) script_execute(getmdl0)
if(state==1) script_execute(getoffs)
if(state==2) script_execute(checkmove)
if(state==3) script_execute(fixheader)
if(state==4) script_execute(moveheader)
if(state==5) fixlast()

If it's of any use to you, I'll post the codes for the Matrix and Polygon fixers  ;)


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 07, 2011, 04:39:12 PM
If it's of any use to you, I'll post the codes for the Matrix and Polygon fixers  ;)

all of them plz

hmm, GM code looks like a mix of C++ and Py
interesting


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 07, 2011, 05:07:17 PM
So, properly following the steps I've been trying to follow gives the exact output as the existing fixer does.
That's good...
any other way, and I'd go insane XD


Title: Re: [Python] All-in-one import hexer.
Post by: ForOhFor Error on April 07, 2011, 09:36:17 PM
HYESS!
I've done it!
I've fixed the problem!
The program will now fix every header in any amount of MDL0 files!

EDIT: Wait... what?
I ran it through some... fixed 'em fine.
Then I ran it through some different files.
It made every model be named ÿÿÿ¸ÿÿÿÀ
clearly, I have some bugs...


Title: Re: [Python] All-in-one import hexer.
Post by: DarkPikachu on April 08, 2011, 01:21:26 PM
glad to hear of your progress :)

I'll prbly do better if I get your src when it's finished ;)

EDIT:
can you leave alot of commenting like I do :/


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: ForOhFor Error on April 08, 2011, 07:20:11 PM
I added a lot of comments. The second function has no comments, but you should be able to figure it out, it's almost the same as the first function.

Alpha version released, only fixes the header:
http://dl.dropbox.com/u/5869687/PythonModelHexer%20-%20HEADER%20ONLY%20ALPHA.rar
It should determine which function is needed.
If it doesn't work, please post a bug report here.


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: DarkPikachu on April 08, 2011, 09:03:54 PM
alright :)

also, could I reverse-engineer this...??
like say I wanted to get a model from brawl into Pokepark or some game

I want my converter to be able to work both ways :/


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: the98pika on April 08, 2011, 09:10:34 PM
When i double click it says windows can't open this file what do i do?


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: BlackJax96 on April 08, 2011, 09:14:42 PM
When i double click it says windows can't open this file what do i do?

You install python 2.6

lol


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: ForOhFor Error on April 08, 2011, 09:34:31 PM
alright :)

also, could I reverse-engineer this...??
like say I wanted to get a model from brawl into Pokepark or some game

I want my converter to be able to work both ways :/
Sure :D
BTW, I'm fine-tuning my BRRES separator to auto-fix the brres files output from it.


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: ForOhFor Error on April 10, 2011, 02:28:16 PM
I realized that, though going at header fixing on a model-by-model basis works quite well, the same cannot be said for material and polygon fixing.

Therefore, I'm doing separate counts of models, materials, and polygons.

BTW, material fixing is working. I think.
EDIT: My mistake. It's ALMOST working.


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: SSJCerious on April 10, 2011, 04:49:17 PM
This is going to be a good program, good luck ForOhFoR~


Title: Re: [Python] All-in-one import hexer. ALPHA (Header only) RELEASED
Post by: ForOhFor Error on April 12, 2011, 04:15:34 AM
Thanks

I haven't gotten much working. I'm gonna work on it more this weekend.

And I'm also gonna learn how to 3D print this Sunday (not that I have a 3D printer)!


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 12, 2011, 02:44:34 PM
Program completed, download here:
http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%20-%20Complete.zip

Gonna go implement these functions in the BRRES separator.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: Difegue on April 12, 2011, 03:44:45 PM
you are my hero


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DarkPikachu on April 12, 2011, 03:59:07 PM
I'm gonna try my hand at brres conversion as well...

since the brres format is more like the blend format... somewhat
pac/pcs is actually closer

Melee's dat format is like a brres that can't be split D:
^blah


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 12, 2011, 04:08:25 PM
Oh, Tcll, check out the brres separator thread. I've implemented the model fixing into it, so it will fix every mdl0 in every brres in the input file.

Which means you can extract and fix all of pokepark's pokemon very, very quickly.
;D


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DarkPikachu on April 12, 2011, 04:44:33 PM
Oh, Tcll, check out the brres separator thread. I've implemented the model fixing into it, so it will fix every mdl0 in every brres in the input file.

Which means you can extract and fix all of pokepark's pokemon very, very quickly.
;D
I saw that already :)
nice job :D


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: BlackJax96 on April 12, 2011, 04:49:34 PM
This will save so much time :srs:
Freakin AWESOME job; will use.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 12, 2011, 04:58:36 PM
And, of course, anyone's free to use the code in their own projects.
If they can read the uncommented hellscape that my coding is XD


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: BlackJax96 on April 12, 2011, 05:03:53 PM
And, of course, anyone's free to use the code in their own projects.
If they can read the uncommented hellscape that my coding is XD

I may try to translate it to C#... (So I can add it to Brawlbox :D)


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DarkPikachu on April 12, 2011, 05:06:51 PM
I may try to translate it to C#... (So I can add it to Brawlbox :D)

heh... good luck with that...


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: Naruto200Man on April 12, 2011, 05:26:48 PM
So

I would be able to make a tales of symphonia model work with this?

I'm dying to make a Genis psa =3

You should also add a bone tree editor, like it automatically rigs the bones for brawl use. If that's possible, since most models from other games have a [censored]-ton of bones.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 12, 2011, 05:42:28 PM
So

I would be able to make a tales of symphonia model work with this?

I'm dying to make a Genis psa =3

You should also add a bone tree editor, like it automatically rigs the bones for brawl use. If that's possible, since most models from other games have a [censored]-ton of bones.
This program only changes a few bytes of data. Redoing bones, besides being completely unknown to me, would probably a complete restructure of the model.

In other terms, no.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DarkPikachu on April 12, 2011, 06:01:30 PM
you could create a program for my method of adding bones :/

here's an example for Pika (the one I know by heart):
bones:
TopN
-TransN
--XRotN
---YRotN
----HipN
-----HaveN (to be repositioned to the char's head or hand)
-----(add your bones here)
----ThrowN

^don't animate these bones...
(only animate your bones)


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DSX8 on April 16, 2011, 02:45:42 PM
ok umm how do i exactly use this? i dont see a application/exe program... i only see these...

___MDL0Fix___.py
___MDL0Fix___.pyc
PyModHex.py


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: BlackJax96 on April 16, 2011, 02:49:54 PM
Run PyModHex.py

If nothing happens when you double click it, install Python.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DSX8 on April 16, 2011, 02:50:37 PM
Run PyModHex.py

If nothing happens when you double click it, install Python.

and where CAN i find python?


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: BlackJax96 on April 16, 2011, 02:53:13 PM
http://www.python.org/download/

:af:


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DSX8 on April 16, 2011, 02:53:30 PM
[url]http://www.python.org/download/[/url]

:af:


xDD thanks :af:


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: BlackJax96 on April 16, 2011, 02:54:16 PM
xDD thanks :af:

lol np


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: SmashClash on April 17, 2011, 01:50:42 PM
Some day I hope a external graphic importer is made for PSA. :)


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: SSJCerious on April 17, 2011, 01:55:31 PM
^I hope you mean from other games, if not, then your dream as already come true~


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: SmashClash on April 17, 2011, 01:57:37 PM
^I hope you mean from other games, if not, then your dream as already come true~
Some day I hope a external graphic importer is made for PSA. :)
You sure? Cuz in PSA some characters need enough graphics for enough models to be able to be imported.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: SSJCerious on April 17, 2011, 01:59:24 PM
Um...what? I was reffering to TheShyGuy's ext model replacer program....you should check it out. 3rd or 4th page in OnTopic Discussion.


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: DarkPikachu on April 17, 2011, 03:44:41 PM
Um...what? I was reffering to TheShyGuy's ext model replacer program....you should check it out. 3rd or 4th page in OnTopic Discussion.

I'm still working on my REFT editor...
it'll be better than TSG's,
and you'll be able to actually replace more with it
although...
I havn't worked on it in a while...
been having too many other things to worry about >_>


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 18, 2011, 06:01:59 PM
I've been messing around with tkinter. Should I implement a GUI?


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: SmashClash on April 18, 2011, 06:20:35 PM

I'm still working on my REFT editor...
it'll be better than TSG's,
and you'll be able to actually replace more with it
although...
I havn't worked on it in a while...
been having too many other things to worry about >_>
When you finish it can you give a guide how to use REFT to make more/replace external graphics?


Title: Re: [Python] All-in-one import hexer. DONE! Get the complete version!
Post by: ForOhFor Error on April 18, 2011, 07:30:29 PM
New version:
http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%202%20%28GUI%29.zip

Has a GUI, and multiple file support.
What's more, it overwrites the input files.


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: DarkPikachu on April 18, 2011, 07:55:03 PM
New version:
[url]http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%202%20%28GUI%29.zip[/url]

Has a GUI, and multiple file support.
What's more, it overwrites the input files.

multiple files you say...
interesting

I wanna do that to my converter :D

EDIT:
btw, you don't need both the py and pyc
theyre the same exact files...
one's just a compiled output


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: Parvati ~ <3 on April 18, 2011, 08:04:13 PM
YES! ITS FINALLY OUT!


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: DarkPikachu on April 18, 2011, 08:08:26 PM
hey...

hav you figured out how to save filetypes by the filter type??


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: ForOhFor Error on April 18, 2011, 08:34:27 PM
No.
And I'm putting both .py and .pyc because .pyc is auto-created when using import, and the .py is for anyone who wants to use my code.


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: BlackJax96 on April 18, 2011, 08:49:25 PM
New version:
[url]http://dl.dropbox.com/u/5869687/Python%20Model%20Hexer%202%20%28GUI%29.zip[/url]

Has a GUI, and multiple file support.
What's more, it overwrites the input files.


http://www.youtube.com/watch?v=kg0yKLE3QkM

I just fixed more than 60 brres files with more than two mdl0s in them in under a minute. Your program is a flipping lifesaver!!!


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: Naruto200Man on April 18, 2011, 08:52:36 PM
*sideglance*
BJ I just want to know one thing...
WHAT ANIME IS THAT VID FROM??
XD

dang, I just remembered a sparta clip idea that I had :l
But crap, I have to download a bunch of jackie chan adventures episodes from youtube to make it XD


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: BlackJax96 on April 18, 2011, 08:57:01 PM
*sideglance*
BJ I just want to know one thing...
WHAT ANIME IS THAT VID FROM??
XD

dang, I just remembered a sparta clip idea that I had :l
But crap, I have to download a bunch of jackie chan adventures episodes from youtube to make it XD

lol it's
Azumanga Daioh Osaka
:srs:


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: ForOhFor Error on April 18, 2011, 09:16:22 PM
[url]http://www.youtube.com/watch?v=kg0yKLE3QkM[/url]

I just fixed more than 60 brres files with more than two mdl0s in them in under a minute. Your program is a flipping lifesaver!!!

Heh, no problem.


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: DarkPikachu on April 18, 2011, 09:20:56 PM
I'm starting to have that feeling of:

I was the first to have the idea and now someone else is getting all the credit

-.-*

-_-


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: Difegue on April 19, 2011, 05:50:14 AM
Haha, I was using your program earlier and actually thought "dawg it'd be cool if I didn't have to relaunch the program everytime" and there you go.

This is the best thing, brb fixing my 60-something brres from Haruhi Wii


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: BlackJax96 on April 19, 2011, 04:38:22 PM
This is the best thing, brb fixing my 60-something brres from Haruhi Wii

Haha that's what I was fixing too lol
I'm gonna see if I can fix Elebits models now


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: SSJCerious on April 19, 2011, 04:44:31 PM
I'm starting to have that feeling of:

I was the first to have the idea and now someone else is getting all the credit

-.-*

-_-
Well, i had a idea of making a Goku vertex, does that mean Beyond's getting MY credit?
No.


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: DarkPikachu on April 19, 2011, 04:52:32 PM
Well, i had a idea of making a Goku vertex, does that mean Beyond's getting MY credit?
No.
lol
yea... but I did mention it and I even PM'd someone I'd do it... heh

so yea...
I know I'm still getting credit for the idea :)

just wish I could've done it is all -.-


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: Naruto200Man on April 21, 2011, 12:38:01 PM
Hey,
any chance you could make an exe version of this that doesn't need python :af2:


Title: Re: [Python] All-in-one import hexer. Version 2! GUI and multiple file support!
Post by: DarkPikachu on April 21, 2011, 12:49:03 PM
Hey,
any chance you could make an exe version of this that doesn't need python :af2:

you can make exe's with Py...
all you need to do is include the python##.dll (I think)

I havn't really looked into it so I can't really say I know how...
but I do know it can be done >_>