07th-mod/python-patcher

Sharedasset detection using checksum can fail when switching between proton and native on second install [no fix needed?]

drojf opened this issue · 2 comments

drojf commented

For some chapters (eg. ch8), installer chooses sharedassets depending on the checksum of the original sharedassets0.assets.

Because our installer overwrites the sharedassets0.assets file, we also check the checksum of the sharedassets0.assets.backup file to see the "original" sharedassets file. This .backup file is created by our installer when you install the mod.

However, if you:

  • First install using say Proton, it will create a sharedassets0.assets.backup file from the Proton install.
  • Switch back to Native. This will overwrite the sharedassets0.assets with the Native version
  • Perform an install of the mod the first time, the install will work OK (it will overwrite the sharedassets0.assets with the mod version)
    • Because a .backup file already exists, this install won't overwrite the sharedassets0.assets.backup file
  • Now, when you perform the second install or update, the sharedassets0.assets will be the mod version, which the installer does not recognise. Also, the sharedassets0.assets.backup file is from the Proton install, which the mod also does not recognize. This will cause an install error.
drojf commented

Some ways to fix this:

  • Tell users to delete the .backup file when switching between Proton/Wine, or do it automatically in the installer.
  • If the installer detects a stock sharedassets (is there some way to do this besides keeping checksums of all stock sharedassets?), then always create a .backup file. Currently the installer will not overwrite an existing .backup file if it already exists. This way seems better, especially since the installer couldn't accidentally backup a modded sharedassets, assuming the detection works well.
drojf commented

NOTE: this might not be an issue anymore, as I believe the "sharedasset detection using SHA" is no longer required for any chapter.

Our installData.json still has sharedasset entries listed with SHA, but they can be removed in most cases. See this list of sharedasset variants for each chapter for details:

https://github.com/07th-mod/ui-editing-scripts/blob/5adde5b725ce1426b81953637b19180a81114782/build.py#L76-L137