CodeRedModding / CodeRed-Generator

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

incorrect generation of bitfields #11

Open nyrpqsqq35 opened 1 month ago

nyrpqsqq35 commented 1 month 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 1 month 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 2 weeks 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.