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