Compare commits
No commits in common. "25ca6cf2cb9a5f862a0f363f41c4763ba57244c1" and "68a598410b74615a3cd4a4e4948661facb916ba9" have entirely different histories.
25ca6cf2cb
...
68a598410b
@ -79,8 +79,7 @@ class HSR:
|
|||||||
print(
|
print(
|
||||||
"Windows is supported officialy by the game, so no patching is needed."
|
"Windows is supported officialy by the game, so no patching is needed."
|
||||||
)
|
)
|
||||||
print("By patching you are breaking the ToS, use at your own risk.")
|
if not ask("Do you still want to patch?"):
|
||||||
if not ask("Do you want to patch the game?"):
|
|
||||||
print("Patching aborted.")
|
print("Patching aborted.")
|
||||||
return
|
return
|
||||||
print("Checking telemetry hosts...", end=" ")
|
print("Checking telemetry hosts...", end=" ")
|
||||||
@ -90,13 +89,10 @@ class HSR:
|
|||||||
print("Telemetry hosts found: ")
|
print("Telemetry hosts found: ")
|
||||||
for host in telemetry_list:
|
for host in telemetry_list:
|
||||||
print(f" - {host}")
|
print(f" - {host}")
|
||||||
print(
|
if not ask(
|
||||||
"To prevent the game from sending data about the patch, "
|
"Do you want to block these hosts? (Without blocking you can't use the patch)"
|
||||||
+ "we need to block these hosts."
|
):
|
||||||
)
|
|
||||||
if not ask("Do you want to block these hosts?"):
|
|
||||||
print("Patching aborted.")
|
print("Patching aborted.")
|
||||||
print("Please block these hosts manually then try again.")
|
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self._patcher.block_telemetry(telemetry_list=telemetry_list)
|
self._patcher.block_telemetry(telemetry_list=telemetry_list)
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
from vollerei.common.configfile import ConfigFile
|
|
||||||
from vollerei.common.telemetry import block_telemetry, check_telemetry
|
|
||||||
|
|
||||||
__all__ = ["ConfigFile", "block_telemetry", "check_telemetry"]
|
|
@ -1,15 +0,0 @@
|
|||||||
from configparser import ConfigParser
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigFile(ConfigParser):
|
|
||||||
path: Path
|
|
||||||
|
|
||||||
def __init__(self, path, **kwargs):
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
self.path = Path(path)
|
|
||||||
self.read(self.path)
|
|
||||||
|
|
||||||
def save(self):
|
|
||||||
with self.path.open("w") as f:
|
|
||||||
self.write(f)
|
|
@ -2,7 +2,6 @@ from hashlib import md5
|
|||||||
from os import PathLike
|
from os import PathLike
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from vollerei.common import ConfigFile
|
|
||||||
from vollerei.abc.launcher.game import GameABC
|
from vollerei.abc.launcher.game import GameABC
|
||||||
from vollerei.hsr.constants import MD5SUMS
|
from vollerei.hsr.constants import MD5SUMS
|
||||||
|
|
||||||
@ -90,24 +89,6 @@ class Game(GameABC):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _get_version_config(self) -> tuple[int, int, int]:
|
|
||||||
cfg_file = self._path.joinpath("config.ini")
|
|
||||||
if not cfg_file.exists():
|
|
||||||
return (0, 0, 0)
|
|
||||||
cfg = ConfigFile(cfg_file)
|
|
||||||
if "General" not in cfg.sections():
|
|
||||||
return (0, 0, 0)
|
|
||||||
if "game_version" not in cfg["General"]:
|
|
||||||
return (0, 0, 0)
|
|
||||||
version_str = cfg["General"]["game_version"]
|
|
||||||
if version_str.count(".") != 2:
|
|
||||||
return (0, 0, 0)
|
|
||||||
try:
|
|
||||||
version = tuple(int(i) for i in version_str.split("."))
|
|
||||||
except Exception:
|
|
||||||
return (0, 0, 0)
|
|
||||||
return version
|
|
||||||
|
|
||||||
def get_version(self) -> tuple[int, int, int]:
|
def get_version(self) -> tuple[int, int, int]:
|
||||||
"""
|
"""
|
||||||
Get the current installed game version.
|
Get the current installed game version.
|
||||||
@ -135,7 +116,6 @@ class Game(GameABC):
|
|||||||
version_bytes: list[list[bytes]] = [[], [], []]
|
version_bytes: list[list[bytes]] = [[], [], []]
|
||||||
version_ptr = 0
|
version_ptr = 0
|
||||||
correct = True
|
correct = True
|
||||||
try:
|
|
||||||
with self.data_folder().joinpath("data.unity3d").open("rb") as f:
|
with self.data_folder().joinpath("data.unity3d").open("rb") as f:
|
||||||
f.seek(0x7D0) # 2000 in decimal
|
f.seek(0x7D0) # 2000 in decimal
|
||||||
for byte in f.read(10000):
|
for byte in f.read(10000):
|
||||||
@ -165,10 +145,7 @@ class Game(GameABC):
|
|||||||
version_bytes[version_ptr].append(byte)
|
version_bytes[version_ptr].append(byte)
|
||||||
else:
|
else:
|
||||||
correct = False
|
correct = False
|
||||||
except Exception:
|
return (0, 0, 0)
|
||||||
pass
|
|
||||||
# Fallback to config.ini
|
|
||||||
return self._get_version_config()
|
|
||||||
|
|
||||||
def get_version_str(self) -> str:
|
def get_version_str(self) -> str:
|
||||||
"""
|
"""
|
||||||
|
@ -218,4 +218,6 @@ class Patcher(PatcherABC):
|
|||||||
Args:
|
Args:
|
||||||
telemetry_list (list[str], optional): A list of telemetry servers to block.
|
telemetry_list (list[str], optional): A list of telemetry servers to block.
|
||||||
"""
|
"""
|
||||||
|
if not telemetry_list:
|
||||||
|
telemetry_list = telemetry.check_telemetry()
|
||||||
telemetry.block_telemetry(telemetry_list)
|
telemetry.block_telemetry(telemetry_list)
|
||||||
|
Loading…
Reference in New Issue
Block a user