DirectInput Bhop

(+)_

Coders
xD BHop for games which use DirectInput. Only tested in Gothic 3.
DirectInput looks for scancode...

Credits:
UCForum
Other

Code:
#include <windows.h>
#include <stdio.h>

void SendKey( UINT mappedKey )
{
	INPUT Input[2]				= {0};

	Input[0].type					= INPUT_KEYBOARD;
	Input[0].ki.wScan			= mappedKey;
	Input[0].ki.dwFlags			= KEYEVENTF_SCANCODE;

	Input[1].type					= INPUT_KEYBOARD;
	Input[1].ki.wScan			= mappedKey;
	Input[1].ki.dwFlags			= KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;

	SendInput( 2, Input, sizeof(INPUT) );
}

void ChangeCase(char s)
{
	if((s > 64)&&(s < 91)) //check if in range of upper case characters
	{
		s += 32; //is upper, offset 32 to make lower
	}
	else if((s > 96)&&(s < 123)) //check if in range of lower case characters
	{
		s -= 32; //is lower, offset -32 to make upper
	}
}

void main()
{
	printf( "Start!\n\nPress the space bar! ...\n" );

	char Letter		= 'W';

	if( !isalpha( Letter ) && !isdigit( Letter ) )
	{
		printf( "Error!\n" );
		ExitProcess(0);
	}
	else if( isupper( Letter ) )
	{
		ChangeCase( Letter );
	}

	SHORT key				= VkKeyScanA( Letter );
	UINT mappedKey		= MapVirtualKey( LOBYTE( key ), 0 );

	while( true )
	{
		if( GetAsyncKeyState( VK_SPACE ) < 0 )
		{
			SendKey( mappedKey );
			SendKey( MapVirtualKey( VK_SPACE, 0 ) );
		}

		Sleep( 10 );
	}
}

15070936479_4bdd28d410_z.jpg
 
Last edited:
Top