ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Fri Dec 14, 2018 5:37 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Dec 01, 2015 10:17 am 

Joined: Sat Aug 09, 2014 11:21 am
Posts: 645
Can somebody help me to unpack these files? I know that some of them are encrypted but the ones containing sound files are not. Here are samples: http://www28.zippyshare.com/v/bLD0pitU/file.html.
Header creation not needed, I'll add that myself. I only have a problem with the offsets/sizes.
Thanks for your help!


Top
   
PostPosted: Wed Dec 02, 2015 7:31 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 528
This is what riley-man's analysis of SWBF lvl files says, it might be the same for SWBFII but i don't know, you might be able to write a bms script from this
Code:
Basic Algorithm - Iterate Through Chunks
This section explains how to iterate through all the chunks in any *.lvl file. 
This can be used to find all the chunks in a file, or all the chunks of a particular type.

The first eight bytes of a chunk is the "chunk header".  Everything that follows is the "chunk data". 
The following table illustrates how the chunk header is organized.

Data Type    Size (bytes)    Description
int          4               Chunk marker, as a 32-bit integer.  This could also be read as a char[4], for languages that do not use zero-terminated strings.
int          4               32-bit integer specifying the number of bytes to follow. Note that if this is not a multiple of 4,
                             there will be extra zero bytes of padding so that the next chunk begins at a 4-byte boundary.


The following functions are general purpose, and can be used when reading in chunks.

/* Returns the actual number of bytes that will follow the 8-byte chunk header (including the padded zero bytes, if any) */
int getTrueChunkSize(int sizeAsRead) {
    int remainder, result;
    result = sizeAsRead;
    remainder = ( sizeAsRead % 4 );
    if ( remainder != 0 ) {
       result -= ( 4 - remainder );
    }
    return( result );
}

The following algorithm will read in all chunks in a given file.  Generic function "readInt" is not necessarily an actual function. 
For C/C++, you can use the fread function in stdio.h, for example. 
Similarly, seekInFile() is not necessarily an actual function (its C/C++ equivalent would be fseek). 
This algorithm assumes you have opened a random-access binary file.

int fileMarker, fileSize;
int chunkMarker, chunkSize;
int curFilePosition;
int bytesReadSoFar;

fileMarker = readInt();
fileSize = readInt();

bytesReadSoFar = 0;
curFilePosition = 8;
while ( bytesReadSoFar < fileSize ) {
    seekInFile(curFilePosition);
    chunkMarker = readInt();
    chunkSize = readInt();
    ... Read / Process this chunk according to chunkMarker ...
    curFilePosition += getTrueChunkSize(chunkSize) + 8;
    bytesReadSoFar += getTrueChunkSize(chunkSize) + 8;
}


Attachment:
riley-man.zip [74.44 KiB]
Downloaded 228 times


Top
   
PostPosted: Wed Dec 02, 2015 9:18 pm 

Joined: Sat Aug 09, 2014 11:21 am
Posts: 645
Actually... I have no idea what to do with this, sorry. ;)


Top
   
PostPosted: Wed Dec 02, 2015 9:47 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 528
kidding or no? surely someone that has written as many bms scripts as you can make sense of it. :?


Top
   
PostPosted: Wed Dec 02, 2015 11:36 pm 

Joined: Mon Sep 22, 2014 5:13 pm
Posts: 71
Battlefront's lvl files are compiled assets that don't do much good after compilation. The lvl format isn't really a traditional container. Is there something specific you're looking for? I previously extracted the entire sound bank into separate .wav formats, but that's something different entirely. Everything in the lvl files can be obtained in a usable format in the game's mod tools. If you need the sounds, sift through the following thread at Gametoast.com

http://www.gametoast.com/viewtopic.php?f=64&t=28297


Top
   
PostPosted: Thu Dec 03, 2015 7:20 am 

Joined: Sat Aug 09, 2014 11:21 am
Posts: 645
I'm after the music but I want to split the files first. I know that lvl files are compiled bun in the case of the sound files there's a file table at the beginning or at least so it seems, so the sounds should all be exctractable nicely!
I sifted through the thread and actually all they do is import the file and split it by hand. That is a possibility but you'll get plain PCM for the split parts. I want to do a streamed music rip so I'll need the split streams.
To be honest, I thought that the file table would be something to work with to write a QuickBMS script. Maybe I'm wrong? :\
@Acewell: not kidding. :\ I'm not good at programming other than QuickBMS I'm afraid. Let's hope for somebody to write something or give some other hints. :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited