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 


how to reserve N bytes for dynamic string / array ?

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

Joined: 03 Oct 2014
Posts: 84

PostPosted: Thu Jan 12, 2023 12:03 pm    Post subject: how to reserve N bytes for dynamic string / array ? Reply with quote

Code:
label(myBigString)
registerSymbol(myBigString)


newmem:

bytes_save:
  readmem(AOB_LOG_f_ActiveTalentListOnUrbanZoneLand,5)

myBigString:
db [100]   cannot be compiled

db 'init string',0
[b]myBigString+100:[/b] ??   would this do it ?

code:


...
jmp code  // instead of jmp newmem


the string is built in a lua function and then the address passed as parameter for asm function call .. But if I don't reserve enough bytes the string will overwrite code:

myBigString+100: // ADDRESS NOT VALID
db 0
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Thu Jan 12, 2023 12:17 pm    Post subject: Reply with quote

`resb` pseudoinstruction. Don't use it in tandem with db: what you're trying to do in that first post would reserve 0x10C bytes, and the 'init string' would be written at myBigString+100.

Or just put the data after the code.

Code:
newmem:
code:
  // ...
bytes_save:
  readmem(...)
myBigString:
  db 'whatever',0
  // rest of newmem is reserved for myBigString

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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