Delegate archive extraction to GameArchiveHandler when built-in archive support is unavailable#20
Open
LegendMaster03 wants to merge 6 commits intoModOrganizer2:masterfrom
Open
Delegate archive extraction to GameArchiveHandler when built-in archive support is unavailable#20LegendMaster03 wants to merge 6 commits intoModOrganizer2:masterfrom
LegendMaster03 wants to merge 6 commits intoModOrganizer2:masterfrom
Conversation
Introduce a dispatch layer to delegate archive extraction to game-provided handlers while falling back to bsatk for .bsa/.ba2 files. Adds archivehandlerdispatch.{h,cpp} and a temporary local GameArchiveHandler shim (disabled by default via macro until upstream uibase support exists). BsaExtractor was updated to use the dispatch: it now chooses between extractWithGameHandler and the existing bsatk extraction path. CMakeLists were updated to include the new source and enable tests; tests using GoogleTest for archive dispatch were added under tests/. README updated with maintainer notes and vcpkg.json now includes gtest. This change enables pluggable archive formats and adds unit coverage for the dispatch logic.
Remove the extractor-local GameArchiveHandler shim and switch to the canonical uibase feature lookup. Update archivehandlerdispatch to return the game feature directly, delete the local gamearchivehandler.h, and adapt bsaextractor to the new progress callback (qint64 current, qint64 total): show archive-level progress, compute percent with std::clamp, and adjust the lambda and progress label. README updated to document the delegated progress callback and note the expectation that the uibase API is available.
Delay registration of the mod install hook to avoid early-startup initialization hazards by scheduling tryRegisterInstallHook() via QTimer (2s). Add BSA_EXTRACTOR_DISABLE_INSTALL_HOOK env var to opt out, introduce tryRegisterInstallHook() to safely obtain modList and register the onModInstalled callback, and track registration with m_InstallHookRegistered. Resolve installed mods by name on the Qt event loop (QueuedConnection) to avoid stale pointers and add defensive null checks and warning logs. Add necessary includes (QTimer, QtDebug), update translation locations, and add mo2-uibase to test dependencies.
Add support for using MO2's built-in DataArchives feature when available and add a flag to include built-in archive patterns when scanning a directory. Introduces canUseBuiltInArchiveTools() and includes the uibase/dataarchives header; changes findExtractableArchives() to accept an includeBuiltInArchives bool and updates callers in BsaExtractor and tests accordingly. Also guards BsaExtractor initialization to avoid registering when neither built-in tools nor a game handler are present, updates CMake to optionally add uibase include path, updates translations (line shifts) and expands .gitignore with local/build entries. Note: API change to findExtractableArchives requires updating callers.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR updates modorganizer-bsa_extractor so archive extraction can be delegated to a game-provided GameArchiveHandler when the active game does not expose MO2’s built-in DataArchives capability.
Behavior after this change:
Why:
Implementation notes:
Tested with: