Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


read/write array of bytes with CEEdit?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Mon Apr 29, 2019 1:31 pm    Post subject: read/write array of bytes with CEEdit? Reply with quote

I want to ask two questions:
1) How to read/write array of bytes (28 bytes) from address: ePSXe ENG.exe+5E975C , with CEEdit?
2) How to read/write array of bytes (28 bytes) from address: ePSXe ENG.exe+5E975C , with CEEdit in Hex and in Decimal?

Solution is found. The easiest way is to use memory record of the array of byte type.
To read array of bytes:
Code:
AddressList=getAddressList()
timer = createTimer(nil,false)
timer.Interval = 1000
timer.OnTimer = function()

UDF1.CEEdit1.Text = AddressList.getMemoryRecordByDescription('28byteshex').Value
end
timer.Enabled = true


To write array of bytes:
Code:
  UDF1.CEEdit1.OnKeyPress = function(sender, key)
      timer.Enabled = false
      if isKeyPressed(VK_RETURN) then
        AddressList.getMemoryRecordByDescription('28byteshex').Value=UDF1.CEEdit1.Text
        timer.Enabled = true
      end
      return key
  end


To read/write array of bytes in Hex or Decimal, need to do right click on memory record of the array of byte type in Address List and choose Show as Decimal or Hexadecimal.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed May 01, 2019 9:16 pm    Post subject: Reply with quote

You can directly read the memory as well from Lua via:

Code:

readBytes(address,bytecount, ReturnAsTable ) : returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
  Reads the bytes at the given address and returns a table containing the read out bytes


You can then convert the returned data to a string of hex bytes as needed. Use the ReturnAsTable (set it to true) param to make this easier.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Fri May 03, 2019 4:56 am    Post subject: Reply with quote

@atom0s: Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites