Cheat Engine
The Official Site of Cheat Engine

Author Message
OldCheatEngineUser
Whateven rank
Reputation: 9

Joined: 01 Feb 2016
Posts: 867

 Posted: Mon Jul 10, 2017 12:27 am    Post subject: 2D array or 3D array how would two dimensional array would be in assembly. or more. EDIT: who can write a small program with 5x5 (5d array). and assign random values to these boxes or whatever they called technically. and when we click on a box the value changes randomly. anyone interested in this? also since i talked about dimensional arrays. why not making a new value type with a table to set address of the value for a game that use dimensional arrays. it would be great feature. (and it must appear as columns and rows). _________________About Me; I Use CE Since Version 1.X, And Still Learning How To Use It Well! patched cheat engine tutorials Memory Hacker
FreeER
Grandmaster Cheater
Reputation: 27

Joined: 09 Aug 2013
Posts: 676

Posted: Mon Jul 10, 2017 10:46 pm    Post subject:

int x[n][m] with index x[i][j] translates to int x[i*n + j] and of course in bytes that translates to address of x + i*sizeof(int)*n + j*sizeof(int) or x+i*4*n + j*4, something like lea eax, [eax + ebx*4 + ecx] (not sure if that's entirely valid but).

the reason is that memory is flat so if you take a grid like this

 Code: 12345 00- XXXXX 05- XXXXX 10- XXXXX 15- XXXXX 20- XXXXX

and just stick them end to end

00- XXXXX 05- XXXXX 10- XXXXX 15- XXXXX 20- XXXXX

to move 1 row you have to move 5 Xs in memory. To move i rows you have to move i*5 Xs in memory, and to move i rows with n elements per row you have to move i*n Xs. To then select a particular x in the row (aka column) you just have to move by individual Xs, hence the +j. The same applies to higher dimensions, x[n][m][o] for x[i][j][k] is x[i*n*m + j*m + k].
OldCheatEngineUser
Whateven rank
Reputation: 9

Joined: 01 Feb 2016
Posts: 867

 Posted: Tue Jul 11, 2017 3:23 am    Post subject: thank you free... good example, even tho its a lil bit complicated to me. and I didn't get everything. but one thing here, you said size.of(int) so addresses will be 4 bytes in memory. then why in your example its 5bytes? BTW I don't understand multi dimensional arrays (technically I mean) they are different than normal array _________________About Me; I Use CE Since Version 1.X, And Still Learning How To Use It Well! patched cheat engine tutorials Memory Hacker
FreeER
Grandmaster Cheater
Reputation: 27

Joined: 09 Aug 2013
Posts: 676

Posted: Tue Jul 11, 2017 9:33 am    Post subject:

 OldCheatEngineUser wrote: but one thing here, you said size.of(int) so addresses will be 4 bytes in memory. then why in your example its 5bytes?
The Xs weren't meant to represent bytes but elements, and the numbers 1-5, 5,10,etc. were meant to represent the 1 dimensional indices (the 2D indices are pretty easy to see/count for a small 5x5)

 OldCheatEngineUser wrote: BTW I don't understand multi dimensional arrays (technically I mean) they are different than normal array
except that they're really not. They are, mostly, pointers to a chunk of memory numElements*sizeof(element) in size. The only difference is whether you have "syntactic sugar" to let you access it in terms of multiple-dimensions.

https://www.cse.msu.edu/~cse251/lecture11.pdf seems to provide good info on the subject
OldCheatEngineUser
Whateven rank
Reputation: 9

Joined: 01 Feb 2016
Posts: 867

Posted: Tue Jul 11, 2017 11:34 am    Post subject:

 FreeER wrote: https://www.cse.msu.edu/~cse251/lecture11.pdf seems to provide good info on the subject

pretty much good info.
thank you.
ill try the examples of dimensional array. (and debug the example.)

also there is a good subject too, which is pointers to arrays.
this is also a good thing to learn.

_________________
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
patched cheat engine tutorials
Memory Hacker
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 6 Hours Page 1 of 1

 Jump to: Select a forum Cheat Engine----------------Cheat EngineCheat Engine Lua ScriptingCheat Engine TutorialsGeneral GamehackingAuto Assembler tutorialsPointer tutorialsGame specific tutorialsWebbrowser stuff related tutorialsConsole ModdingLUA TutorialsLua Extensions General Discussions----------------General DiscussionsArtComputer TalkRandom spamArt RequestsArt TutorialsWillekeurige RotzooiGuestsHorse Excrement Cheat Requests----------------Single player cheat request Cheat Engine Downloads----------------TablesTrainersAuto Assemble scripts Coding----------------Cheat Engine SourceCETC Server and ClientsDBVMPlugin developmentGeneral programmingBinariesCrackmesGeneral programming+Game Development2D Graphics3D ModelingGameplay designWeb Development Games----------------Flash GamesGaia OnlineStick Arena
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