XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sat Feb 16, 2019 1:07 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: data0.pkg [Banished]
PostPosted: Thu Feb 27, 2014 12:43 am 
Offline
mega-veteran
mega-veteran
User avatar

Joined: Tue Mar 01, 2011 9:34 pm
Posts: 277
Has thanked: 68 times
Have thanks: 181 times














You can make the ads go away by registering

Request
Image

_________________
-= GP-team =-
Image


Top
 Profile  
 
 Post subject: Re: data0.pkg [Banished]
PostPosted: Thu Feb 27, 2014 2:23 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1638
Has thanked: 62 times
Have thanks: 817 times
Table and files compressed by blocks with custom algo. Each block = max decompressed size is 0x8000

Code:
struct PKGHeader
{
   DWORD dwTableOffset;
};

goto dwTableOffset

struct PKGTableHeader
{
   DWORD dwTableSize;
   DWORD dwTableBlockCount;
};

struct PKGTableBlockEntry
{
   DWORD dwBlockPosition;
   WORD dwBlockTableZSize;
   WORD dwBlockTableSize;
};

File data compressed too and have custom header

struct PKGFileDataHeader
{
   DWORD dwBlockCount;
};

struct PKGFileDataEntry
{
   DWORD dwBlockOffset;
   WORD dwBlockZSize;  //can be 0 , don't know how avoid it
   WORD dwBlockSize;
};

// for Table
struct PKGDataEntry
{
   DWORD dwNameLength;
   String pFileName; // Unicode
   DWORD dwOffset;
   DWORD dwSize;
};


Decompress algo:

Code:
int __cdecl System__Compression__Decompress(unsigned int pScrBuffer, int pScrSize, unsigned int pDstBuffer, int pDstSize)
{
  unsigned int v4; // eax@1
  unsigned int v5; // ebx@1
  unsigned int v6; // edi@1
  unsigned int v7; // edx@2
  int v8; // edx@3
  int v9; // edx@6
  int v10; // esi@6
  unsigned int v11; // esi@6
  int v12; // ecx@8
  int v13; // ecx@10
  int v15; // [sp+14h] [bp+8h]@1
  unsigned int v16; // [sp+1Ch] [bp+10h]@1

  v5 = pDstBuffer;
  v6 = pScrBuffer;
  v16 = pScrBuffer + pScrSize;
  v4 = v5;
  v15 = v5 + pDstSize;
  while ( 1 )
  {
    v7 = *(BYTE *)v6++;
    if ( v7 >= 0x20 )
      break;
    v8 = v7 + 1;
    if ( v8 + v4 > v15 )
      return 0;
    do
    {
      *(BYTE *)v4++ = *(BYTE *)v6++;
      --v8;
    }
    while ( v8 );
LABEL_12:
    if ( v6 >= v16 )
      return v4 - v5;
  }
  v11 = v7;
  v9 = (v7 & 0x1F) << 8;
  v10 = v11 >> 5;
  if ( v10 == 7 )
    v10 = *(BYTE *)v6++ + 7;
  v12 = v4 - v9 - 1 - *(BYTE *)v6++;
  if ( v10 + v4 + 2 <= v15 && v12 >= v5 )
  {
    *(BYTE *)v4 = *(BYTE *)v12;
    *(BYTE *)(v4 + 1) = *(BYTE *)(v12 + 1);
    v4 += 2;
    v13 = v12 + 2;
    do
    {
      *(BYTE *)v4++ = *(BYTE *)v13++;
      --v10;
    }
    while ( v10 );
    goto LABEL_12;
  }
  return 0;
}


I make unpacker but i don't know how avoid this: Entry number > 54 > file have entry where PKGFileDataEntry.dwBlockZSize equal 0 for all blocks.


Top
 Profile  
 
 Post subject: Re: data0.pkg [Banished]
PostPosted: Thu Feb 27, 2014 7:22 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Wed Mar 31, 2010 6:54 am
Posts: 1638
Has thanked: 62 times
Have thanks: 817 times
Well here unpacker. Some files (music above all) can't be unpacked. :constipated:


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: data0.pkg [Banished]
PostPosted: Fri Sep 05, 2014 4:15 pm 
Offline
ultra-n00b

Joined: Fri Sep 05, 2014 3:31 pm
Posts: 6
Has thanked: 1 time
Have thanks: 1 time
Sadly doesn't provide us with anything the modkit didn't already come with, which is to say, all we get out of it are .crs files. It would be cool if you could decouple the .crs from other datafiles like textures and models. Also only works on v1.0.0 of the data file.

But a really cool effort, nonetheless!


Top
 Profile  
 
 Post subject: Re: data0.pkg [Banished]
PostPosted: Thu Mar 17, 2016 3:48 pm 
Offline
ultra-n00b

Joined: Thu Mar 17, 2016 3:40 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time
I get the information message "PKG Archive Successfully Unpacked" but no files are created on disk and the list inside the program remains blank. This unpacker doesn't work.


Top
 Profile  
 
 Post subject: Re: data0.pkg [Banished]
PostPosted: Fri Feb 08, 2019 10:02 pm 
Offline
beginner

Joined: Fri Apr 21, 2017 1:47 pm
Posts: 25
Has thanked: 3 times
Have thanks: 2 times
Is there a way to pack all the files back or create a new archive with the files?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 5 guests


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:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group