Skip to content

Commit a36b82b

Browse files
authored
Merge pull request #4497 from LmeSzinc/dev
Bug fix
2 parents 269c4d6 + 546f25d commit a36b82b

11 files changed

Lines changed: 73 additions & 7 deletions

File tree

16.2 KB
Loading
-12.5 KB
Loading
1.16 KB
Loading
1.2 KB
Loading

deploy/Windows/patch.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,34 @@ def patch_uiautomator2():
5959
https://tool.appetizer.io is added to bypass the wall in China but https://tool.appetizer.io is slow outside of CN
6060
plus some CN users cannot access it for unknown reason.
6161
62-
So we patch `uiautomator2/init.py` to a local assets cache `uiautomator2cache/cache`.
62+
1. So we patch `uiautomator2/init.py` to a local assets cache `uiautomator2cache/cache`.
6363
appdir = os.path.join(os.path.expanduser('~'), '.uiautomator2')
6464
to:
6565
appdir = os.path.join(__file__, '../../uiautomator2cache')
6666
67-
And we also remove minicap installations since emulators doesn't need it.
67+
2. And we also remove minicap installations since emulators doesn't need it.
6868
for url in self.minicap_urls:
6969
self.push_url(url)
7070
to:
7171
for url in []:
7272
self.push_url(url)
73+
74+
3. Fix atx_agent_url so ARM Mac can have correct ATX installed
75+
```
76+
@property
77+
def atx_agent_url(self):
78+
files = {
79+
'armeabi-v7a': 'atx-agent_{v}_linux_armv7.tar.gz',
80+
'arm64-v8a': 'atx-agent_{v}_linux_armv7.tar.gz',
81+
'armeabi': 'atx-agent_{v}_linux_armv6.tar.gz',
82+
'x86': 'atx-agent_{v}_linux_386.tar.gz',
83+
'x86_64': 'atx-agent_{v}_linux_386.tar.gz',
84+
}
85+
```
86+
where
87+
'arm64-v8a': 'atx-agent_{v}_linux_armv7.tar.gz',
88+
to
89+
'arm64-v8a': 'atx-agent_{v}_linux_arm64.tar.gz',
7390
"""
7491
init_file = './toolkit/Lib/site-packages/uiautomator2/init.py'
7592
cache_dir = './toolkit/Lib/site-packages/uiautomator2cache/cache'
@@ -92,6 +109,17 @@ def patch_uiautomator2():
92109
else:
93110
logger.info(f'{init_file} minicap_urls no need to patch')
94111

112+
# Patch atx_agent_url
113+
res = re.search(r"'arm64-v8a': 'atx-agent_\{v}_linux_armv7.tar.gz'", content)
114+
if res:
115+
content = re.sub(r"'arm64-v8a': 'atx-agent_\{v}_linux_armv7.tar.gz'",
116+
"'arm64-v8a': 'atx-agent_{v}_linux_arm64.tar.gz'",
117+
content)
118+
modified = True
119+
logger.info(f'{init_file} atx_agent_url patched')
120+
else:
121+
logger.info(f'{init_file} atx_agent_url no need to patch')
122+
95123
# Patch appdir
96124
if os.path.exists(cache_dir):
97125
res = re.search(r'appdir ?=(.*)\n', content)

module/campaign/gems_farming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def get_common_rarity_dd(self):
282282
return ships
283283

284284
scanner.set_limitation(fleet=0)
285-
if self.config.GemsFarming_CommonDD in ['any', 'favourite']:
285+
if self.config.GemsFarming_CommonDD in ['any', 'favourite', 'z20_or_z21']:
286286
# Change to any ship
287287
return scanner.scan(self.device.image, output=False)
288288

module/device/method/ldopengl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import numpy as np
1010

1111
from module.base.decorator import cached_property
12+
from module.device.env import IS_WINDOWS
1213
from module.device.method.utils import RETRY_TRIES, get_serial_pair, retry_sleep
1314
from module.device.platform import Platform
1415
from module.exception import RequestHumanTakeover
@@ -312,6 +313,8 @@ def ldopengl(self):
312313
raise RequestHumanTakeover
313314

314315
def ldopengl_available(self) -> bool:
316+
if not IS_WINDOWS:
317+
return False
315318
if not self.is_ldplayer_bluestacks_family:
316319
return False
317320
logger.attr('EmulatorInfo_Emulator', self.config.EmulatorInfo_Emulator)

module/device/method/nemu_ipc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from module.base.timer import Timer
1313
from module.base.utils import ensure_time
1414
from module.config.utils import deep_get
15+
from module.device.env import IS_WINDOWS
1516
from module.device.method.minitouch import insert_swipe, random_rectangle_point
1617
from module.device.method.pool import JobTimeout, WORKER_POOL
1718
from module.device.method.utils import RETRY_TRIES, retry_sleep
@@ -500,6 +501,8 @@ def nemu_ipc(self) -> NemuIpcImpl:
500501
raise RequestHumanTakeover
501502

502503
def nemu_ipc_available(self) -> bool:
504+
if not IS_WINDOWS:
505+
return False
503506
if not self.is_mumu_family:
504507
return False
505508
# >= 4.0 has no info in getprop

module/device/method/utils.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,38 @@ def setup_logger(*args, **kwargs):
7373
u2.init.setup_logger = setup_logger
7474

7575

76+
# Patch Initer
77+
class PatchedIniter(u2.init.Initer):
78+
@property
79+
def atx_agent_url(self):
80+
files = {
81+
'armeabi-v7a': 'atx-agent_{v}_linux_armv7.tar.gz',
82+
# 'arm64-v8a': 'atx-agent_{v}_linux_armv7.tar.gz',
83+
'arm64-v8a': 'atx-agent_{v}_linux_arm64.tar.gz',
84+
'armeabi': 'atx-agent_{v}_linux_armv6.tar.gz',
85+
'x86': 'atx-agent_{v}_linux_386.tar.gz',
86+
'x86_64': 'atx-agent_{v}_linux_386.tar.gz',
87+
}
88+
name = None
89+
for abi in self.abis:
90+
name = files.get(abi)
91+
if name:
92+
break
93+
if not name:
94+
raise Exception(
95+
"arch(%s) need to be supported yet, please report an issue in github"
96+
% self.abis)
97+
return u2.init.GITHUB_BASEURL + '/atx-agent/releases/download/%s/%s' % (
98+
u2.version.__atx_agent_version__, name.format(v=u2.version.__atx_agent_version__))
99+
100+
@property
101+
def minicap_urls(self):
102+
return []
103+
104+
105+
u2.init.Initer = PatchedIniter
106+
107+
76108
def is_port_using(port_num):
77109
""" if port is using by others, return True. else return False """
78110
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

module/guild/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
GUILD_LOGISTICS_ENSURE_CHECK = Button(area={'cn': (390, 382, 516, 393), 'en': (390, 382, 516, 393), 'jp': (390, 382, 516, 393), 'tw': (390, 382, 516, 393)}, color={'cn': (155, 87, 90), 'en': (155, 87, 90), 'jp': (155, 87, 90), 'tw': (155, 87, 90)}, button={'cn': (390, 382, 516, 393), 'en': (390, 382, 516, 393), 'jp': (390, 382, 516, 393), 'tw': (390, 382, 516, 393)}, file={'cn': './assets/cn/guild/GUILD_LOGISTICS_ENSURE_CHECK.png', 'en': './assets/en/guild/GUILD_LOGISTICS_ENSURE_CHECK.png', 'jp': './assets/jp/guild/GUILD_LOGISTICS_ENSURE_CHECK.png', 'tw': './assets/tw/guild/GUILD_LOGISTICS_ENSURE_CHECK.png'})
1919
GUILD_MISSION = Button(area={'cn': (1068, 279, 1224, 320), 'en': (1070, 281, 1222, 318), 'jp': (1068, 279, 1224, 320), 'tw': (1070, 281, 1222, 318)}, color={'cn': (105, 124, 179), 'en': (168, 104, 104), 'jp': (115, 131, 176), 'tw': (168, 104, 104)}, button={'cn': (1068, 279, 1224, 320), 'en': (1070, 281, 1222, 318), 'jp': (1068, 279, 1224, 320), 'tw': (1070, 281, 1222, 318)}, file={'cn': './assets/cn/guild/GUILD_MISSION.png', 'en': './assets/en/guild/GUILD_MISSION.png', 'jp': './assets/jp/guild/GUILD_MISSION.png', 'tw': './assets/tw/guild/GUILD_MISSION.png'})
2020
GUILD_MISSION_CHOOSE = Button(area={'cn': (406, 194, 565, 235), 'en': (406, 194, 565, 235), 'jp': (406, 194, 565, 235), 'tw': (406, 194, 565, 235)}, color={'cn': (106, 107, 112), 'en': (106, 107, 112), 'jp': (106, 107, 112), 'tw': (106, 107, 112)}, button={'cn': (406, 194, 565, 235), 'en': (406, 194, 565, 235), 'jp': (406, 194, 565, 235), 'tw': (406, 194, 565, 235)}, file={'cn': './assets/cn/guild/GUILD_MISSION_CHOOSE.png', 'en': './assets/cn/guild/GUILD_MISSION_CHOOSE.png', 'jp': './assets/cn/guild/GUILD_MISSION_CHOOSE.png', 'tw': './assets/cn/guild/GUILD_MISSION_CHOOSE.png'})
21-
GUILD_MISSION_NEW = Button(area={'cn': (414, 199, 551, 230), 'en': (414, 199, 551, 230), 'jp': (414, 199, 551, 230), 'tw': (414, 199, 551, 230)}, color={'cn': (127, 128, 132), 'en': (127, 128, 132), 'jp': (127, 128, 132), 'tw': (127, 128, 132)}, button={'cn': (414, 199, 551, 230), 'en': (414, 199, 551, 230), 'jp': (414, 199, 551, 230), 'tw': (414, 199, 551, 230)}, file={'cn': './assets/cn/guild/GUILD_MISSION_NEW.png', 'en': './assets/cn/guild/GUILD_MISSION_NEW.png', 'jp': './assets/cn/guild/GUILD_MISSION_NEW.png', 'tw': './assets/cn/guild/GUILD_MISSION_NEW.png'})
21+
GUILD_MISSION_NEW = Button(area={'cn': (414, 199, 551, 230), 'en': (414, 199, 551, 230), 'jp': (415, 198, 626, 231), 'tw': (414, 199, 551, 230)}, color={'cn': (127, 128, 132), 'en': (127, 128, 132), 'jp': (165, 172, 178), 'tw': (127, 128, 132)}, button={'cn': (414, 199, 551, 230), 'en': (414, 199, 551, 230), 'jp': (415, 198, 626, 231), 'tw': (414, 199, 551, 230)}, file={'cn': './assets/cn/guild/GUILD_MISSION_NEW.png', 'en': './assets/cn/guild/GUILD_MISSION_NEW.png', 'jp': './assets/jp/guild/GUILD_MISSION_NEW.png', 'tw': './assets/cn/guild/GUILD_MISSION_NEW.png'})
2222
GUILD_MISSION_SELECT = Button(area={'cn': (1023, 131, 1052, 160), 'en': (1023, 131, 1052, 160), 'jp': (1023, 131, 1052, 160), 'tw': (1023, 131, 1052, 160)}, color={'cn': (185, 75, 72), 'en': (185, 75, 72), 'jp': (185, 75, 72), 'tw': (185, 75, 72)}, button={'cn': (912, 532, 975, 565), 'en': (912, 532, 975, 565), 'jp': (912, 532, 975, 565), 'tw': (912, 532, 975, 565)}, file={'cn': './assets/cn/guild/GUILD_MISSION_SELECT.png', 'en': './assets/cn/guild/GUILD_MISSION_SELECT.png', 'jp': './assets/cn/guild/GUILD_MISSION_SELECT.png', 'tw': './assets/cn/guild/GUILD_MISSION_SELECT.png'})
2323
GUILD_OPERATIONS_ACTIVE_CHECK = Button(area={'cn': (967, 640, 1078, 667), 'en': (941, 634, 1222, 672), 'jp': (946, 637, 1103, 668), 'tw': (967, 639, 1081, 667)}, color={'cn': (116, 123, 191), 'en': (87, 99, 178), 'jp': (104, 110, 186), 'tw': (112, 119, 190)}, button={'cn': (967, 640, 1078, 667), 'en': (941, 634, 1222, 672), 'jp': (946, 637, 1103, 668), 'tw': (967, 639, 1081, 667)}, file={'cn': './assets/cn/guild/GUILD_OPERATIONS_ACTIVE_CHECK.png', 'en': './assets/en/guild/GUILD_OPERATIONS_ACTIVE_CHECK.png', 'jp': './assets/jp/guild/GUILD_OPERATIONS_ACTIVE_CHECK.png', 'tw': './assets/tw/guild/GUILD_OPERATIONS_ACTIVE_CHECK.png'})
2424
GUILD_OPERATIONS_CLICK_SAFE_AREA = Button(area={'cn': (271, 680, 320, 704), 'en': (271, 680, 320, 704), 'jp': (271, 680, 320, 704), 'tw': (271, 680, 320, 704)}, color={'cn': (18, 21, 36), 'en': (18, 21, 36), 'jp': (18, 21, 36), 'tw': (18, 21, 36)}, button={'cn': (271, 680, 320, 704), 'en': (271, 680, 320, 704), 'jp': (271, 680, 320, 704), 'tw': (271, 680, 320, 704)}, file={'cn': './assets/cn/guild/GUILD_OPERATIONS_CLICK_SAFE_AREA.png', 'en': './assets/en/guild/GUILD_OPERATIONS_CLICK_SAFE_AREA.png', 'jp': './assets/jp/guild/GUILD_OPERATIONS_CLICK_SAFE_AREA.png', 'tw': './assets/tw/guild/GUILD_OPERATIONS_CLICK_SAFE_AREA.png'})

0 commit comments

Comments
 (0)