Opt: Auto package detection when cloud game and android game both installed

This commit is contained in:
LmeSzinc 2024-06-18 01:35:07 +08:00
parent 2d0b67271d
commit 0242feead6

View File

@ -1016,7 +1016,24 @@ class Connection(ConnectionAttr):
# Set server # Set server
# logger.info('Server changed, release resources') # logger.info('Server changed, release resources')
# set_server(self.package) # set_server(self.package)
return
else: else:
if self.config.is_cloud_game:
packages = [p for p in packages if p in server_.VALID_CLOUD_PACKAGE]
if len(packages) == 1:
logger.info('Auto package detection found only one package, using it')
self.package = packages[0]
if set_config:
self.config.Emulator_PackageName = server_.to_server(self.package)
return
else:
packages = [p for p in packages if p in server_.VALID_PACKAGE]
if len(packages) == 1:
logger.info('Auto package detection found only one package, using it')
self.package = packages[0]
if set_config:
self.config.Emulator_PackageName = server_.to_server(self.package)
return
logger.critical( logger.critical(
f'Multiple Star Rail packages found, auto package detection cannot decide which to choose, ' f'Multiple Star Rail packages found, auto package detection cannot decide which to choose, '
'please copy one of the available devices listed above to Alas.Emulator.PackageName') 'please copy one of the available devices listed above to Alas.Emulator.PackageName')