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 


Array and Loop in ASM.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Tue Mar 15, 2016 12:36 pm    Post subject: Array and Loop in ASM. Reply with quote

How to create a one-dimensional array and loop through it? Thanks a lot.
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Tue Mar 15, 2016 1:17 pm    Post subject: Reply with quote

Yeah explain what exactly you want to accomplish.
_________________
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Tue Mar 15, 2016 1:18 pm    Post subject: Reply with quote

What kind of array do you mean?

Basically all the instructions like
Code:
mov eax,[eax+ecx*4]

are loops through array, the multiplier and the offset of course depends on the type with which you want to fill your array ...
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Tue Mar 15, 2016 6:30 pm    Post subject: Reply with quote

Thanks for the replies. I want to create a global array that can hold the ID of multiple AI players. When an AI player dies, its ID will be taken off from the array. And when a new AI player is created, I want:
Option one:
The ID of the new AI player will be places in the position in the array where the last dead AI player was.


Option two:
The ID of the new AI player will be places in sequence of the array and do not take the position of the dead AI player in the array, which means there will be empty slot in the array.

I want to know how to implement both of these options.

I hope I explain it well. Sorry for my English.
Thanks a lot.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Mar 15, 2016 7:24 pm    Post subject: Reply with quote

Lets assume EBX holds the ID of the new AI and you backup whatever registers the game requires. Sample injection:
Code:
newmem:
  mov eax,myarray
  xor ecx,ecx
begin:
  cmp [eax+ecx*4],0
  je save
  inc ecx
  cmp ecx,#10 //max size of array
  jl begin
  jmp code
save:
  mov [eax+ecx*4],ebx
code:
  //original code
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Fri Mar 18, 2016 1:55 am    Post subject: Reply with quote

Zanzer wrote:
Lets assume EBX holds the ID of the new AI and you backup whatever registers the game requires. Sample injection:
Code:
newmem:
  mov eax,myarray
  xor ecx,ecx
begin:
  cmp [eax+ecx*4],0
  je save
  inc ecx
  cmp ecx,#10 //max size of array
  jl begin
  jmp code
save:
  mov [eax+ecx*4],ebx
code:
  //original code

Thanks a lot. Very Happy
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