mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
272661b640
commit
1b28a2cfad
@ -5,6 +5,7 @@ void detachall();
|
|||||||
HMODULE hLUNAHOOKDLL;
|
HMODULE hLUNAHOOKDLL;
|
||||||
WinMutex viewMutex;
|
WinMutex viewMutex;
|
||||||
CommonSharedMem *commonsharedmem;
|
CommonSharedMem *commonsharedmem;
|
||||||
|
Synchronized<std::map<uint64_t, std::pair<std::string, HookParam>>> delayinserthook; // 谜之这个必须在这里定义(可以extern+cpp里定义,或者只在这里写),不能在main.h里inline定义,否则会在v141_xp上编译后会崩。
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
AutoHandle<> hookPipe = INVALID_HANDLE_VALUE,
|
AutoHandle<> hookPipe = INVALID_HANDLE_VALUE,
|
||||||
@ -252,20 +253,17 @@ bool NewHook_1(HookParam &hp, LPCSTR lpname)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static std::mutex delayinsertlock;
|
|
||||||
void delayinsertadd(HookParam hp, std::string name)
|
void delayinsertadd(HookParam hp, std::string name)
|
||||||
{
|
{
|
||||||
std::lock_guard _(maplock);
|
delayinserthook->insert(std::make_pair(hp.emu_addr, std::make_pair(name, hp)));
|
||||||
delayinserthook[hp.emu_addr] = {name, hp};
|
|
||||||
ConsoleOutput(INSERTING_HOOK, name.c_str(), hp.emu_addr);
|
ConsoleOutput(INSERTING_HOOK, name.c_str(), hp.emu_addr);
|
||||||
}
|
}
|
||||||
void delayinsertNewHook(uint64_t em_address)
|
void delayinsertNewHook(uint64_t em_address)
|
||||||
{
|
{
|
||||||
if (delayinserthook.find(em_address) == delayinserthook.end())
|
if (delayinserthook->find(em_address) == delayinserthook->end())
|
||||||
return;
|
return;
|
||||||
std::lock_guard _(maplock);
|
auto h = delayinserthook->at(em_address);
|
||||||
auto h = delayinserthook[em_address];
|
delayinserthook->erase(em_address);
|
||||||
delayinserthook.erase(em_address);
|
|
||||||
NewHook(h.second, h.first.c_str());
|
NewHook(h.second, h.first.c_str());
|
||||||
}
|
}
|
||||||
bool NewHook(HookParam hp, LPCSTR name)
|
bool NewHook(HookParam hp, LPCSTR name)
|
||||||
|
@ -25,7 +25,6 @@ void jitaddraddr(uint64_t em_addr, uintptr_t jitaddr, JITTYPE);
|
|||||||
void context_get(hook_stack *, PCONTEXT);
|
void context_get(hook_stack *, PCONTEXT);
|
||||||
void context_set(hook_stack *, PCONTEXT);
|
void context_set(hook_stack *, PCONTEXT);
|
||||||
|
|
||||||
inline std::map<uint64_t, std::pair<std::string, HookParam>> delayinserthook;
|
|
||||||
void delayinsertadd(HookParam, std::string);
|
void delayinsertadd(HookParam, std::string);
|
||||||
void delayinsertNewHook(uint64_t);
|
void delayinsertNewHook(uint64_t);
|
||||||
inline bool safeautoleaveveh = false;
|
inline bool safeautoleaveveh = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user