07th-mod / python-patcher

Mod Installer for the Higurashi and Umineko Games
158 stars 12 forks source link

Add option to make a copy of the game folder before patching (console arcs, but also generally) #129

Open drojf opened 3 years ago

drojf commented 3 years ago

For all games, it would be nice to make a backup of the game, in case the installation fails, or just so the user can play either copy.

The user can do this manually, but adding a simple "make a copy of the game folder" option should be reasonably easy

If a user wants to restore their original version (to re-patch or otherwise), they need to manually delete the game and then re-download, then re-install it.

This is especially important for the Console arcs, which share chapter 4.

We should remember to remind users that steam sync won't work on the duplicate copy/steam won't launch the duplicate copy, and any other gotchas with the other copy.

drojf commented 1 year ago

O: If we can make the installer copy the folder that'd be nice. I recently figured out how to add shortcuts to Steam in Python, see here: https://github.com/andOlga/steam-thcrap/blob/master/steam-thcrap.py#L74, you can more or less just copy this (it'll be less complicated since you'll be adding just one game though) O: Unfortunately this won't work with the grid extractor thingy because Steam generates fake appIDs for non-Steam games and I'm not entirely sure how those are calculated

D: and I guess mac/linux won't work unless they install that library or I figure out how to distribute the installer with that library

O: It seems to be just two files so it should be possible to just drop them in the project dir? I'm not too sure though

O: Need to make sure where the shortcuts.vdf file even is on Linux/Mac though and also if it's structured the same (mainly concerned about Exe, on Windows it's a path to the .exe enclosed in double-quotes, my guess is it just passes it to the shell so that's to avoid spaces causing issues, but idk if it works the same on other operating systems)

O: Also no damn clue how to handle Icon (but it's optional) since on Windows it fetches that from the executable itself but on Mac/Linux programs don't contain their own icons

O: You can more or less see the structure of the file just by pritning the output of vdf.binary_loads(open("path_to_file", "rb")) So I'd say if you have access to those operating systems, add a shortcut there manually and then just copy whatever it produces (omitting fields that aren't relevant such as, e.g., AllowDesktopConfig or OpenVR or whatever else is fine being kept as default)

O: Also, Steam Cloud should technically still work even when the game is elsewhere since it checks the files in the save directory which is %APPDATA%\Mangagamer, the only problem is it will have to be triggered manually, by restarting Steam, since it won't watch those files unless it can tell that the game is running. Clicking the base game in your library (not even running it, just opening its page) should also trigger cloud re-sync

See https://github.com/ValvePython/vdf

O: ftr I figured out how to calculate the app ID for non-Steam games (can be used for adding artwork if we ever do the game copying thing):

str(binascii.crc32(str.encode(Exe + AppName)) | 0x80000000)

(where Exe and AppName are the relevant fields from the shortcut in shortcuts.vdf)

drojf commented 1 year ago

Note that this issue is partially a dupe of https://github.com/07th-mod/python-patcher/issues/11