Don't rely on xdelta3 python module
Don't crash if xdelta3 module is not present, and add the ability to download game & voicepack in CLI Bump to 1.2.8
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
import xdelta3
|
||||
import tarfile
|
||||
import appdirs
|
||||
from pathlib import Path
|
||||
@ -12,6 +10,12 @@ from worthless import constants
|
||||
from worthless.launcher import Launcher
|
||||
from worthless.installer import Installer
|
||||
|
||||
NO_XDELTA3_MODULE = False
|
||||
try:
|
||||
import xdelta3
|
||||
except ImportError:
|
||||
NO_XDELTA3_MODULE = True
|
||||
|
||||
|
||||
class Patcher:
|
||||
def __init__(self, gamedir=Path.cwd(), data_dir: str | Path = None, patch_url: str = None, overseas=True):
|
||||
@ -147,7 +151,7 @@ class Patcher:
|
||||
f.write(patched_xlua_bytes)
|
||||
|
||||
def apply_xlua_patch(self, fallback=True):
|
||||
if fallback:
|
||||
if NO_XDELTA3_MODULE or fallback:
|
||||
asyncio.run(self._patch_xlua_fallback())
|
||||
return
|
||||
self._patch_xlua()
|
||||
@ -161,7 +165,7 @@ class Patcher:
|
||||
:return: None
|
||||
"""
|
||||
# Patch UnityPlayer.dll
|
||||
if fallback:
|
||||
if NO_XDELTA3_MODULE or fallback:
|
||||
asyncio.run(self._patch_unityplayer_fallback())
|
||||
else:
|
||||
self._patch_unityplayer()
|
||||
|
||||
Reference in New Issue
Block a user