#pragma once #include "CoreMinimal.h" //#include "SkyPortalFigure.generated.h" UENUM(BlueprintType) enum class EFigureStatus : uint8 { NOT_PRESENT = 0b00 UMETA(DisplayName = "Not Present"), PRESENT = 0b01 UMETA(DisplayName = "Present"), ADDED = 0b11 UMETA(DisplayName = "Added"), REMOVED = 0b10 UMETA(DisplayName = "Removed") }; #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]; // 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(const FigureDataBlock& DataBlock); UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure")) uint32 GetFigureIdByIndex(uint32 index); UFUNCTION() TArray 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); };