mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-23 13:55:36 +08:00
safe
This commit is contained in:
parent
964868b2d2
commit
f0bbae9df9
@ -95,7 +95,6 @@ bool yuzusuyu::attach_function()
|
||||
auto DoJitPtr=getDoJitAddress();
|
||||
if(DoJitPtr==0)return false;
|
||||
ConsoleOutput("DoJitPtr %p",DoJitPtr);
|
||||
jitaddrclear();
|
||||
HookParam hp;
|
||||
hp.address=DoJitPtr;
|
||||
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||
|
@ -283,7 +283,6 @@ bool hookPPSSPPDoJit(){
|
||||
HookParam hp;
|
||||
hp.address=DoJitPtr;//Jit::DoJit
|
||||
ConsoleOutput("DoJitPtr %p",DoJitPtr);
|
||||
jitaddrclear();
|
||||
hp.user_value=(uintptr_t)new uintptr_t;
|
||||
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||
auto em_address=stack->THISCALLARG1;
|
||||
|
@ -207,8 +207,9 @@ void SafeSendJitVeh(hook_stack* stack,uintptr_t address,uintptr_t em_addr,JITTYP
|
||||
}__except (EXCEPTION_EXECUTE_HANDLER) {}
|
||||
}
|
||||
std::unordered_map<uintptr_t,uint64_t>addresscalledtime;
|
||||
bool safeautoleaveveh=false;
|
||||
bool SendJitVeh(PCONTEXT context,uintptr_t address,uintptr_t em_addr,JITTYPE jittype){
|
||||
|
||||
if(safeautoleaveveh)return true;
|
||||
if (recordsAvailable <= 0) return false;
|
||||
if(addresscalledtime.find(address)==addresscalledtime.end())addresscalledtime[address]=0;
|
||||
auto tm=GetTickCount64();
|
||||
@ -384,6 +385,7 @@ void SearchForHooks(SearchParam spUser)
|
||||
}
|
||||
else
|
||||
{
|
||||
safeautoleaveveh=false;
|
||||
ConsoleOutput(HOOK_SEARCH_INITIALIZED, jitaddr2emuaddr.size());
|
||||
std::vector<uint64_t>successaddr;int i=0;
|
||||
for(auto addr:jitaddr2emuaddr){
|
||||
@ -395,9 +397,10 @@ void SearchForHooks(SearchParam spUser)
|
||||
}
|
||||
ConsoleOutput(MAKE_GAME_PROCESS_TEXT, sp.searchTime / 1000);
|
||||
Sleep(sp.searchTime);
|
||||
for(auto addr:successaddr){
|
||||
remove_veh_hook((void*)addr);
|
||||
}
|
||||
// for(auto addr:successaddr){
|
||||
// remove_veh_hook((void*)addr);
|
||||
// }
|
||||
safeautoleaveveh=true;
|
||||
SearchForHooks_Return();
|
||||
}
|
||||
}).detach();
|
||||
|
@ -173,11 +173,6 @@ int HookStrLen(HookParam* hp,BYTE* data){
|
||||
|
||||
}
|
||||
static std::mutex maplock;
|
||||
void jitaddrclear(){
|
||||
std::lock_guard _(maplock);
|
||||
emuaddr2jitaddr.clear();
|
||||
jitaddr2emuaddr.clear();
|
||||
}
|
||||
void jitaddraddr(uintptr_t em_addr,uintptr_t jitaddr,JITTYPE jittype){
|
||||
std::lock_guard _(maplock);
|
||||
if(emuaddr2jitaddr.find(em_addr)==emuaddr2jitaddr.end())
|
||||
|
@ -21,7 +21,6 @@ inline SearchParam spDefault;
|
||||
int HookStrLen(HookParam*,BYTE* data);
|
||||
inline std::unordered_map<uintptr_t,std::pair<JITTYPE,std::set<uintptr_t> > >emuaddr2jitaddr;
|
||||
inline std::unordered_map<uintptr_t,std::pair<JITTYPE,uintptr_t>>jitaddr2emuaddr;
|
||||
void jitaddrclear();
|
||||
void jitaddraddr(uintptr_t em_addr,uintptr_t jitaddr,JITTYPE);
|
||||
|
||||
void context_get(hook_stack*,PCONTEXT);
|
||||
|
Loading…
Reference in New Issue
Block a user