Closed gir489returns closed 2 days ago
Well, for that I'd need to store the number of padding members in the super classes. Which would be quite annoying. I don't think padding names changing is of big concern right now.
Hmmmmm, then maybe we can use their offset instead? What you're doing right now is using a static variable that's never cleared. This creates a FIFO problem, from the fact that subsequent class generations are never done in lockstep with the way they were done before. The first parameter to GenerateBytePadding is the Offset parameter which you use in the generation of the comment. However, I do not see the possibility of two members occupying the same member space, so this physically cannot occur.
Here is how it looked before with the static member:
// Class Niagara.NiagaraDataInterfaceCurveBase
// 0x0038 (0x0070 - 0x0038)
class UNiagaraDataInterfaceCurveBase : public UNiagaraDataInterface
{
public:
TArray<float> ShaderLUT; // 0x0038(0x0010)(ZeroConstructor, Protected, NativeAccessSpecifierProtected)
float LUTMinTime; // 0x0048(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTMaxTime; // 0x004C(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTInvTimeRange; // 0x0050(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTNumSamplesMinusOne; // 0x0054(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
uint8 Pad_1032[0x4]; // 0x0058(0x0004)(Fixing Size After Last Property [ Dumper-7 ])
uint8 bUseLUT : 1; // 0x005C(0x0001)(BitIndex: 0x00, PropSize: 0x0001 (Edit, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic))
uint8 bExposeCurve : 1; // 0x005C(0x0001)(BitIndex: 0x01, PropSize: 0x0001 (Edit, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic))
uint8 Pad_1033[0x3]; // 0x005D(0x0003)(Fixing Size After Last Property [ Dumper-7 ])
class FName ExposedName; // 0x0060(0x0008)(Edit, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic)
class UTexture2D* ExposedTexture; // 0x0068(0x0008)(ZeroConstructor, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
public:
static class UClass* StaticClass()
{
return StaticClassImpl<"NiagaraDataInterfaceCurveBase">();
}
static class UNiagaraDataInterfaceCurveBase* GetDefaultObj()
{
return GetDefaultObjImpl<UNiagaraDataInterfaceCurveBase>();
}
};
static_assert(alignof(UNiagaraDataInterfaceCurveBase) == 0x000008, "Wrong alignment on UNiagaraDataInterfaceCurveBase");
static_assert(sizeof(UNiagaraDataInterfaceCurveBase) == 0x000070, "Wrong size on UNiagaraDataInterfaceCurveBase");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ShaderLUT) == 0x000038, "Member 'UNiagaraDataInterfaceCurveBase::ShaderLUT' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTMinTime) == 0x000048, "Member 'UNiagaraDataInterfaceCurveBase::LUTMinTime' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTMaxTime) == 0x00004C, "Member 'UNiagaraDataInterfaceCurveBase::LUTMaxTime' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTInvTimeRange) == 0x000050, "Member 'UNiagaraDataInterfaceCurveBase::LUTInvTimeRange' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTNumSamplesMinusOne) == 0x000054, "Member 'UNiagaraDataInterfaceCurveBase::LUTNumSamplesMinusOne' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ExposedName) == 0x000060, "Member 'UNiagaraDataInterfaceCurveBase::ExposedName' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ExposedTexture) == 0x000068, "Member 'UNiagaraDataInterfaceCurveBase::ExposedTexture' has a wrong offset!");
And here's after with the change to use Offset instead.
class UNiagaraDataInterfaceCurveBase : public UNiagaraDataInterface
{
public:
TArray<float> ShaderLUT; // 0x0038(0x0010)(ZeroConstructor, Protected, NativeAccessSpecifierProtected)
float LUTMinTime; // 0x0048(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTMaxTime; // 0x004C(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTInvTimeRange; // 0x0050(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
float LUTNumSamplesMinusOne; // 0x0054(0x0004)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
uint8 Pad_58[0x4]; // 0x0058(0x0004)(Fixing Size After Last Property [ Dumper-7 ])
uint8 bUseLUT : 1; // 0x005C(0x0001)(BitIndex: 0x00, PropSize: 0x0001 (Edit, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic))
uint8 bExposeCurve : 1; // 0x005C(0x0001)(BitIndex: 0x01, PropSize: 0x0001 (Edit, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic))
uint8 Pad_5D[0x3]; // 0x005D(0x0003)(Fixing Size After Last Property [ Dumper-7 ])
class FName ExposedName; // 0x0060(0x0008)(Edit, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic)
class UTexture2D* ExposedTexture; // 0x0068(0x0008)(ZeroConstructor, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
public:
static class UClass* StaticClass()
{
return StaticClassImpl<"NiagaraDataInterfaceCurveBase">();
}
static class UNiagaraDataInterfaceCurveBase* GetDefaultObj()
{
return GetDefaultObjImpl<UNiagaraDataInterfaceCurveBase>();
}
};
static_assert(alignof(UNiagaraDataInterfaceCurveBase) == 0x000008, "Wrong alignment on UNiagaraDataInterfaceCurveBase");
static_assert(sizeof(UNiagaraDataInterfaceCurveBase) == 0x000070, "Wrong size on UNiagaraDataInterfaceCurveBase");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ShaderLUT) == 0x000038, "Member 'UNiagaraDataInterfaceCurveBase::ShaderLUT' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTMinTime) == 0x000048, "Member 'UNiagaraDataInterfaceCurveBase::LUTMinTime' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTMaxTime) == 0x00004C, "Member 'UNiagaraDataInterfaceCurveBase::LUTMaxTime' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTInvTimeRange) == 0x000050, "Member 'UNiagaraDataInterfaceCurveBase::LUTInvTimeRange' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, LUTNumSamplesMinusOne) == 0x000054, "Member 'UNiagaraDataInterfaceCurveBase::LUTNumSamplesMinusOne' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ExposedName) == 0x000060, "Member 'UNiagaraDataInterfaceCurveBase::ExposedName' has a wrong offset!");
static_assert(offsetof(UNiagaraDataInterfaceCurveBase, ExposedTexture) == 0x000068, "Member 'UNiagaraDataInterfaceCurveBase::ExposedTexture' has a wrong offset!");
Hm, I guess it can be done like that. But I'm short on time at the moment, so it would be great if you just submitted a pullrequest. Thanks!
Instead of using the offset/physical address or whatever the project is currently using to generate the Padding names, it should instead count the number of padding members from 0 and increment it each time. That way on subsequent dumps of the game, half the SDK won't be changed.