Family Guy: Another Freaking Mobile Game (*.ZLIB)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Family Guy: Another Freaking Mobile Game (*.ZLIB)

Post by LolHacksRule »

Given by the name, these files are compressed with ZLib and yes I can decompress these with typical ZLib decompression but can I get the actual filenames of the extracted file(s) or is that impossible?

filedropper.com/fgafmgzlib
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Family Guy: Another Freaking Mobile Game (*.ZLIB)

Post by LokiReborn »

LolHacksRule wrote:Given by the name, these files are compressed with ZLib and yes I can decompress these with typical ZLib decompression but can I get the actual filenames of the extracted file(s) or is that impossible?

filedropper.com/fgafmgzlib


the files appear to be archives and in most cases has names and paths (depending for path if there is one)

the structure itself doesn't appear to be overly complicated but the math is weird to guess.
each file appears to be broken into 3 sections

Section 1
Data types / extension

Section 2
Names

Section 3
Data

The Sound data appears to only specify mp3 for the first one and then the rest are blank, maybe a ditto type of thing.
The file names are straight forward and ascii from what I saw, as for the math piece of it, it appears to be (value - 1) / 2 for what it says is the length
the Data section is the same thing but the length is even more obscured by some logic (may apply to prior if data was longer, it seems the number of bytes for length is variable as part of that logic)

Edit:
I was correct in the assumption even the smaller values probably followed the similar logic however it just wasn't as apparent.
The values for the length use a simple bit shift style logic using the high bit to flag if that byte is the last for the length

Basically put:
byte value = Read.Byte();
bool continue = (bool)(value >> 7) & 1;

the last byte only contains 6 bits of the original number, the high bit will be 0 and the low bit will be 1
all bytes proceed this will contain 7 bits of the original value shifted up (2 from the previous byte or more depending on position) and the 8th bit used for the flag (this is why the math looked so odd)

I'll see if I can write something that can do the math correctly to be able to extract all of the archives.
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Family Guy: Another Freaking Mobile Game (*.ZLIB)

Post by LokiReborn »

LolHacksRule wrote:Given by the name, these files are compressed with ZLib and yes I can decompress these with typical ZLib decompression but can I get the actual filenames of the extracted file(s) or is that impossible?

filedropper.com/fgafmgzlib


Here you go, I attached a program to extract the files and the source too. It seems if there were a couple more rules in there but I got it all working 100% I believe.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Family Guy: Another Freaking Mobile Game (*.ZLIB)

Post by LolHacksRule »

Thanks so much.