bruhmoment21 / UniversalHookX

Universal graphical hook for Windows apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIRECTX9 Mouse clicks in game interface

bymcs opened this issue · comments

commented

Hello mouse clicks in game interface not working properly ,
In-game mouse clicks working properly before injecting dll ,
this looks like an imgui issue, can you help if you know ?
if you watch the video you can understand what i mean

vid.mp4

game link : https://www.origins2.global

edit: I noticed that if I press right and left click at the same time it works like normal left click

new information : clicking issue returns to normal when imgui window is hidden.

vid2.mp4
commented

I think the click problem is caused by the "WndProc" function.
this problem only happened to me in Metin2 game, CSGO also works normally, it looks like we should code a different function for Metin2 game.

commented

I've solved the problem, I'll share it when it's available

Taken from a cheat with another imgui menu coded for Metin2. c4us hack source

static WNDPROC oWndProc;
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	//ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
	
	if (msg == WM_KEYDOWN) {
		
		if (wParam == VK_INSERT) {
			
			H::bShowDemoWindow = !H::bShowDemoWindow;
			return 0;
		}
		else if (wParam == VK_HOME) {

			HANDLE hHandle = CreateThread(NULL, 0, ReinitializeGraphicalHooks, NULL, 0, NULL);
			if (hHandle != NULL) CloseHandle(hHandle);
			return 0;
		}
		else if (wParam == VK_END) {
	
			H::bShuttingDown = true;
			U::UnloadDLL();
			return 0;
		}
	}
	else if (msg == WM_DESTROY) {
		HANDLE hHandle = CreateThread(NULL, 0, ReinitializeGraphicalHooks, hWnd, 0, NULL);
		if (hHandle != NULL) CloseHandle(hHandle);
	}
	
	if (H::bShowDemoWindow)
	{
		ImGuiIO& io = ImGui::GetIO();

		switch (msg)
		{
		case WM_LBUTTONDOWN:
			io.MouseDown[0] = true;
			break;
		case WM_LBUTTONUP:
			io.MouseDown[0] = false;
			break;
		case WM_RBUTTONDOWN:
			io.MouseDown[1] = true;
			break;
		case WM_RBUTTONUP:
			io.MouseDown[1] = false;
			break;
		case WM_MBUTTONDOWN:
			io.MouseDown[2] = true;
			break;
		case WM_MBUTTONUP:
			io.MouseDown[2] = false;
			break;
		case WM_MOUSEWHEEL:
			io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;
			break;
		case WM_MOUSEMOVE:
			io.MousePos.x = (signed short)(lParam);
			io.MousePos.y = (signed short)(lParam >> 16);
			break;
		case WM_KEYDOWN:
			if (wParam < 256)
				io.KeysDown[wParam] = 1;
			break;
		case WM_KEYUP:
			if (wParam < 256)
				io.KeysDown[wParam] = 0;
			break;
		case WM_CHAR:
			if (wParam > 0 && wParam < 0x10000)
				io.AddInputCharacter((unsigned short)wParam);
			break;
		}
		if (io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput)
		{
			return true;
		}

	}
	return CallWindowProc(oWndProc, hWnd, msg, wParam, lParam);
}

hey sorry for the late reply but i stated in the readme that input handling is left to you to decide it.

Input handling is up to you to decide how to make/use it.

You could've tried to uncomment this line and comment the one above it.

commented

@bruhmoment21 hello, I encountered another problem, I cannot use the dll file that I compiled from my own computer on another computer.

VirtualBoxVM_SkIYUBnqc6

commented

solution: windows sdk must be installed