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",
|
"log-upload.mihoyo.com",
|
||||||
"public-data-api.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 enum import Enum
|
||||||
from shutil import copy2
|
from shutil import copy2
|
||||||
from distutils.version import StrictVersion
|
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.hsr.launcher.game import Game, GameChannel
|
||||||
from vollerei.utils import download_and_extract, Git, Xdelta3
|
from vollerei.utils import download_and_extract, Git, Xdelta3
|
||||||
from vollerei.paths import tools_data_path
|
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):
|
class PatchType(Enum):
|
||||||
@ -24,6 +23,10 @@ class PatchType(Enum):
|
|||||||
|
|
||||||
|
|
||||||
class Patcher(PatcherABC):
|
class Patcher(PatcherABC):
|
||||||
|
"""
|
||||||
|
Patch helper for HSR.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, patch_type: PatchType = PatchType.Jadeite):
|
def __init__(self, patch_type: PatchType = PatchType.Jadeite):
|
||||||
self._patch_type: PatchType = patch_type
|
self._patch_type: PatchType = patch_type
|
||||||
self._path = tools_data_path.joinpath("patcher")
|
self._path = tools_data_path.joinpath("patcher")
|
||||||
@ -45,8 +48,9 @@ class Patcher(PatcherABC):
|
|||||||
self._git.pull_or_clone(astra_repo, self._astra)
|
self._git.pull_or_clone(astra_repo, self._astra)
|
||||||
|
|
||||||
def _update_jadeite(self):
|
def _update_jadeite(self):
|
||||||
file = self._git.get_latest_release_dl(jadeite_repo)[0]
|
release_info = self._git.get_latest_release(jadeite_repo)
|
||||||
file_version = Path(file).stem[1:]
|
file = self._git.get_latest_release_dl(release_info)[0]
|
||||||
|
file_version = release_info["tag_name"][1:] # Remove "v" prefix
|
||||||
current_version = None
|
current_version = None
|
||||||
if self._jadeite.joinpath("version").exists():
|
if self._jadeite.joinpath("version").exists():
|
||||||
with open(self._jadeite.joinpath("version"), "r") as f:
|
with open(self._jadeite.joinpath("version"), "r") as f:
|
||||||
@ -121,3 +125,6 @@ class Patcher(PatcherABC):
|
|||||||
self._patch_astra(game)
|
self._patch_astra(game)
|
||||||
case PatchType.Jadeite:
|
case PatchType.Jadeite:
|
||||||
return self._patch_jadeite()
|
return self._patch_jadeite()
|
||||||
|
|
||||||
|
def unpatch_game(self, game: Game):
|
||||||
|
pass
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from os import PathLike
|
||||||
from platformdirs import PlatformDirs
|
from platformdirs import PlatformDirs
|
||||||
|
|
||||||
|
|
||||||
base_paths = PlatformDirs("vollerei", "tretrauit", roaming=True)
|
base_paths = PlatformDirs("vollerei", "tretrauit", roaming=True)
|
||||||
tools_data_path: Path = None
|
cache_path = base_paths.site_cache_path
|
||||||
tools_cache_path: Path = None
|
data_path = base_paths.site_data_path
|
||||||
launcher_cache_path: Path = None
|
tools_data_path = data_path.joinpath("tools")
|
||||||
utils_cache_path: Path = None
|
tools_cache_path = cache_path.joinpath("tools")
|
||||||
|
launcher_cache_path = cache_path.joinpath("launcher")
|
||||||
|
utils_cache_path = cache_path.joinpath("utils")
|
||||||
|
|
||||||
|
|
||||||
def init_paths():
|
def change_base_path(path: PathLike):
|
||||||
global tools_data_path, tools_cache_path, launcher_cache_path, utils_cache_path
|
path = Path(path)
|
||||||
tools_data_path = base_paths.site_data_path.joinpath("tools")
|
global base_paths, tools_data_path, tools_cache_path, launcher_cache_path, utils_cache_path, cache_path, data_path
|
||||||
tools_cache_path = base_paths.site_cache_path.joinpath("tools")
|
cache_path = path.joinpath("cache")
|
||||||
launcher_cache_path = base_paths.site_cache_path.joinpath("launcher")
|
data_path = path.joinpath("data")
|
||||||
utils_cache_path = base_paths.site_cache_path.joinpath("utils")
|
tools_data_path = data_path.joinpath("tools")
|
||||||
tools_data_path.mkdir(parents=True, exist_ok=True)
|
tools_cache_path = cache_path.joinpath("tools")
|
||||||
tools_cache_path.mkdir(parents=True, exist_ok=True)
|
launcher_cache_path = cache_path.joinpath("launcher")
|
||||||
launcher_cache_path.mkdir(parents=True, exist_ok=True)
|
utils_cache_path = cache_path.joinpath("utils")
|
||||||
utils_cache_path.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user