Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Warning! Experimental! No guarantees on functionality! Use at your own risk!!!!!
- (Not so much on this one. I have used it and it actually functions very well, but still potentially unstable.)
- */
- #pragma once
- #include "FormID.h"
- #include "CoreMinimal.h"
- #include "Kismet/BlueprintFunctionLibrary.h"
- #include "AsyncPluginLoader.generated.h"
- DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnPluginFileLoaded, bool, bSuccess, const TArray<uint8>&, LoadedBytes);
- USTRUCT(BlueprintType)
- struct FESMSubrecord
- {
- GENERATED_BODY()
- UPROPERTY(BlueprintReadOnly)
- FString SubrecordType;
- UPROPERTY(BlueprintReadOnly)
- TArray<uint8> SubrecordData;
- };
- USTRUCT(BlueprintType)
- struct FESMRecord
- {
- GENERATED_BODY()
- UPROPERTY(BlueprintReadOnly)
- FString RecordType;
- UPROPERTY(BlueprintReadOnly)
- TArray<uint8> RecordData;
- UPROPERTY(BlueprintReadOnly)
- TArray<FFormID> FormIDs;
- UPROPERTY(BlueprintReadOnly)
- TArray<FESMSubrecord> Subrecords;
- UPROPERTY(BlueprintReadOnly)
- FString EditorID;
- };
- USTRUCT(BlueprintType)
- struct FESMHeightData
- {
- GENERATED_BODY()
- UPROPERTY(BlueprintReadOnly)
- float BaseHeight;
- UPROPERTY(BlueprintReadOnly)
- TArray<float> Heights; // 65x65 grid (4225 floats)
- };
- UCLASS()
- class UAsyncPluginLoader : public UBlueprintFunctionLibrary
- {
- GENERATED_BODY()
- public:
- UFUNCTION(BlueprintCallable, Category = "File I/O")
- static void LoadPluginFileAsync(const FString& FilePath, const FOnPluginFileLoaded& OnLoaded);
- UFUNCTION(BlueprintCallable, Category = "ESM Parsing")
- static void ParseESMRecords(const TArray<uint8>& FileBytes, TArray<FESMRecord>& OutRecords);
- UFUNCTION(BlueprintCallable, Category = "ESM Parsing")
- static void ParseESMSubrecords(const TArray<uint8>& RecordData, TArray<FESMSubrecord>& OutSubrecords, TArray<FFormID>& OutFormIDs, FESMRecord& CurrentRecord); // Added CurrentRecord parameter
- UFUNCTION(BlueprintCallable, Category = "ESM Parsing")
- static bool ExtractHeightData(const FESMRecord& Record, FESMHeightData& OutHeightData);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement