some QoL
This commit is contained in:
parent
0797c9488a
commit
ff10e884dc
3 changed files with 61 additions and 10 deletions
|
@ -5,6 +5,7 @@
|
||||||
UFigureData::UFigureData()
|
UFigureData::UFigureData()
|
||||||
{
|
{
|
||||||
ClearData();
|
ClearData();
|
||||||
|
GenerationID = EVariantIDGeneration::UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 UFigureData::GetFigureID()
|
int32 UFigureData::GetFigureID()
|
||||||
|
@ -29,6 +30,28 @@ int32 UFigureData::GetFigureID()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int32 UFigureData::GetVariantID() {
|
||||||
|
|
||||||
|
int16_t OutFigureID = 0;
|
||||||
|
|
||||||
|
// The figure ID is stored in Block 1 of Sector 0 (i.e., data[1]), bytes 0 and 1 (16-bit integer, little-endian)
|
||||||
|
OutFigureID = decryptedData[1][0] | // Least significant byte
|
||||||
|
(data[1][1] << 8); // Most significant byte, shifted left by 8 bits
|
||||||
|
|
||||||
|
VariantID = OutFigureID;// Return the 16-bit figure ID
|
||||||
|
return OutFigureID;
|
||||||
|
}
|
||||||
|
|
||||||
|
EVariantIDGeneration UFigureData::GetGeneration()
|
||||||
|
{
|
||||||
|
return static_cast<EVariantIDGeneration>(VariantID);
|
||||||
|
}
|
||||||
|
|
||||||
void UFigureData::ClearData()
|
void UFigureData::ClearData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UFigureData::Dump(bool decrypted, FString filePath)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -266,6 +266,8 @@ void USkyPortalSubsystem::PortalAnalyzeAsync(const uint8 Index)
|
||||||
// Run the PortalAnalyze function asynchronously on a background thread
|
// Run the PortalAnalyze function asynchronously on a background thread
|
||||||
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this, Index]()
|
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this, Index]()
|
||||||
{
|
{
|
||||||
|
UE_LOG(LogSkyportalIO, Verbose, TEXT("Async Task started for figure index %d"), Index);
|
||||||
|
|
||||||
// Perform the blocking operation on the background thread
|
// Perform the blocking operation on the background thread
|
||||||
PortalAnalyze(Index);
|
PortalAnalyze(Index);
|
||||||
|
|
||||||
|
@ -283,13 +285,17 @@ void USkyPortalSubsystem::PortalAnalyzeAsync(const uint8 Index)
|
||||||
{
|
{
|
||||||
|
|
||||||
UE_LOG(LogSkyportalIO, Log, TEXT("Reading figure..."));
|
UE_LOG(LogSkyportalIO, Log, TEXT("Reading figure..."));
|
||||||
if (FigureArray.IsValidIndex(index)) {
|
if (FigureArray.IsValidIndex(index) && StatusData.StatusArray[index] == EFigureStatus::PRESENT) {
|
||||||
FigureArray[index] = PortalHandle->ReadFigureBlocks(index);
|
if (IsValid(PortalHandle)) {
|
||||||
UE_LOG(LogSkyportalIO, Log, TEXT("Figure ID : %d"), FigureArray[index]->GetFigureID());
|
FigureArray[index] = PortalHandle->ReadFigureBlocks(index);
|
||||||
|
UE_LOG(LogSkyportalIO, Log, TEXT("Figure ID : %d"), FigureArray[index]->GetFigureID());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UE_LOG(LogSkyportalIO, Error, TEXT("PortalHandle unreachable"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UE_LOG(LogSkyportalIO, Error, TEXT("Error in FigureArray"));
|
UE_LOG(LogSkyportalIO, Error, TEXT("Error in FigureArray"));
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,26 @@ static const uint8 HASH_CONST[] = {
|
||||||
#define FIGURE_TOTAL_BLOCKS 64
|
#define FIGURE_TOTAL_BLOCKS 64
|
||||||
#define FIGURE_BLOCK_SIZE 16
|
#define FIGURE_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum EVariantIDGeneration {
|
||||||
|
UNKNOW = -1,
|
||||||
|
SPYROS_ADVENTURE = 0,
|
||||||
|
GIANTS = 1,
|
||||||
|
SWAP_FORCE = 2,
|
||||||
|
TRAP_TEAM = 3,
|
||||||
|
SUPERCHARGERS = 4,
|
||||||
|
IMAGINATORS = 5
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char blockdata[FIGURE_TOTAL_BLOCKS][FIGURE_BLOCK_SIZE]; bool error;
|
unsigned char blockdata[FIGURE_TOTAL_BLOCKS][FIGURE_BLOCK_SIZE]; bool error;
|
||||||
} FigureDataBlock;
|
} FigureDataBlock;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
UCLASS()
|
UCLASS(BlueprintType,Blueprintable)
|
||||||
class UFigureData : public UObject {
|
class UFigureData : public UObject {
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -30,6 +43,11 @@ public:
|
||||||
// Data Arrays
|
// Data Arrays
|
||||||
uint8 data[64][16];
|
uint8 data[64][16];
|
||||||
uint8 decryptedData[64][16];
|
uint8 decryptedData[64][16];
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly)
|
||||||
|
bool bDecrypted;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly)
|
||||||
bool dataError;
|
bool dataError;
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
@ -47,6 +65,7 @@ public:
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
int16 ID; //Skylander ID
|
int16 ID; //Skylander ID
|
||||||
int16 VariantID; //Skylander Variant ID
|
int16 VariantID; //Skylander Variant ID
|
||||||
|
EVariantIDGeneration GenerationID;
|
||||||
#pragma region counters
|
#pragma region counters
|
||||||
uint8 counter1;
|
uint8 counter1;
|
||||||
uint8 counter2;
|
uint8 counter2;
|
||||||
|
@ -56,13 +75,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable,BlueprintPure, meta = (Category = "SkyPortal|Figure"))
|
||||||
int32 GetFigureID();
|
int32 GetFigureID();
|
||||||
|
|
||||||
uint32 GetFigureIdByIndex(uint32 index);
|
UFUNCTION(BlueprintCallable,BlueprintPure, meta = (Category = "SkyPortal|Figure"))
|
||||||
|
int32 GetVariantID();
|
||||||
|
|
||||||
//UFUNCTION()
|
UFUNCTION(BlueprintCallable, BlueprintPure, meta = (Category = "SkyPortal|Figure"))
|
||||||
//TArray<uint8> QueryBlock(uint8 characterIndex, uint8 block = 0x00);
|
EVariantIDGeneration GetGeneration();
|
||||||
|
|
||||||
void ReadData(uint8 index);
|
void ReadData(uint8 index);
|
||||||
void ClearData();
|
void ClearData();
|
||||||
|
@ -70,7 +90,9 @@ public:
|
||||||
void SetByte(int block, int offset, uint8 value);
|
void SetByte(int block, int offset, uint8 value);
|
||||||
uint16 GetShort(int block, int offset);
|
uint16 GetShort(int block, int offset);
|
||||||
uint32 GetUInt(int block, int offset);
|
uint32 GetUInt(int block, int offset);
|
||||||
void Dump(bool decrypted, FString filePath);
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
bool Dump(bool decrypted, FString filePath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue