This commit is contained in:
恍兮惚兮 2024-08-15 00:47:00 +08:00
parent 91cd3dfe5e
commit 2fdd5621ec
6 changed files with 21 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
LunaTranslator/userconfig LunaTranslator/userconfig
LunaTranslator/userconfig1
lunatranslator/cache lunatranslator/cache
*.pyc *.pyc

View File

@ -662,12 +662,13 @@ class MAINUI:
found = findgameuidofpath(pexe) found = findgameuidofpath(pexe)
if found: if found:
gameuid, reflist = found gameuid, reflist = found
if globalconfig["startgamenototop"] == False:
idx = reflist.index(gameuid)
reflist.insert(0, reflist.pop(idx))
else: else:
gameuid = find_or_create_uid(savehook_new_list, pexe, title) gameuid = find_or_create_uid(savehook_new_list, pexe, title)
reflist = savehook_new_list savehook_new_list.insert(0, gameuid)
if globalconfig["startgamenototop"] == False:
idx = reflist.index(gameuid)
reflist.insert(0, reflist.pop(idx))
self.textsource = texthook(pids, hwnd, pexe, gameuid, autostart=False) self.textsource = texthook(pids, hwnd, pexe, gameuid, autostart=False)
self.textsource.start() self.textsource.start()

View File

@ -383,7 +383,7 @@ class hookselect(closeashidewindow):
addnewhooksignal = pyqtSignal(tuple, bool) addnewhooksignal = pyqtSignal(tuple, bool)
getnewsentencesignal = pyqtSignal(str) getnewsentencesignal = pyqtSignal(str)
sysmessagesignal = pyqtSignal(str) sysmessagesignal = pyqtSignal(str)
changeprocessclearsignal = pyqtSignal(dict) changeprocessclearsignal = pyqtSignal()
removehooksignal = pyqtSignal(tuple) removehooksignal = pyqtSignal(tuple)
getfoundhooksignal = pyqtSignal(dict) getfoundhooksignal = pyqtSignal(dict)
update_item_new_line = pyqtSignal(tuple, str) update_item_new_line = pyqtSignal(tuple, str)
@ -444,7 +444,7 @@ class hookselect(closeashidewindow):
1, QHeaderView.ResizeMode.ResizeToContents 1, QHeaderView.ResizeMode.ResizeToContents
) )
def changeprocessclear(self, config): def changeprocessclear(self):
# self.ttCombo.clear() # self.ttCombo.clear()
self.ttCombomodelmodel.clear() self.ttCombomodelmodel.clear()
self.save = [] self.save = []

View File

@ -86,6 +86,8 @@ EmbedCallback = CFUNCTYPE(None, c_wchar_p, ThreadParam)
class texthook(basetext): class texthook(basetext):
autofindpids = False
@property @property
def config(self): def config(self):
if savehook_new_data[self.gameuid]["hooksetting_follow_default"]: if savehook_new_data[self.gameuid]["hooksetting_follow_default"]:
@ -135,7 +137,7 @@ class texthook(basetext):
self.pids = pids self.pids = pids
self.is64bit = Is64bit(pids[0]) self.is64bit = Is64bit(pids[0])
self.hwnd = hwnd self.hwnd = hwnd
gobject.baseobject.hookselectdialog.changeprocessclearsignal.emit(self.config) gobject.baseobject.hookselectdialog.changeprocessclearsignal.emit()
self.isremoveuseless = self.config["removeuseless"] and len( self.isremoveuseless = self.config["removeuseless"] and len(
self.autostarthookcode self.autostarthookcode
) )

View File

@ -53,6 +53,8 @@ class hwndchecker:
class basetext: class basetext:
autofindpids = True
@property @property
def hwnd(self): def hwnd(self):
@ -65,14 +67,17 @@ class basetext:
if self.__hwnd: if self.__hwnd:
self.__hwnd.end = True self.__hwnd.end = True
self.__hwnd = None self.__hwnd = None
self.pids = [] if self.autofindpids:
self.gameuid = None self.pids = []
self.md5 = "0" self.gameuid = None
self.basename = self.__basename self.md5 = "0"
self.basename = self.__basename
if _hwnd: if _hwnd:
self.__hwnd = hwndchecker(_hwnd, self) self.__hwnd = hwndchecker(_hwnd, self)
if not self.autofindpids:
return
self.pids = [windows.GetWindowThreadProcessId(_hwnd)] self.pids = [windows.GetWindowThreadProcessId(_hwnd)]
gameuid = findgameuidofpath(getpidexe(self.pids[0])) gameuid = findgameuidofpath(getpidexe(self.pids[0]))
if gameuid: if gameuid:

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5) set(VERSION_MAJOR 5)
set(VERSION_MINOR 26) set(VERSION_MINOR 26)
set(VERSION_PATCH 9) set(VERSION_PATCH 10)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)