81 lines
1.7 KiB
C++
81 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "SkyPortalFigure.h"
|
|
|
|
uint32 GetFigureID(const FigureDataBlock& DataBlock)
|
|
{
|
|
int16_t OutFigureID;
|
|
// Figure ID is stored in Block 0, bytes 0 to 3 (32-bit integer, little-endian)
|
|
OutFigureID = DataBlock.blockdata[0][0] |
|
|
(DataBlock.blockdata[0][1] << 8) |
|
|
(DataBlock.blockdata[0][2] << 16) |
|
|
(DataBlock.blockdata[0][3] << 24);
|
|
/*
|
|
// Variant ID is stored in Block 0, bytes 4 to 5 (16-bit integer, little-endian)
|
|
OutVariantID = (DataBlock.blockdata[0][5] << 8) |
|
|
DataBlock.blockdata[0][4];
|
|
*/
|
|
return OutFigureID;
|
|
};
|
|
|
|
/*
|
|
void FigureData::ReadData(uint8 index)
|
|
{
|
|
ClearData();
|
|
for (uint8 i = 0; i < 64; i++)
|
|
{
|
|
GEngine->GetEngineSubsystem<USkyPortalSubsystem>();
|
|
TArray<uint8> output = SkySubsystem->QueryBlock(index, i);
|
|
|
|
uint8[] blockData = new uint8[0x10];
|
|
Array.Copy(output, 3, blockData, 0, 16);
|
|
|
|
// block 1 is sometimes a duplicate of block 0
|
|
if (i == 1)
|
|
{
|
|
if (blockData.SequenceEqual(data[0]))
|
|
{
|
|
i -= 1;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
Array.Copy(blockData, 0, data[i], 0, 16);
|
|
|
|
if (((i + 1) % 4 == 0) || i < 8)
|
|
{
|
|
Array.Copy(data[i], 0, decryptedData[i], 0, 16);
|
|
}
|
|
else
|
|
{
|
|
uint8[] hashIn = new byte[0x56];
|
|
data[0].CopyTo(hashIn, 0);
|
|
data[1].CopyTo(hashIn, 0x10);
|
|
hashIn[0x20] = i;
|
|
HASH_CONST.CopyTo(hashIn, 0x21);
|
|
|
|
uint8[] key = MD5.Create().ComputeHash(hashIn);
|
|
|
|
uint8[] decrypted = new byte[0x10];
|
|
|
|
using (Aes aesAlg = Aes.Create())
|
|
{
|
|
aesAlg.Key = key;
|
|
aesAlg.Mode = CipherMode.ECB;
|
|
aesAlg.Padding = PaddingMode.Zeros;
|
|
|
|
ICryptoTransform decryptor = aesAlg.CreateDecryptor();
|
|
|
|
decrypted = decryptor.TransformFinalBlock(data[i], 0, data[i].Length);
|
|
|
|
}
|
|
|
|
Array.Copy(decrypted, 0, decryptedData[i], 0, 16);
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
void FigureData::ClearData()
|
|
{
|
|
}
|