mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-14 16:33:54 +08:00
fix
This commit is contained in:
parent
7abc23f171
commit
fbb30251c4
@ -726,9 +726,7 @@ class hookselect(closeashidewindow):
|
||||
action = menu.exec(self.tttable.cursor().pos())
|
||||
hc, _, tp = self.querykeyofrow(index)
|
||||
if action == remove:
|
||||
pid = tp.processId
|
||||
addr = tp.addr
|
||||
gobject.baseobject.textsource.removehook(pid, addr)
|
||||
gobject.baseobject.textsource.Luna_RemoveHook(tp.processId, tp.addr)
|
||||
|
||||
elif action == copy:
|
||||
winsharedutils.clipboard_set(hc)
|
||||
|
@ -240,7 +240,7 @@ class texthook(basetext):
|
||||
self.Luna_useembed = LunaHost.Luna_useembed
|
||||
self.Luna_useembed.argtypes = ThreadParam, c_bool
|
||||
self.Luna_embedcallback = LunaHost.Luna_embedcallback
|
||||
self.Luna_embedcallback.argtypes = DWORD, LPCWSTR, LPCWSTR
|
||||
self.Luna_embedcallback.argtypes = ThreadParam, LPCWSTR, LPCWSTR
|
||||
|
||||
self.Luna_QueryThreadHistory = LunaHost.Luna_QueryThreadHistory
|
||||
self.Luna_QueryThreadHistory.argtypes = (ThreadParam, c_void_p)
|
||||
@ -453,7 +453,7 @@ class texthook(basetext):
|
||||
tp.addr = addr
|
||||
tp.ctx = _ctx1
|
||||
tp.ctx2 = _ctx2
|
||||
self.useembed(tp, True)
|
||||
self.Luna_useembed(tp, True)
|
||||
|
||||
def safeembedcheck(self, text):
|
||||
try:
|
||||
@ -468,8 +468,8 @@ class texthook(basetext):
|
||||
|
||||
@threader
|
||||
def getembedtext(self, text: str, tp):
|
||||
if not (self.isautorunning and self.Luna_checkisusingembed(tp)):
|
||||
return self.embedcallback(text, "")
|
||||
if not self.isautorunning:
|
||||
return self.embedcallback(text, "", tp)
|
||||
engine = (
|
||||
globalconfig["embedded"]["translator_2"]
|
||||
if globalconfig["embedded"]["use_appointed_translate"]
|
||||
@ -488,12 +488,11 @@ class texthook(basetext):
|
||||
trans = ""
|
||||
if globalconfig["embedded"]["trans_kanji"]:
|
||||
trans = kanjitrans(zhconv.convert(trans, "zh-tw"))
|
||||
self.embedcallback(text, trans)
|
||||
self.embedcallback(text, trans, tp)
|
||||
|
||||
def embedcallback(self, text: str, trans: str):
|
||||
def embedcallback(self, text: str, trans: str, tp:ThreadParam):
|
||||
trans = splitembedlines(trans)
|
||||
for pid in self.pids.copy():
|
||||
self.Luna_embedcallback(pid, text, trans)
|
||||
self.Luna_embedcallback(tp, text, trans)
|
||||
|
||||
def flashembedsettings(self, pid=None):
|
||||
if pid:
|
||||
@ -634,10 +633,6 @@ class texthook(basetext):
|
||||
"Invalie Hook Code Format!",
|
||||
)
|
||||
|
||||
def removehook(self, pid, address):
|
||||
for pid in self.pids.copy():
|
||||
self.Luna_RemoveHook(pid, address)
|
||||
|
||||
@threader
|
||||
def delaycollectallselectedoutput(self):
|
||||
while not self.ending:
|
||||
@ -696,10 +691,6 @@ class texthook(basetext):
|
||||
xx.append(self.serialkey(key))
|
||||
return xx
|
||||
|
||||
def useembed(self, address, ctx1, ctx2, use):
|
||||
for pid in self.pids.copy():
|
||||
self.Luna_useembed(pid, address, ctx1, ctx2, use)
|
||||
|
||||
def dispatchtext(self, text):
|
||||
self.runonce_line = text
|
||||
|
||||
|
@ -28,8 +28,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version)
|
||||
include(generate_product_version)
|
||||
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 53)
|
||||
set(VERSION_PATCH 13)
|
||||
set(VERSION_MINOR 55)
|
||||
set(VERSION_PATCH 0)
|
||||
|
||||
add_library(pch pch.cpp)
|
||||
target_precompile_headers(pch PUBLIC pch.h)
|
||||
|
@ -91,8 +91,7 @@ void (*Luna_Start)(ProcessEvent Connect, ProcessEvent Disconnect, void *, void *
|
||||
void (*Luna_Inject)(DWORD pid, LPCWSTR basepath);
|
||||
void (*Luna_EmbedSettings)(DWORD pid, UINT32 waittime, UINT8 fontCharSet, bool fontCharSetEnabled, wchar_t *fontFamily, UINT32 keeprawtext, bool fastskipignore);
|
||||
void (*Luna_useembed)(ThreadParam, bool use);
|
||||
bool (*Luna_checkisusingembed)(ThreadParam);
|
||||
void (*Luna_embedcallback)(DWORD pid, LPCWSTR text, LPCWSTR trans);
|
||||
void (*Luna_embedcallback)(ThreadParam, LPCWSTR text, LPCWSTR trans);
|
||||
std::set<std::string> notranslation;
|
||||
HANDLE hsema;
|
||||
class lunapatch
|
||||
@ -111,7 +110,6 @@ public:
|
||||
Luna_EmbedSettings = (decltype(Luna_EmbedSettings))GetProcAddress(LunaHost, "Luna_EmbedSettings");
|
||||
Luna_Inject = (decltype(Luna_Inject))GetProcAddress(LunaHost, "Luna_Inject");
|
||||
Luna_useembed = (decltype(Luna_useembed))GetProcAddress(LunaHost, "Luna_useembed");
|
||||
Luna_checkisusingembed = (decltype(Luna_checkisusingembed))GetProcAddress(LunaHost, "Luna_checkisusingembed");
|
||||
Luna_embedcallback = (decltype(Luna_embedcallback))GetProcAddress(LunaHost, "Luna_embedcallback");
|
||||
hsema = CreateSemaphore(NULL, 0, 100, NULL);
|
||||
Luna_Start(
|
||||
@ -148,14 +146,8 @@ public:
|
||||
[](const wchar_t *output, ThreadParam tp)
|
||||
{
|
||||
std::wstring text = output;
|
||||
for (auto pid : connectedpids)
|
||||
{
|
||||
if ((Luna_checkisusingembed(tp)))
|
||||
{
|
||||
auto trans = findtranslation(text);
|
||||
Luna_embedcallback(pid, output, trans.c_str());
|
||||
}
|
||||
}
|
||||
Luna_embedcallback(tp, output, trans.c_str());
|
||||
},
|
||||
0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user