Gears 5 b2container file

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
elybelbely
Posts: 21
Joined: Sun Mar 10, 2019 11:03 am

Gears 5 b2container file

Post by elybelbely »

Does anybody know what is b2container file in UE4 in Gears 5 And how can we extract texts?
jakmrk88
Posts: 10
Joined: Thu Sep 26, 2019 10:09 pm

Re: Gears 5 b2container file

Post by jakmrk88 »

I also try to find some information on how to extract texts from b2container files. Gildor wrote: (- b2container files are not encrypted, but seems compressed with some simple algorithm, probably with lz4.) If you find anything, please let me know.
by-freon
Posts: 20
Joined: Sat Dec 22, 2018 2:56 pm

Re: Gears 5 b2container file

Post by by-freon »

Gears 5 uses oodle compression for b2container.
The GearGame.b2index file contains information about B2 container names, file names, and their location and size in b2containers.
There should be localization texts in Launch.b2container.
Could someone create a bms script to unpack the files?
https://drive.google.com/open?id=18KaNN ... m3CAF78hxF
jakmrk88
Posts: 10
Joined: Thu Sep 26, 2019 10:09 pm

I need help with BMS script and Gears 5

Post by jakmrk88 »

Gears 5 uses oodle compression for b2container.
The GearGame.b2index file contains information about B2 container names, file names, and their location and size in b2containers.
There should be localization texts in Launch.b2container.
It is possible to create a BMS script to unpack the files???
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Gears 5 b2container file

Post by aluigi »

Almost 2 Gb file?
Oh no thanks, there is the filecutter script for the first-time analysis:
http://aluigi.org/bms/filecutter.bms
by-freon
Posts: 20
Joined: Sat Dec 22, 2018 2:56 pm

Re: Gears 5 b2container file

Post by by-freon »

aluigi wrote:Almost 2 Gb file?
Oh no thanks, there is the filecutter script for the first-time analysis:
http://aluigi.org/bms/filecutter.bms


ok
Here new data -14mb
https://drive.google.com/file/d/1gxuQGf ... sp=sharing


Complete file b2container - 10mb
https://drive.google.com/file/d/1kPYQk- ... sp=sharing
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Gears 5 b2container file

Post by aluigi »

Quite complicated but not impossible.
Will keep you update.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Gears 5 b2container file

Post by aluigi »

Ok, it's too boring and I can't spend time on it.
The following is the work-in-progress script that parses all the fields of b2index.
It's NOT for being used, it's just for watching the fields when running quickbms -V

Code: Select all

get EXT extension
if EXT != "b2index"
    print "Error: please open the b2index file"
    cleanexit
endif
idstring "TCB2"
get ENTRIES long
get B2INDEX_SIZE longlong
get OFFSET1 longlong
get DUMMY longlong
for i = 0 < ENTRIES
    get OFFSET longlong
    get NUM long
    putarray 0 i OFFSET
    putarray 1 i NUM
next i
get NAMES_OFF longlong
get NAMES_SIZE long
get DUMMY longlong
get DUMMY long

callfunction GET_ENTRY 1 0
for i = 0 < FILES
    get NAME_OFF longlong
    get OFFSET longlong
    get NUM long
    callfunction GET_NAME 1
next i

# b2container files
callfunction GET_ENTRY 1 1
for i = 0 < FILES
    get NAME_OFF longlong
    callfunction GET_NAME 1
    get NAME_OFF longlong
    callfunction GET_NAME 1
    get OFFSET longlong
    get DUMMY longlong
    get OFFSET longlong
    get DUMMY long
    get OFFSET longlong
    get DUMMY long
next i

callfunction GET_ENTRY 1 2
for i = 0 < FILES
    get OFFSET longlong
    get DUMMY longlong
    get DUMMY longlong
    get DUMMY long
    get OFFSET longlong
    get DUMMY long
next i

callfunction GET_ENTRY 1 3
for i = 0 < FILES
    get OFFSET longlong
    get DUMMY long
    get DUMMY long
next i

#callfunction GET_ENTRY 1 4

callfunction GET_ENTRY 1 5
for i = 0 < FILES
    get NAME_OFF longlong
    get SIZE long
    get LEVEL long  # -1 for files
    callfunction GET_NAME 1
next i

startfunction GET_NAME
    savepos TMP
    goto NAME_OFF
    get NAME string
    goto TMP
endfunction

startfunction GET_ENTRY
    print "### Parse entry %GET_ENTRY_ARG1%"
    getarray OFFSET 0 GET_ENTRY_ARG1
    getarray FILES  1 GET_ENTRY_ARG1
    goto OFFSET
endfunction
by-freon
Posts: 20
Joined: Sat Dec 22, 2018 2:56 pm

Re: Gears 5 b2container file

Post by by-freon »

I understand, thank you for your opinion
Solved. I have found localization texts
zotya0330
Posts: 11
Joined: Sun Dec 30, 2018 10:59 pm

Re: Gears 5 b2container file

Post by zotya0330 »

by-freon wrote:I understand, thank you for your opinion
Solved. I have found localization texts


And how did you do that?
Can you help me with that?
GabrielProudmore
Posts: 13
Joined: Sun Apr 07, 2019 4:42 pm

Re: Gears 5 b2container file

Post by GabrielProudmore »

Better ask and do some necro post instead of make a new one:

I've search around and it seems nobody could unpack the b2container file. Even on Gildor they couldn't find a way to unpack them:

https://www.gildor.org/smf/index.php?topic=6790.0

Specially as Gears Tactics has the same format.
BeaniBirb
Posts: 1
Joined: Wed May 06, 2020 2:46 am

Re: Gears 5 b2container file

Post by BeaniBirb »

Damn, it seems TC really found a way to keep us from getting our hands on their assets
GabrielProudmore
Posts: 13
Joined: Sun Apr 07, 2019 4:42 pm

Re: Gears 5 b2container file

Post by GabrielProudmore »

BeaniBirb wrote:Damn, it seems TC really found a way to keep us from getting our hands on their assets

Yes. Maybe was because the models are more realistic in terms of face compared with older versions.

But, it is a shame nobody has being able to unpack or try to break the cursed b2container format, because all inside it is un unreal formats.
farrarie
Posts: 2
Joined: Tue Oct 29, 2019 5:30 pm

Re: Gears 5 b2container file

Post by farrarie »

Any updates ?
GabrielProudmore
Posts: 13
Joined: Sun Apr 07, 2019 4:42 pm

Re: Gears 5 b2container file

Post by GabrielProudmore »

Nothing so far in all webs, it was truly a rare format that they will never crack out...
I guess that is. Gears 5 and Tactic will never be unpacked.
Simo311
Posts: 8
Joined: Sat Nov 21, 2020 10:22 pm

Re: Gears 5 b2container file

Post by Simo311 »

So it ends here?
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Gears 5 b2container file

Post by spiritovod »

It's strange that nobody didn't release anything for this format yet, it's not even encrypted and not obfuscated, like many other mixed formats. So, here is work-in-progress script for files extraction from b2 containers. Based on initial research from aluigi. Use it on GearGame.b2index.

Extraction of some big files (~800MB+) will take quite some time, since script is building them from 1MB chunks in memory - make sure you have enough free RAM and be patient, otherwise quickbms may stop with some error. Alternatively, you can uncomment certain section in the script to skip them.
Directory tree data looks similar to the one from latest utoc format, so it shouldn't be hard as well, but it's much easier to fix base stuff in raw format. The script is not errors-proof yet, so please report only major problems when you're certain about it.

P.S. In case if you're missing some b2containers (b2index is addressing them all regardless of their presence), it's better to comment out second "print" string in the script. If you want to extract some small container, aside from commenting out the mentioned string, you can also run quickbms with -Q option.

Update: Script fixed in v0.1a, now it can skip files from missing containers properly. Also, it would be nice if someone could check the script with Gears Tactics, since I don't have not free space, nor time to do this.

Update 2: Script updated to v0.2, now it can extract files with filenames, but without complete paths. Thus some overlaps are possible (in case of files with similar names from different folders), you can use "r" when asked to rename them. Also, you can now uncomment certain script section to skip big assets upon extraction (more than 800MB by default).

Update 3: Script with filenames is quite bugged when some b2containers are missing, so I've decided to attach both scripts, including previous version (for raw extraction without filenames). Raw extraction script works fine even if you're using it with only single b2container present (via b2index).

Update 4: Base script fixed in v0.2a, now it can handle files from missing containers properly. Though it works much slower than raw extraction script, especially when used with a single container (random test: 35 sec via raw extraction vs 10 min via base script). It probably will not be optimized until base features will be done.
Last edited by spiritovod on Thu May 20, 2021 9:05 am, edited 5 times in total.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Gears 5 b2container file

Post by spiritovod »

Small update to the script, for more info read previous post. While proper paths are still under testing, updated script can simplify recognition of some particular assets like video (bk2), audio (wem) and such.
Simo311
Posts: 8
Joined: Sat Nov 21, 2020 10:22 pm

Re: Gears 5 b2container file

Post by Simo311 »

I immensely thank you for all your hard work done.
But it seems that this script doesn't work with some of the b2container as i get an error like this:

Code: Select all

MP_Shared_Localized_it.b2container 
Info:  algorithm   650 offset      00b1d000 input size  0x00020000 131072 output size 0x00020000 131072 result      0xffffffff -1 Error: uncompressed data (-1) bigger than allocated buffer (186036) It usually means that data is not compressed or uses another algorithm
Last script line before the error or that produced the error: 134 clog MEMORY_FILE CHUNK_OFFSET ZSIZE SIZE B2 - OFFSET       0x00b1d000 - ZSIZE        0x00020000 - SIZE         0x00020000 coverage file 0   100%!  97076750   57370794   . offset 0115088a coverage file 10   40%   11553718   28549120   . offset 00b3d000 coverage file -1    0%   0          16706495   . offset 00feebbf
Press ENTER or close the window to quit


Where did i go wrong?
I would really appreciate some help!
Thanks!
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Gears 5 b2container file

Post by spiritovod »

@Simo311: PM me that b2container and b2index files, so I could take a look.