T
twostars
Client: Auto-detect supported formats (#777)
* Attempt auto-detection of supported formats
We add CN3BaseFileAccess::LoadSupportedVersions() for opt-in detection of supported formats.
Naturally this doesn't apply to 99% of files; most will still load directly.
For the few that we do implement (CN3Terrain -> CN3River/CN3Pond, CN3ShapeMgr, CN3UIBase),
we cycle through supported versions for that particular format, releasing and rewinding when
an exception is thrown (or it otherwise returns false, which is rare).
In this way we can support the old 1.098 format and the newer (explicitly marked 1.264 for now)
formats with minimal fuss.
Naturally this only extends so far; it won't be possible to support arbitrary TBL formats in this way,
as that requires struct layout changes, but for most file formats this should be sufficient.
We also restore pond behaviour, adding the additional read needed to properly parse this file,
now that we handle its versioning better.
* Simplify CN3Pond & CN3River storage and cleanup
These don't really need the full CN3BaseFileAccess support.
* Tweak file format version overrides
The only time this is necessary is when it's part of the same file
and makes sense to do so.
Additionally, it should only be done on Load().
* clang-tidy pass
Github Commit Görüntüle...
See Commints...
..
* Attempt auto-detection of supported formats
We add CN3BaseFileAccess::LoadSupportedVersions() for opt-in detection of supported formats.
Naturally this doesn't apply to 99% of files; most will still load directly.
For the few that we do implement (CN3Terrain -> CN3River/CN3Pond, CN3ShapeMgr, CN3UIBase),
we cycle through supported versions for that particular format, releasing and rewinding when
an exception is thrown (or it otherwise returns false, which is rare).
In this way we can support the old 1.098 format and the newer (explicitly marked 1.264 for now)
formats with minimal fuss.
Naturally this only extends so far; it won't be possible to support arbitrary TBL formats in this way,
as that requires struct layout changes, but for most file formats this should be sufficient.
We also restore pond behaviour, adding the additional read needed to properly parse this file,
now that we handle its versioning better.
* Simplify CN3Pond & CN3River storage and cleanup
These don't really need the full CN3BaseFileAccess support.
* Tweak file format version overrides
The only time this is necessary is when it's part of the same file
and makes sense to do so.
Additionally, it should only be done on Load().
* clang-tidy pass
Github Commit Görüntüle...
See Commints...
..