Radfordhound / HedgeLib

A C++ library and collection of tools that aims to make modding games in the Sonic the Hedgehog franchise easier.
MIT License
88 stars 24 forks source link

HedgeLib++ - Improve Writing #51

Closed Radfordhound closed 5 years ago

Radfordhound commented 5 years ago

Really, writing isn't something we can do "directly" like we can with reading via direct memory loading unless we're dealing with a file consisting of purely-fixed size structures. Therefore the current system that's in-place for writing being semi-based on reflection and all is honestly kind of silly, plus it's only really easy to use if we're dealing with an incredibly simply structure anyway. I'd like to improve this.

My idea is to use the current system only on types the actual games would've used reflection on, like RFL files from Forces, and use the C# HedgeLib method of just having a custom Write function for each "managed" version of the type (which overrides the one from FileBase) for everything else. For simple fixed-size structs with no pointers/variable arrays this shouldn't even be necessary as we can just use fwrite.

Radfordhound commented 5 years ago

83a388f8f5fa0d5130e2c4789a4ca27430f9bc61 Done