mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
fix
This commit is contained in:
parent
434d1f1fc9
commit
ba2f0545d1
@ -200,6 +200,8 @@ class texthook(basetext):
|
|||||||
self.runonce_line = ""
|
self.runonce_line = ""
|
||||||
gobject.baseobject.autoswitchgameuid = False
|
gobject.baseobject.autoswitchgameuid = False
|
||||||
self.delaycollectallselectedoutput()
|
self.delaycollectallselectedoutput()
|
||||||
|
self.singlethread = True
|
||||||
|
self.singlethreadlock = threading.Lock()
|
||||||
self.autohookmonitorthread()
|
self.autohookmonitorthread()
|
||||||
self.initdllonce = True
|
self.initdllonce = True
|
||||||
self.initdlllock = threading.Lock()
|
self.initdlllock = threading.Lock()
|
||||||
@ -357,6 +359,10 @@ class texthook(basetext):
|
|||||||
|
|
||||||
@threader
|
@threader
|
||||||
def autohookmonitorthread(self):
|
def autohookmonitorthread(self):
|
||||||
|
with self.singlethreadlock:
|
||||||
|
if not self.singlethread:
|
||||||
|
return
|
||||||
|
self.singlethread = False
|
||||||
while (not self.ending) and (len(self.pids) == 0):
|
while (not self.ending) and (len(self.pids) == 0):
|
||||||
try:
|
try:
|
||||||
hwnd = windows.GetForegroundWindow()
|
hwnd = windows.GetForegroundWindow()
|
||||||
@ -365,9 +371,14 @@ class texthook(basetext):
|
|||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
with self.singlethreadlock:
|
||||||
|
self.singlethread = True
|
||||||
|
|
||||||
def start(self, hwnd, pids, gamepath, gameuid, autostart=False):
|
def start(self, hwnd, pids, gamepath, gameuid, autostart=False):
|
||||||
self.delayinit()
|
self.delayinit()
|
||||||
|
for pid in pids:
|
||||||
|
# 如果有进程一闪而逝,没来的及注入,导致无法自动重连
|
||||||
|
self.waitend(pid)
|
||||||
gobject.baseobject.hwnd = hwnd
|
gobject.baseobject.hwnd = hwnd
|
||||||
gobject.baseobject.gameuid = gameuid
|
gobject.baseobject.gameuid = gameuid
|
||||||
self.gameuid = gameuid
|
self.gameuid = gameuid
|
||||||
@ -463,7 +474,6 @@ class texthook(basetext):
|
|||||||
|
|
||||||
def onprocconnect(self, pid):
|
def onprocconnect(self, pid):
|
||||||
self.pids.append(pid)
|
self.pids.append(pid)
|
||||||
self.waitend(pid)
|
|
||||||
for hookcode in self.needinserthookcode:
|
for hookcode in self.needinserthookcode:
|
||||||
self.Luna_InsertHookCode(pid, hookcode)
|
self.Luna_InsertHookCode(pid, hookcode)
|
||||||
gobject.baseobject.displayinfomessage(
|
gobject.baseobject.displayinfomessage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user