mirror of
https://github.com/0TheSpy/Seaside.git
synced 2025-09-19 20:26:10 +08:00
Update Hooks.hpp
This commit is contained in:
@ -199,3 +199,70 @@ int __stdcall hkGetUnverifiedFileHashes(void* _this, void* someclass, int nMaxFi
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
enum class account_status_t : int
|
||||
{
|
||||
none = 0,
|
||||
not_identifying,
|
||||
awaiting_cooldown,
|
||||
eligible,
|
||||
eligible_with_takeover,
|
||||
elevated, // prime
|
||||
account_cooldown
|
||||
};
|
||||
|
||||
typedef const int(__thiscall* pGetAccountData)(void*);
|
||||
pGetAccountData oGetAccountData;
|
||||
int __fastcall hkGetAccountData(void* _this, void* edx) noexcept
|
||||
{
|
||||
const auto ret = oGetAccountData(_this);
|
||||
|
||||
account_status_t& account_status = *reinterpret_cast<account_status_t*>(ret + 24);
|
||||
static const bool is_originally_prime_account = account_status == account_status_t::elevated; // not good fix
|
||||
if (!is_originally_prime_account)
|
||||
{
|
||||
account_status = g_Options.prime ? account_status_t::elevated : account_status_t::none;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
typedef const void(__thiscall* pShutdown)(void*, void*, const char*);
|
||||
pShutdown oShutdown;
|
||||
void __fastcall hkShutdown(void* thisptr, void* unk1, void* unk2, const char* reason) noexcept
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("shutdown (%x) HOOKED %s\n", thisptr, reason);
|
||||
#endif
|
||||
|
||||
if (*g_Options.discmsg_active) {
|
||||
#ifdef DEBUG
|
||||
printf("set new reason %s\n", g_Options.discmsg.value->mystring);
|
||||
#endif
|
||||
char customreason[256] = "#";
|
||||
strcat_s(customreason, MakeControlChars(g_Options.discmsg.value->mystring));
|
||||
|
||||
oShutdown(thisptr, nullptr, customreason);
|
||||
}
|
||||
else
|
||||
oShutdown(thisptr, nullptr, reason);
|
||||
}
|
||||
|
||||
inline void HookNetchannel()
|
||||
{
|
||||
DWORD ptrShutdown = *((DWORD*)iff.g_pEngineClient->GetNetChannelInfo()) + 36 * 4;
|
||||
DWORD addrShutdown = *(DWORD*)ptrShutdown;
|
||||
oShutdown = (pShutdown)DetourFunction(
|
||||
(PBYTE)(addrShutdown),
|
||||
(PBYTE)hkShutdown);
|
||||
#ifdef DEBUG
|
||||
printf("Detoured at %x\n", addrShutdown);
|
||||
#endif
|
||||
opt.netchannedlhooked = 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user