From 8951eb189a1b618cd5ea41a76925ed4a9e16cf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 22 Apr 2024 12:01:27 +0800 Subject: [PATCH] once --- LunaTranslator/LunaTranslator/myutils/fullscreen.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LunaTranslator/LunaTranslator/myutils/fullscreen.py b/LunaTranslator/LunaTranslator/myutils/fullscreen.py index b8d51b33..b77305dc 100644 --- a/LunaTranslator/LunaTranslator/myutils/fullscreen.py +++ b/LunaTranslator/LunaTranslator/myutils/fullscreen.py @@ -16,6 +16,7 @@ class fullscreen: self._externalfsend = _externalfsend self.status = False self.lasthwnd = None + self.injectedpids = set() def end(self): if self.status and self.lasthwnd: @@ -48,11 +49,14 @@ class fullscreen: if globalconfig["hooklossless"]: for pid, exe in ListProcess(): if exe == pexe.replace("/", "\\"): + if pid in self.injectedpids: + continue dll = os.path.abspath("./files/plugins/hookmagpie.dll") injecter = os.path.abspath( "./files/plugins/shareddllproxy{}.exe".format("64") ) injectdll(pid, injecter, dll) + self.injectedpids.add(pid) break def _external_lossless(self, hwnd, full): @@ -100,11 +104,14 @@ class fullscreen: pid = windows.GetWindowThreadProcessId( windows.FindWindow("Magpie_Hotkey", None) ) + if pid in self.injectedpids: + return dll = os.path.abspath("./files/plugins/hookmagpie.dll") injecter = os.path.abspath( "./files/plugins/shareddllproxy{}.exe".format("64") ) injectdll([pid], injecter, dll) + self.injectedpids.add(pid) @threader def _wait_magpie_stop_external(self):