are these custom webp files viewable? [vainglory]

Textures, recreate headers, conversions, algorithms and parsing of image files
verticalD
Posts: 9
Joined: Thu May 18, 2017 10:35 am

are these custom webp files viewable? [vainglory]

Post by verticalD »

can anyone help me with these image files? there are multiple headers in them (does it mean there are more than one image in each one?)
I have some experience with coding in .net and stuff but i have no experience with finding patterns in binary. so I would appreciate if anyone could at least put me on the right track. I don't even know where to start
here's a sample of some of the files
https://www.mediafire.com/file/k5kdaz5z ... Sample.zip

Edit :they're from "vainglory"
both iOS and android versions use this format
Last edited by verticalD on Wed Nov 29, 2017 3:53 pm, edited 3 times in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: are these custom webp files viewable?

Post by aluigi »

Remember to specify the name of the game
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: are these custom webp files viewable?

Post by episoder »

does the game matter? the structure seems obvious.

Code: Select all

struct
{
   int32   filesize;
   int32   nr_mipmaps;
   int32   unk0;
   int32   unk1;
   int32   width;
   int32   height;
}multi_header;

for nr_mipmaps

int32   size_chunk;

struct
{
   int32   magic;
   int32   size_payload;
   int32   FOURCC_webp;
   int32   FOURCC_vfmt;
   int32   size_vfragment

   char   data[size_vfragment]
}file_webp;
verticalD
Posts: 9
Joined: Thu May 18, 2017 10:35 am

Re: are these custom webp files viewable?

Post by verticalD »

episoder wrote:does the game matter? the structure seems obvious.

Code: Select all

struct
{
   int32   filesize;
   int32   nr_mipmaps;
   int32   unk0;
   int32   unk1;
   int32   width;
   int32   height;
}multi_header;

for nr_mipmaps

int32   size_chunk;

struct
{
   int32   magic;
   int32   size_payload;
   int32   FOURCC_webp;
   int32   FOURCC_vfmt;
   int32   size_vfragment

   char   data[size_vfragment]
}file_webp;

well its a moba, and mobas are addictive as hell.
thank you man, now im on the right track.
im assuming by "unk0" you mean unknown right?
if I understand correctly each file has the first part until 'height' and then each mipmap starts at the 'size chunk' line and ends with the file itself. and then right at the end of the file the next mipmap with its 'size chunk' starts. is that correct?
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: are these custom webp files viewable?

Post by episoder »

yep. unkX is unknown purpose. width and height are basicly engine internal. the dimensions of the biggest mimap. and...

the files you gotta extract are basicly just the first mipmap. which start at the first 'R'I'F'F' magic. that is the start of the header of the webp file format. the size_chunk before that tells you how large the entire webp file for this particular mipmap is.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: are these custom webp files viewable?

Post by Acewell »

episoder wrote:does the game matter?

of course! posting the game name, platform and format will leave enough breadcrumbs in
Google search so the next guy can find this thread and not have to start from scratch :)

here is a bms script based on episoder's findings :D

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

get FILESIZE long
get NUM_MIPS long
get UNK long
get UNK2 long
get WIDTH long
get HEIGHT long
for i = 0 < NUM_MIPS
   get SIZE long
   savepos OFFSET
   get NAME basename
   string NAME + _
   string NAME + i   
   string NAME + .webp
   if i == 0
      log NAME OFFSET SIZE
   endif
   math OFFSET + SIZE
   goto OFFSET
next i

it is currently set to write out only largest mip.
comment out lines 16 and 18 to write out all mips.
you can open these webp files in IrfanView.
verticalD
Posts: 9
Joined: Thu May 18, 2017 10:35 am

Re: are these custom webp files viewable?

Post by verticalD »

Acewell wrote:
episoder wrote:does the game matter?

of course! posting the game name, platform and format will leave enough breadcrumbs in
Google search so the next guy can find this thread and not have to start from scratch :)

here is a bms script based on episoder's findings :D

Code: Select all

# script for QuickBMS http://aluigi.altervista.org/quickbms.htm

get FILESIZE long
get NUM_MIPS long
get UNK long
get UNK2 long
get WIDTH long
get HEIGHT long
for i = 0 < NUM_MIPS
   get SIZE long
   savepos OFFSET
   get NAME basename
   string NAME + _
   string NAME + i   
   string NAME + .webp
   if i == 0
      log NAME OFFSET SIZE
   endif
   math OFFSET + SIZE
   goto OFFSET
next i

it is currently set to write out only largest mip.
comment out lines 16 and 18 to write out all mips.
you can open these webp files in IrfanView.

Thanks