Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to to bypass container hash checks #5

Merged
merged 2 commits into from
Mar 25, 2023
Merged

Conversation

NeryK
Copy link
Owner

@NeryK NeryK commented Mar 25, 2023

A user has reported that his container sometimes triggered errors.
container.zip

For each file listed in the container file, I had noticed that the obfuscated name (looks like a hash) is repeated twice. So I had a consistency check in place. This check seems to fail while the game is running, or maybe cloud sync is running.

py -m sr_u2s.container --input-container=C:\Temp\container.253
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "F:\src\snowrunner-uwp2steam\sr_u2s\container.py", line 45, in <module>
    save_list = load_container(args.input_container, args.bypass_hash_check)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\src\snowrunner-uwp2steam\sr_u2s\container.py", line 36, in load_container
    save_files.append(parse_file_bytes(containerfile.read(160), bypass_hash_check))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\src\snowrunner-uwp2steam\sr_u2s\container.py", line 23, in parse_file_bytes
    raise ValueError(f"Inconsistent hash for {filepath}")
ValueError: Inconsistent hash for CommonSslSave

The value of the first obfuscated name is either zeroes or another value entirely, while the second always seems to match an existing file. With that in mind I added an option to bypass the consistency check and always use the second value.

py -m sr_u2s.container --input-container=C:\Temp\container.253 --bypass-hash-check
Warning: hash check failed for CommonSslSave
Warning: hash check failed for CompleteSave
Warning: hash check failed for achievements
Warning: hash check failed for sts_level_ru_02_02
Warning: hash check failed for user_profile
Warning: hash check failed for user_social_data
[('CommonSslSave', '1174797E34D8447ABA078411C1FB1DC3'), ('CompleteSave', '0BD5CE875B0B45D89E2BD72E80906436'), ('achievements', 'F1901A80B2EF4FA2BBC1FC2992515CBB'), ('fog_level_ru_02_02', '2F1F7A62A43F4E11B47D4E946F6F7349'), ('fog_level_us_01_01', 'C9CE106B310B4B4BBBFBE5B00DCDC180'), ('fog_level_us_01_02', '06950D4EFE174402A4C1E72777B87F26'), ('fog_level_us_01_03', '951E59F097A3421699C994B10459A326'), ('fog_level_us_01_04_new', 'A47D0A68E7C0495889ED641AF78CF861'), ('fog_level_us_02_01', '8E31784B1F934080968ABB216E8D1293'), ('sts_level_ru_02_02', 'E7D5A83838AF4D81A901BA61420DF1F9'), ('sts_level_us_01_01', 'B01207F5D51348F59BCC69B0A2F39682'), ('sts_level_us_01_02', '10A9EABC456B4362A448B4251A4D9714'), ('sts_level_us_01_03', '7C3E626ABF8D42FB8AEC29E2D5E6098F'), ('sts_level_us_01_04_new', '65FC369EAF9148B6B792060532186CC8'), ('sts_level_us_02_01', '2B7FEC51F8B5491C99436636C82C8FC5'), ('user_profile', '300B953967F44851B52CA8BAE03526FC'), ('user_settings', '3A0D7EB7E0E3482FB7A4AEE48FFB36B8'), ('user_social_data', '664DC6E2422A44F88703ECC90963373B'), ('video', '814868237E2D4D8F9DD0EE29652625AB')]

@NeryK NeryK merged commit 16c9319 into master Mar 25, 2023
@NeryK NeryK deleted the feature-missinghash branch March 25, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant