fix(genshin): voicepack detection
This commit is contained in:
@ -281,7 +281,9 @@ class VoicepackUpdate(Command):
|
|||||||
progress = utils.ProgressIndicator(self)
|
progress = utils.ProgressIndicator(self)
|
||||||
progress.start("Checking for updates... ")
|
progress.start("Checking for updates... ")
|
||||||
try:
|
try:
|
||||||
update_diff: resource.Patch | None = State.game.get_update(pre_download=pre_download)
|
update_diff: resource.Patch | None = State.game.get_update(
|
||||||
|
pre_download=pre_download
|
||||||
|
)
|
||||||
game_info = State.game.get_remote_game(pre_download=pre_download)
|
game_info = State.game.get_remote_game(pre_download=pre_download)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
progress.finish(
|
progress.finish(
|
||||||
|
|||||||
@ -46,7 +46,9 @@ def apply_update_archive(
|
|||||||
if isinstance(archive, py7zr.SevenZipFile):
|
if isinstance(archive, py7zr.SevenZipFile):
|
||||||
archive.reset()
|
archive.reset()
|
||||||
|
|
||||||
def extract_files(archive: py7zr.SevenZipFile | zipfile.ZipFile, files, path: PathLike):
|
def extract_files(
|
||||||
|
archive: py7zr.SevenZipFile | zipfile.ZipFile, files, path: PathLike
|
||||||
|
):
|
||||||
if isinstance(archive, py7zr.SevenZipFile):
|
if isinstance(archive, py7zr.SevenZipFile):
|
||||||
# .7z archive
|
# .7z archive
|
||||||
archive.extract(path, files)
|
archive.extract(path, files)
|
||||||
|
|||||||
@ -272,12 +272,11 @@ class Game(GameABC):
|
|||||||
"""
|
"""
|
||||||
if not self.is_installed():
|
if not self.is_installed():
|
||||||
raise GameNotInstalledError("Game is not installed.")
|
raise GameNotInstalledError("Game is not installed.")
|
||||||
|
audio_assets = self.data_folder().joinpath("StreamingAssets/AudioAssets/")
|
||||||
|
if audio_assets.joinpath("AudioPackage").is_dir():
|
||||||
|
audio_assets = audio_assets.joinpath("AudioPackage")
|
||||||
voicepacks = []
|
voicepacks = []
|
||||||
for child in (
|
for child in audio_assets.iterdir():
|
||||||
self.data_folder()
|
|
||||||
.joinpath("StreamingAssets/AudioAssets/AudioPackage/")
|
|
||||||
.iterdir()
|
|
||||||
):
|
|
||||||
if child.resolve().is_dir():
|
if child.resolve().is_dir():
|
||||||
try:
|
try:
|
||||||
voicepacks.append(VoicePackLanguage[child.name])
|
voicepacks.append(VoicePackLanguage[child.name])
|
||||||
|
|||||||
@ -224,7 +224,12 @@ class Game(GameABC):
|
|||||||
for byte in f.read(10000):
|
for byte in f.read(10000):
|
||||||
match byte:
|
match byte:
|
||||||
case 0:
|
case 0:
|
||||||
if correct and len(version_bytes[0]) > 0 and len(version_bytes[1]) > 0 and len(version_bytes[2]) > 0:
|
if (
|
||||||
|
correct
|
||||||
|
and len(version_bytes[0]) > 0
|
||||||
|
and len(version_bytes[1]) > 0
|
||||||
|
and len(version_bytes[2]) > 0
|
||||||
|
):
|
||||||
found_version = tuple(
|
found_version = tuple(
|
||||||
bytes_to_int(i) for i in version_bytes
|
bytes_to_int(i) for i in version_bytes
|
||||||
)
|
)
|
||||||
@ -232,7 +237,7 @@ class Game(GameABC):
|
|||||||
version_bytes = [[], [], []]
|
version_bytes = [[], [], []]
|
||||||
version_ptr = 0
|
version_ptr = 0
|
||||||
correct = True
|
correct = True
|
||||||
case b'.':
|
case b".":
|
||||||
version_ptr += 1
|
version_ptr += 1
|
||||||
if version_ptr > 2:
|
if version_ptr > 2:
|
||||||
correct = False
|
correct = False
|
||||||
|
|||||||
Reference in New Issue
Block a user