Closed ScanMountGoat closed 2 years ago
It may make more sense to move the null pointer checks for MeshEx to the parser itself. This would require a new non nullable type. A simpler option is to switch from From
to TryFrom
and return an error on null pointers for non strings.
The current implementation for anim decoding can potentially allocate too much memory when the bit count is zero. This insert the default valueframe_count
many times. A bit count of zero and a non zero frame count is a legal way to represent a series of default values, so this may be too difficult to check for.
One possible solution is to detect the case with identical compressed values in the track and convert to a single value for ssbh_data. This results in an uncompressed track when saving. It's unclear if potentially changing the interpolation behavior would matter in this case. This approach will require some extra care when handling NaN values.
ssbh_data doesn't provide the same guarantee as ssbh_lib that binary data will be preserved. All we can really test for is that the conversion will be free of panics or memory errors for arbitrary inputs. A major source of potential errors is encoding/decoding byte buffers for mesh and skel.