Apex Legends .MSTR

Codecs, formats, encoding/decoding of game audio, video and music
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

Durandal217 wrote:Two questions: I tend to find these by hex values or offsets, is the offset always the same or it is a different offset every time? and is it possible your script could be modified to find and split and or get these to convert? Hope i worded that right.

It didn't work quite well on other banks. I got a 27MB tail from another bank. Trimming off the first few blocks only yielded me 4 voice lines.

I can rewrite the script to slice the tail. The problem is simply slicing off each data chunk won't work.

So far I've found that the binka header is necessary for mss to recognize the file. However it would not work if I snap the header onto any individual data chunk - the conversion result is a 44-byte empty wav file.

Unless I know how the data chunks are grouped/organized I'm afraid slicing is pretty much useless.

E: for your first question - do you mean whether the data chunks have same size? No, their size apparently varies.
E2: According to this wav header struct https://www.isip.piconepress.com/projec ... 1_p05.html, 44 bytes is exactly the header length. That means it's a valid wav file but surely no audio data is inside.
E3: I'll still write a script for doing that anyway...
E4: I'm also doing a rewrite of the BinkA2Wav converter. When that's done it'll be possible to convert sound data directly in memory without having to save it to disk. i promise this is my last edit
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

So apparently binka files start with "1FCB", in hex it is

Code: Select all

{ 0x31, 0x46, 0x43, 0x42 }

Does anyone know if

Code: Select all

{ 0x02, 0x01, 0x80, 0xbb }

is also part of the signature? I think every binka file have these 8 bytes at the beginning.

There also appears to be 4 long/ulong's following the 8 bytes in small endian.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

I took some time to sit down and really read into and examine what you were talking about. I looked at your sample from titanfall 2 and reproduced your success. I then looked at a sample from apex legends, and noticed that the 0x00 are not present at all. However 0x99 is, hex editing the data to begin at that point yields a successful conversion of a single file unlike yours which will convert 5 in a single file.

Sadly I am not sure if that hex value you mentioned is a signature or not.
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

Here's an idea: trim off audio blocks one by one from the beginning of file. Each time feed the remaining data into the converter and look at conversion size. If it's bigger than 44 bytes, save that to disk.

From my current understanding on the format, this "bruteforce" way may work, unless some flags in the BinkA header is messing with MSS on how it recognizes the audio chunks.

I think I've ran into a bug in Visual Studio/.NET SDK where breakpoints on MSS library functions can cause debug session to crash.

Edit: all right, downgrading .NET Framework version works
Mages
Posts: 2
Joined: Thu Feb 21, 2019 6:59 pm

Re: Apex Legends .MSTR

Post by Mages »

Durandal217 wrote:I took some time to sit down and really read into and examine what you were talking about. I looked at your sample from titanfall 2 and reproduced your success. I then looked at a sample from apex legends, and noticed that the 0x00 are not present at all. However 0x99 is, hex editing the data to begin at that point yields a successful conversion of a single file unlike yours which will convert 5 in a single file.

Sadly I am not sure if that hex value you mentioned is a signature or not.


Could you provide a sample of a apex file pre and post conversion? I've reproduced successful conversions from Titanfall 2, but the Apex tail banks appear to have a different and far larger header after 1FCB (offset 6210 at general_english_patch_1.mstr), which is causing Binka2Wav to fail.
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

I pushed my tools to the repo here: https://github.com/xyx0826/MilesTools
There are two projects in it:
Mileslice takes a stream bank or a folder of stream banks then slice them into bink audio files.
(WIP) Binkalore (not Bangalore) takes bink audio files and convert them into wavs. MSS binaries required. I'll implement data chunk slicing later.
Mileslice is written on .NET Core for cross-platform but the code is compilable to .NET Framework. Binkalore is strictly ran on .NET Framework 3.5. Any newer version will break MSS calls.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

Mages wrote:
Durandal217 wrote:I took some time to sit down and really read into and examine what you were talking about. I looked at your sample from titanfall 2 and reproduced your success. I then looked at a sample from apex legends, and noticed that the 0x00 are not present at all. However 0x99 is, hex editing the data to begin at that point yields a successful conversion of a single file unlike yours which will convert 5 in a single file.

Sadly I am not sure if that hex value you mentioned is a signature or not.


Could you provide a sample of a apex file pre and post conversion? I've reproduced successful conversions from Titanfall 2, but the Apex tail banks appear to have a different and far larger header after 1FCB (offset 6210 at general_english_patch_1.mstr), which is causing Binka2Wav to fail.


Absolutely.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

xyx0826 wrote:Here's an idea: trim off audio blocks one by one from the beginning of file. Each time feed the remaining data into the converter and look at conversion size. If it's bigger than 44 bytes, save that to disk.

From my current understanding on the format, this "bruteforce" way may work, unless some flags in the BinkA header is messing with MSS on how it recognizes the audio chunks.

I think I've ran into a bug in Visual Studio/.NET SDK where breakpoints on MSS library functions can cause debug session to crash.

Edit: all right, downgrading .NET Framework version works


I am gonna try this tomorrow and i'll report back. Thought I was gonna have some free time to try that but it didn't work out that way i'm also gonna try out the new tools.
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

Durandal217 wrote:I am gonna try this tomorrow and i'll report back. Thought I was gonna have some free time to try that but it didn't work out that way i'm also gonna try out the new tools.

Trimming data chunks sometimes produce malformed files causing MSS to stuck and eat CPU power.

There's a way to cancel conversion mid-way but it only applies to conversions that do not go wrong.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

xyx0826 wrote:
Durandal217 wrote:I am gonna try this tomorrow and i'll report back. Thought I was gonna have some free time to try that but it didn't work out that way i'm also gonna try out the new tools.

Trimming data chunks sometimes produce malformed files causing MSS to stuck and eat CPU power.

There's a way to cancel conversion mid-way but it only applies to conversions that do not go wrong.


Yup, that was the problem i kept running into it would not convert or if i got a file to convert it was simply the same audio file just shorten.

Also for some reason when compiling Mileslice the project builds but does not produce a .exe, it will create the dll and everything else but even using VSS command prompt attempting to build program.cs produces this error:

Code: Select all

Program.cs(4,24): error CS0234: The type or namespace name 'Slicing' does not exist in the namespace 'Mileslice' (are you missing an assembly reference?)
Program.cs(5,24): error CS0234: The type or namespace name 'Utilities' does not exist in the namespace 'Mileslice' (are you missing an assembly reference?)


Am I doing something wrong?
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

Durandal217 wrote:Also for some reason when compiling Mileslice the project builds but does not produce a .exe, it will create the dll and everything else but even using VSS command prompt attempting to build program.cs produces this error:

Code: Select all

Program.cs(4,24): error CS0234: The type or namespace name 'Slicing' does not exist in the namespace 'Mileslice' (are you missing an assembly reference?)
Program.cs(5,24): error CS0234: The type or namespace name 'Utilities' does not exist in the namespace 'Mileslice' (are you missing an assembly reference?)


Am I doing something wrong?

It's intended. Mileslice uses .NET Core which compiles it to a dll, then you can use .NET Core runtime to execute it:
dotnet Mileslice.dll [parameters]

This allows the tool to be cross-platform. I've heard people playing Apex on other platforms so I decided to make it that way.
Since it seems like people here mostly use Windows... I'll change it to .NET Framework to prevent confusion.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

so I downloaded the latest version and split general_stream.mstr, everything looks good so far. Binkalore is working good, just trying to create a batch file to batch convert but what I was able to listen to sounded better, still has the cutoff due to chunk audio but a decent improvment.

I also played around with the larger files, I found many instances of 0x99 in them, I even got one to play. I also tried "stitching" files together through hex editing and see what results I could get, sadly the stitching resulted in corrupted files that would not convert.

That's the latest I have...
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

Durandal217 wrote:so I downloaded the latest version and split general_stream.mstr, everything looks good so far. Binkalore is working good, just trying to create a batch file to batch convert but what I was able to listen to sounded better, still has the cutoff due to chunk audio but a decent improvment.

I also played around with the larger files, I found many instances of 0x99 in them, I even got one to play. I also tried "stitching" files together through hex editing and see what results I could get, sadly the stitching resulted in corrupted files that would not convert.

That's the latest I have...

I'll add batch conversion soon. It's weird that the files sounded better... Binkalore literally uses the same method as BinkA2Wav does besides some logic improvements.

BTW if anyone has trouble compiling the tools, here are the binaries.
loongers111
Posts: 1
Joined: Mon Feb 25, 2019 8:54 am

Re: Apex Legends .MSTR

Post by loongers111 »

xyx0826 wrote:
Durandal217 wrote:so I downloaded the latest version and split general_stream.mstr, everything looks good so far. Binkalore is working good, just trying to create a batch file to batch convert but what I was able to listen to sounded better, still has the cutoff due to chunk audio but a decent improvment.

I also played around with the larger files, I found many instances of 0x99 in them, I even got one to play. I also tried "stitching" files together through hex editing and see what results I could get, sadly the stitching resulted in corrupted files that would not convert.

That's the latest I have...

I'll add batch conversion soon. It's weird that the files sounded better... Binkalore literally uses the same method as BinkA2Wav does besides some logic improvements.

BTW if anyone has trouble compiling the tools, here are the binaries.


I can recompile your milestools, because of titan and apex use there 64bit dll, so I don't have mss32.dll and binkawin.asi...
I can successfully find mss32.dll from the internet, but the binawin.asi could not be found...

I have found mss32.dll&binkawin.asi from Civilization V, but it seems that AilDecompressAsi failed, and return 0, don't know why
Or am I use the wrong version of mss32.dll&binkawin.asi?
Which is the right version and file to decompress Apex ?
Thanks.
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

loongers111 wrote:I can recompile your milestools, because of titan and apex use there 64bit dll, so I don't have mss32.dll and binkawin.asi...
I can successfully find mss32.dll from the internet, but the binawin.asi could not be found...

I have found mss32.dll&binkawin.asi from Civilization V, but it seems that AilDecompressAsi failed, and return 0, don't know why
Or am I use the wrong version of mss32.dll&binkawin.asi?
Which is the right version and file to decompress Apex ?
Thanks.

When AilDecompressAsi fails you should check AilLastError() to get the related error message.
I'm using mss32.dll v9.1.3.0, and a binkawin of 55,296 bytes in size with MD5 63151af96072cceb75772a8443213eba.
zuronaught
Posts: 12
Joined: Sun Mar 03, 2019 4:17 am

Re: Apex Legends .MSTR

Post by zuronaught »

xyx0826 wrote:
loongers111 wrote:I can recompile your milestools, because of titan and apex use there 64bit dll, so I don't have mss32.dll and binkawin.asi...
I can successfully find mss32.dll from the internet, but the binawin.asi could not be found...

I have found mss32.dll&binkawin.asi from Civilization V, but it seems that AilDecompressAsi failed, and return 0, don't know why
Or am I use the wrong version of mss32.dll&binkawin.asi?
Which is the right version and file to decompress Apex ?
Thanks.

When AilDecompressAsi fails you should check AilLastError() to get the related error message.
I'm using mss32.dll v9.1.3.0, and a binkawin of 55,296 bytes in size with MD5 63151af96072cceb75772a8443213eba.


I have begun looking through the three audio related dlls from Apex and, on a similar note, the version of bink2w64.dll is 9.9.4.m. This seems to be the Miles Sound System version number as bink is only on version 2. Also, if this is true, it would mean that Apex is not actually using MSS 10 completely. Other parts of binkawin64.dll and mileswin64.dll show a version of 10.0.33.10. So, does anyone know what 9.9.4 is? One other thing: the audio.mprj is definitely necessary somewhere in the process as the dlls reference it. I hope I can help with decoding the audio binaries, but I am fairly new to reverse engineering, so I may not be that helpful :| .
xyx0826
Posts: 26
Joined: Sat Feb 16, 2019 10:29 pm

Re: Apex Legends .MSTR

Post by xyx0826 »

zuronaught wrote:I have begun looking through the three audio related dlls from Apex and, on a similar note, the version of bink2w64.dll is 9.9.4.m. This seems to be the Miles Sound System version number as bink is only on version 2. Also, if this is true, it would mean that Apex is not actually using MSS 10 completely. Other parts of binkawin64.dll and mileswin64.dll show a version of 10.0.33.10. So, does anyone know what 9.9.4 is? One other thing: the audio.mprj is definitely necessary somewhere in the process as the dlls reference it. I hope I can help with decoding the audio binaries, but I am fairly new to reverse engineering, so I may not be that helpful :| .


I think bink2w64 belongs to Bink Video that plays movie cutscenes. Its file version is 1.999.4.0.
Miles, on the other hand, is completely about playing audio.
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

zuronaught wrote:
xyx0826 wrote:
loongers111 wrote:I can recompile your milestools, because of titan and apex use there 64bit dll, so I don't have mss32.dll and binkawin.asi...
I can successfully find mss32.dll from the internet, but the binawin.asi could not be found...

I have found mss32.dll&binkawin.asi from Civilization V, but it seems that AilDecompressAsi failed, and return 0, don't know why
Or am I use the wrong version of mss32.dll&binkawin.asi?
Which is the right version and file to decompress Apex ?
Thanks.

When AilDecompressAsi fails you should check AilLastError() to get the related error message.
I'm using mss32.dll v9.1.3.0, and a binkawin of 55,296 bytes in size with MD5 63151af96072cceb75772a8443213eba.


I have begun looking through the three audio related dlls from Apex and, on a similar note, the version of bink2w64.dll is 9.9.4.m. This seems to be the Miles Sound System version number as bink is only on version 2. Also, if this is true, it would mean that Apex is not actually using MSS 10 completely. Other parts of binkawin64.dll and mileswin64.dll show a version of 10.0.33.10. So, does anyone know what 9.9.4 is? One other thing: the audio.mprj is definitely necessary somewhere in the process as the dlls reference it. I hope I can help with decoding the audio binaries, but I am fairly new to reverse engineering, so I may not be that helpful :| .


As long as you can gleam something that can help someone extract the audio from these games no matter how small the contribution is, is worth it, hell I don't know much, but we've accomplished more here in 1 month then others have in the last three years!

Incredible work to all and please keep it up, I feel continued persistence will leads to a breakthrough.
beclet
Posts: 1
Joined: Sun Mar 10, 2019 2:32 am

Re: Apex Legends .MSTR

Post by beclet »

Hi guys
Has anyone had anymore luck with this? I'm an animator on youtube and I'm currently working on an Apex Legends cartoon. If anyone comes across a way to export the sounds if you could contact me that would be amazing! Thank you! I have left my socials below as a way to contact:

www.youtube.com/beclet
www.twitter.com/beclet_
www.instagram.com/becletyt
Durandal217
Posts: 31
Joined: Sun Apr 10, 2016 3:54 pm

Re: Apex Legends .MSTR

Post by Durandal217 »

I haven't and I've tried to ask more experienced people for help but to no reply...

I am kind of puzzled about one thing... There is a modding forum I ran across in my continued quest to get the audio from these games, who said the MSTR files can be opened in Native Instruments Maschine software. I'm 98.9% sure it's a troll post but if anyone has that software by chance can you please verify i'm right.

I'm going to keep pushing this, I mean really the only problem is the big chunk audio how to split it and get it playable, that's the last hurtle.