feat: implement filename lookup in database (#3)#5
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
danielsreichenbach
force-pushed
the
feat/listfile-database
branch
from
June 29, 2025 04:09
8663000 to
5c688b3
Compare
Implement persistent storage for MPQ filename hash lookups to improve file identification and resolution across archives. The database stores both traditional MPQ hashes (hash_a, hash_b) and HET hashes for modern formats. Key features: - SQLite-based persistent storage in user data directory - Support for both MPQ and HET hash formats (40/48/56/64 bit) - Import functionality for listfiles, archives, and directory scanning - Database lookup integration in archive listing operations - CLI commands for database management (status, import, analyze, etc.) The database significantly improves the ability to identify files in MPQ archives that don't include internal listfiles, by building a comprehensive hash-to-filename mapping from various sources.
- Remove duplicate BLP parsing code (491 lines) from wow-m2 - Add wow-blp v0.2.0 as dependency - Re-export BlpImage as BlpTexture for backwards compatibility - Update documentation to reflect BLP support from wow-blp crate - Update CHANGELOG files to document the refactoring BREAKING CHANGE: None - maintains API compatibility through re-export
danielsreichenbach
force-pushed
the
feat/listfile-database
branch
from
July 27, 2025 04:11
5c688b3 to
66d9390
Compare
Update m2.rs to use load_blp from wow-blp::parser instead of the removed BlpTexture::load method. This fixes the compilation error after wow-m2 switched to using wow-blp as a dependency.
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 implements a SQLite database for persistent MPQ filename hash storage and resolution, as suggested in the feature request. The database enables filename lookups even when archives lack internal listfiles.
Summary
wow-mpqfor storing filename-to-hash mappingsmpq dbsubcommand with comprehensive database management featuresType of Change
Changes Made
Core Database Module (
file-formats/archives/wow-mpq/src/database/)Archive Integration
MutableArchivefor database operationsrecord_listfile_to_db()method for automatic listfile importlist()method with optional database lookups via--use-dbflagCLI Enhancements (
warcraft-rs/src/commands/mpq.rs)mpq dbsubcommand with operations:status: Display database statistics and healthimport: Import filenames from listfiles, archives, or directoriesanalyze: Scan MPQ archives and record their filenameslookup: Calculate and display hash values for a filenameexport: Export database contents to listfile formatlist: Browse database entries with filtering--use-dband--record-to-dbflags tompq listcommandDependencies
rusqlite(v0.32) for SQLite database supportdirectoriesfor platform-specific data directory resolutionRelated Issues
Fixes #3
Testing
Test Cases Added/Modified
Test Results
Manual testing performed with various MPQ archives:
Tested On
WoW Versions Tested
Quality Assurance
Code Quality
Required Checks
cargo fmt --all- Code is formattedcargo clippy --all-targets --all-features- No clippy warningscargo test --all-features- All tests passcargo test --no-default-features- Tests pass without featurescargo deny check- No security/license issuesCompatibility
Documentation
docs/Benchmarks
Performance Impact
The database is optional and only used when explicitly requested, so there's no performance impact on existing operations.
Breaking Changes
None - all database functionality is additive and opt-in.
Security Considerations
The database is stored in the user's local data directory with appropriate permissions.
Additional Context
Dependencies
rusqlitev0.32 - SQLite database supportdirectoriesv5.0 - Platform-specific data directory resolutionKnown Limitations
Usage Examples
Reviewer Notes
Areas of Focus
Questions for Reviewers
By submitting this PR, I confirm that: