#include <Windows.h>
#include <thread>
#include "memwrapper/memwrapper.h"
struct keys {
bool ews = false;
}keys;
static WNDPROC OrigWnd;
class extra
{
private:
using CTimerUpdate_t = void(__cdecl*)();
std::unique_ptr<memwrapper::memhook<CTimerUpdate_t>> pCTimerUpdateHook;
static void __cdecl CTimerUpdate_hook();
public:
extra() {
pCTimerUpdateHook = std::make_unique<memwrapper::memhook<CTimerUpdate_t>>(0x00561B10, CTimerUpdate_hook);
pCTimerUpdateHook->install();
};
~extra() {
*reinterpret_cast<char*>(0x5109AC) = 122;
*reinterpret_cast<char*>(0x5109C5) = 122;
*reinterpret_cast<char*>(0x5231A6) = 117;
*reinterpret_cast<char*>(0x52322D) = 117;
*reinterpret_cast<char*>(0x5233BA) = 117;
pCTimerUpdateHook->remove();
};
} xtra;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (uMsg == WM_KEYDOWN && wParam == VK_F5) {
keys.ews = !keys.ews;
return true;
}
if (uMsg == WM_KEYDOWN && wParam == VK_F11) {
xtra.~extra();
}
return CallWindowProcA(OrigWnd, hwnd, uMsg, wParam, lParam);
}
void __cdecl extra::CTimerUpdate_hook() {
static bool inited{ false };
if (!inited) {
OrigWnd = (WNDPROC)SetWindowLongA(**reinterpret_cast<HWND**>(0xC17054), GWL_WNDPROC, (LONG)WindowProc);
inited = true;
}
if (inited && keys.ews) {
*reinterpret_cast<char*>(0x5109AC) = 235;
*reinterpret_cast<char*>(0x5109C5) = 235;
*reinterpret_cast<char*>(0x5231A6) = 235;
*reinterpret_cast<char*>(0x52322D) = 235;
*reinterpret_cast<char*>(0x5233BA) = 235;
}
else {
*reinterpret_cast<char*>(0x5109AC) = 122;
*reinterpret_cast<char*>(0x5109C5) = 122;
*reinterpret_cast<char*>(0x5231A6) = 117;
*reinterpret_cast<char*>(0x52322D) = 117;
*reinterpret_cast<char*>(0x5233BA) = 117;
}
return xtra.pCTimerUpdateHook->call<>();
}