📄 keylistener.pas
字号:
unit KeyListener;
interface
uses classes,windows,D3DX81mo,graphics,sysutils,syncobjs;
type TAPIInfo = record
location: Pointer;
Original: Array [0..4] of byte;
Jump: Array [0..4] of byte;
end;
procedure InitializeKeyListener;
type TKeyCombo=array [0..4] of word;
type TKeys=record
configured: boolean;
CEDir: string[255];
cewindow: thandle;
callibrationmode: boolean; //false=no textureselect hud
callibrationkey: TKeycombo;
setcallibration: boolean;
mousecallibrationhorizontal1point: single;
mousecallibrationvertical1point: single;
mousecallibrationhorizontal2point: single;
mousecallibrationvertical2point: single;
mousecallibrationhorizontal5point: single;
mousecallibrationvertical5point: single;
mousecallibrationhorizontal10point: single;
mousecallibrationvertical10point: single;
mousecallibrationhorizontal20point: single;
mousecallibrationvertical20point: single;
mousecallibrationhorizontal40point: single;
mousecallibrationvertical40point: single;
loadaimsettingsfile: tkeycombo;
saveaimsettingsfile: tkeycombo;
aimsettings1: string[255];
Aimsettings2: string[255];
Aimsettings3: string[255];
setaimsetting1: tkeycombo;
setaimsetting2: tkeycombo;
setaimsetting3: tkeycombo;
nexttexture: tkeycombo;
previoustexture: tkeycombo;
locktexture: tkeycombo;
IncreaseX: tkeycombo;
DecreaseX: TKeyCombo;
Increasey: tkeycombo;
Decreasey: TKeyCombo;
Increasez: tkeycombo;
Decreasez: TKeyCombo;
HoldAutoaimtoggle: boolean;
autoshoot: boolean;
autoaimtoggle: tKeycombo;
increaselag: tkeycombo;
decreaselag: tkeycombo;
zoomin,zoomout: TKeyCombo;
nozoom: tKeyCombo;
zoom1: tKeyCombo;
zoomlevel1: single;
zoom2: tkeycombo;
zoomlevel2: single;
zoom3: tkeycombo;
zoomlevel3: single;
zoom4: tkeycombo;
zoomlevel4: single;
zoom5: tkeycombo;
zoomlevel5: single;
zoomdelta: single;
lagdelta: integer;
setlag: boolean;
lagtoset: dword;
usefpslag: boolean;
rotateleft: tKeycombo;
rotateright: tkeycombo;
rotateup: tkeycombo;
rotatedown: tkeycombo;
moveleft: tkeycombo;
moveright: tkeycombo;
moveup: tkeycombo;
movedown: tkeycombo;
moveforward: tkeycombo;
movebackwards: tkeycombo;
movespeed: single;
rotatespeed: single;
setcameraback: tkeycombo;
zbuffer: tkeycombo;
fog: tkeycombo;
lighting: tkeycombo;
wireframe: tkeycombo;
ShowKeylist: tkeycombo;
SaveAlltextures: TKeycombo;
selectedlagrecord: string[50];
lagmemorytype: byte;
getlagfrommemory: boolean;
nrofoffsets: dword;
lagaddress: dword;
offset1: dword;
offset2: dword;
offset3: dword;
offset4: dword;
offset5: dword;
offset6: dword;
offset7: dword;
offset8: dword;
offset9: dword;
offset10: dword;
offset11: dword;
offset12: dword;
offset13: dword;
offset14: dword;
offset15: dword;
pollinginterval: integer;
end;
type PKeys= ^TKeys;
type Tdirectxversion= (Directx8,Directx9);
type tcepointer=record
address:dword;
offset:dword;
end;
type TKeyListener=class(TThread)
public
procedure execute; override;
end;
var KeyListenerThread: TKeyListener;
keys: PKeys;
KeysFileMapping:THandle;
//some public vars
var tickspersecond: int64;
TicksPerMS:double;
onetick: double; //holds the time in miliseconds that a tick takes
lasttick: int64;
lag: integer; //should be in keys
lagfrommemory: dword;
fpslag: double;
lagtimer: dword;
usefpslag: boolean;
lagoffsets: array of tcepointer;
bbb: dword;
xdelta,ydelta: single;
xdelta2,ydelta2: single;
autoaim: boolean;
autoaimtimer: dword;
aimsettings: string;
aimsettingsset: boolean;
aimsettingstimer: dword;
selectedaimconfig: integer; //1,2 or 3
showloading: boolean;
loadedtimer: dword;
showsaving: boolean;
savedtimer: dword;
callibrationmode: boolean;
//mouse callibration part
mousecallibrationactive: boolean;
mousecallibrationmode: integer;
mousecallibrationpreviouspos: td3dxvector2;
mousecallibrationhorizontal1point: single;
mousecallibrationvertical1point: single;
mousecallibrationhorizontal2point: single;
mousecallibrationvertical2point: single;
mousecallibrationhorizontal5point: single;
mousecallibrationvertical5point: single;
mousecallibrationhorizontal10point: single;
mousecallibrationvertical10point: single;
mousecallibrationhorizontal20point: single;
mousecallibrationvertical20point: single;
mousecallibrationhorizontal40point: single;
mousecallibrationvertical40point: single;
mousespeedx: array [0..40] of single;
mousespeedy: array [0..40] of single;
cefonthandle: tFont;
zoom: single;
fog,zbuffer,lighting,wireframe: dword;
LoadPhase: integer; //1=loading the locked textures 2=comparing
currentposition,maxposition: integer;
texturepointer: integer;
locking: boolean;
imreleasing: boolean;
autoshoot: boolean;
shot: boolean;
mousedowntime: dword;
clicktime: dword;
intervalbetweenshots: dword;
lastshot: dword;
directxversion: TDirectxversion;
imdrawing:boolean;
showkeylist: boolean;
keylist: tstringlist;
requiredkeylistwidth,requiredkeylistheight:integer;
texturelistCS: TCriticalsection;
LockedtexturelistCS: TCriticalsection;
function ConvertKeyComboToString(x: tkeycombo):string;
function CheckKeyCombo(keycombo: tkeycombo):boolean;
procedure getlag;
implementation
uses directxhook,directx9hook;
function ConvertKeyComboToString(x: tkeycombo):string;
var i: integer;
newstr: string;
begin
result:='';
for i:=0 to 4 do
if x[i]=0 then
break
else
begin
newstr:='';
case x[i] of
VK_BACK : newstr:='Backspace';
VK_SHIFT: newstr:='Shift';
VK_CONTROL: newstr:='Ctrl';
VK_MENU: newstr:='Alt';
VK_TAB : newstr:='Tab';
VK_CLEAR : newstr:='Clear';
VK_RETURN : newstr:='Enter';
VK_PAUSE : newstr:='Pause';
VK_CAPITAL : newstr:='Caps Lock';
VK_ESCAPE : newstr:='Esc';
VK_SPACE : newstr:='Space bar';
VK_PRIOR : newstr:='Page Up';
VK_NEXT : newstr:='Page Down';
VK_END : newstr:='End';
VK_HOME : newstr:='Home';
VK_LEFT : newstr:='Left Arrow';
VK_UP : newstr:='Up Arrow';
VK_RIGHT : newstr:='Right Arrow';
VK_DOWN : newstr:='Down Arrow';
VK_SELECT : newstr:='Select';
VK_PRINT : newstr:='Print';
VK_EXECUTE : newstr:='Execute';
VK_SNAPSHOT : newstr:='Print Screen';
VK_INSERT : newstr:='Insert';
VK_DELETE : newstr:='Delete';
VK_HELP : newstr:='Help';
VK_LWIN : newstr:='Left Windows key';
VK_RWIN : newstr:='Right Windows key';
VK_APPS : newstr:='Applications key';
VK_NUMPAD0 : newstr:='numeric 0';
VK_NUMPAD1 : newstr:='numeric 1';
VK_NUMPAD2 : newstr:='numeric 2';
VK_NUMPAD3 : newstr:='numeric 3';
VK_NUMPAD4 : newstr:='numeric 4';
VK_NUMPAD5 : newstr:='numeric 5';
VK_NUMPAD6 : newstr:='numeric 6';
VK_NUMPAD7 : newstr:='numeric 7';
VK_NUMPAD8 : newstr:='numeric 8';
VK_NUMPAD9 : newstr:='numeric 9';
VK_MULTIPLY : newstr:='numeric *';
VK_ADD : newstr:='numeric +';
VK_SEPARATOR : newstr:='numeric Separator';
VK_SUBTRACT : newstr:='numeric -';
VK_DECIMAL : newstr:='numeric .';
VK_DIVIDE : newstr:='numeric /';
VK_F1 : newstr:='F1';
VK_F2 : newstr:='F2';
VK_F3 : newstr:='F3';
VK_F4 : newstr:='F4';
VK_F5 : newstr:='F5';
VK_F6 : newstr:='F6';
VK_F7 : newstr:='F7';
VK_F8 : newstr:='F8';
VK_F9 : newstr:='F9';
VK_F10 : newstr:='F10';
VK_F11 : newstr:='F11';
VK_F12 : newstr:='F12';
VK_F13 : newstr:='F13';
VK_F14 : newstr:='F14';
VK_F15 : newstr:='F15';
VK_F16 : newstr:='F16';
VK_F17 : newstr:='F17';
VK_F18 : newstr:='F18';
VK_F19 : newstr:='F19';
VK_F20 : newstr:='F20';
VK_F21 : newstr:='F21';
VK_F22 : newstr:='F22';
VK_F23 : newstr:='F23';
VK_F24 : newstr:='F24';
VK_NUMLOCK : newstr:='Num Lock';
VK_SCROLL : newstr:='Scroll Lock';
48..57 : newstr:=chr(x[i]);
65..90 : newstr:=chr(x[i]);
else newstr:='#'+inttostr(x[i]);
end;
result:=result+newstr+'+';
end;
result:=copy(result,1,length(result)-1);
end;
function CheckKeyCombo(keycombo: tkeycombo):boolean;
var i: integer;
begin
result:=false;
if keycombo[0]=0 then exit;
if keycombo[0]<>0 then
begin
result:=true;
for i:=0 to 4 do
if (keycombo[i]=0) then break
else
if (getasynckeystate(keycombo[i])=0) then result:=false;
end;
end;
procedure TKeyListener.execute;
var i,j: integer;
ok,found: boolean;
tempsingle: single;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -