2024-09-23 21:55:43 +00:00
|
|
|
#pragma once
|
2024-09-24 16:24:05 +00:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
//#include "SkyPortalFigure.generated.h"
|
2024-09-23 21:55:43 +00:00
|
|
|
|
2024-09-24 16:24:05 +00:00
|
|
|
|
2024-09-24 22:17:52 +00:00
|
|
|
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")
|
|
|
|
};
|
2024-09-24 16:24:05 +00:00
|
|
|
|
|
|
|
#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
|
2024-09-24 22:17:52 +00:00
|
|
|
int16 ID;
|
2024-09-24 16:24:05 +00:00
|
|
|
int16 VariantID;
|
|
|
|
#pragma region counters
|
|
|
|
uint8 counter1;
|
|
|
|
uint8 couter2;
|
|
|
|
#pragma endregion
|
|
|
|
FString Nickname;
|
|
|
|
|
|
|
|
FigureData()
|
|
|
|
{
|
|
|
|
ClearData();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Methods
|
2024-09-25 11:47:11 +00:00
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure"))
|
|
|
|
uint32 GetFigureID(const FigureDataBlock& DataBlock);
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure"))
|
|
|
|
uint32 GetFigureIdByIndex(uint32 index);
|
|
|
|
|
2024-09-25 15:33:25 +00:00
|
|
|
UFUNCTION()
|
|
|
|
TArray<uint8> QueryBlock(uint8 characterIndex, uint8 block = 0x00);
|
|
|
|
|
2024-09-24 16:24:05 +00:00
|
|
|
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);
|
|
|
|
};
|