2022-12-06 08:09:17 +13:00
|
|
|
from dataclasses import dataclass, field
|
2022-08-12 22:17:53 +12:00
|
|
|
from enum import IntEnum
|
2023-12-14 02:00:36 +13:00
|
|
|
from typing import List, Optional, Dict
|
2022-07-11 04:32:42 +12:00
|
|
|
|
2022-10-27 14:00:48 +13:00
|
|
|
from rare.lgndr.glue.monkeys import (
|
2022-08-12 22:17:53 +12:00
|
|
|
LgndrIndirectStatus,
|
2023-12-14 02:00:36 +13:00
|
|
|
GetBooleanChoiceProtocol,
|
|
|
|
SdlPromptProtocol,
|
|
|
|
VerifyStdoutProtocol,
|
|
|
|
UiUpdateProtocol,
|
2023-12-11 09:43:31 +13:00
|
|
|
get_boolean_choice_factory,
|
|
|
|
sdl_prompt_factory,
|
|
|
|
verify_stdout_factory,
|
|
|
|
ui_update_factory,
|
2022-12-06 08:09:17 +13:00
|
|
|
DLManagerSignals,
|
2022-08-12 22:17:53 +12:00
|
|
|
)
|
2022-07-11 22:22:17 +12:00
|
|
|
|
2022-07-12 05:11:34 +12:00
|
|
|
"""
|
2022-07-11 04:32:42 +12:00
|
|
|
@dataclass(kw_only=True)
|
|
|
|
class LgndrCommonArgs:
|
|
|
|
# keep this here for future reference
|
|
|
|
# when we move to 3.10 we can use 'kw_only' to do dataclass inheritance
|
|
|
|
app_name: str
|
|
|
|
platform: str = "Windows"
|
|
|
|
yes: bool = False
|
2022-07-12 05:11:34 +12:00
|
|
|
"""
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrImportGameArgs:
|
|
|
|
app_path: str
|
|
|
|
app_name: str
|
|
|
|
platform: str = "Windows"
|
|
|
|
disable_check: bool = False
|
|
|
|
skip_dlcs: bool = False
|
|
|
|
with_dlcs: bool = False
|
|
|
|
yes: bool = False
|
2022-07-11 22:22:17 +12:00
|
|
|
# Rare: Extra arguments
|
2022-12-06 08:09:17 +13:00
|
|
|
indirect_status: LgndrIndirectStatus = field(default_factory=LgndrIndirectStatus)
|
2023-12-14 02:00:36 +13:00
|
|
|
get_boolean_choice: GetBooleanChoiceProtocol = get_boolean_choice_factory(True)
|
2022-07-16 06:00:52 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrUninstallGameArgs:
|
|
|
|
app_name: str
|
|
|
|
keep_files: bool = False
|
2023-11-30 23:52:24 +13:00
|
|
|
skip_uninstaller: bool = False
|
2022-07-16 06:00:52 +12:00
|
|
|
yes: bool = False
|
|
|
|
# Rare: Extra arguments
|
2022-12-06 08:09:17 +13:00
|
|
|
indirect_status: LgndrIndirectStatus = field(default_factory=LgndrIndirectStatus)
|
2023-12-14 02:00:36 +13:00
|
|
|
get_boolean_choice_main: GetBooleanChoiceProtocol = get_boolean_choice_factory(True)
|
|
|
|
get_boolean_choice_handler: GetBooleanChoiceProtocol = get_boolean_choice_factory(True)
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrVerifyGameArgs:
|
|
|
|
app_name: str
|
2022-07-11 07:23:53 +12:00
|
|
|
# Rare: Extra arguments
|
2022-12-06 08:09:17 +13:00
|
|
|
indirect_status: LgndrIndirectStatus = field(default_factory=LgndrIndirectStatus)
|
2023-12-14 02:00:36 +13:00
|
|
|
verify_stdout: VerifyStdoutProtocol = verify_stdout_factory(None)
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrInstallGameArgs:
|
|
|
|
app_name: str
|
|
|
|
base_path: str = ""
|
|
|
|
shared_memory: int = 0
|
|
|
|
max_workers: int = 0
|
|
|
|
force: bool = False
|
|
|
|
disable_patching: bool = False
|
|
|
|
game_folder: str = ""
|
|
|
|
override_manifest: str = ""
|
|
|
|
override_old_manifest: str = ""
|
|
|
|
override_base_url: str = ""
|
|
|
|
platform: str = "Windows"
|
|
|
|
file_prefix: List = None
|
|
|
|
file_exclude_prefix: List = None
|
2022-07-24 10:06:35 +12:00
|
|
|
install_tag: Optional[List[str]] = None
|
2022-07-11 04:32:42 +12:00
|
|
|
order_opt: bool = False
|
|
|
|
dl_timeout: int = 10
|
|
|
|
repair_mode: bool = False
|
|
|
|
repair_and_update: bool = False
|
|
|
|
disable_delta: bool = False
|
|
|
|
override_delta_manifest: str = ""
|
|
|
|
egl_guid: str = ""
|
|
|
|
preferred_cdn: str = None
|
|
|
|
no_install: bool = False
|
|
|
|
ignore_space: bool = False
|
|
|
|
disable_sdl: bool = False
|
|
|
|
reset_sdl: bool = False
|
|
|
|
skip_sdl: bool = False
|
|
|
|
disable_https: bool = False
|
2023-12-10 23:09:26 +13:00
|
|
|
bind_ip: str = ""
|
2022-08-09 06:32:31 +12:00
|
|
|
# FIXME: move to LgndrInstallGameRealArgs
|
|
|
|
skip_dlcs: bool = False
|
|
|
|
with_dlcs: bool = False
|
|
|
|
# end of FIXME
|
2022-07-11 04:32:42 +12:00
|
|
|
yes: bool = True
|
2022-07-11 07:23:53 +12:00
|
|
|
# Rare: Extra arguments
|
2022-12-06 08:09:17 +13:00
|
|
|
indirect_status: LgndrIndirectStatus = field(default_factory=LgndrIndirectStatus)
|
2023-12-14 02:00:36 +13:00
|
|
|
get_boolean_choice: GetBooleanChoiceProtocol = get_boolean_choice_factory(True)
|
|
|
|
verify_stdout: VerifyStdoutProtocol = verify_stdout_factory(None)
|
2022-07-27 03:45:27 +12:00
|
|
|
|
2023-12-11 09:43:31 +13:00
|
|
|
def __post_init__(self):
|
2023-12-14 02:00:36 +13:00
|
|
|
self.sdl_prompt: SdlPromptProtocol = sdl_prompt_factory(self.install_tag)
|
2022-08-09 06:06:58 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrInstallGameRealArgs:
|
|
|
|
app_name: str
|
|
|
|
platform: str = "Windows"
|
|
|
|
repair_mode: bool = False
|
|
|
|
repair_file: str = ""
|
|
|
|
no_install: bool = False
|
|
|
|
save_path: str = ""
|
|
|
|
skip_dlcs: bool = False
|
|
|
|
with_dlcs: bool = False
|
|
|
|
dlm_debug: bool = False
|
2022-08-12 22:17:53 +12:00
|
|
|
yes: bool = False
|
2022-08-09 06:06:58 +12:00
|
|
|
# Rare: Extra arguments
|
2022-09-01 20:49:42 +12:00
|
|
|
install_prereqs: bool = False
|
2022-12-06 08:09:17 +13:00
|
|
|
indirect_status: LgndrIndirectStatus = field(default_factory=LgndrIndirectStatus)
|
2023-12-14 02:00:36 +13:00
|
|
|
ui_update: UiUpdateProtocol = ui_update_factory(None)
|
2023-12-11 09:43:31 +13:00
|
|
|
dlm_signals: DLManagerSignals = field(default_factory=DLManagerSignals)
|
2022-08-12 22:17:53 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrInstallGameRealRet:
|
|
|
|
class ReturnCode(IntEnum):
|
|
|
|
ERROR = 1
|
|
|
|
STOPPED = 2
|
|
|
|
FINISHED = 3
|
|
|
|
|
|
|
|
app_name: str
|
|
|
|
ret_code: ReturnCode = ReturnCode.ERROR
|
|
|
|
message: str = ""
|
|
|
|
dlcs: Optional[List[Dict]] = None
|
|
|
|
sync_saves: bool = False
|
|
|
|
tip_url: str = ""
|
|
|
|
shortcuts: bool = False
|