What's new

Welcome to HvH Forum!

SignUp Now! Download Free HvH CS:GO Cheats, CFG, LUA/JS Scripts, And More!


SignUp Now!

Source Code AutoAccept for LegendWare [spoonfeed] (creds. klye)

quantumware
Moderator
User ID
4
Messages
29
Reactions
328
Level
44
Firstly you should add MinHook library to your source
I changed over most my hooks to minhooks as apposed to vmthooks but you can use the same general idea to add this with vmthooks
use that skid brain and just look at other vmthooks in your source and copy the general idea

  1. Download attached zip
  2. Add the files into your project [Right click in a new filter or folder in Visual Studio and select Add -> Existing Item]
  3. Add all the files from the minhook zip
  4. After that follow below steps

configs.h
// add into misc struct // find 'bool anti_untrusted;' // insert below bool auto_accept_matchmaking;



configs.cpp
// insert wherever you please within this method 'void C_ConfigManager::setup()' setup_item(&g_cfg.misc.auto_accept_matchmaking, false, crypt_str("Misc.auto_accept_matchmaking"));



hooks.hpp
//find 'extern C_HookedEvents hooked_events;' // insert this code above that line extern vmthook* enginesound_hook; // find 'class c_baseplayeranimationstate;' // insert this code below that line struct SoundData { std::byte pad[4]; int entityIndex; int channel; const char* soundEntry; std::byte pad1[8]; float volume; std::byte pad2[44]; }; // find 'LRESULT __stdcall Hooked_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);' // insert this code above that line void __stdcall hooked_emitsound(SoundData data); // find 'extern SetMouseCodeState_t o_SetMouseCodeState;' // insert this code below that line using EmitSound_t = void(__stdcall*)(SoundData data); inline EmitSound_t oEmitSound;



hooks.cpp
// find 'C_HookedEvents hooked_events;' // insert this code above that line vmthook* enginesound_hook; // scroll to the bottom of hooks.cpp and paste this code void __stdcall hooks::hooked_emitsound(SoundData data) { static auto original_fn = oEmitSound; if (g_cfg.misc.auto_accept_matchmaking) { if (!strcmp(data.soundEntry, "UIPanorama.popup_accept_match_beep")) { static auto fnAccept = reinterpret_cast<bool(__stdcall*)(const char*)>(util::FindSignature("client.dll", "55 8B EC 83 E4 F8 8B 4D 08 BA ? ? ? ? E8 ? ? ? ? 85 C0 75 12")); static HWND window = FindWindow(NULL, "Counter-Strike: Global Offensive"); if (fnAccept) { fnAccept(""); FLASHWINFO fi; fi.cbSize = sizeof(FLASHWINFO); fi.hwnd = window; fi.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; fi.uCount = 0; fi.dwTimeout = 0; FlashWindowEx(&fi); } } } original_fn(data); } // insert wherever you please within this method 'void C_ConfigManager::setup()' setup_item(&g_cfg.misc.auto_accept_matchmaking, false, crypt_str("Misc.auto_accept_matchmaking"));



main.cpp
// below other includes at top of file // make sure this leads to the location of your minhook files so it actually finds the header file lol #include "minhook.h" // above the 'enum error_type' inline unsigned int get_virtual(void* _class, unsigned int index) { return static_cast<unsigned int>((*static_cast<int**>(_class))[index]); } // find 'hooks::original_processinterpolatedlist' // insert code below that line MH_Initialize(); // find 'hooks::hooked_events.RegisterSelf();' // insert code above that line MH_EnableHook(MH_ALL_HOOKS); // find 'while (!(INIT::Window = IFH(FindWindow)(crypt_str("Valve001"), nullptr)))' // insert code above that line - just find somewhere along your other hooks to put this hooks::enginesound_hook = new vmthook(reinterpret_cast<DWORD**>(m_enginesound())); const auto emitsound_target = reinterpret_cast<void*>(get_virtual(m_enginesound(), 5)); MH_CreateHook(emitsound_target, &hooks::hooked_emitsound, reinterpret_cast<void**>(&hooks::oEmitSound));
 

Attachments

  • minhook.zip
    25.1 KB · Views: 20

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Top