mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 08:37:42 +00:00
Fix: Share screenshot_method_override across tasks
This commit is contained in:
parent
44bd59251b
commit
f959b53445
@ -93,12 +93,6 @@ class Device(Screenshot, Control, AppControl):
|
||||
if IS_WINDOWS and self.config.EmulatorInfo_Emulator == 'auto':
|
||||
_ = self.emulator_instance
|
||||
|
||||
# SRC only, use nemu_ipc if available
|
||||
available = self.nemu_ipc_available()
|
||||
logger.attr('nemu_ipc_available', available)
|
||||
if available:
|
||||
self.config.override(Emulator_ScreenshotMethod='nemu_ipc')
|
||||
|
||||
self.screenshot_interval_set()
|
||||
self.method_check()
|
||||
|
||||
|
@ -42,6 +42,15 @@ class Screenshot(Adb, WSA, DroidCast, AScreenCap, Scrcpy, NemuIpc):
|
||||
'nemu_ipc': self.screenshot_nemu_ipc,
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def screenshot_method_override(self) -> str:
|
||||
# SRC only, use nemu_ipc if available
|
||||
available = self.nemu_ipc_available()
|
||||
logger.attr('nemu_ipc_available', available)
|
||||
if available:
|
||||
return 'nemu_ipc'
|
||||
return ''
|
||||
|
||||
def screenshot(self):
|
||||
"""
|
||||
Returns:
|
||||
@ -51,10 +60,12 @@ class Screenshot(Adb, WSA, DroidCast, AScreenCap, Scrcpy, NemuIpc):
|
||||
self._screenshot_interval.reset()
|
||||
|
||||
for _ in range(2):
|
||||
method = self.screenshot_methods.get(
|
||||
self.config.Emulator_ScreenshotMethod,
|
||||
self.screenshot_adb
|
||||
)
|
||||
if self.screenshot_method_override:
|
||||
method = self.screenshot_method_override
|
||||
else:
|
||||
method = self.config.Emulator_ScreenshotMethod
|
||||
method = self.screenshot_methods.get(method, self.screenshot_adb)
|
||||
|
||||
self.image = method()
|
||||
|
||||
# if self.config.Emulator_ScreenshotDedithering:
|
||||
|
Loading…
Reference in New Issue
Block a user