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 


write register value to file with auto assembler

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Artykalamata
Cheater
Reputation: 0

Joined: 21 Mar 2016
Posts: 32
Location: Germany

PostPosted: Fri Feb 24, 2017 11:24 am    Post subject: write register value to file with auto assembler Reply with quote

This function reads the tooltip text:

Code:
movzx ecx,byte ptr [rdx]


Now i want to write every char to a text file.
Whats the smartest way doing that?

Code:
globalalloc(_text,8)

code:
  movzx ecx,byte ptr [rdx]
  mov rbx,rdx
  jmp copy

copy:
  push rax
  mov rax,_text
  mov [rax],ecx
  pop rax
  jmp return
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Fri Feb 24, 2017 1:46 pm    Post subject: Reply with quote

A possible https://en.wikipedia.org/wiki/Circular_buffer

AA write/produce at head and Lua read/consume at tail then write to ui/file.
Should minimize the workload on target process, ie you don't want to make extra io in target process I guess.
It can make easier to change the process on how to write/display logged data, eg. CE Lua side can check if the register represent an Address has already been seen so no further action need, which might be complicated if done on AA script.
Needless to say, Lua can format your register data nicely before output.

btw,
@ main.lua @ ce directory
Code:

...
function debugger_onBreakpoint():
When a breaking breakpoint hits (that includes single stepping) and the lua function debugger_onBreakpoint() is defined it will be called and the global variables EAX, EBX, .... will be filled in
Return 0 if you want the userinterface to be updated and anything else if not (e.g: You continued from the breakpoint in your script)
...

and
ParkourPenguin's Track Changes to Addresses
http://forum.cheatengine.org/viewtopic.php?t=598509
has option "breakpoints to track all writes to the addresses" may meet your need.

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Artykalamata
Cheater
Reputation: 0

Joined: 21 Mar 2016
Posts: 32
Location: Germany

PostPosted: Fri Feb 24, 2017 5:17 pm    Post subject: Reply with quote

Thanks for your help, but i think something like "circular buffer" is to hard for me with my current xp. Wink
I made myselfe this little script:

Code:
debugProcess()
myaddress=getAddress("game.exe")+0xC2428

function log_TT(char)
  f = io.open(getCheatEngineDir() .. "TTLog.txt", "a");
  if char == "\0" then
    f:write("\n")
  else
    f:write(char)
  end
  f:close()
end

function debugger_onBreakpoint()
  myvar=RCX
  log_TT(string.char(myvar))
  print(string.char(myvar))
  return 1
end

debug_setBreakpoint(myaddress)


It might not be the fastest way of doing it but im pretty happy with my first LUA script. ^^
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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