
Need unpack .PKG
Sample File : https://drive.google.com/open?id=0B0b7s ... nZaUnlTMVU
aluigi wrote:http://aluigi.org/bms/kingdom_under_fire_2.bms
aluigi wrote:That file seems to have an encrypted TOC (the table with information about the archived files).
That's why the script doesn't work on it.
The only solution is using offzip -a.
Code: Select all
uint32_t kuf2_fs_decrypt_entry(uint8_t *pBuffer, uint32_t dwTableSize, uint32_t dwArchiveSize)
{
uint32_t dwResult1;
uint32_t dwResult2;
uint32_t dwResult3;
uint32_t dwResult4;
uint32_t dwSeed = dwArchiveSize;
uint32_t dwBlockSize = 24;
uint32_t dwBlockCount = dwTableSize / dwBlockSize;
for (uint32_t i = 0; i < dwBlockCount; i++, pBuffer += dwBlockSize)
{
dwResult1 = 0x19660D * dwSeed + 0x3C6EF35F;
*(uint64_t *)(pBuffer + 0) += dwResult1;
dwResult2 = 0x19660D * dwResult1 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 8) += dwResult2;
dwResult3 = 0x19660D * dwResult2 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 12) += dwResult3;
dwResult4 = 0x19660D * dwResult3 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 16) += dwResult4;
dwSeed = 0x19660D * dwResult4 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 20) += dwSeed;
}
return dwSeed;
}
Code: Select all
void kuf2_fs_decrypt_subentry(uint8_t *pBuffer, uint32_t dwTableSize, uint32_t dwSeed)
{
uint32_t dwResult1;
uint32_t dwResult2;
uint32_t dwResult3;
uint32_t dwBlockSize = 12;
uint32_t dwBlockCount = dwTableSize / dwBlockSize;
for (uint32_t i = 0; i < dwBlockCount; i++, pBuffer += dwBlockSize)
{
dwResult1 = 0x19660D * dwSeed + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 0) += dwResult1;
dwResult2 = 0x19660D * dwResult1 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 4) += dwResult2;
dwSeed = 0x19660D * dwResult2 + 0x3C6EF35F;
*(uint32_t *)(pBuffer + 8) += dwSeed;
}
}
Code: Select all
get SOME_CRC longlong
get ZSIZE long
get SIZE long
get ID long
get ZERO long
Code: Select all
get CHUNK_OFF long
get CHUNK_ZSIZE long
get CHUNK_SIZE long
Code: Select all
//First table
dwSeed = kuf2_fs_decrypt_entry(pBuffer, dwTableSize, dwArchiveSize);
//Second table
kuf2_fs_decrypt_subentry(pBuffer, dwTableSize, dwSeed);
WollieWoltaz wrote:Doesn't the tool Aluige provided work?
Btw.. is this game made with Unreal Engine or?
Amagakuro wrote:Quickbms works although files have no names and "useless" extension apart from the .dds, maybe the tables have a different encyption?