mgr.inz.Player I post too much
  Reputation: 222
  Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
  | 
		
			
				 Posted: Sat Jan 15, 2011 3:49 pm    Post subject: Minesweeper. CE6 Lua GUI, AutoAssemble, SOUND. | 
				       | 
			 
			
				
  | 
			 
			
				Not for beginners  
 
 
Autoassemble scripts attached to cheat table and "LUA script" MIX.
 
 
 
 
 
Autoassemble scripts:
 
Unlimited Flags:
 
 	  | Code: | 	 		  [ENABLE]
 
winmine.exe+346E:
 
db 90 90 90 90 90 90
 
 
[DISABLE]
 
winmine.exe+346E:
 
db 01 05 94 51 00 01 | 	  
 
 
Timer Freeze:
 
 	  | Code: | 	 		  [ENABLE]
 
winmine.exe+2FF5:
 
db 90 90 90 90 90 90
 
 
[DISABLE]
 
winmine.exe+2FF5:
 
db FF 05 9C 57 00 01
 
 | 	  
 
 
 
Now the better part, SOUND:
 
 
Loading two WAVE files into memory
 
 	  | Code: | 	 		  [DISABLE]
 
dealloc(SOUNDcheatengine)
 
unregistersymbol(SOUNDcheatengine)
 
unregistersymbol(SOUNDcheatengine_2)
 
 
[ENABLE]
 
LOADLIBRARY(winmm.dll)
 
alloc(SOUNDcheatengine,47936)
 
registersymbol(SOUNDcheatengine)    // "disable" WAVE file
 
label(SOUNDcheatengine_2)
 
registersymbol(SOUNDcheatengine_2) // "enable" WAVE file
 
SOUNDcheatengine:
 
dd 46464952
 
dd 0000654C
 
dd 45564157
 
dd 20746D66
 
dd 00000010
 
dd 00010001
 
dd 00002B11
 
dd 00005622
 
.....
 
.....many of these
 
.....
 
SOUNDcheatengine_2:
 
dd 46464952
 
dd 000055E4
 
dd 45564157
 
dd 20746D66
 
.....
 
.....many of these
 
.....
 
 | 	  
 
 
Code from [ENABLE] is launched when trainer attches to process (onOpenProcess). Part between [DISABLE] [ENABLE] is launched when we close custom gui window (onClose)
 
Search "entry_sound_bytearray" inside LUA code.
 
 
 
 
Playing sound:
 
 
in this case, under SOUNDcheatengine_2 offset, there is WAVE with "cheat enabled" (assigned hotkey numeric1)
 
 	  | Code: | 	 		  [ENABLE]
 
globalalloc(codeplaysound,64)
 
createthread(codeplaysound)
 
 
codeplaysound:
 
push 5
 
push 0
 
push SOUNDcheatengine_2
 
call WINMM.PlaySoundA
 
ret
 
[DISABLE]
 
 | 	  
 
 
under SOUNDcheatengine offset, there is WAVE with "cheat disabled" (assigned hotkey numeric2)
 
 	  | Code: | 	 		  [ENABLE]
 
globalalloc(codeplaysound,64)
 
createthread(codeplaysound)
 
 
codeplaysound:
 
push 5
 
push 0
 
push SOUNDcheatengine
 
call WINMM.PlaySoundA
 
ret
 
[DISABLE]
 
 | 	  
 
 
Search "entry_soundenable" and "entry_sounddisable" inside LUA code.
 
 
 
LUA GUI
 
 
 
 	  | Code: | 	 		  ---------------------------------------------------------------
 
--------- _memrec_xxxxx_activated(te)
 
--------- where xxxxx is your table entry description
 
---------------------------------------------------------------
 
----- enable
 
function _memrec_Flags_activated(te)
 
     --play ("cheat enable")
 
     memrec_freeze(entry_soundenable)
 
     --clear freeze status
 
     memrec_unfreeze(entry_sounddisable)
 
     --change "label caption" related to cheat status (enabled)
 
     control_setCaption( unlimitedflagsLabel, unlimitedflagsString .. " [enabled]")
 
end
 
function _memrec_Timer_activated(te)
 
     memrec_freeze(entry_soundenable)
 
     memrec_unfreeze(entry_sounddisable)
 
     control_setCaption( timefreezeLabel, timefreezeString .. " [enabled]")
 
end
 
----- disable (opposite, freeze unfreeze'ed and vice versa, )
 
function _memrec_Flags_deactivated(te)
 
     --play ("cheat disable")
 
     memrec_unfreeze(entry_soundenable)
 
     --clear freeze status
 
     memrec_freeze(entry_sounddisable)
 
     --change "label caption" related to cheat status (disabled)
 
     control_setCaption( unlimitedflagsLabel, unlimitedflagsString )
 
end
 
function _memrec_Timer_deactivated(te)
 
     memrec_unfreeze(entry_soundenable)
 
     memrec_freeze(entry_sounddisable)
 
     control_setCaption( timefreezeLabel, timefreezeString )
 
end
 
---------------------------------------------------------------
 
---------------------------------------------------------------
 
--------- autoassamble sound (huge byte array)
 
function onOpenProcess(processid)
 
     -- Autoassemble script with wave files
 
     memrec_freeze(entry_sound_bytearray)
 
     --change form caption
 
     control_setCaption(TrainerWindow,"Minesweeper. Lua, Autoassemble, Sound. ACTIVE")
 
end
 
---------------------------------------------------------------
 
--------- function InitLabel (Wiccaan function)-----------------
 
function InitLabel( form, x, y, text )
 
     local label = createLabel(form)
 
     if( label == nil ) then return nil end 
 
     control_setCaption( label, text )
 
     control_setPosition( label, x, y )
 
     return label
 
end
 
---------------------------------------------------------------
 
---------------------------------------------------------------
 
function onClose(sender)
 
     --cleaning
 
     memrec_unfreeze(entry_sound_bytearray)
 
     unlimitedflagsLabel=nil
 
     timefreezeLabel=nil
 
     TrainerWindow = nil
 
     --show Cheat Engine Main Window
 
     unhideMainCEwindow()
 
end
 
---------------------------------------------------------------
 
----------------MAIN FUNCTION----------------------------------
 
---------------------------------------------------------------
 
--------- get Table Entries
 
entry_soundenable=getTableEntry('SOUND ENABLED')
 
entry_sounddisable=getTableEntry('SOUND DISABLED')
 
entry_sound_bytearray=getTableEntry('SOUND_BYTEARRAY')
 
---------
 
--------- initialize variables
 
unlimitedflagsString="Hit NUMERIC1 for unlimited flags"
 
timefreezeString="Hit NUMERIC2 for time freeze"
 
---------
 
--------- autoattach
 
aalist=getAutoAttachList()
 
stringlist_add(aalist,"winmine.exe")
 
---------
 
--------- prepare GUI
 
hideAllCEWindows()
 
TrainerWindow = createForm( true )
 
form_onClose(TrainerWindow,onClose)
 
control_setCaption(TrainerWindow,"Minesweeper. Lua, Autoassemble, Sound.")
 
control_setSize(TrainerWindow, 400,50)
 
unlimitedflagsLabel=InitLabel(TrainerWindow, 5, 5, unlimitedflagsString)
 
timefreezeLabel=InitLabel(TrainerWindow, 5, 25, timefreezeString)
 
form_centerScreen(TrainerWindow)
 
 | 	  
 
 
 
How to create WAV file inside CT:
 
1) prepare WAVE. 11025 HZ, 16 bit, mono. Save file as wav.wav
 
2) download my old pascal prog (quickly modified to WAV2CT.EXE) Link
 
3) place EXE file in the same folder where wav.wav file is
 
4) launch EXE, You get MUSIC.CT cheat table and information about size adjustments[/img]
	
  
	 
	
	
		
	 
	
		|  Description: | 
		
			
			
				Mineseeper
 LUA GUI, SOUND, AUTOASSEMBLER | 
			 
			 
		 | 
		  Download | 
	 
	
		|  Filename: | 
		 winmine.CT | 
	 
	
		|  Filesize: | 
		 157.87 KB | 
	 
	
		|  Downloaded: | 
		 3084 Time(s) | 
	 
	 
	 
 _________________
 
  Last edited by mgr.inz.Player on Mon Nov 14, 2011 4:48 pm; edited 3 times in total | 
			 
		  |