A tiny C library that builds a readable struct definition from a known and an unknown field list.
it matches everything by name and fills gaps with char pad_x[].
known fields that have no matching offset get put into the smallest gap they fit in (or get appended to the end)
#include <struct_build.h>
struct sb_struct_field_known known_arr[] = {
{0x8, "value", "Value"},
{0x4, "tt", "int"},
};
struct sb_struct_field_unk unk_arr[] = {
{"value", 0x0, NULL},
{"tt", 0xC, NULL},
};
char* result = sb_build_struct(unk_arr, 2, known_arr, 2, "TValue");
puts(result);
free(result);struct TValue {
Value value; /* 0x00 */
char pad_0[0x4]; /* 0x08 */
int tt; /* 0x0C */
}; /* 0.012ms */-
inferredmeans that the field had no known offset and was best-fit placed into a gap or appended -
warnings get placed above the struct
- Caller must
free()the returned string unk_arrgets sorted