Page 1 of 1

HOW TO FIND THE ADDRESS WHEN THE BUTTON/KEY IS PRESSED?!!!

Posted: Thu Jan 09, 2020 8:02 am
by sherkhan
HELLO GUYZ,
I am new here in this forum,
Can any one please tell me that " how can we find the Address and the Value of the Button/key pressed in the game?"
I use PCSX2 - PS2 EMULATOR. and Cheat engine for hacking.
Thanks

Re: HOW TO FIND THE ADDRESS WHEN THE BUTTON/KEY IS PRESSED?!!!

Posted: Thu Jan 09, 2020 10:59 am
by TimFun13
In ASM it's a standard windows function, so just do a search for getAsyncKeyState and you should be able to find plenty of posts on it (you can even refine it with "site:cheatengine.org"). With Lua you'll need a timer or a thread and use isKeyPressed or getXBox360ControllerState. I tend to use lua so here is an example key reader from one of my tables.

Code: Select all

{$lua}
if syntaxcheck then return end
------------------------------ ENABLE ------------------------------
[ENABLE]
RunFireSelectKeyReader = true
local function keyReader(thread)
	while RunFireSelectKeyReader do
		local xcs = getXBox360ControllerState()
		if (xcs.LeftTrigger > 50 and xcs.GAMEPAD_DPAD_LEFT)
		or (isKeyPressed(VK_RBUTTON) and isKeyPressed(VK_NUMPAD1)) then
			-- Keys are pressed, do something here
			sleep(300)
		else
			-- Keys aren't press, do nothing
			sleep(0)
		end
		if process == nil or readInteger(process) == 0 then
			-- Process is no longer available so stop key reader
			RunFireSelectKeyReader = false
		end
	end
	thread.terminate()
end
if syntaxcheck then return end
createThread(keyReader)
------------------------------ DISABLE ------------------------------
[DISABLE]
RunFireSelectKeyReader = false