mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
issues/498
This commit is contained in:
parent
634830a1e2
commit
92efcc17b1
@ -86,6 +86,7 @@ class texthook(basetext ):
|
|||||||
self.allow_set_text_name=globalconfig['allow_set_text_name']
|
self.allow_set_text_name=globalconfig['allow_set_text_name']
|
||||||
|
|
||||||
self.pids=pids
|
self.pids=pids
|
||||||
|
self.connectedpids=[]
|
||||||
self.pname=pname
|
self.pname=pname
|
||||||
self.hwnd=hwnd
|
self.hwnd=hwnd
|
||||||
self.runonce_line=''
|
self.runonce_line=''
|
||||||
@ -166,6 +167,7 @@ class texthook(basetext ):
|
|||||||
windows.ShellExecute(0,'runas',injecter,'dllinject {} "{}"'.format(pid,dll),None,windows.SW_HIDE)
|
windows.ShellExecute(0,'runas',injecter,'dllinject {} "{}"'.format(pid,dll),None,windows.SW_HIDE)
|
||||||
@threader
|
@threader
|
||||||
def onprocconnect(self,pid):
|
def onprocconnect(self,pid):
|
||||||
|
self.connectedpids.append(pid)
|
||||||
time.sleep(savehook_new_data[self.pname]['inserthooktimeout']/1000)
|
time.sleep(savehook_new_data[self.pname]['inserthooktimeout']/1000)
|
||||||
for hookcode in self.needinserthookcode:
|
for hookcode in self.needinserthookcode:
|
||||||
self.Luna_InsertHookCode(pid,hookcode)
|
self.Luna_InsertHookCode(pid,hookcode)
|
||||||
@ -183,6 +185,7 @@ class texthook(basetext ):
|
|||||||
if _type==0:
|
if _type==0:
|
||||||
self.onprocconnect(pid)
|
self.onprocconnect(pid)
|
||||||
elif _type==1:
|
elif _type==1:
|
||||||
|
self.connectedpids.remove(pid)
|
||||||
gobject.baseobject.hookselectdialog.sysmessagesignal.emit('{} disconenct'.format(pid))
|
gobject.baseobject.hookselectdialog.sysmessagesignal.emit('{} disconenct'.format(pid))
|
||||||
elif _type in [2,3]:
|
elif _type in [2,3]:
|
||||||
if _type==2:
|
if _type==2:
|
||||||
@ -214,14 +217,14 @@ class texthook(basetext ):
|
|||||||
|
|
||||||
def embedcallback(self,text,_unused,trans):
|
def embedcallback(self,text,_unused,trans):
|
||||||
|
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
self.Luna_embedcallback(pid,text,trans)
|
self.Luna_embedcallback(pid,text,trans)
|
||||||
|
|
||||||
def flashembedsettings(self,pid=None):
|
def flashembedsettings(self,pid=None):
|
||||||
if pid:
|
if pid:
|
||||||
pids=[pid]
|
pids=[pid]
|
||||||
else:
|
else:
|
||||||
pids=self.pids
|
pids=self.connectedpids.copy()
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
self.Luna_EmbedSettings(pid,
|
self.Luna_EmbedSettings(pid,
|
||||||
int(1000* globalconfig['embedded']['timeout_translate']),
|
int(1000* globalconfig['embedded']['timeout_translate']),
|
||||||
@ -311,7 +314,7 @@ class texthook(basetext ):
|
|||||||
@threader
|
@threader
|
||||||
def findhook(self,usestruct):
|
def findhook(self,usestruct):
|
||||||
savefound={}
|
savefound={}
|
||||||
pids=self.pids.copy()
|
pids=self.connectedpids.copy()
|
||||||
|
|
||||||
headers={}
|
headers={}
|
||||||
waiters={}
|
waiters={}
|
||||||
@ -338,13 +341,13 @@ class texthook(basetext ):
|
|||||||
gobject.baseobject.hookselectdialog.getfoundhooksignal.emit(savefound)
|
gobject.baseobject.hookselectdialog.getfoundhooksignal.emit(savefound)
|
||||||
def inserthook(self,hookcode):
|
def inserthook(self,hookcode):
|
||||||
succ=True
|
succ=True
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
succ=self.Luna_InsertHookCode(pid,hookcode) and succ
|
succ=self.Luna_InsertHookCode(pid,hookcode) and succ
|
||||||
if succ==False:
|
if succ==False:
|
||||||
getQMessageBox(gobject.baseobject.hookselectdialog,"Error","Invalie Hook Code Format!")
|
getQMessageBox(gobject.baseobject.hookselectdialog,"Error","Invalie Hook Code Format!")
|
||||||
|
|
||||||
def removehook(self,pid,address):
|
def removehook(self,pid,address):
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
self.Luna_RemoveHook(pid,address)
|
self.Luna_RemoveHook(pid,address)
|
||||||
@threader
|
@threader
|
||||||
def delaycollectallselectedoutput(self):
|
def delaycollectallselectedoutput(self):
|
||||||
@ -392,12 +395,12 @@ class texthook(basetext ):
|
|||||||
|
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
def checkisusingembed(self,address,ctx1,ctx2):
|
def checkisusingembed(self,address,ctx1,ctx2):
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
if self.Luna_checkisusingembed(pid,address,ctx1,ctx2):
|
if self.Luna_checkisusingembed(pid,address,ctx1,ctx2):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
def useembed(self,address,ctx1,ctx2,use):
|
def useembed(self,address,ctx1,ctx2,use):
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
self.Luna_useembed(pid,address,ctx1,ctx2,use)
|
self.Luna_useembed(pid,address,ctx1,ctx2,use)
|
||||||
|
|
||||||
def gettextthread(self ):
|
def gettextthread(self ):
|
||||||
@ -409,7 +412,7 @@ class texthook(basetext ):
|
|||||||
|
|
||||||
return self.runonce_line
|
return self.runonce_line
|
||||||
def end(self):
|
def end(self):
|
||||||
for pid in self.pids:
|
for pid in self.connectedpids:
|
||||||
self.Luna_Detach(pid)
|
self.Luna_Detach(pid)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
super().end()
|
super().end()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user