[Question] How to best create a list to edit values via selected character? [Solved]

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
ssj4maiko
What is cheating?
What is cheating?
Posts: 3
Joined: Thu Dec 15, 2022 1:42 am
Reputation: 1

[Question] How to best create a list to edit values via selected character? [Solved]

Post by ssj4maiko »

Before starting, let me explain that I already have most things:
- I know there is a pointer based on what I'm selecting, so if I'm in the first character, it's 00, if I'm selecting the 3rd character it's 02 and so on. I know I can find the pointer (So this is not part of my question)
- I have also mapped the memory to find the values that I want to edit, as in, I found out that 1st character is at Address "X", 2nd character is at Address "X"+(offset * selected_pointer), so if the distance between each set of characters is 100, then 0, 100, 200, 300 and so on. It's easy math.

So what I want to do is to make a list that shows which character I'm selecting (by number), and fills up a bunch of other data with the offsets I would be making, so I can easily visualize the relevant data and change them.

So, it would be like this:
- Selected: 05 #Shows that 4th character on the list is selected
- - Name: 10 bytes string
- - Value1: 1 byte signed int value
- - Value2: 2 bytes int
And so on

I have seen some complex Tables that do it, but they are overall very complicated for me to understand.
Again, I can deal with the pointers, offsets and math.

What I do not know is how to properly use Cheatengine to deal with this. I know very basic stuff about Scripting, so treat me as not knowing anything relevant.

I do know it's possible to use variables, so when I'm making a pointer to one of the values, I could create it using "Base Address" then following the offsets. What I do not know is how to make these variables, I'm guessing I would need to make scripts, but how to I make them, and how do I make them interact with the table. If this question is confusing, that's because I am confused with the interaction between these two ways of writing code (I'm used to the table version)

-------------

I don't need a step by step guide on how to make it (it sure is welcome though), if I can understand the logic, limitations and interactions between the Tables and scripts I may be able to find the answer myself, it's more like I just need some guidance.

Edit:
Trying to make a script:

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(CAW_selected_address, 8)
registersymbol(CAW_selected_address)
CAW_selected_address:
  dq Executable.exe+25E06A0
 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
unregistersymbol(CAW_selected_address)
dealloc(CAW_selected_address)
Then I created a cheat inside of it with the address "CAW_selected_address".
The address that it turns into is not the right one (much less the value expected)

I'm aware the code is wrong, but I don't what are the possible commands, or even if my logic is wrong, I want "Executable.exe+25E06A0" to be the value of my variable so I can use it as the base address for other codes via table
Last edited by ssj4maiko on Mon Sep 11, 2023 4:33 am, edited 1 time in total.

User avatar
tdg6661
Table Makers
Table Makers
Posts: 698
Joined: Sat Dec 15, 2018 12:10 pm
Reputation: 267

Re: [Question] How to best create a list to edit values via selected character?

Post by tdg6661 »

I believe there are opcodes that pointing to the current displayed character, all you need to do to find that and write that to CAW_selected_address and you can use it as base address.

For example:

Code: Select all

[ENABLE]
alloc(CAW_selected_address, 8)
registersymbol(CAW_selected_address)
CAW_selected_address:
  dq 0
 
[DISABLE]
unregistersymbol(CAW_selected_address)
dealloc(CAW_selected_address)
And use it on the opcodes that I mentioned before.

Code: Select all

mov [CAW_selected_address],xxxx // register that contains the current displayed character
And then you can define it on address list, use dissect data/structures to understand the offsets:
- - Name: CAW_selected_address+xxx
- - Value1: CAW_selected_address+xxx
- - Value2: CAW_selected_address+xxx

ssj4maiko
What is cheating?
What is cheating?
Posts: 3
Joined: Thu Dec 15, 2022 1:42 am
Reputation: 1

Re: [Question] How to best create a list to edit values via selected character?

Post by ssj4maiko »

hmmm, from the way you are explaining, I think I get the idea:
1. Initialize the variable with 0
2. Use the opcode "mov" to save the address value to that variable's place in memory.

But wouldn't "mov" transfer the value?
For example, if I'm selecting the 3rd character, then it would save the number 2. (Executable.exe+25E06A0 = 2)

Also, I can see the idea, but I'm not sure how to put that into practice.
So I took the base that you shared, and add the opcode right after the initialization.

Code: Select all

[ENABLE]
alloc(CAW_selected_address, 16)
registersymbol(CAW_selected_address)
CAW_selected_address:
  dq 0

mov [CAW_selected_address],Executable.exe+25E06A0 // register that contains the current displayed character

[DISABLE]
unregistersymbol(CAW_selected_address)
dealloc(CAW_selected_address)
But this gives me errors during compilation, same if I add brackets in between the address.

--------------

Also, when I mentioned in my first post that I would search for the pointer to get the value I wanted, I originally had mapped and found a place in memory with all custom characters, and I even had the value of distance where one ends and the other starts.

But when I putted it into practice, I actually found an easier address, so I'm not sure if it's correct to say I'm using a pointer or not, in short, I found a direct address (in green, that never changes, so straight from the executable), that directly holds all the information for the selected character (So the offsets are simplified), and if I move to another character, it changes all the values to that one. In short, it temporarily copies the value from the long list, into this new static place, and then updates the list back.

So all the math I imagined (Find the selected value, let's say 5, then sum 5 * distance + base) ended up not being needed. That is not to say I wouldn't like to know how to make something like that work (I could use it in other code, after all), but if this easier method is influencing the ideas on how to make the code work negatively (as in, the solution for one method doesn't work for the other), then I'm adding this correction to my description.

User avatar
oyyzj
Expert Cheater
Expert Cheater
Posts: 129
Joined: Mon Mar 13, 2017 4:14 pm
Reputation: 55

Re: [Question] How to best create a list to edit values via selected character?

Post by oyyzj »

Because CE script doesn't understand what Executable.exe+25E06A0 means.

you can mov [CAW_selected_address], eax or ebx or ecx or edx

User avatar
tdg6661
Table Makers
Table Makers
Posts: 698
Joined: Sat Dec 15, 2018 12:10 pm
Reputation: 267

Re: [Question] How to best create a list to edit values via selected character?

Post by tdg6661 »

ssj4maiko wrote:
Wed Aug 09, 2023 2:59 am
hmmm, from the way you are explaining, I think I get the idea:
1. Initialize the variable with 0
2. Use the opcode "mov" to save the address value to that variable's place in memory.

But wouldn't "mov" transfer the value?
For example, if I'm selecting the 3rd character, then it would save the number 2. (Executable.exe+25E06A0 = 2)

Also, I can see the idea, but I'm not sure how to put that into practice.
So I took the base that you shared, and add the opcode right after the initialization.

Code: Select all

[ENABLE]
alloc(CAW_selected_address, 16)
registersymbol(CAW_selected_address)
CAW_selected_address:
  dq 0

mov [CAW_selected_address],Executable.exe+25E06A0 // register that contains the current displayed character

[DISABLE]
unregistersymbol(CAW_selected_address)
dealloc(CAW_selected_address)
But this gives me errors during compilation, same if I add brackets in between the address.
Because you cannot move pointer to a pointer (I guess), you have to move it to a register then move it to the allocated pointer.
ssj4maiko wrote:
Wed Aug 09, 2023 2:59 am
Also, when I mentioned in my first post that I would search for the pointer to get the value I wanted, I originally had mapped and found a place in memory with all custom characters, and I even had the value of distance where one ends and the other starts.

But when I putted it into practice, I actually found an easier address, so I'm not sure if it's correct to say I'm using a pointer or not, in short, I found a direct address (in green, that never changes, so straight from the executable), that directly holds all the information for the selected character (So the offsets are simplified), and if I move to another character, it changes all the values to that one. In short, it temporarily copies the value from the long list, into this new static place, and then updates the list back.

So all the math I imagined (Find the selected value, let's say 5, then sum 5 * distance + base) ended up not being needed. That is not to say I wouldn't like to know how to make something like that work (I could use it in other code, after all), but if this easier method is influencing the ideas on how to make the code work negatively (as in, the solution for one method doesn't work for the other), then I'm adding this correction to my description.
That's good to know, that's called static address. You can use it as a pointer, you can also give a simple name instead of app.exe+xxxx.

Code: Select all

[ENABLE]
define(CAW_selected_address, "app.exe"+xxxx)
registersymbol(CAW_selected_address)
[DISABLE]
unregistersymbol(CAW_selected_address)
Then you're ready to use it on addresslist.

ssj4maiko
What is cheating?
What is cheating?
Posts: 3
Joined: Thu Dec 15, 2022 1:42 am
Reputation: 1

Re: [Question] How to best create a list to edit values via selected character?

Post by ssj4maiko »

tdg6661 wrote:
Fri Aug 18, 2023 7:16 am
That's good to know, that's called static address. You can use it as a pointer, you can also give a simple name instead of app.exe+xxxx.

Code: Select all

[ENABLE]
define(CAW_selected_address, "app.exe"+xxxx)
registersymbol(CAW_selected_address)
[DISABLE]
unregistersymbol(CAW_selected_address)
Then you're ready to use it on addresslist.
Sorry for the delay in my answer, I just decided to update my table that I had already filled up by using the static address directly, but once I confirmed it worked, I updated everything to use it. It's working great. :)

Thank you very much

Post Reply

Who is online

Users browsing this forum: No registered users