ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Thu Apr 15, 2021 8:59 am

All times are UTC




Post new topic  Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Sat Mar 13, 2021 5:44 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
Is there a way to extract these? I'm looking to extract the files from Dogbyte Games' games. On iOS, it comes in "XPK" file format. On android, it's an obb file. They have the magic of "XPAK". Hmm... I can't find anything about this file. I was able to extract using offzip but I don't know what to do with the extracted files afterwards.
Sample: (Offroad Legends, iOS) https://www.mediafire.com/file/4xi26ah3 ... a.xpk/file


Top
   
PostPosted: Sat Mar 13, 2021 7:22 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
Data is encrypted


Top
   
PostPosted: Sat Mar 13, 2021 7:31 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
Oh. How do I decrypt it?


Top
   
PostPosted: Sat Mar 13, 2021 8:12 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
data xored by 0xAC54DF34 and compressed by Brotli

Image


Last edited by Ekey on Sun Mar 14, 2021 12:28 pm, edited 3 times in total.

Top
   
PostPosted: Sat Mar 13, 2021 8:55 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
nice, what coding is that?
wtf me I posted that on "zenhax", home of quickbms.
are you still working on it?


Top
   
PostPosted: Sat Mar 13, 2021 9:04 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
Currently no. I'm busy with my main job .. I can look it in next weekends. Maybe someone else can take a look in more detail about this format


Top
   
PostPosted: Sun Mar 14, 2021 7:24 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
DEV INFO
So. There are 2 types of archives:

xor key > 0xAC54DF34 (2891243316u)

[HEADER V0 + V1]
Code:
struct XPAKHeader
{
   uint32_t   dwMagic;
   uint32_t   dwVersion; // 0 / 1 (LZMA)
   uint32_t   dwArchiveSize;
   byte   lpMD5[16]; // only present in versions above 0
   byte   lpLZMAProps[5]; // 4 bytes xored
   uint32_t dwTableZSize; // compressed size of table (xored)
};


[TABLE V0 + V1] (first dword is files count)
Code:
struct XPAKTable
{
   uint32_t   dwFileNameLength;
   byte   lpFileName[dwFileNameLength];
   uint32_t   dwFileZSize;
   byte   bFlag; // if value > 3 = data is compressed
};


[HEADER V2]
Code:
struct XPAKHeader
{
   uint32_t   dwMagic;
   uint32_t   dwVersion; // 2 (Brotli)
   uint32_t   dwArchiveSize;
   byte   lpMD5[16];
   uint32_t dwZero;
   uint32_t dwTableZSize; // compressed size of table (xored)
};


[TABLE V2] (first dword is files count)
Code:
struct XPAKTable
{
   uint32_t   dwFileNameLength;
   byte   lpFileName[dwFileNameLength];
   uint32_t   dwFileZSize;
   byte   bFlag; // flag & 0x40 != 0
};


[DECRYPTION]
Code:
void obfuscate(void *lpBuffer, int dwSize)
{
  signed int i; // r3@1
  int count; // r2@1 MAPDST

  i = 0;
  count = dwSize / 4;
  if ( count >= 4 )
    count = 4;
  while ( i < count )
  {
    ++i;
    *(DWORD *)lpBuffer ^= 0xAC54DF34;
    lpBuffer = (char *)lpBuffer + 4;
  }
}


Edited: Done


Last edited by Ekey on Wed Mar 17, 2021 2:38 pm, edited 5 times in total.

Top
   
PostPosted: Sun Mar 14, 2021 10:32 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
Done. I must admit, I could not implement a script for QuickBMS so I made batch tool for unpack on C# :mrgreen:

Code:
[Usage]
    DB.XPAK.Unpacker <m_File> <m_OutDirectory>


Code:
[Examples]
    DB.XPAK.Unpacker D:\main.33.com.dogbytegames.zombiesafari.obb D:\Unpacked


Supported V0, V1 and V2 archives. Unpack Only!

If someone needs a packer, then I attach the source code (yeah, I'm a lazy ass ¯\_(ツ)_/¯ )


Last edited by Ekey on Wed Mar 17, 2021 2:36 pm, edited 4 times in total.

Top
   
PostPosted: Mon Mar 15, 2021 7:49 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
Ekey wrote:
Done. I must admit, I could not implement a script for QuickBMS so I made batch tool for unpack on C# :mrgreen:

Code:
[Usage]
    DB.XPAK.Unpacker <m_File> <m_OutDirectory>


Code:
[Examples]
    DB.XPAK.Unpacker D:\main.33.com.dogbytegames.zombiesafari.obb D:\Unpacked


Supported V1 and V2 archives. Unpack Only!

If someone needs a packer, then I attach the source code (yeah, I'm a lazy ass ¯\_(ツ)_/¯ )

Thanks! Wow, a lot of info! Works great on Offroad Legends iOS. Found out the PNGs that are actually not PNGs, they're actually PVR textures. Here's an example of Rainbow.
Image
Edit: Would be amazing if I can convert the models. They come in two formats, H3D and GEO. The H3D file looks to be an XML of some sort. The GEO file is not ASCII, and it has the MAGIC of "H3DG".
Another edit: They appear to be Horde3D model files.


Top
   
PostPosted: Mon Mar 15, 2021 7:58 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
squidiskool wrote:
Thanks! Wow, a lot of info! Works great on Offroad Legends iOS.

Yup. Tool works on all the games from this company of those that I could find.


Top
   
PostPosted: Wed Mar 17, 2021 12:37 am 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
Ekey wrote:
squidiskool wrote:
Thanks! Wow, a lot of info! Works great on Offroad Legends iOS.

Yup. Tool works on all the games from this company of those that I could find.

ALERT! I'm trying to extract the XPK from version 1.0 of Offroad Legends but I get this:
[ERROR]: Unsupported version > 0 < of XPAK archive file!
Can you look into it ?
H e r e : https://www.mediafire.com/file/77rmb8xv ... 9.xpk/file


Top
   
PostPosted: Wed Mar 17, 2021 10:53 am 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1164
Added V0 type :)


Attachments:
File comment: Dogbyte Games XPAK UnPacker (Binaries)
DB.XPAK.Unpacker-Bin.rar [327.29 KiB]
Downloaded 13 times
File comment: Dogbyte Games XPAK UnPacker (Source Code)
DB.XPAK.Unpacker-Src.rar [668.07 KiB]
Downloaded 19 times
Top
   
PostPosted: Wed Mar 17, 2021 6:48 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
Ekey wrote:
Added V0 type :)

Thanks, I was trying to get the old Wheely before it turned into a UAZ, for some reason.


Top
   
PostPosted: Sun Mar 21, 2021 2:34 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12088
Well done Ekey.

I tried to make a quickbms script based on the source code of the tool (good occasion to spot bugs in my quickbms beta):
http://aluigi.org/bms/dogbyte_xpk.bms


Top
   
PostPosted: Mon Mar 22, 2021 4:08 pm 

Joined: Wed Nov 04, 2020 2:05 pm
Posts: 14
aluigi wrote:
Well done Ekey.

I tried to make a quickbms script based on the source code of the tool (good occasion to spot bugs in my quickbms beta):
http://aluigi.org/bms/dogbyte_xpk.bms

That does the job well too.


Top
   
PostPosted: Sat Apr 03, 2021 1:18 pm 

Joined: Wed Nov 12, 2014 1:46 pm
Posts: 73
squidiskool wrote:
Would be amazing if I can convert the models. They come in two formats, H3D and GEO. The H3D file looks to be an XML of some sort. The GEO file is not ASCII, and it has the MAGIC of "H3DG".
Another edit: They appear to be Horde3D model files.


I have finished my Horde3D Engine (v5;v6; Offroad Legends; Offroad Legends 2) *.GEO/*.SCENE.XML/*.MATERIAL.XML or *.GEO/*.H3D loader module and I have released the following programs as web updates:

- 3D Object Converter v7.047 (Windows)
- i3DConverter v3.905 (macOS)
- i3DConverter v1.905 (Linux)

How to get the 3D Object Converter v7.047:
Download the 3D Object Converter from http://3doc.i3dconverter.com and install it or download and use the portable version.
After it just use the Help/Check for updates... function to get the v7.047.

How to get the i3DConverter v3.905 macOS:
Download the i3DConverter from http://www.i3dconverter.com and install it.
After it just use the Help/Check for updates... function to get the v3.905.

How to get the i3DConverter v1.905 Linux:
Download the i3DConverter from http://www.i3dconverter.com and install it.
After it just use the Help/Check for updates... function to get the v1.905.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 16 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:
Powered by phpBB® Forum Software © phpBB Limited