This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
New SGA API #18
Draft
ModernMAK
wants to merge
19
commits into
main
Choose a base branch
from
refactoring-sga
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
New SGA API #18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To reduce the tight coupling of 'Versioned' classes and their Unversioned base; the unversioned base no longer contains any version lookups. Instead; the APIvX protocol should be used to get/specify types that each version is expected to have This refactoring breaks alot of the old codebase; which expected most versioned types to 'figure it out' by being passed the version and the stream The new APIvX format should ensure that A) modules that want to be vX compatible define their 'version' of the vX classes (vX defines a helper to determine if a module has been properly defined as an API) A.1) While modules can be apis, the preferred method is to use APIvX objects; while following the vX module syntax format for imports B) 'Simple' to define their own arbitrary vX formats: Simply create a class with classvars and set the classes to their appropriate hook. C) Registering versions is done in a single location; before each individual class needed to update a lookup table with the versioned classes & there was only one global table (per class), meaning swapping the version contexts was impossible. Now, we still have one global lookup table; but it's easier to pass a version lookup table and avoid worrying about ensuring other tables are up to date This is kinda a rant, but this is a massive API change With tests not fully implemented for SGA, alot of functionality is broken; and the tests created need to be refactored to account for the changes
tests pass but the other archive tests should be PRd first; then cherry-picked merged into this one, and fixed for the new API
Before I was rewriting to keep versioned code together; which ill still do; but now that I see that the SGA follows a pretty straightforward layout (for v2-v9) I think I can refactor a lot of excess code out
It still really sucks; but to avoid the problem that the OFFICIAL RELIC ARCHIVE TOOL has; each `version` reimplements it's own codebase I get around this as much as I can with ABCs but it is ugly. Ranting about official Archive Viewer; admittedly, they are distributed with CoH2 (and DowIII) so as long as it works for those formats; great! But then why bother supporting past formats? Dow II (v5) is among the formats which is supported (v4 is the earliest supported according to their version-assertion logic; COH1 I assume) but the checks to support that format don't seem to line up with my own research I'd have assumed this was because the switch to the Essence Engine (over whatever DOW1 uses) but COH2 and DOW2 both use the new Essence engine; so... ? As an aside; that explains why DOW1's enumerations for FileStorageType are different. I pray this is the last time I rewrite this API; I moved away from the clunky 'make no assumptions' strategy I had done before (which was very straightforward, but a lot of boilerplate) with a simple read/write at the archive level; with unpack/pack for helpers used for serializing data . I need to get better at typing (figuring out generics of some kind) to make ArchiveABC auto-type things like Folder/File/Drive definitions and their respective pack-aware helpers. We also stop using those nifty ptr objects; as much as I liked the idea of 'slicing' a binary stream; it's annoying to debug, and only hides where a stream is pointing: perhaps using a slice which only warns/errors when reading/writing outside the bounds (allowing seeks); and will only read to the 'end of the slice'
A lot of code is 'rewritten' instead of shared between versions; but I consider this a 'feature' for the most part. I'm sure I could hack something together, but this looks much cleaner then my previous two rewrites. Unfortunately, unlike the previous rewrites, tests were extremely broken; as 'headers' are replaced by metadata or ignored (due to being redundant). Rather than fix them in this commit; I added the ability to test against file sources on the local machine; in other words, I can test against REAL data. Unfortunately, unless I build my own dataset, this won't be used in CI to avoid distributing relic's assets.
Most of them are going to be rewritten completely;
Fix setup.cfg not using find_namespace for new 'relic' namespace package
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.