Compare commits
2 commits
faad1f217c
...
71cfd8629a
Author | SHA1 | Date | |
---|---|---|---|
71cfd8629a | |||
9011e9ebb8 |
5 changed files with 29 additions and 5 deletions
|
@ -4,7 +4,7 @@ import os
|
|||
import sys
|
||||
import threading
|
||||
import time
|
||||
from functools import wraps
|
||||
from functools import cached_property, wraps
|
||||
from typing import Any, Callable
|
||||
|
||||
import numpy as np
|
||||
|
@ -180,6 +180,17 @@ class MuMu12IPC:
|
|||
def mumumanager(self) -> MuMuManager:
|
||||
return config.device.get_service("mumumanager")
|
||||
|
||||
@cached_property
|
||||
def is_new_version(self):
|
||||
version = self.mumumanager.emulator_version()
|
||||
target = [4, 1, 21]
|
||||
for i in range(3):
|
||||
if version[i] < target[i]:
|
||||
return False
|
||||
elif version[i] > target[i]:
|
||||
return True
|
||||
return True
|
||||
|
||||
def connect(self):
|
||||
"连接到 emulator"
|
||||
if self.mumumanager.emulator_status() != "running":
|
||||
|
@ -256,9 +267,16 @@ class MuMu12IPC:
|
|||
# 单点触控
|
||||
def touch_down(self, x: int, y: int):
|
||||
self.check_status()
|
||||
result = self.external_renderer.nemu_input_event_touch_down(
|
||||
self.connection, self.display_id, int(1080 - y), int(x)
|
||||
result = (
|
||||
self.external_renderer.nemu_input_event_touch_down(
|
||||
self.connection, self.display_id, int(x), int(y)
|
||||
)
|
||||
if self.is_new_version
|
||||
else self.external_renderer.nemu_input_event_touch_down(
|
||||
self.connection, self.display_id, int(1080 - y), int(x)
|
||||
)
|
||||
)
|
||||
# mumu12版本4.1.21之后的版本修改了坐标参数
|
||||
if result != 0:
|
||||
self.connection = 0
|
||||
self.display_id = -1
|
||||
|
|
|
@ -93,13 +93,19 @@ class MuMuManager:
|
|||
return "stopped"
|
||||
|
||||
def get_setting_info(self):
|
||||
cmd = [self.manager_path, "setting", "-v", str(self.index), "-aw"]
|
||||
cmd = [self.manager_path, "setting", "-v", str(self.index), "-a"]
|
||||
output = subprocess_run(cmd)
|
||||
return self.load_json(output)
|
||||
|
||||
def app_kept_alive(self) -> bool:
|
||||
return self.get_field_value(self.get_setting_info(), "app_keptlive")
|
||||
|
||||
def emulator_version(self) -> list[int]:
|
||||
version = self.get_field_value(self.get_setting_info(), "core_version")
|
||||
logger.debug(f"MuMu12模拟器版本: {version}")
|
||||
parts = [int(x) for x in version.split(".")[:3]] # 4.1.31.3724取出[4, 1, 31]
|
||||
return parts
|
||||
|
||||
def set_app_kept_alive_false(self) -> None:
|
||||
cmd = [
|
||||
self.manager_path,
|
||||
|
|
|
@ -22,7 +22,7 @@ from . import const
|
|||
from .control import ControlSender
|
||||
|
||||
SCR_PATH = "/data/local/tmp/scrcpy-server.jar"
|
||||
SCR_VER = "3.3"
|
||||
SCR_VER = "3.3.1"
|
||||
|
||||
|
||||
def retry_scrcpy(func):
|
||||
|
|
BIN
mower/vendor/scrcpy-server-v3.3
vendored
BIN
mower/vendor/scrcpy-server-v3.3
vendored
Binary file not shown.
BIN
mower/vendor/scrcpy-server-v3.3.1
vendored
Normal file
BIN
mower/vendor/scrcpy-server-v3.3.1
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue