it kinda work

This commit is contained in:
Milxnor
2023-04-05 07:55:28 -04:00
parent bd4a8da94f
commit 0aa6c49580
25 changed files with 1247 additions and 219 deletions

View File

@@ -18,6 +18,44 @@ FName* getFNameOfProp(void* Property)
return NamePrivate;
};
void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) const
{
for (auto CurrentClass = ClassPrivate; CurrentClass; CurrentClass = *(UClass**)(__int64(CurrentClass) + Offsets::SuperStruct))
{
void* Property = *(void**)(__int64(CurrentClass) + Offsets::Children);
if (Property)
{
// LOG_INFO(LogDev, "Reading prop name..");
std::string PropName = getFNameOfProp(Property)->ToString();
// LOG_INFO(LogDev, "PropName: {}", PropName);
if (PropName == ChildName)
{
return Property;
}
while (Property)
{
if (PropName == ChildName)
{
return Property;
}
Property = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next;
PropName = Property ? getFNameOfProp(Property)->ToString() : "";
}
}
}
if (bWarnIfNotFound)
LOG_WARN(LogFinder, "Unable to find0{}", ChildName);
return nullptr;
}
void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound)
{
for (auto CurrentClass = ClassPrivate; CurrentClass; CurrentClass = *(UClass**)(__int64(CurrentClass) + Offsets::SuperStruct))
@@ -66,6 +104,16 @@ int UObject::GetOffset(const std::string& ChildName, bool bWarnIfNotFound)
return *(int*)(__int64(Property) + Offsets::Offset_Internal);
}
int UObject::GetOffset(const std::string& ChildName, bool bWarnIfNotFound) const
{
auto Property = GetProperty(ChildName, bWarnIfNotFound);
if (!Property)
return -1;
return *(int*)(__int64(Property) + Offsets::Offset_Internal);
}
bool UObject::ReadBitfieldValue(int Offset, uint8_t FieldMask)
{
return ReadBitfield(this->GetPtr<PlaceholderBitfield>(Offset), FieldMask);