diff --git a/vollerei/cli/hsr.py b/vollerei/cli/hsr.py
index 270ec55..a04261c 100644
--- a/vollerei/cli/hsr.py
+++ b/vollerei/cli/hsr.py
@@ -1,5 +1,6 @@
from cleo.commands.command import Command
from cleo.helpers import option, argument
+from copy import deepcopy
from platform import system
from vollerei.hsr.launcher.enums import GameChannel
from vollerei.cli import utils
@@ -209,6 +210,53 @@ class PatchInstallCommand(Command):
self.astra()
+PatchCommand = deepcopy(PatchInstallCommand)
+PatchCommand.name = "hsr patch"
+
+
+class PatchTelemetryCommand(Command):
+ name = "hsr patch telemetry"
+ description = "Checks for telemetry hosts and block them."
+ options = default_options
+
+ def handle(self):
+ progress = utils.ProgressIndicator(self)
+ progress.start("Checking telemetry hosts... ")
+ telemetry_list = patcher.check_telemetry()
+ if telemetry_list:
+ progress.finish("Telemetry hosts were found.")
+ self.line("Below is the list of telemetry hosts that need to be blocked:")
+ print()
+ for host in telemetry_list:
+ self.line(f"{host}")
+ print()
+ self.line(
+ "To prevent the game from sending data about the patch, "
+ + "we need to block these hosts."
+ )
+ if not self.confirm("Do you want to block them?"):
+ self.line("Patching aborted.")
+ self.line(
+ "Please block these hosts manually then try again."
+ )
+ return
+ try:
+ patcher.block_telemetry(telemetry_list=telemetry_list)
+ except Exception as e:
+ self.line_error(
+ f"Couldn't block telemetry hosts: {e.__context__}"
+ )
+ # There's a good reason for this.
+ if system() != "Windows":
+ self.line(
+ "Cannot continue, please block them manually then try again."
+ )
+ return
+ self.line("Continuing anyway...")
+ else:
+ progress.finish("No telemetry hosts found.")
+
+
class GetVersionCommand(Command):
name = "hsr version"
description = "Gets the local game version"
@@ -338,9 +386,11 @@ class ApplyUpdateArchive(Command):
commands = [
ApplyUpdateArchive,
- UpdateCommand,
+ GetVersionCommand,
+ PatchCommand,
+ PatchInstallCommand,
+ PatchTelemetryCommand,
PatchTypeCommand,
UpdatePatchCommand,
- PatchInstallCommand,
- GetVersionCommand,
+ UpdateCommand,
]
diff --git a/vollerei/common/functions.py b/vollerei/common/functions.py
index b2ff44e..27f0360 100644
--- a/vollerei/common/functions.py
+++ b/vollerei/common/functions.py
@@ -69,8 +69,15 @@ def apply_update_archive(
try:
_hdiff.patch_file(file, file.with_suffix(""), patchpath)
except HPatchZPatchError:
- # Let the game download the file.
- file.rename(file.with_suffix(""))
+ if auto_repair:
+ try:
+ game.repair_file(game.path.joinpath(file.with_suffix("")))
+ except Exception:
+ # Let the game download the file.
+ file.rename(file.with_suffix(""))
+ else:
+ # Let the game download the file.
+ file.rename(file.with_suffix(""))
return
finally:
patchpath.unlink()