Ai
1 Star 0 Fork 0

phy0292/cheat-engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
HotKeys.pas 21.09 KB
一键复制 编辑 原始数据 按行查看 历史
Dark Byte 提交于 2020-12-19 08:22 +08:00 . more dark mode fixes
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
unit HotKeys;
{$MODE Delphi}
interface
uses
{$ifdef darwin}
macport, LCLType, math, machotkeys,
{$endif}
{$ifdef windows}
windows,
{$endif}
LCLIntf, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, registry, CEFuncProc, ExtCtrls, LResources,
comCtrls, menus, hotkeyhandler, MemoryRecordUnit, commonTypeDefs, strutils, betterControls;
type
{ THotKeyForm }
THotKeyForm = class(TForm)
btnApply: TButton;
btnCreateHotkey: TButton;
btnEditHotkey: TButton;
btnCancel: TButton;
btnOK: TButton;
Button2: TButton;
cbActivateSound: TComboBox;
cbDeactivateSound: TComboBox;
cbFreezedirection: TComboBox;
cbForceEnglishActivate: TCheckBox;
cbForceEnglishDeactivate: TCheckBox;
edtActivateText: TEdit;
edtDeactivateText: TEdit;
edtDescription: TEdit;
edtFreezeValue: TEdit;
edtHotkey: TEdit;
schImageList: TImageList;
Label1: TLabel;
Label2: TLabel;
lblActivateSound: TLabel;
lblDeactivateSound: TLabel;
lblID: TLabel;
ListView1: TListView;
miAddSound: TMenuItem;
miDelete: TMenuItem;
odWave: TOpenDialog;
PageControl1: TPageControl;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
pmHotkeylist: TPopupMenu;
pmAddSound: TPopupMenu;
sbPlayActivate: TSpeedButton;
sbPlayDeactivate: TSpeedButton;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
procedure btnCreateHotkeyClick(Sender: TObject);
procedure btnEditHotkeyClick(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure cbActivateSoundChange(Sender: TObject);
procedure cbDeactivateSoundChange(Sender: TObject);
procedure cbForceEnglishActivateChange(Sender: TObject);
procedure cbFreezedirectionSelect(Sender: TObject);
procedure cbPlaySoundChange(Sender: TObject);
procedure edtHotkeyKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtHotkeyMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ListView1DblClick(Sender: TObject);
procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure miAddSoundClick(Sender: TObject);
procedure miDeleteClick(Sender: TObject);
procedure Panel2Resize(Sender: TObject);
procedure pmHotkeylistPopup(Sender: TObject);
procedure sbPlayActivateClick(Sender: TObject);
procedure sbPlayDeactivateClick(Sender: TObject);
private
{ Private declarations }
keys: tkeycombo;
editHotkey: boolean;
fmemrec: TMemoryRecord;
procedure SpeakText(s:string; forceEnglish: boolean=false);
procedure SetMemrec(x: TMemoryRecord);
function HotkeyActionToText(a: TMemrecHotkeyAction): string;
function getHotkeyAction: TMemrecHotkeyAction;
public
{ Public declarations }
property memrec: TMemoryRecord read fmemrec write SetMemrec;
end;
implementation
uses MainUnit, {$ifdef windows}trainergenerator,{$endif} luafile, LuaHandler, DPIHelper;
resourcestring
rsHotkeyID = 'Hotkey ID=%s';
rsToggleScript = 'Toggle script';
rsEnableScript = 'Enable script';
rsDisableScript = 'Disable script';
rsToggleFreeze = 'Toggle freeze';
rsToggleFreezeAndAllowIncrease = 'Toggle freeze and allow increase';
rsToggleFreezeAndAllowDecrease = 'Toggle freeze and allow decrease';
rsFreeze = 'Freeze';
rsUnfreeze = 'Unfreeze';
rsSetValueTo = 'Set value to:';
rsDecreaseValueWith = 'Decrease value with:';
rsIncreaseValueWith = 'Increase value with:';
rsSpeakText = 'Speak Text';
rsTextToSpeechHint = 'The text to speak'#13#10'{Description} = The description of the hotkey'#13#10'{MRDescription} = The description field of the memory record'#13#10'{MRValue} = The value of the memory record';
rsDefaultActivated = '%s Activated';
rsDefaultDeactivated = '%s Deactivated';
function THotkeyform.getHotkeyAction: TMemrecHotkeyAction;
begin
result:=mrhToggleActivation;
if fmemrec.vartype=vtAutoAssembler then
begin
case cbFreezedirection.ItemIndex of
0: result:=mrhToggleActivation;
1: result:=mrhActivate;
2: result:=mrhDeactivate;
end;
end
else
begin
case cbFreezedirection.ItemIndex of
0: result:=mrhToggleActivation;
1: result:=mrhToggleActivationAllowIncrease;
2: result:=mrhToggleActivationAllowDecrease;
3: result:=mrhActivate;
4: result:=mrhDeactivate;
5: result:=mrhSetValue;
6: result:=mrhDecreaseValue;
7: result:=mrhIncreaseValue;
end;
end;
end;
function THotkeyform.HotkeyActionToText(a: TMemrecHotkeyAction): string;
begin
{
Toggle freeze/Toggle activated
Toggle freeze and allow increase
Toggle freeze and allow decrease
Set value to:
Decrease value with:
Increase value with:
}
result:='';
if memrec.VarType=vtAutoAssembler then
begin
case a of
mrhToggleActivation: result:=cbFreezedirection.Items[0];
mrhActivate: result:=cbFreezedirection.items[1];
mrhDeactivate: result:=cbFreezedirection.items[2];
end;
end
else
begin
case a of
mrhToggleActivation: result:=cbFreezedirection.Items[0];
mrhToggleActivationAllowIncrease: result:=cbFreezedirection.Items[1];
mrhToggleActivationAllowDecrease: result:=cbFreezedirection.Items[2];
mrhActivate: result:=cbFreezedirection.items[3];
mrhDeactivate: result:=cbFreezedirection.items[4];
mrhSetValue: result:=cbFreezedirection.Items[5];
mrhDecreaseValue: result:=cbFreezedirection.Items[6];
mrhIncreaseValue: result:=cbFreezedirection.Items[7];
end;
end;
end;
procedure THotkeyform.SetMemrec(x: TMemoryRecord);
var i: integer;
li: TListItem;
hk: TMemoryRecordHotkey;
begin
if x<>nil then
begin
if x.VarType=vtAutoAssembler then
begin
cbFreezedirection.Clear;
cbFreezedirection.Items.add(rsToggleScript);
cbFreezedirection.items.add(rsEnableScript);
cbFreezedirection.items.add(rsDisableScript);
cbFreezedirection.ItemIndex:=0;
edtFreezeValue.enabled:=false;
end;
listview1.clear;
fmemrec:=x;
for i:=0 to memrec.HotkeyCount-1 do
begin
hk:=memrec.Hotkey[i];
begin
li:=listview1.Items.Add;
li.caption:=ConvertKeyComboToString(hk.keys);
li.SubItems.Add(HotkeyActionToText(hk.action));
li.SubItems.Add(hk.value);
li.SubItems.Add(hk.description);
lblid.caption:=inttostr(hk.id);
li.Data:=hk;
end;
end;
end;
end;
procedure THotKeyForm.btnCreateHotkeyClick(Sender: TObject);
var li: TListitem;
i: integer;
begin
for i:=0 to length(keys)-1 do
keys[i]:=0;
pagecontrol1.ActivePage:=tabsheet2;
li:=listview1.items.add;
li.SubItems.add(''); //on hotkey
li.SubItems.add(''); //value
li.SubItems.add(''); //description
li.Data:=nil;
li.selected:=true;
edtHotkey.text:='';
cbFreezedirection.ItemIndex:=0;
edtFreezeValue.text:='';
editHotkey:=true;
listview1.Enabled:=false;
if visible then
edtHotkey.SetFocus;
cbFreezedirectionSelect(cbFreezedirection);
cbActivateSound.itemindex:=-1;
cbActivateSoundChange(cbActivateSound);
cbDeactivateSound.itemindex:=-1;
cbDeactivateSoundChange(cbDeactivateSound);
end;
procedure THotKeyForm.btnEditHotkeyClick(Sender: TObject);
var
s: TListitem;
i: integer;
hk: TMemoryRecordHotkey;
begin
s:=listview1.selected;
if s=nil then
begin
i:=listview1.itemindex;
if i=-1 then exit;
s:=listview1.items[i];
end;
if s=nil then exit;
pagecontrol1.ActivePage:=tabsheet2;
listview1.Enabled:=false;
keys:=TMemoryRecordHotkey(listview1.selected.data).keys;
edtHotkey.text:=ConvertKeyComboToString(keys);
cbFreezedirection.ItemIndex:=cbFreezedirection.Items.IndexOf(listview1.selected.SubItems[0]);
edtFreezeValue.text:=listview1.selected.subitems[1];
edtDescription.text:=listview1.selected.subitems[2];
if visible then
edtHotkey.SetFocus;
editHotkey:=true;
hk:=TMemoryRecordHotkey(listview1.Selected.data);
if hk.ActivateSoundFlag=hksPlaySound then
cbActivateSound.ItemIndex:=cbActivateSound.Items.IndexOf(hk.activateSound)
else
begin
cbActivateSound.ItemIndex:=cbActivateSound.items.count-1;
cbForceEnglishActivate.checked:=hk.ActivateSoundFlag=hksSpeakTextEnglish;
edtActivateText.Text:=hk.activateSound;
end;
if hk.DeactivateSoundFlag=hksPlaySound then
cbDeactivateSound.ItemIndex:=cbDeactivateSound.Items.IndexOf(hk.deactivateSound)
else
begin
cbDeactivateSound.ItemIndex:=cbActivateSound.items.count-1;
cbForceEnglishDeactivate.checked:=hk.DeactivateSoundFlag=hksSpeakTextEnglish;
edtDeactivateText.Text:=hk.deactivateSound;
end;
cbActivateSoundChange(cbActivateSound);
cbDeactivateSoundChange(cbDeactivateSound);
cbFreezedirection.OnSelect(cbFreezedirection);
end;
procedure THotKeyForm.btnApplyClick(Sender: TObject);
var hk: TMemoryRecordHotkey;
begin
if editHotkey and (listview1.Selected.data<>nil) then
begin
hk:=TMemoryRecordHotkey(listview1.Selected.data);
hk.keys:=keys;
hk.action:=getHotkeyAction;
hk.value:=edtFreezeValue.text;
hk.fdescription:=edtDescription.text;
hk.registerkeys;
end
else
hk:=memrec.Addhotkey(keys, getHotkeyAction, edtFreezeValue.text, edtDescription.text );
if cbActivateSound.ItemIndex=cbActivateSound.items.count-1 then
begin
if cbForceEnglishActivate.Checked then
hk.ActivateSoundFlag:=hksSpeakTextEnglish
else
hk.ActivateSoundFlag:=hksSpeakText;
hk.activateSound:=edtActivateText.Text;
end
else
begin
hk.ActivateSoundFlag:=hksPlaySound;
hk.activateSound:=cbActivateSound.Text;
end;
if cbDeactivateSound.ItemIndex=cbDeactivateSound.items.count-1 then
begin
if cbForceEnglishDeactivate.Checked then
hk.DeactivateSoundFlag:=hksSpeakTextEnglish
else
hk.DeactivateSoundFlag:=hksSpeakText;
hk.deactivatesound:=edtDeactivateText.Text;
end
else
begin
hk.DeactivateSoundFlag:=hksPlaySound;
hk.deactivatesound:=cbDeactivateSound.Text;
end;
listview1.selected.Caption:=edtHotkey.Text;
listview1.Selected.SubItems[0]:=cbFreezedirection.Text;
listview1.selected.subitems[1]:=edtFreezeValue.text;
listview1.selected.subitems[2]:=edtDescription.text;
listview1.Selected.data:=hk;
pagecontrol1.ActivePage:=tabsheet1;
listview1.Enabled:=true;
edithotkey:=false;
end;
procedure THotKeyForm.btnCancelClick(Sender: TObject);
begin
editHotkey:=false;
if (listview1.Selected<>nil) and (listview1.selected.data=nil) then //created hotkey
listview1.selected.delete;
pagecontrol1.ActivePage:=tabsheet1;
listview1.Enabled:=true;
end;
procedure THotKeyForm.btnOKClick(Sender: TObject);
begin
if edithotkey then
btnApply.click;
close;
end;
procedure THotKeyForm.Button2Click(Sender: TObject);
begin
zeromemory(@keys,sizeof(TKeyCombo));
edtHotkey.Text:=ConvertKeyComboToString(keys);
edtHotkey.SetFocus;
end;
procedure THotKeyForm.cbActivateSoundChange(Sender: TObject);
begin
edtActivateText.visible:=cbActivateSound.ItemIndex=cbActivateSound.Items.Count-1;
cbForceEnglishActivate.visible:=edtActivateText.visible;
end;
procedure THotKeyForm.cbDeactivateSoundChange(Sender: TObject);
begin
edtDeactivateText.visible:=cbDeactivateSound.ItemIndex=cbDeactivateSound.Items.Count-1;
cbForceEnglishDeactivate.visible:=edtDeactivateText.Visible;
end;
procedure THotKeyForm.cbForceEnglishActivateChange(Sender: TObject);
begin
end;
procedure THotKeyForm.cbFreezedirectionSelect(Sender: TObject);
var
onpossible: boolean;
offpossible: boolean;
begin
edtFreezeValue.enabled:=(memrec.VarType<>vtAutoAssembler) and (cbFreezeDirection.itemindex >=5); //set value, increase by and decrease by
if (memrec.VarType=vtAutoAssembler) then
begin
onpossible:=cbFreezeDirection.itemindex in [0,1];
offpossible:=cbFreezeDirection.itemindex in [0,2];
end
else
begin
onpossible:=cbFreezeDirection.itemindex in [0,1,2,3,5,6,7];
offpossible:=cbFreezeDirection.itemindex in [0,1,2,4];
end;
lblActivateSound.enabled:=onpossible;
cbActivateSound.enabled:=onpossible;
sbPlayActivate.enabled:=onpossible;
lblDeactivateSound.enabled:=offpossible;
cbDeactivateSound.enabled:=offpossible;
sbPlayDeactivate.enabled:=offpossible;
end;
procedure THotKeyForm.cbPlaySoundChange(Sender: TObject);
begin
cbFreezedirectionSelect(cbFreezedirection);
end;
function isModifier(k: word): boolean;
begin
result:=false;
case k of
vk_lwin, vk_rwin, vk_shift,vk_lshift,
vk_rshift, VK_CAPITAL, VK_MENU, vk_LMENU,
vk_RMENU, VK_CONTROL, VK_LCONTROL, VK_RCONTROL:
result:=true;
end;
end;
procedure THotKeyForm.edtHotkeyKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
i: integer;
begin
{$ifdef darwin}
if not isModifier(key) then
begin
//there can be only one non-modifier
for i:=0 to 4 do
begin
if keys[i]=0 then break;
if not isModifier(keys[i]) then
begin
key:=0; //do not add
break;
end;
end;
end;
{$endif}
if keys[4]=0 then
begin
for i:=0 to 4 do
if keys[i]=0 then
begin
keys[i]:=key;
break;
end else
if keys[i]=key then break;
end;
edtHotkey.Text:=ConvertKeyComboToString(keys);
key:=0;
end;
procedure THotKeyForm.edtHotkeyMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var key: word;
begin
key:=0;
case button of
mbMiddle: key:=VK_MBUTTON;
mbExtra1: key:=VK_XBUTTON1;
mbExtra2: key:=VK_XBUTTON2;
end;
if key<>0 then
edtHotkeyKeyDown(edtHotkey, key, shift);
end;
procedure THotKeyForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
fmemrec.endEdit;
CloseAction:=caFree;
end;
procedure THotKeyForm.FormCreate(Sender: TObject);
var lblLimiteHotkeySupport: tlabel;
begin
{$ifdef darwin}
if loadMacHotkeyFunctions=false then
begin
lblLimiteHotkeySupport:=tlabel.create(self);
lblLimiteHotkeySupport.caption:='Limited hotkey support. No character keys supported';
lblLimiteHotkeySupport.font.color:=clRed;
lblLimiteHotkeySupport.align:=alBottom;
lblLimiteHotkeySupport.parent:=self;
end;
{$endif}
edtActivateText.Hint:=rsTextToSpeechHint; //make it easier for translators
edtDeactivateText.Hint:=edtActivateText.Hint;
edtActivateText.Text:=format(rsDefaultActivated, ['{MRDescription}']);
edtDeactivateText.Text:=format(rsDefaultDeactivated, ['{MRDescription}']);
edtActivateText.ShowHint:=true;
edtDeactivateText.ShowHint:=true;
pagecontrol1.ActivePage:=tabsheet1;
with cbFreezedirection.Items do
begin
clear;
add(rsToggleFreeze);
add(rsToggleFreezeAndAllowIncrease);
add(rsToggleFreezeAndAllowDecrease);
add(rsFreeze);
add(rsUnfreeze);
add(rsSetValueTo);
add(rsDecreaseValueWith);
add(rsIncreaseValueWith);
end;
cbFreezedirection.itemindex:=0;
cbActivateSound.Items.Clear;
cbDeactivateSound.Items.Clear;
cbActivateSound.Items.add('');
cbDeactivateSound.Items.add('');
{$ifdef windows}
FillSoundList(cbActivateSound.Items);
FillSoundList(cbDeactivateSound.Items);
cbActivateSound.Items.Add(rsSpeakText);
cbDeactivateSound.Items.Add(rsSpeakText);
{$else}
cbActivateSound.Enabled:=false;
cbDeactivateSound.Enabled:=false;
sbPlayActivate.enabled:=false;
sbPlayDeactivate.enabled:=false;
{$endif}
end;
procedure THotKeyForm.FormShow(Sender: TObject);
var
i, maxwidth: integer;
s: string;
{$ifdef windows}
cbi: TComboboxInfo;
{$endif}
begin
PageControl1.PageIndex:=1;
cbActivateSound.Top:=edtHotkey.Top;
AdjustSpeedButtonSize(sbPlayActivate);
AdjustSpeedButtonSize(sbPlayDeactivate);
maxwidth:=0;
for i:=0 to cbFreezedirection.Items.Count-1 do
begin
s:=cbFreezedirection.Items[i];
maxwidth:=max(maxwidth, Canvas.TextWidth(s));
end;
{$ifdef windows}
cbi.cbSize:=sizeof(cbi);
if GetComboBoxInfo(cbFreezedirection.Handle, @cbi) then
begin
i:=maxwidth-(cbi.rcItem.Right-cbi.rcItem.Left)+4;
cbFreezedirection.width:=cbFreezedirection.width+i;
end
else
{$endif}
cbFreezedirection.width:=maxwidth+16;
maxwidth:=0;
for i:=0 to cbActivateSound.Items.Count-1 do
begin
s:=cbActivateSound.Items[i];
maxwidth:=max(maxwidth, Canvas.TextWidth(s));
end;
maxwidth:=max(maxwidth, canvas.TextWidth(edtActivateText.Text));
{$ifdef windows}
cbi.cbSize:=sizeof(cbi);
if GetComboBoxInfo(cbActivateSound.Handle, @cbi) then
begin
i:=maxwidth-(cbi.rcItem.Right-cbi.rcItem.Left)+4;
cbActivateSound.width:=cbActivateSound.width+i;
end
else
{$endif}
cbActivateSound.width:=maxwidth+16;
if cbFreezedirection.width>edtHotkey.Width then
edtHotkey.Width:=cbFreezedirection.width;
constraints.MinWidth:=width;
Constraints.MinHeight:=height; //panel2.height+panel1.Height+3*edtDescription.Height;
cbActivateSoundChange(cbActivateSound);
cbDeactivateSoundChange(cbDeactivateSound);
PageControl1.PageIndex:=0;
// autosize:=false;
if editHotkey then
begin
PageControl1.PageIndex:=1;
edtHotkey.SetFocus;
end;
// panel1.Constraints.MinHeight:=btnCancel.Top+btnCancel.Height+2;
end;
procedure THotKeyForm.ListView1DblClick(Sender: TObject);
begin
if btnEditHotkey.enabled then
btnEditHotkey.click;
end;
procedure THotKeyForm.ListView1SelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
begin
btnEditHotkey.enabled:=selected;
if (listview1.selected<>nil) and (listview1.selected.data<>nil) then
lblid.caption:=Format(rsHotkeyID, [inttostr(TMemoryRecordHotkey(listview1.selected.data).id)])
else
lblid.caption:='';
end;
procedure THotKeyForm.miAddSoundClick(Sender: TObject);
var
i: integer;
s: tmemorystream;
lf: TLuafile;
oldactivate, olddeactivate: string;
begin
odwave.InitialDir:=GetCEdir;
if odwave.execute then
begin
for i:=0 to odwave.Files.Count-1 do
begin
s := TMemorystream.Create;
try
s.LoadFromFile(odwave.files[i]);
lf := TLuaFile.Create(extractfilename(odwave.files[i]), s);
MainForm.LuaFiles.Add(lf);
finally
s.free;
end;
end;
oldactivate:=cbActivateSound.text;
olddeactivate:=cbDeactivateSound.Text;
{$ifdef windows}
FillSoundList(cbActivateSound.Items);
FillSoundList(cbDeactivateSound.Items);
{$endif}
cbActivateSound.Items.Add(rsSpeakText);
cbDeactivateSound.Items.Add(rsSpeakText);
cbActivateSound.Itemindex:=cbActivateSound.Items.IndexOf(oldactivate);
cbDeactivateSound.Itemindex:=cbActivateSound.Items.IndexOf(olddeactivate);
end;
end;
procedure THotKeyForm.miDeleteClick(Sender: TObject);
var hk: TMemoryRecordHotkey;
begin
if listview1.enabled and (listview1.Selected<>nil) then
begin
hk:=TMemoryRecordHotkey(listview1.selected.data);
hk.free;
listview1.selected.delete;
end;
end;
procedure THotKeyForm.Panel2Resize(Sender: TObject);
begin
end;
procedure THotKeyForm.pmHotkeylistPopup(Sender: TObject);
begin
midelete.visible:=listview1.enabled and (listview1.Selected<>nil);
end;
procedure THotKeyForm.SpeakText(s:string; forceEnglish: boolean=false);
begin
s:=StringReplace(s,'{MRDescription}', memrec.Description,[rfIgnoreCase, rfReplaceAll]);
s:=StringReplace(s,'{Description}', edtDescription.Text, [rfIgnoreCase, rfReplaceAll]);
if forceEnglish then
LUA_DoScript('speakEnglish([['+s+']])')
else
LUA_DoScript('speak([['+s+']])');
end;
procedure THotKeyForm.sbPlayActivateClick(Sender: TObject);
begin
if cbActivateSound.ItemIndex=cbActivateSound.Items.Count-1 then
SpeakText(edtActivateText.text, cbForceEnglishActivate.Checked)
else
LUA_DoScript('playSound(findTableFile([['+cbActivateSound.Text+']]))');
end;
procedure THotKeyForm.sbPlayDeactivateClick(Sender: TObject);
begin
if cbDeactivateSound.ItemIndex=cbDeactivateSound.Items.Count-1 then
SpeakText(edtDeactivateText.text, cbForceEnglishDeactivate.Checked)
else
LUA_DoScript('playSound(findTableFile([['+cbDeactivateSound.Text+']]))');
end;
initialization
{$i HotKeys.lrs}
end.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/phy0292/cheat-engine.git
git@gitee.com:phy0292/cheat-engine.git
phy0292
cheat-engine
cheat-engine
master

搜索帮助