Fix database update crashes and sanctifying elixir artifact scanning#593
Open
syrusgreycloak wants to merge 7 commits intoAndrewthe13th:masterfrom
Open
Fix database update crashes and sanctifying elixir artifact scanning#593syrusgreycloak wants to merge 7 commits intoAndrewthe13th:masterfrom
syrusgreycloak wants to merge 7 commits intoAndrewthe13th:masterfrom
Conversation
The database updater was crashing when trying to process unreleased content (6.5.0 data) because it directly accessed the Mappings dictionary without checking if keys existed first. Changes: - UpdateCharacters: Add defensive checks for character name, skill, and constellation hashes before accessing Mappings dictionary - UpdateArtifacts: Add defensive check for artifact piece hashes - UpdateWeapons and UpdateMaterials already had proper checks This allows the updater to: - Skip unreleased content with warnings instead of crashing - Save all successfully processed released content (6.4) - Complete updates successfully even when remote data contains unreleased items Fixes issue where update would fail completely and roll back all changes when encountering missing mapping keys, leaving users stuck on outdated game data versions.
Sanctified artifacts have a purple indicator bar that shifts the visual layout. Without this fix, the scanner hangs when processing rerolled artifacts because bitmap coordinates are misaligned. Changes: - Add IsSanctified() to detect purple sanctifying indicator - Add GetSanctifyBitmap() to extract indicator region - Update GetSubstatsBitmap() with 0.0520 Y-shift for sanctified artifacts - Update GetLevelBitmap() with 0.0520 Y-shift for sanctified artifacts - Add GetArtifactLockedBitmap() with 0.0520 Y-shift for sanctified artifacts Based on fix from Sirielia/Inventory_Kamera fork, adapted for 16:9. Fixes hang/crash when scanning artifacts created with sanctifying elixir.
OCR worker threads were hanging indefinitely when processing problematic artifacts, causing the entire scan to freeze. This adds timeouts and additional debug logging to diagnose and recover from hangs. Changes: - Add 30-second timeout to artifact OCR processing - Add 30-second timeout to weapon OCR processing - Skip hung artifacts with error message instead of freezing - Add debug logging to IsSanctified() to show color detection - Add debug logging to bitmap extraction steps When timeout occurs, the artifact/weapon is skipped and scanning continues with remaining items. This prevents one problematic item from blocking the entire scan. Addresses issue where scanner hangs on specific artifacts during OCR processing, particularly during substat parsing.
The sanctified purple indicator varies in brightness from dark purple RGB(138,107,197) to light purple RGB(220,192,255). The exact color matching with tolerance=10 was failing on light purple variants, causing wrong coordinates and Tesseract hangs. Changes: - Replace exact color matching with purple range detection (B>R>G pattern) - Check Blue channel > 150 to ensure it's purple-ish - Switch from Task.Wait() to Task.WhenAny() for more reliable timeout - Add debug logging for OCR start/completion This should detect all purple variants and properly apply the coordinate shift for sanctified artifacts, preventing OCR hangs on malformed regions.
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.
Summary
This PR fixes critical issues that prevent the scanner from working with current Genshin Impact versions (6.4+):
Database Update Crash Fix
Sanctifying Elixir Artifact Support
OCR Timeout Improvements
Debug Logging Enhancements
Testing
Compatibility
🤖 Generated with Claude Code