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.
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.