typedef void* (__fastcall* GetCPanel2DFn)(void*);
GetCPanel2DFn oGetCPanel2D;
typedef char(__fastcall* OnAcceptMatchFn)(panorama::CPanel2D*);
OnAcceptMatchFn OnAcceptMatch;
typedef void(__fastcall* RunScriptFn)(panorama::UIEngine*, panorama::IUIPanel*, const char*, const char*, int, int, bool);
RunScriptFn oRunScript;
panorama::CPanel2D* CPanel = nullptr;
void* GetCPanel2D(void* thisptr) {
if (!CPanel)
CPanel = (panorama::CPanel2D*)thisptr;
return oGetCPanel2D(thisptr);
}
void RunScript(panorama::UIEngine* thisptr, panorama::IUIPanel* panel, const char* entireJSCode, const char* pathToXMLContext, int int1, int int2, bool alreadyCompiled) {
if (CPanel && strstr(pathToXMLContext, "popup_accept_match.xml"))
OnAcceptMatch(CPanel);
oRunScript(thisptr, panel, entireJSCode, pathToXMLContext, int1, int2, alreadyCompiled);
}
void Hooks::HookRunScript() {
// Panel
uintptr_t CPanel2DBase = Memory::GetAbsoluteAddress(Адрес_С_Сиги + 0x2A, 3, 7);
uintptr_t GetCPanel2DFn = *(uintptr_t*)CPanel2DBase;
Hook((void*)GetCPanel2DFn, GetCPanel2D, (uintptr_t)&oGetCPanel2D, "GetCPanel2D");
// RunScript
void* FuncAddr = Memory::GetVFunc<void*>(sdk.panoramaEngine->AccessUIEngine(), 107);
Hook((void*)FuncAddr, RunScript, (uintptr_t)&oRunScript, "RunScript");
// OnAcceptMatch
OnAcceptMatch = (OnAcceptMatchFn)Memory::GetAbsoluteAddress(Адрес_С_Сиги + 0x55D, 1, 5);
}