SkyPortal-plugin/Source/SkyPortal/Public/SkyPortalFigure.h
2024-09-26 17:52:10 +02:00

74 lines
2.2 KiB
C++

#pragma once
#include "CoreMinimal.h"
//#include "SkyPortalFigure.generated.h"
//Copyright (C) 2010 Activision.All Rights Reserved.
static const uint8 HASH_CONST[] = {
0x20, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x43, 0x29, 0x20, 0x32, // Copyright (C) 2
0x30, 0x31, 0x30, 0x20, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x2E, 0x20, // 010 Activision.
0x41, 0x6C, 0x6C, 0x20, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x52, 0x65, 0x73, 0x65, 0x72, // All Rights Reser
0x76, 0x65, 0x64, 0x2E, 0x20 }; // ved.
#define FIGURE_TOTAL_BLOCKS 64
#define FIGURE_BLOCK_SIZE 16
typedef struct {
unsigned char blockdata[FIGURE_TOTAL_BLOCKS][FIGURE_BLOCK_SIZE]; bool error;
} FigureDataBlock;
class FigureData {
public:
// Data Arrays
uint8 data[64][16];
uint8 decryptedData[64][16];
bool dataError;
// Properties
#pragma region manufacturer
uint32 NUID; // should under no circumstances be corrupted. 4-byte
uint8 BCC; //Block Check Character. When this BCC does not match the NUID of the tag, the tag ceases to function. stored in block 0 at offset 0x4
uint8 SAK = 0x81; //needs to be set to allow for the tag to be read correctly
uint16 ATQA; //always set to 0x01 0x0F
FString ProductionYear; //last 2 digits of the year that the tag was manufactured as Binary-coded decimal
#pragma endregion
#pragma region Toy code
uint32 ToyCodeNumber1, ToyCodeNumber2;
uint64 FullToyCodeNumber;
FString ToyCode;
#pragma endregion
int16 ID;
int16 VariantID;
#pragma region counters
uint8 counter1;
uint8 couter2;
#pragma endregion
FString Nickname;
FigureData()
{
ClearData();
}
// Methods
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure"))
uint32 GetFigureID();
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure"))
uint32 GetFigureIdByIndex(uint32 index);
//UFUNCTION()
//TArray<uint8> QueryBlock(uint8 characterIndex, uint8 block = 0x00);
void ReadData(uint8 index);
void ClearData();
uint8 GetByte(int block, int offset);
void SetByte(int block, int offset, uint8 value);
uint16 GetShort(int block, int offset);
uint32 GetUInt(int block, int offset);
void Dump(bool decrypted, FString filePath);
};