From 0242feead6000c9327a3c3adbb6de9994ba24f7d Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Tue, 18 Jun 2024 01:35:07 +0800 Subject: [PATCH] Opt: Auto package detection when cloud game and android game both installed --- module/device/connection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/module/device/connection.py b/module/device/connection.py index 2e19fd286..9be7fbe0f 100644 --- a/module/device/connection.py +++ b/module/device/connection.py @@ -1016,7 +1016,24 @@ class Connection(ConnectionAttr): # Set server # logger.info('Server changed, release resources') # set_server(self.package) + return 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( 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')