From d6fafd58feeb50b4fbdd3bcf4f3a6276d47eaac5 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: Thu, 9 May 2024 15:30:31 +0800 Subject: [PATCH] fix --- LunaHook/main.cc | 8 +++++++- include/hookcode.cpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/LunaHook/main.cc b/LunaHook/main.cc index a838952..b861dd0 100644 --- a/LunaHook/main.cc +++ b/LunaHook/main.cc @@ -207,10 +207,16 @@ bool NewHook(HookParam hp, LPCSTR name){ return NewHook_1(hp,name); if(hp.jittype==JITTYPE::UNITY){ auto spls=strSplit(hp.unityfunctioninfo,":"); + if(spls.size()!=5){ + ConsoleOutput("invalid"); + return false; + } hp.address = tryfindmonoil2cpp(spls[0].c_str(),spls[1].c_str() ,spls[2].c_str(),spls[3].c_str(),std::stoi(spls[4])); - if(!hp.address) + if(!hp.address){ + ConsoleOutput("not find"); return false; + } return NewHook_1(hp,name); } //下面的是手动插入 diff --git a/include/hookcode.cpp b/include/hookcode.cpp index 909493d..7db999b 100644 --- a/include/hookcode.cpp +++ b/include/hookcode.cpp @@ -168,6 +168,7 @@ namespace if(hp.jittype==JITTYPE::UNITY){ if(HCode[0]!=L'@')return {}; HCode.erase(0,1); + HCode=HCode.substr(0,HCode.size()-wcslen(L":JIT:UNITY")); hp.argidx=hp.offset; hp.offset=0; hp.address=0;