Preferred method of loading binary files?

That makes sense; you’ll basically have to reverse engineer these formats then.

My suggestion would be to start with writing out the loader code explicitly as a big lot of read(io, T) while you work on understanding the format. Once you start to see patterns you’ll know whether it’s possible to attack it with a code generator or not. The reason I say this is that many ad hoc binary formats are rather “clever” in being optimized for file size, access time, or backward compatibility and there can be a ton of special cases which are not well suited to code generation. YMMV :slight_smile:

2 Likes