CodeRedModding / CodeRed-Generator

A modern C++20 internal SDK generator for Unreal Engine 3 games.
MIT License
47 stars 20 forks source link

incorrect generation of bitfields #11

Open nyrpqsqq35 opened 3 months ago

nyrpqsqq35 commented 3 months ago

i reported this to u on discord in march but you never replied and it doesnt look like it ever got fixed

the boolproperty bitfields in some classes dont generate correctly because the bps dont take 32 bits this is easily solved by generating bitfields like this (union with the bitfields inside of a struct) image

you might find it beneficial to generate a verifier source file that has static_assert statements verifying the offsetof properties/sizeof objects is what you expect it to be to discover some of these issues yourself

additionally there's probably still heaps of struct packing/alignment issues since you rely on the developer's compiler to align members and your logic for adding padding manually is flawed

nyrpqsqq35 commented 3 months ago

it also looks like some of the bitfields dont start at 1<<0 (shown in my picture) idk if thats fixed in your gen (probably not)

ItsBranK commented 3 months ago

This is a game specific issue not global, Rocket League has two different bool types and doesn't calculate offsets or report the size of padding correctly in some cases.