From a2a287002dfd3a8d4def11f28bea338a8f87055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 1 Apr 2024 00:46:05 +0800 Subject: [PATCH] fix --- LunaHook/texthook.cc | 20 +++++++++----------- include/hookcode.cpp | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/LunaHook/texthook.cc b/LunaHook/texthook.cc index 1caf454..ae4591e 100644 --- a/LunaHook/texthook.cc +++ b/LunaHook/texthook.cc @@ -145,21 +145,18 @@ uintptr_t queryrelativeret(uintptr_t retaddr){ return relative; } -void jitfunctiontext_fun(hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){ +uintptr_t jitgetaddr(hook_stack* stack, HookParam* hp){ switch (hp->jittype) { #ifdef _WIN64 case JITTYPE::YUZU: - *data=YUZU::emu_arg(stack)[hp->argidx]+hp->padding; - break; + return YUZU::emu_arg(stack)[hp->argidx]+hp->padding; #endif case JITTYPE::PPSSPP: - *data=PPSSPP::emu_arg(stack)[hp->argidx]+hp->padding; - break; + return PPSSPP::emu_arg(stack)[hp->argidx]+hp->padding; default: - *data=0; + return 0; } - *len=HookStrLen(hp,(BYTE*)*data); } void TextHook::Send(uintptr_t lpDataBase) { @@ -183,6 +180,11 @@ void TextHook::Send(uintptr_t lpDataBase) plpdatain=(lpDataBase + hp.offset), lpDataIn=*(uintptr_t*)plpdatain; bool isstring=false; + if(hp.jittype!=JITTYPE::PC) + { + lpDataIn=jitgetaddr(stack,&hp); + plpdatain=(uintptr_t)&lpDataIn; + } auto use_custom_embed_fun=(hp.type&EMBED_ABLE)&&!(hp.type&EMBED_BEFORE_SIMPLE); if(use_custom_embed_fun) @@ -196,10 +198,6 @@ void TextHook::Send(uintptr_t lpDataBase) isstring=true; hp.text_fun(stack, &hp, &lpDataIn, &lpSplit, &lpCount); } - else if(hp.jittype!=JITTYPE::PC){ - isstring=true; - jitfunctiontext_fun(stack, &hp, &lpDataIn, &lpSplit, &lpCount); - } else { if (hp.type & FIXING_SPLIT) lpSplit = FIXED_SPLIT_VALUE; // fuse all threads, and prevent floating diff --git a/include/hookcode.cpp b/include/hookcode.cpp index cff1392..0174007 100644 --- a/include/hookcode.cpp +++ b/include/hookcode.cpp @@ -304,7 +304,7 @@ namespace if (hp.type & NO_CONTEXT) HCode += L'N'; - if (hp.codepage != 0 && !(hp.type & CODEC_UTF8) ) HCode += std::to_wstring(hp.codepage) + L'#'; + if (hp.codepage != 0 && !(hp.type & CODEC_UTF8)&&!(hp.type & CODEC_UTF16)&&!(hp.type & CODEC_UTF32) ) HCode += std::to_wstring(hp.codepage) + L'#'; if (hp.padding) HCode += HexString(hp.padding) + L'+';