Howdy,
I'm trying to automatically do frame perfect button presses in a game, but I've run into a bit of a snag.

I've managed to simulate what I'd like to do in a game running OpenGL by detour hooking glfwSwapBuffers and calling a function like so
Code:
DWORD jmpBackAddy;
DWORD _funcAddy;
void __declspec(naked) ourFunct() {
	__asm {
		push ebp
		mov ebp, esp
		sub esp, 8
		call [_funcAddy]
		jmp [jmpBackAddy]
	}
}

void Test()
{
	//Call this
}

DWORD __stdcall mainLoop(LPVOID param)
{

	int hookLength = 6;
	DWORD hookAddress = *(DWORD*)(0x4DA3E0); //SwapBuffers
	jmpBackAddy = hookAddress + hookLength;
	_funcAddy = (DWORD)Test;
	Hook((void*)hookAddress, ourFunct, hookLength);

	while (true)
	{

		if (GetAsyncKeyState(VK_ESCAPE) & 1)
                         break;
	}
	FreeLibraryAndExitThread((HMODULE)param, NULL);
}
But the game I intended for this to work on uses DirectX 11 and I can't find a function to hook in the same way.

Is there a better way of achieving this? Am I stupid? Probably, but any help would be greatly appreciated.