This commit is contained in:
恍兮惚兮 2024-04-22 12:01:27 +08:00
parent a40258945f
commit 8951eb189a

View File

@ -16,6 +16,7 @@ class fullscreen:
self._externalfsend = _externalfsend self._externalfsend = _externalfsend
self.status = False self.status = False
self.lasthwnd = None self.lasthwnd = None
self.injectedpids = set()
def end(self): def end(self):
if self.status and self.lasthwnd: if self.status and self.lasthwnd:
@ -48,11 +49,14 @@ class fullscreen:
if globalconfig["hooklossless"]: if globalconfig["hooklossless"]:
for pid, exe in ListProcess(): for pid, exe in ListProcess():
if exe == pexe.replace("/", "\\"): if exe == pexe.replace("/", "\\"):
if pid in self.injectedpids:
continue
dll = os.path.abspath("./files/plugins/hookmagpie.dll") dll = os.path.abspath("./files/plugins/hookmagpie.dll")
injecter = os.path.abspath( injecter = os.path.abspath(
"./files/plugins/shareddllproxy{}.exe".format("64") "./files/plugins/shareddllproxy{}.exe".format("64")
) )
injectdll(pid, injecter, dll) injectdll(pid, injecter, dll)
self.injectedpids.add(pid)
break break
def _external_lossless(self, hwnd, full): def _external_lossless(self, hwnd, full):
@ -100,11 +104,14 @@ class fullscreen:
pid = windows.GetWindowThreadProcessId( pid = windows.GetWindowThreadProcessId(
windows.FindWindow("Magpie_Hotkey", None) windows.FindWindow("Magpie_Hotkey", None)
) )
if pid in self.injectedpids:
return
dll = os.path.abspath("./files/plugins/hookmagpie.dll") dll = os.path.abspath("./files/plugins/hookmagpie.dll")
injecter = os.path.abspath( injecter = os.path.abspath(
"./files/plugins/shareddllproxy{}.exe".format("64") "./files/plugins/shareddllproxy{}.exe".format("64")
) )
injectdll([pid], injecter, dll) injectdll([pid], injecter, dll)
self.injectedpids.add(pid)
@threader @threader
def _wait_magpie_stop_external(self): def _wait_magpie_stop_external(self):