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 


Logging values with Auto Assemble

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
ysfc3m
How do I cheat?
Reputation: 0

Joined: 13 Apr 2020
Posts: 8

PostPosted: Sun May 17, 2020 6:35 pm    Post subject: Logging values with Auto Assemble Reply with quote

Hello, this is my code:
Code:
[ENABLE]

aobscanmodule(INJECT,"Game.bnbx"+263C57,66 89 10 89 48 04 89 48 0C 89 48 08 C7 44 24 10 FF FF FF FF)
alloc(newmem,$1000, "Game.bnbx"+263C57)
alloc(buf, $50, "Game.bnbx"+263C57)
alloc(buf2, $100, "Game.bnbx"+263C57)

label(code)
label(return)
label(hexcbuf)
label(FileName)
label(crlf)
label(itoaloop)
label(itoaloop2)
label(itoaloop3)
label(inttostr)
label(savefile)
label(byteswritten)
label(dash)
label(iszero)
label(justone)

buf: // allocated 50 bytes
db 0

buf2:
FileName:
  db 'C:\Users\stokc\Desktop\c.txt',0
byteswritten:
  dd 0
tmp_register:
  dd 0
crlf:
  db 0d 0a 00
dash:
  db '=',0
iszero:
  db '0',0
hexcbuf:
  dd 0 0
  db 0

newmem:
// [eax+04]-[eax+0C]-[eax+08]
  //mov [eax],dx
  pushfd
  pushad  // I missed this at 64-bit :D

  cmp     eax, 0
  je      code
  cmp     eax, FFFFFFFF
  je      code
  cmp     eax, 7FFFFFFF
  je      code
  cmp     [eax+04], 0
  je      code
  cmp     [eax+0C], 2
  jae      code
  cmp     [eax+0C], 0
  jb      code

  mov     ebx, dword ptr [eax+08]
  push    ebx
  mov     ebx, dword ptr [eax+0C]
  push    ebx
  mov     ebx, dword ptr [eax+04]

  mov     eax, ebx          // convert inttost ebx
  call    inttostr          // save to buf
  lea     edx, [buf+0]      // code [eax+04]
  call    savefile

  lea     edx, [dash+0]     // dash
  call    savefile

  pop     eax               // convert inttost eax
  call    inttostr          // save to buf
  lea     edx, [buf+0]      // code [eax+0C]
  call    savefile

  lea     edx, [dash+0]     // dash
  call    savefile

  pop     eax               // convert inttost eax
  call    inttostr          // save to buf
  lea     edx, [buf+0]      // code [eax+08]
  call    savefile

  lea     edx, [crlf+0]     // cr/lf
  call    savefile

code:
  popad
  popfd
  mov [eax],dx
  mov [eax+04],ecx
  jmp return


newmem+200:
savefile:
  mov     ebx, edx        // buffer to write
  push    0
  push    80
  push    4
  push    0
  push    7
  push    4
  push    FileName
  call    CreateFileA
  mov     dword ptr [byteswritten], 0
  mov     esi, eax        // move file handle to esi
  mov     edx, ebx
  mov     eax, ebx
  mov     ebx, FFFFFFFF
aloop:                    // get string length
  inc     ebx
  cmp     byte ptr [eax+ebx], 0
  jnz     short aloop
  push    0
  push    [byteswritten]
  push    ebx             // nNumberOfBytesToWrite
  push    eax             //; lpBuffer
  push    esi             //; hFile
  call    WriteFile
  push    esi
  call    CloseHandle
  ret

newmem+300:
inttostr:
// put data to eax
  lea ecx, [buf+0]
// initialize buf[50]
  mov ebx, #50
itoaloop:
  mov byte ptr [ecx], 0
  inc ecx
  dec ebx
  cmp ebx, 0
  jg itoaloop
// Convert rax to string
  lea ecx, [buf+0]
  xor esi, esi
  mov ebx, #10
itoaloop2:
  xor edx, edx
  div ebx
  add dl, 30
  mov byte ptr [ecx], dl
  inc ecx
  inc esi
  cmp eax, 0
  jne itoaloop2
// String reverse
  cmp esi, 1
  je  justone
  xor edx, edx
  mov eax, esi
  mov ebx, 2
  div ebx
  dec esi
  xor ebx, ebx
  lea ecx, [buf+0]
itoaloop3:
  mov dl, byte ptr [ecx+ebx]
  mov dh, byte ptr [ecx+esi]
  mov byte ptr [ecx+ebx], dh
  mov byte ptr [ecx+esi], dl
  dec eax
  dec esi
  inc ebx
  cmp eax, 0
jne itoaloop3
// Finally
justone:
  ret
db 90 90 90 90


INJECT:
  jmp newmem
  nop
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
 db 66 89 10 89 48 04

unregistersymbol(INJECT)
dealloc(newmem)


And this is my test values:
Code:
663 needed (4-5 seconds to perform)
written values: 437 - 576 - 574 - 544

3707 needed (150 seconds to perform: game goes to "not responding" and after 150 seconds it is back)
written values: 3082 - 3140

9000 (my target)
not tested yet


Can you suggest me or help to fix this code please ? I am not sure asking paid help allowed but if needed i can pay.
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 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