fix: F&C Soreiyu MCG v200 img dec #126
Merged
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.
Target game: それいゆ -PREMIE'RE- (PC) https://vndb.org/v5130
Problem: The compressed file contains both v101 and v200 versions of the image, and the v200 version’s content cannot be decoded (occasionally it can be successfully decoded using a tricky method, once).
Analysis: In the UnpackV200 method, the m_key input is usually 0. If the
Properties.Settings.Default.MCGLastKeyhas not been selected beforehand, this value will be 0, which equals m_key. This causes the method to exit directly during the first loop and throw an exception. If MCGLastKey has been selected or the v101 version of the image has been decoded, the loop will trigger an exit condition after a few iterations with the previous key value and throw an exception.Solution: Before attempting the key, first try using MCGLastKey, as both formats in this game share the same key. If successful, the process can return normally. If MCGLastKey is 0 and fails, then continue trying with m_key=1. If MCGLastKey is not 0 and still fails… does this situation even exist? In cases where the real key is greater than MCGLastKey, the issue cannot be properly handled. It is recommended to restart the process.