SpartaPAK: Difference between revisions
Jump to navigation
Jump to search
imported>Ikskoks No edit summary |
imported>Ikskoks No edit summary |
(No difference)
| |
Latest revision as of 19:22, 25 July 2021
Taken from original site http://int0thegame.blogspot.com/2007/05/ancient-wars-sparta.html :
I've coded a tool for this game, game using a pretty tricky encryption, it takes me two days to made stable tool and properly implement decryption algorithm.
Decryption routine looks like:
// ( outbuffsize == decrypt FAT) ? position in stream : size of decompressed stream.
public static byte[] Decrypt(byte[] buff, int outbuffsize)
{
// If buffer length > 0x100 then decrypt only first 0x100 bytes.
int num = ( buff.Length > 0x100 ) ? 0x100 : buff.Length;
for (int i = 0; i < num; i++)
{
int index = ( outbuffsize + i ) % 15;
buff[i] = (byte) (buff[i] ^ m_array[index]);
}
return buff;
}
File structure is simple and looks like:
[StructLayout(LayoutKind.Sequential)]
public struct PAK
{
public int LengthFileName;
public string FileName;
public int Offset;
public int IsPacked; // 1 - true 2 - false
public int PackedSize;
public int UnpackedSize;
public int Crc; // it looks like crc but I'm not sure.
}
Download: Download from Xentax