mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 08:37:42 +00:00
Fix: Allow Hermit on VMOS only
(cherry picked from commit ff6307b09df73d498f93c01f68d2587fb4b89fb4)
This commit is contained in:
parent
087c0371c8
commit
0bffc37d60
@ -7,6 +7,7 @@ from adbutils import AdbClient, AdbDevice
|
||||
|
||||
from module.base.decorator import cached_property
|
||||
from module.config.config import AzurLaneConfig
|
||||
from module.device.method.utils import get_serial_pair
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
|
||||
@ -127,8 +128,11 @@ class ConnectionAttr:
|
||||
|
||||
@cached_property
|
||||
def port(self) -> int:
|
||||
port_serial, _ = get_serial_pair(self.serial)
|
||||
if port_serial is None:
|
||||
port_serial = self.serial
|
||||
try:
|
||||
return int(self.serial.split(':')[1])
|
||||
return int(port_serial.split(':')[1])
|
||||
except (IndexError, ValueError):
|
||||
return 0
|
||||
|
||||
@ -147,6 +151,10 @@ class ConnectionAttr:
|
||||
def is_nox_family(self):
|
||||
return 62001 <= self.port <= 63025
|
||||
|
||||
@cached_property
|
||||
def is_vmos(self):
|
||||
return 5667 <= self.port <= 5699
|
||||
|
||||
@cached_property
|
||||
def is_emulator(self):
|
||||
return self.serial.startswith('emulator-') or self.serial.startswith('127.0.0.1:')
|
||||
|
@ -138,6 +138,10 @@ class Device(Screenshot, Control, AppControl):
|
||||
# if self.config.Emulator_ScreenshotMethod != 'nemu_ipc' and self.config.Emulator_ControlMethod == 'nemu_ipc':
|
||||
# logger.warning('When not using nemu_ipc, both screenshot and control should not use nemu_ipc')
|
||||
# self.config.Emulator_ControlMethod = 'minitouch'
|
||||
# Allow Hermit on VMOS only
|
||||
if self.config.Emulator_ControlMethod == 'Hermit' and not self.is_vmos:
|
||||
logger.warning('ControlMethod is allowed on VMOS only')
|
||||
self.config.Emulator_ControlMethod = 'minitouch'
|
||||
pass
|
||||
|
||||
def screenshot(self):
|
||||
|
Loading…
Reference in New Issue
Block a user