|
- struct ActorsEncryption {
- uint32_t Enc_1, Enc_2;
- uint32_t Enc_3, Enc_4;
- };
-
- struct Encryption_Chunk {
- uint32_t val_1, val_2;
- uint32_t val_3, val_4;
- };
- uint32_t DecryptActorsArray(uint32_t uLevel, int Actors_Offset, int EncryptedActors_Offset)
- {
- if (uLevel < 0x10000000)
- return 0;
-
- if (ReadMemory<uint32_t>(uLevel + Actors_Offset) > 0)
- return uLevel + Actors_Offset;
-
- if (ReadMemory<uint32_t>(uLevel + EncryptedActors_Offset) > 0)
- return uLevel + EncryptedActors_Offset;
-
- auto Encryption = ReadMemory<ActorsEncryption>(uLevel + EncryptedActors_Offset + 0x0C);
-
- if (Encryption.Enc_1 > 0)
- {
- auto Enc = ReadMemory<Encryption_Chunk>(Encryption.Enc_1 + 0x80);
-
- return (ReadMemory<uint8_t>(Encryption.Enc_1 + Enc.val_1)
- | (ReadMemory<uint8_t>(Encryption.Enc_1 + Enc.val_2) << 8)
- | (ReadMemory<uint8_t>(Encryption.Enc_1 + Enc.val_3) << 0x10)
- | (ReadMemory<uint8_t>(Encryption.Enc_1 + Enc.val_4) << 0x18));
- }
- else if (Encryption.Enc_2 > 0)
- {
- auto Encrypted_Actors = ReadMemory<uint32_t>(Encryption.Enc_2);
- if (Encrypted_Actors > 0)
- {
- return ((unsigned short)Encrypted_Actors - 0x400) & 0xFF00
- | (unsigned char)(Encrypted_Actors - 0x04)
- | (Encrypted_Actors + 0xFC0000) & 0xFF0000
- | (Encrypted_Actors - 0x4000000) & 0xFF000000;
- }
- }
- else if (Encryption.Enc_3 > 0)
- {
- auto Encrypted_Actors = ReadMemory<uint32_t>(Encryption.Enc_3);
- if (Encrypted_Actors > 0)
- return (Encrypted_Actors >> 0x18) | (Encrypted_Actors << (32 - 0x18));
- }
- else if (Encryption.Enc_4 > 0)
- {
- auto Encrypted_Actors = ReadMemory<uint32_t>(Encryption.Enc_4);
- if (Encrypted_Actors > 0)
- return Encrypted_Actors ^ 0xCDCD00;
- }
- return 0;
- }
|
|