Madagascar : extracting textures in png or bmp help

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
HARVLAW_ORENGI
Posts: 6
Joined: Sun Apr 02, 2017 8:06 am

Madagascar : extracting textures in png or bmp help

Post by HARVLAW_ORENGI »

Hey guys, i need some help extracting texture's from Madagascar and if anyone could tell me how to unpack and repack the textures in png or bmp format , that would be great :D .
the type of file is a .stream

Download the .stream i'm on about : http://download1509.mediafireuserdownload.com/9xavvk73tspg/nljg14zoiosub9v/banquet.stream

i tried using this but this bms code only extracts one texture and it extract's it in txd format

Get Q ASIZE 0 ;
Math offset = 1
For T = 0 < Q ;
Math OFFSET += 1 ;
GoTo OFFSET 0
findloc OFFSET string "\x72\x77\x49\x44\x5F\x54\x45\x58\x44\x49\x43\x54\x49\x4F\x4E\x41\x52\x59" 0 0 ;
If OFFSET = 0 ;
Math T = Q ;
Math T += 1 ;
ELSE ;
GoTo OFFSET 0 ;
SavePos start 0 ;
GoTo 0x14 0 SEEK_CUR ;
SavePos start 0 ;
Get namelength Long 0 ;
GoTo start 0 ;
GoTo namelength 0 SEEK_CUR ;
GoTo 0x10 0 SEEK_CUR ;
Get size Long 0 ;
SavePos start 0 ;
Math x = T ;
string x += .TXD ;
Log x start size 0 ;
EndIF ;
Next T ;
StreamThread
Posts: 54
Joined: Fri May 27, 2016 2:28 pm

Re: Madagascar : extracting textures in png or bmp help

Post by StreamThread »

That is RenderWare 3x engine stream data. Sections IDs is modified.
StreamThread
Posts: 54
Joined: Fri May 27, 2016 2:28 pm

Re: Madagascar : extracting textures in png or bmp help

Post by StreamThread »

QuickBMS unpack script:

Code: Select all


# RenderWare 3.6.0.2 binary stream file unpacker v.0.1 (Madagascar: The game)

get sSize asize

for
math I + 1
log memory_file 0 0
get rwType long
set fName string I
string fName + "_"
get sectSize long
get rwVersion long
savepos sectOffset

     if rwType != 1814
        string fName + rwType
        string fName + .UNK
        log fName sectOffset sectSize
     else
        log memory_file sectOffset sectSize
     endif

     if rwType == 1814
        get headerSize long memory_file
        savepos headerStart memory_file
        get nameSize long memory_file
        get rwName string memory_file
        string fName + rwName
        strlen fNameLen rwName
        math nameSize - fNameLen
        math nameSize - 1
        goto nameSize memory_file SEEK_CUR
        goto 16 memory_file SEEK_CUR
        get rwID_Size long memory_file
        get rwID string memory_file

        if rwID == "rwID_TEXDICTIONARY"
           string fName - .txd #subtract extension for debug
           string fName - .TXD
           string fName + .txd
        elif rwID == "rwaID_WAVEDICT"
           string fName - .rws
           string fName - .RWS
           string fName + .rws
        elif rwID == "rwID_WORLD"
           string fName - .bsp
           string fName - .BSP
           string fName + .bsp
        elif rwID == "TextStringDict"
           string fName - .txl
           string fName - .TXL
           string fName + .txl
        elif rwID == "rwID_CLUMP"
           string fName - .dff
           string fName - .DFF
           string fName + .dff
        elif rwID == "rwID_HANIMANIMATION"
           string fName - .anm
           string fName - .ANM
           string fName + .anm
        elif rwID == "SCRIPT"
           string fName - .ai
           string fName - .AI
           string fName + .ai
        elif rwID == "TEXT"
           string fName + .TEXT
        elif rwID == "rwID_2DFONT"
           string fName - .fnt
           string fName - .FNT
           string fName + .fnt
        elif rwID == "KFset"
           string fName - .lpa
           string fName - .LPA
           string fName + .lpa
       #DEBUGELSE
        else
           string fName + "."
           string fName + rwID
        endif
      
        goto headerStart memory_file SEEK_SET
        goto headerSize memory_file SEEK_CUR
        get fSize long memory_file
        savepos fOffset memory_file
        log fName fOffset fSize memory_file
     endif

goto sectSize 0 SEEK_CUR
savepos checkPos

     if checkPos == sSize
        print "Files Extracted: %i%"
        cleanexit
     endif
next



*.TXD and *.DFF files can be opened with various of fan-made GTA tools (like Magic.TXD, 3ds max DFF plugins).
HARVLAW_ORENGI
Posts: 6
Joined: Sun Apr 02, 2017 8:06 am

Re: Madagascar : extracting textures in png or bmp help

Post by HARVLAW_ORENGI »

:D :D :D thank you so much , when i make mods in the future i will give you credit for helping , thanks i appreciate it :D