add a play button for the xm file

This commit is contained in:
cheatengine@gmail.com 2014-04-30 18:07:44 +00:00
parent 6ef53c9dfa
commit f08374ef02
3 changed files with 135 additions and 25 deletions

View File

@ -1,7 +1,7 @@
object frmTrainerGenerator: TfrmTrainerGenerator
Left = 390
Left = 595
Height = 416
Top = 179
Top = 199
Width = 703
Caption = 'Trainer generator'
ClientHeight = 416
@ -12,7 +12,7 @@ object frmTrainerGenerator: TfrmTrainerGenerator
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.0.8.0'
LCLVersion = '1.2.0.3'
object Panel1: TPanel
Left = 201
Height = 416
@ -33,9 +33,9 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label2: TLabel
Left = 8
Height = 16
Height = 15
Top = 24
Width = 71
Width = 70
Caption = 'Processname'
ParentColor = False
end
@ -67,9 +67,9 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label1: TLabel
Left = 271
Height = 16
Height = 15
Top = 192
Width = 166
Width = 165
Caption = 'Freeze interval (in milliseconds)'
ParentColor = False
end
@ -149,9 +149,9 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label3: TLabel
Left = 6
Height = 16
Height = 15
Top = 40
Width = 59
Width = 58
Caption = 'About text:'
ParentColor = False
end
@ -184,9 +184,9 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label4: TLabel
Left = 6
Height = 16
Height = 15
Top = 0
Width = 24
Width = 23
Caption = 'Title'
ParentColor = False
end
@ -272,9 +272,9 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label5: TLabel
Left = 276
Height = 16
Height = 15
Top = 328
Width = 39
Width = 38
Caption = 'Output'
ParentColor = False
end
@ -298,8 +298,8 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object Label6: TLabel
Left = 0
Height = 31
Top = 385
Height = 30
Top = 386
Width = 502
Align = alBottom
Caption = 'Tip: The trainer generator is a tool for beginners. It is recommended to learn lua and the formdesigner and save as .exe manually to experience the full power of a Cheat Engine trainer'
@ -367,18 +367,18 @@ object frmTrainerGenerator: TfrmTrainerGenerator
end
object lblActivateSound: TLabel
Left = 281
Height = 16
Height = 15
Top = 93
Width = 44
Width = 43
Caption = 'Activate'
Enabled = False
ParentColor = False
end
object lblDeactivateSound: TLabel
Left = 269
Height = 16
Height = 15
Top = 113
Width = 56
Width = 55
Caption = 'Deactivate'
Enabled = False
ParentColor = False
@ -425,7 +425,6 @@ object frmTrainerGenerator: TfrmTrainerGenerator
000004733AFF2D8859FF859C90FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000
}
NumGlyphs = 0
OnClick = sbPlayActivateClick
end
object sbPlayDeactivate: TSpeedButton
@ -470,9 +469,16 @@ object frmTrainerGenerator: TfrmTrainerGenerator
000004733AFF2D8859FF859C90FF000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000
}
NumGlyphs = 0
OnClick = sbPlayDeactivateClick
end
object sbPlayStopXM: TSpeedButton
Left = 231
Height = 22
Top = 307
Width = 23
Enabled = False
OnClick = sbPlayStopXMClick
end
end
object Panel2: TPanel
Left = 0
@ -664,4 +670,75 @@ object frmTrainerGenerator: TfrmTrainerGenerator
left = 488
top = 128
end
object ImageList1: TImageList
left = 40
top = 95
Bitmap = {
4C69020000001000000010000000000000000000000004733AFF2D8859FF859C
90FF000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000004733AFFA4D9BEFF3D93
66FF5F8873FF0000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF9BD5
B7FF4C9F73FF3D7D5CFF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000004733AFFA5DABFFF57BB
87FF90D2B0FF5BAB82FF23774CFFD4D5D4FF0000000000000000000000000000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF45B4
7BFF47B47CFF82CCA6FF67B68CFF177745FFC1C5C3FF00000000000000000000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF3EB1
76FF3AAF73FF36AE70FF6FC598FF71BF97FF187B49FFA6B0ABFF000000000000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF36AD
70FF32AC6DFF2DAA6AFF28A866FF58BC89FF78C59DFF1F804EFF839A8EFF0000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF2EAD
6BFF2BAD6AFF27AB68FF22A964FF1CA55FFF41B278FF78C69FFF298858FF678C
79FF000000000000000000000000000000000000000004733AFFA9DCC1FF0CAA
58FF12AE5EFF15AF60FF16AD61FF13AA5DFF3AB677FF75C79DFF288957FF4E83
67FF000000000000000000000000000000000000000004733AFFA9DCC1FF0DB3
5EFF0EB660FF0EB660FF0DB45FFF47C484FF70CA9CFF1D824DFF678C79FF0000
0000000000000000000000000000000000000000000004733AFFA9DCC1FF10BD
65FF11C167FF13C269FF59D395FF67C998FF167C47FF889C92FF000000000000
0000000000000000000000000000000000000000000004733AFF83DCAFFF11C3
69FF1ACC73FF69DFA3FF5AC28DFF137643FF9EA7A3FF00000000000000000000
0000000000000000000000000000000000000000000009773FFF83DBAEFF1FC6
71FF72DEA7FF4BB27FFF177445FFA8ADAAFF0000000000000000000000000000
0000000000000000000000000000000000000000000004733AFF82D8ACFF76D6
A6FF3C9D6AFF27744CFFACAEADFF000000000000000000000000000000000000
0000000000000000000000000000000000000000000004733AFF7ACFA4FF2C8C
5AFF3D7659FFAEAEAEFF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000004733AFF21824FFF6382
72FF000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE64550BFE64550
BFE64550BFE64550BFE64550BFE64550BFE64550BFE64550BFE64550BFE64550
BFE64550BFE6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6D1D4F1FFCCD0
F2FFC6CBF2FFBFC5F2FFB7BEF3FFAEB8F3FFA5AFF4FF9BA8F4FF919FF5FF8795
F6FF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6CCD0F1FFC6CB
F1FFBFC5F2FFB7BFF3FFAFB7F4FFA6AFF5FF9BA8F5FF919FF6FF8796F6FF7D8D
F7FF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6C7CAF1FFBFC5
F3FFB7BEF3FFAEB7F4FFA6AFF4FF9BA7F5FF929FF6FF8796F6FF7C8DF7FF7284
F7FF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6BFC5F2FFB7BE
F3FFAFB7F4FFA5AFF4FF9CA7F5FF929FF6FF8795F6FF7D8DF7FF7284F8FF687C
F8FF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6B7BEF3FFAFB7
F4FFA6B0F4FF9BA8F5FF929FF6FF8796F6FF7C8DF7FF7284F8FF677BF8FF5D73
F9FF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6AEB7F3FFA5AF
F5FF9CA7F5FF919FF5FF8796F7FF7C8DF7FF7284F8FF687BF9FF5D73F9FF536B
FAFF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6A6AFF4FF9CA7
F5FF919FF5FF8796F6FF7D8DF7FF7184F7FF687CF8FF5D73F9FF546AFAFF4A63
FBFF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE69BA7F5FF929F
F5FF8796F7FF7C8DF7FF7284F8FF677CF8FF5E73F9FF546BFAFF4A63FBFF415C
FBFF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6929EF5FF8796
F6FF7C8DF7FF7285F8FF687CF9FF5E73F9FF546BFAFF4B63FBFF425CFBFF3955
FCFF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE68796F6FF7C8D
F7FF7284F8FF687CF8FF5E73FAFF536AFAFF4A63FAFF425CFBFF3A55FCFF334F
FCFF393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF004550BFE6393986E63939
86E6393986E6393986E6393986E6393986E6393986E6393986E6393986E63939
86E6393986E6FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00
}
end
end

View File

@ -47,6 +47,7 @@ type
edtPopupHotkey: TEdit;
fnXM: TFileNameEdit;
GroupBox2: TGroupBox;
ImageList1: TImageList;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
@ -78,6 +79,7 @@ type
spbUp: TSpeedButton;
sbPlayActivate: TSpeedButton;
sbPlayDeactivate: TSpeedButton;
sbPlayStopXM: TSpeedButton;
procedure btnDeleteClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
@ -113,6 +115,7 @@ type
procedure RadioButton2Change(Sender: TObject);
procedure sbPlayActivateClick(Sender: TObject);
procedure sbPlayDeactivateClick(Sender: TObject);
procedure sbPlayStopXMClick(Sender: TObject);
procedure spbDownClick(Sender: TObject);
procedure spbUpClick(Sender: TObject);
private
@ -121,6 +124,9 @@ type
restoretimer: ttimer;
adconfig: TfrmAdConfig;
playbitmap: TBitmap;
stopbitmap: TBitmap;
procedure editHotkey(m: Tmemoryrecord; hotkey: TMemoryrecordhotkey);
procedure AddHotkey(hk: TMemoryrecordHotkey);
procedure buildcheatlist;
@ -150,7 +156,7 @@ var
implementation
uses mainunit, frmD3DTrainerGeneratorOptionsunit;
uses mainunit, frmD3DTrainerGeneratorOptionsunit, xmplayer_server;
{ TfrmTrainerGenerator }
resourcestring
@ -489,6 +495,13 @@ begin
fillHotkeyList;
buildcheatlist;
FillSound;
playbitmap:=TBitmap.Create;
stopbitmap:=TBitmap.Create;
ImageList1.GetBitmap(0, playbitmap);
ImageList1.GetBitmap(1, stopbitmap);
sbPlayStopXM.Glyph:=playbitmap;
end;
procedure TfrmTrainerGenerator.FormShow(Sender: TObject);
@ -577,6 +590,22 @@ begin
LUA_DoScript('playSound(findTableFile([['+cbDeactivateSound.Text+']]))');
end;
procedure TfrmTrainerGenerator.sbPlayStopXMClick(Sender: TObject);
begin
if sbPlayStopXM.tag=0 then //not yet playing
begin
xmplayer.playXM(fnXM.FileName);
sbPlayStopXM.glyph:=stopbitmap;
sbPlayStopXM.tag:=1;
end
else
begin
xmplayer.stop;
sbPlayStopXM.glyph:=playbitmap;
sbPlayStopXM.tag:=0;
end;
end;
procedure TfrmTrainerGenerator.spbDownClick(Sender: TObject);
var
i: integer;
@ -1683,6 +1712,7 @@ begin
rbStopWhenAttached.enabled:=cbPlayXM.checked and cbStopPlaying.checked;
rbStopWhenFocusLost.enabled:=cbPlayXM.checked and cbStopPlaying.checked;
sbPlayStopXM.enabled:=cbPlayXM.checked;
end;
procedure TfrmTrainerGenerator.cbStopPlayingChange(Sender: TObject);

View File

@ -74,9 +74,12 @@ begin
if not initialized then
initialize;
f:=TFilestream.create(filename, fmOpenRead or fmShareDenyNone);
playXM(f, noloop);
f.free;
if FileExists(filename) then
begin
f:=TFilestream.create(filename, fmOpenRead or fmShareDenyNone);
playXM(f, noloop);
f.free;
end;
end;
procedure TXMPlayer.playXM(stream: TStream; noloop: boolean=false);