mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 18:05:26 +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':
|
if IS_WINDOWS and self.config.EmulatorInfo_Emulator == 'auto':
|
||||||
_ = self.emulator_instance
|
_ = 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.screenshot_interval_set()
|
||||||
self.method_check()
|
self.method_check()
|
||||||
|
|
||||||
|
@ -42,6 +42,15 @@ class Screenshot(Adb, WSA, DroidCast, AScreenCap, Scrcpy, NemuIpc):
|
|||||||
'nemu_ipc': self.screenshot_nemu_ipc,
|
'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):
|
def screenshot(self):
|
||||||
"""
|
"""
|
||||||
Returns:
|
Returns:
|
||||||
@ -51,10 +60,12 @@ class Screenshot(Adb, WSA, DroidCast, AScreenCap, Scrcpy, NemuIpc):
|
|||||||
self._screenshot_interval.reset()
|
self._screenshot_interval.reset()
|
||||||
|
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
method = self.screenshot_methods.get(
|
if self.screenshot_method_override:
|
||||||
self.config.Emulator_ScreenshotMethod,
|
method = self.screenshot_method_override
|
||||||
self.screenshot_adb
|
else:
|
||||||
)
|
method = self.config.Emulator_ScreenshotMethod
|
||||||
|
method = self.screenshot_methods.get(method, self.screenshot_adb)
|
||||||
|
|
||||||
self.image = method()
|
self.image = method()
|
||||||
|
|
||||||
# if self.config.Emulator_ScreenshotDedithering:
|
# if self.config.Emulator_ScreenshotDedithering:
|
||||||
|
Loading…
Reference in New Issue
Block a user