fix: whatever random thing I throw into this commit
To fix bugs ofc
This commit is contained in:
parent
426062c20b
commit
abbf94b21a
@ -8,7 +8,3 @@ telemetry_hosts = [
|
||||
"log-upload.mihoyo.com",
|
||||
"public-data-api.mihoyo.com",
|
||||
]
|
||||
|
||||
# HSR
|
||||
astra_repo = "https://notabug.org/mkrsym1/astra"
|
||||
jadeite_repo = "https://codeberg.org/mkrsym1/jadeite/"
|
||||
|
@ -11,3 +11,6 @@ md5sums = {
|
||||
},
|
||||
}
|
||||
}
|
||||
# Patches
|
||||
astra_repo = "https://notabug.org/mkrsym1/astra"
|
||||
jadeite_repo = "https://codeberg.org/mkrsym1/jadeite/"
|
||||
|
@ -1,4 +1,3 @@
|
||||
from pathlib import Path
|
||||
from enum import Enum
|
||||
from shutil import copy2
|
||||
from distutils.version import StrictVersion
|
||||
@ -8,7 +7,7 @@ from vollerei.exceptions.patcher import VersionNotSupportedError
|
||||
from vollerei.hsr.launcher.game import Game, GameChannel
|
||||
from vollerei.utils import download_and_extract, Git, Xdelta3
|
||||
from vollerei.paths import tools_data_path
|
||||
from vollerei.constants import astra_repo, jadeite_repo
|
||||
from vollerei.hsr.constants import astra_repo, jadeite_repo
|
||||
|
||||
|
||||
class PatchType(Enum):
|
||||
@ -24,6 +23,10 @@ class PatchType(Enum):
|
||||
|
||||
|
||||
class Patcher(PatcherABC):
|
||||
"""
|
||||
Patch helper for HSR.
|
||||
"""
|
||||
|
||||
def __init__(self, patch_type: PatchType = PatchType.Jadeite):
|
||||
self._patch_type: PatchType = patch_type
|
||||
self._path = tools_data_path.joinpath("patcher")
|
||||
@ -45,8 +48,9 @@ class Patcher(PatcherABC):
|
||||
self._git.pull_or_clone(astra_repo, self._astra)
|
||||
|
||||
def _update_jadeite(self):
|
||||
file = self._git.get_latest_release_dl(jadeite_repo)[0]
|
||||
file_version = Path(file).stem[1:]
|
||||
release_info = self._git.get_latest_release(jadeite_repo)
|
||||
file = self._git.get_latest_release_dl(release_info)[0]
|
||||
file_version = release_info["tag_name"][1:] # Remove "v" prefix
|
||||
current_version = None
|
||||
if self._jadeite.joinpath("version").exists():
|
||||
with open(self._jadeite.joinpath("version"), "r") as f:
|
||||
@ -121,3 +125,6 @@ class Patcher(PatcherABC):
|
||||
self._patch_astra(game)
|
||||
case PatchType.Jadeite:
|
||||
return self._patch_jadeite()
|
||||
|
||||
def unpatch_game(self, game: Game):
|
||||
pass
|
||||
|
@ -1,21 +1,23 @@
|
||||
from pathlib import Path
|
||||
from os import PathLike
|
||||
from platformdirs import PlatformDirs
|
||||
|
||||
|
||||
base_paths = PlatformDirs("vollerei", "tretrauit", roaming=True)
|
||||
tools_data_path: Path = None
|
||||
tools_cache_path: Path = None
|
||||
launcher_cache_path: Path = None
|
||||
utils_cache_path: Path = None
|
||||
cache_path = base_paths.site_cache_path
|
||||
data_path = base_paths.site_data_path
|
||||
tools_data_path = data_path.joinpath("tools")
|
||||
tools_cache_path = cache_path.joinpath("tools")
|
||||
launcher_cache_path = cache_path.joinpath("launcher")
|
||||
utils_cache_path = cache_path.joinpath("utils")
|
||||
|
||||
|
||||
def init_paths():
|
||||
global tools_data_path, tools_cache_path, launcher_cache_path, utils_cache_path
|
||||
tools_data_path = base_paths.site_data_path.joinpath("tools")
|
||||
tools_cache_path = base_paths.site_cache_path.joinpath("tools")
|
||||
launcher_cache_path = base_paths.site_cache_path.joinpath("launcher")
|
||||
utils_cache_path = base_paths.site_cache_path.joinpath("utils")
|
||||
tools_data_path.mkdir(parents=True, exist_ok=True)
|
||||
tools_cache_path.mkdir(parents=True, exist_ok=True)
|
||||
launcher_cache_path.mkdir(parents=True, exist_ok=True)
|
||||
utils_cache_path.mkdir(parents=True, exist_ok=True)
|
||||
def change_base_path(path: PathLike):
|
||||
path = Path(path)
|
||||
global base_paths, tools_data_path, tools_cache_path, launcher_cache_path, utils_cache_path, cache_path, data_path
|
||||
cache_path = path.joinpath("cache")
|
||||
data_path = path.joinpath("data")
|
||||
tools_data_path = data_path.joinpath("tools")
|
||||
tools_cache_path = cache_path.joinpath("tools")
|
||||
launcher_cache_path = cache_path.joinpath("launcher")
|
||||
utils_cache_path = cache_path.joinpath("utils")
|
||||
|
Loading…
Reference in New Issue
Block a user