Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Hello! I'm looking for a script that can extract the bld archive files in the Wii version of Madagascar: Escape 2 Africa. I saw a script on The PS23D Format Wiki, but it is no longer available because the wiki's subscription expired. Does anyone happen to have a script that can extract models and stuff from these bld files? Or can somebody write one? Here is the bld file: https://mega.nz/#!83I3VDQT!g9ond4NkCLkk ... wl_K5CYg8M . I see alot of directories and filenames that reference model (.mdl) and animation (.ma) files, along with specific vertex group names.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Acewell »

this bms script will split the files from bld sample :D

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

idstring "IGA\x1a"
get VERSION long
get DIR_LENGTH long
get FILES long
get UNK long
get UNK2 long
get STR_TABLE_OFF long
get STR_TABLE_SZ long
getdstring SKIP 16
for i = 1 to FILES
   get HASH[i] long
next i
for i = 1 to FILES
   get OFFSET[i] long
   get SIZE[i] long
   get FF_BYTES long
next i
goto STR_TABLE_OFF
for i = 1 to FILES
   get REL_STR_OFFSET long
   math REL_STR_OFFSET + STR_TABLE_OFF
   savepos TMP
   goto REL_STR_OFFSET
   get NAME[i] string
   log NAME[i] OFFSET[i] SIZE[i]
   goto TMP
next i

i just formed this specs into a script :)
http://wiki.xentax.com/index.php/Madaga ... e_2_Africa
i guess you'll need another script for the extracted files, i have not looked at them yet though. :)
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Thank you for the script! It extracted a file called "level.bld". This seems to be a different type of bld file, as the script you made does not work with it. I'm fairly certain the stage and/or character models are stored in this file. Once again, I saw a link on PS23DFormat wiki to a script that converts bld models to 3ds models, but as I said before, anything on that wiki is inaccessible. If possible, can you make or find the script that converts these? Here is the "level.bld" file: https://mega.nz/#!Ej4ADS4R!Zj9CxzdwtBn2 ... 5peSx9zTZs
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Acewell »

your samples up to this point have been archives, this thread would've got more attention in the "Game Archive" section i think. :)
anyway the new bld sample looks like a stream of zlib compressed chunks with 0x800(?) padding but the file ends abruptly for some reason. :D
i don't know anything about this game's models, you'll have to contact the owner of that wiki for the conversion scripts.

edit
this bms script will decompress those zlib streams in your new bld sample :D

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

endian big
comtype zlib_dynamic
get BLD_SIZE asize
for i
   get NAME basename
   string NAME + _decmp.bld
   get ZSIZE short
   savepos OFFSET
   append
   clog NAME OFFSET ZSIZE ZSIZE
   append
   math OFFSET + ZSIZE
   goto OFFSET
   if OFFSET >= BLD_SIZE
      break
   else
      do
         get CHECK byte
      while CHECK == 0
      goto -1 0 seek_cur
   endif
next i
Last edited by Acewell on Fri Feb 16, 2018 1:38 am, edited 1 time in total.
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Thank you! When I use the script, I end up with a file with no extension, and I see it has some ".ZGI" headers. Can this be extracted further? Here is the file: https://mega.nz/#!IygXERhb!CxnbKRlGd5jv ... pRtdyHONpY
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by episoder »

certainly. what is it that you want? models and textures?

-snip-
Last edited by episoder on Mon Feb 19, 2018 2:39 am, edited 1 time in total.
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Thanks! I'm looking for models though, can you make/find a script that can extract them? I see a lot of 3d model-related variables and whatnot in the file (such as shaders, materials, etc).
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by episoder »

yeh. there's a ton of raw beef in it. shaders and havok animation data. the models are probably those...

Image

that's what vertex and index buffers look like. gotta love good aligned raw data. excellent display. data *SPAM*. :mrgreen:
Last edited by episoder on Mon Feb 19, 2018 2:41 am, edited 1 time in total.
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Alright, let me know when you find out how to extract them! :D
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by episoder »

i was just about to edit: extractor done. the bms data shuffler, cause they don't h2o the way they are stored.

Code: Select all

log MEMORY_FILE 0 0 ; out

get relofs_idx long
put relofs_idx long -1
get nr_indices long
put nr_indices long -1
get stride long
put stride long -1
get nr_vertices long
put nr_vertices long -1

for v = 1 to nr_vertices
   get tc_u long
   get tc_v long
   get pos_x long
   get pos_z long
   get pos_y long

   put pos_x long -1
   put pos_y long -1
   put pos_z long -1
   put tc_u long -1
   put tc_v long -1

   xmath skip "(stride / 4) - 5"
   for s = 1 to skip
      get blah long
      put blah long -1
   next s
next v

for i = 1 to nr_indices
   get indx short
   put indx short -1
next i

get buffered asize -1
get name FILENAME 0
string name -= 4
string name += _reshf.dat
log name 0 buffered -1


edit: modified to take the extractor output spec. should work flawless for 64 byte fvfsize aligned meshes (characters) only.
Last edited by episoder on Mon Feb 19, 2018 2:44 am, edited 2 times in total.
Linus
Posts: 6
Joined: Wed Feb 07, 2018 6:33 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by Linus »

Well, looks like I'll have to learn some hex editing now (I have almost no experience with this kind of stuff lol). But thanks so much for the help you guys! :D
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Madagascar: Escape 2 Africa (PS2/PS3/Wii/Xbox/PC) bld help?

Post by episoder »

i was bored. :mrgreen:

extracts all textures of the provided level file. square textures work sorta flawless. non-square show up screwed or may crash your viewer on odd resolutions. same as most normal maps. you gotta hex the headers manually. just width and height. use power of 2. also the textures are all dxt1. on dxt5 textures you gotta flip the fourcc if you can pin them. easy tho, i think. :D

edit: xcuse me. i'm an idiot. i totally ignored the other offsets. :lol: i shouldn't have done that.

extracts the raw buffers of the models now too. you still gotta h2o them. i can't/don't need and won't start to try to figure all the fvf format variations. it's upto you. i gave you the shuffler. you can modify it as you need to reposition the data. i calculated and put the index offset, index count, stride (fvfsize), and vertex count on top of the model dat files. makes it easier to work with. those aligned meshes (character models) should start around model 100. the lil lionus is 106. that's clear. enjoy. :D