initial commit; cv 0.0.3
This commit is contained in:
38
Helpers/PalHelpers.hpp
Normal file
38
Helpers/PalHelpers.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
#include <DynamicOutput/DynamicOutput.hpp>
|
||||
|
||||
#include <Unreal/UObjectGlobals.hpp>
|
||||
#include <Unreal/UObject.hpp>
|
||||
#include <Unreal/UClass.hpp>
|
||||
|
||||
#include <Reflection/UnrealObjectRef.hpp>
|
||||
#include <Reflection/UnrealApiCall.hpp>
|
||||
|
||||
#include <Api/Pal/PalTypes.hpp>
|
||||
|
||||
namespace PalUIExtension::Helpers
|
||||
{
|
||||
using namespace RC;
|
||||
using namespace RC::Unreal;
|
||||
|
||||
|
||||
struct PalKey
|
||||
{
|
||||
Api::Pal::FGuid_ PlayerUID{};
|
||||
Api::Pal::FGuid_ InstanceID{};
|
||||
};
|
||||
|
||||
auto SamePalIndividual(const PalKey& A, const PalKey& B) -> bool
|
||||
{
|
||||
|
||||
return A.InstanceID.A == B.InstanceID.A && A.InstanceID.B == B.InstanceID.B &&
|
||||
A.InstanceID.C == B.InstanceID.C && A.InstanceID.D == B.InstanceID.D &&
|
||||
A.PlayerUID.A == B.PlayerUID.A && A.PlayerUID.B == B.PlayerUID.B &&
|
||||
A.PlayerUID.C == B.PlayerUID.C && A.PlayerUID.D == B.PlayerUID.D;
|
||||
}
|
||||
|
||||
}
|
||||
48
Helpers/TextFromString.hpp
Normal file
48
Helpers/TextFromString.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
#include <DynamicOutput/DynamicOutput.hpp>
|
||||
|
||||
#include <Unreal/UObjectGlobals.hpp>
|
||||
#include <Unreal/UObject.hpp>
|
||||
#include <Unreal/UClass.hpp>
|
||||
|
||||
#include <Reflection/UnrealObjectRef.hpp>
|
||||
#include <Reflection/UnrealApiCall.hpp>
|
||||
|
||||
namespace PalUIExtension::Helpers
|
||||
{
|
||||
using namespace RC;
|
||||
using namespace RC::Unreal;
|
||||
|
||||
|
||||
class FTextFromString
|
||||
{
|
||||
public:
|
||||
explicit FTextFromString(const TCHAR* Str)
|
||||
{
|
||||
static Reflection::UnrealObjectRef KismetTextCDO{
|
||||
STR("/Script/Engine.Default__KismetTextLibrary"), STR("KismetText") };
|
||||
static Reflection::UnrealApiCall<struct Tag_KismetText, FText> Api{
|
||||
STR("/Script/Engine.KismetTextLibrary"), STR("KismetText") };
|
||||
|
||||
UObject* CDO = KismetTextCDO.Get();
|
||||
if (!CDO) return;
|
||||
|
||||
m_params.InString = FString(Str);
|
||||
m_ok = Api.Invoke(CDO, STR("Conv_StringToText"), m_params);
|
||||
}
|
||||
|
||||
auto IsValid() const -> bool { return m_ok; }
|
||||
auto Get() -> FText& { return m_params.ReturnValue; }
|
||||
|
||||
private:
|
||||
// Value-initialized deliberately -- see caveat 1.
|
||||
struct Params { FString InString; FText ReturnValue; };
|
||||
Params m_params{};
|
||||
bool m_ok = false;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user