WIP game patcher

Now worthless can patch the game using xdelta3-python
This commit is contained in:
2022-02-18 20:09:03 +07:00
parent 6286c080f8
commit 5a492c912c
4 changed files with 68 additions and 14 deletions

View File

@ -17,7 +17,7 @@ class UI:
self._gamedir = gamedir
self._launcher = Launcher(gamedir)
self._installer = Installer(gamedir, data_dir=tempdir)
self._patcher = Patcher(gamedir)
self._patcher = Patcher(gamedir, data_dir=tempdir)
def _ask(self, question):
if self._noconfirm:
@ -63,6 +63,17 @@ class UI:
self._patcher.revert_patch(True)
print("Patches reverted.")
def patch_game(self, login_fix: bool = False):
print("NOTE: Hereby you are violating the game's Terms of Service!")
print("Do not patch the game if you don't know what you are doing!")
if not self._ask("Do you want to patch the game? (This will overwrite your game files!)"):
print("Aborting patch process.")
return
print("Patching game...")
self._patcher.apply_patch(login_fix)
print("Game patched.")
print("Please refrain from sharing this project to public especially official channels, thank you.")
def install_from_file(self, filepath):
gamever = self._installer.get_game_version()
print("Archive game version: " + self._installer.get_game_archive_version(filepath))
@ -88,7 +99,7 @@ class UI:
print("Aborting game installation process.")
return
print("Downloading full game (This will take a long time)...")
asyncio.run(self._installer.download_full_game())
asyncio.run(self._installer.download_full_game(forced))
print("Installing game...")
self._install_from_archive(self._installer.temp_path.joinpath(res_info.game.latest.name))
@ -174,6 +185,8 @@ def main():
else update from archive)")
parser.add_argument("-Sp", "--patch", action="store_true",
help="Patch the game (if not already patched, else do nothing)")
parser.add_argument("--login-fix", action="store_true",
help="Patch the game to fix login issues (if not already patched, else do nothing)")
parser.add_argument("-Sy", "--update", action="store", type=str,
help="Update the game and specified voiceover pack only (or install if not found)")
parser.add_argument("-Sv", "--update-voiceover", action="store", type=str,
@ -226,6 +239,9 @@ def main():
if args.install_voiceover_from_file:
ui.install_voiceover_from_file(args.install_voiceover_from_file)
if args.patch:
ui.patch_game(args.login_fix)
if args.remove_patch:
ui.revert_patch()