Assembling a script - mov to add

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Locked
Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Assembling a script - mov to add

Post by Mirek_Burczyn » Tue Feb 05, 2019 1:03 pm

So I've been trying to work out my own script for Civilization 4, specifically trying to get production values in selected city. I've followed those tutorials:
https://wiki.cheatengine.org/index.php? ... ction_full
https://wiki.cheatengine.org/index.php? ... ableValues

and hit a wall, since I have a mov command in my injected code instead of add. The script chokes when I change it from mov to add.
Anyone having any sort of knowledge how to deal with this or what I'm supposed to do? I really don't feel like looking up the production with pointers each and every time, but I'm also unable to get the script working, as it's using different commands. Youtube tutorials (at least those I've found so far) have been absurdly UNhelpful with figuring this out, as they all pick scripts that already have "add" in them or just change the value to be added.

Rysefox
Expert Cheater
Expert Cheater
Posts: 73
Joined: Sat Jun 23, 2018 3:32 pm
Reputation: 32

Re: Assembling a script - mov to add

Post by Rysefox » Tue Feb 05, 2019 1:22 pm

Its good when you show, your script. Then anybody can talk to you, why your script doesnt work

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Tue Feb 05, 2019 1:27 pm

This is what I got from following the first tutorial, up until getting the injection code, but before trying to change it into "add" command from current "mov". The game is adding 2 production/turn, if that's any help, the pointer when this script was done was displaying 4.
I can find pointers for individual production lines in each city and same with each tech I'm researching, but that takes forever to do and eventually leads to memory overload and game crash, so figuring out script that allows to edit those values would be a great help. I've also tried to follow this https://forum.cheatengine.org/viewtopic.php?p=4869794 , but I have literally no clue what the hell they are talking about for the most part.

Anyway, the script:

{ Game : Civ4BeyondSword.exe
Version:
Date : 2019-02-05
Author : XXX

This script does blah blah blah
}

define(address,"CvGameCoreDLL.dll"+C5391)
define(bytes,89 08 8B 86 78 02 00 00)

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat



assert(address,bytes)
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
mov [eax],ecx
mov eax,[esi+00000278]
jmp return

address:
jmp newmem
nop
nop
nop
return:

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
address:
db bytes
// mov [eax],ecx
// mov eax,[esi+00000278]

dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: "CvGameCoreDLL.dll"+C5391

"CvGameCoreDLL.dll"+C536A: 8B 4C 24 0C - mov ecx,[esp+0C]
"CvGameCoreDLL.dll"+C536E: 83 3C 88 00 - cmp dword ptr [eax+ecx*4],00
"CvGameCoreDLL.dll"+C5372: 8D 04 88 - lea eax,[eax+ecx*4]
"CvGameCoreDLL.dll"+C5375: C7 44 24 04 00 00 00 00 - mov [esp+04],00000000
"CvGameCoreDLL.dll"+C537D: 8B D0 - mov edx,eax
"CvGameCoreDLL.dll"+C537F: 7F 04 - jg CvGameCoreDLL.dll+C5385
"CvGameCoreDLL.dll"+C5381: 8D 54 24 04 - lea edx,[esp+04]
"CvGameCoreDLL.dll"+C5385: 8B 4C 24 10 - mov ecx,[esp+10]
"CvGameCoreDLL.dll"+C5389: 39 0A - cmp [edx],ecx
"CvGameCoreDLL.dll"+C538B: 0F 84 93 00 00 00 - je CvGameCoreDLL.dll+C5424
// ---------- INJECTING HERE ----------
"CvGameCoreDLL.dll"+C5391: 89 08 - mov [eax],ecx
"CvGameCoreDLL.dll"+C5393: 8B 86 78 02 00 00 - mov eax,[esi+00000278]
// ---------- DONE INJECTING ----------
"CvGameCoreDLL.dll"+C5399: 8B 15 80 59 E3 04 - mov edx,[CvGameCoreDLL.dll+945980]
"CvGameCoreDLL.dll"+C539F: 8D 0C C5 00 00 00 00 - lea ecx,[eax*8+00000000]
"CvGameCoreDLL.dll"+C53A6: 2B C8 - sub ecx,eax
"CvGameCoreDLL.dll"+C53A8: 03 C9 - add ecx,ecx
"CvGameCoreDLL.dll"+C53AA: 2B C8 - sub ecx,eax
"CvGameCoreDLL.dll"+C53AC: 53 - push ebx
"CvGameCoreDLL.dll"+C53AD: C1 E1 05 - shl ecx,05
"CvGameCoreDLL.dll"+C53B0: 57 - push edi
"CvGameCoreDLL.dll"+C53B1: 8B 7A 50 - mov edi,[edx+50]
"CvGameCoreDLL.dll"+C53B4: 8B 15 58 6C E3 04 - mov edx,[CvGameCoreDLL.dll+946C58]
}

And the address of the pointer on which the script is based is: 78D62700

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1375
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 417
Contact:

Re: Assembling a script - mov to add

Post by TheyCallMeTim13 » Tue Feb 05, 2019 2:51 pm

What are you trying to do exactly. Are you just storing the address for a pointer, or modifying the value. Why are you changing the MOV to ADD.

If your just storing the address there is no need to change the instruction to ADD, this should work for storing the address.

Code: Select all

{ Game : Civ4BeyondSword.exe
Version: 
Date : 2019-02-05
Author : XXX

This script does blah blah blah
}

define(address,"CvGameCoreDLL.dll"+C5391)
define(bytes,89 08 8B 86 78 02 00 00)

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat



assert(address,bytes)
alloc(newmem,$1000)

label(code)
label(return)

label(myPointer)
registerSymbol(myPointer)

newmem:

code:
	mov [myPointer],eax // or // mov [myPointer],esi
mov [eax],ecx
mov eax,[esi+00000278]
jmp return
	myPointer:
  		dd 0

address:
jmp newmem
nop
nop
nop
return:

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
address:
db bytes
// mov [eax],ecx
// mov eax,[esi+00000278]

unregisterSymbol(myPointer)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: "CvGameCoreDLL.dll"+C5391

"CvGameCoreDLL.dll"+C536A: 8B 4C 24 0C - mov ecx,[esp+0C]
"CvGameCoreDLL.dll"+C536E: 83 3C 88 00 - cmp dword ptr [eax+ecx*4],00
"CvGameCoreDLL.dll"+C5372: 8D 04 88 - lea eax,[eax+ecx*4]
"CvGameCoreDLL.dll"+C5375: C7 44 24 04 00 00 00 00 - mov [esp+04],00000000
"CvGameCoreDLL.dll"+C537D: 8B D0 - mov edx,eax
"CvGameCoreDLL.dll"+C537F: 7F 04 - jg CvGameCoreDLL.dll+C5385
"CvGameCoreDLL.dll"+C5381: 8D 54 24 04 - lea edx,[esp+04]
"CvGameCoreDLL.dll"+C5385: 8B 4C 24 10 - mov ecx,[esp+10]
"CvGameCoreDLL.dll"+C5389: 39 0A - cmp [edx],ecx
"CvGameCoreDLL.dll"+C538B: 0F 84 93 00 00 00 - je CvGameCoreDLL.dll+C5424
// ---------- INJECTING HERE ----------
"CvGameCoreDLL.dll"+C5391: 89 08 - mov [eax],ecx
"CvGameCoreDLL.dll"+C5393: 8B 86 78 02 00 00 - mov eax,[esi+00000278]
// ---------- DONE INJECTING ----------
"CvGameCoreDLL.dll"+C5399: 8B 15 80 59 E3 04 - mov edx,[CvGameCoreDLL.dll+945980]
"CvGameCoreDLL.dll"+C539F: 8D 0C C5 00 00 00 00 - lea ecx,[eax*8+00000000]
"CvGameCoreDLL.dll"+C53A6: 2B C8 - sub ecx,eax
"CvGameCoreDLL.dll"+C53A8: 03 C9 - add ecx,ecx
"CvGameCoreDLL.dll"+C53AA: 2B C8 - sub ecx,eax
"CvGameCoreDLL.dll"+C53AC: 53 - push ebx
"CvGameCoreDLL.dll"+C53AD: C1 E1 05 - shl ecx,05
"CvGameCoreDLL.dll"+C53B0: 57 - push edi
"CvGameCoreDLL.dll"+C53B1: 8B 7A 50 - mov edi,[edx+50]
"CvGameCoreDLL.dll"+C53B4: 8B 15 58 6C E3 04 - mov edx,[CvGameCoreDLL.dll+946C58]
}

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Tue Feb 05, 2019 3:38 pm

Ok, so each time the game is reloaded, the direct pointers to values stop working. So I was trying to get a script that would always keep track of the pointer I need, even after the game reloads. From what I understand, I need to figure out script for code injections and then ability to modify the value related with that script.
In other words - I'm trying to get a script with modifable value in it.

EDIT
So far any attempts to make it work failed, as it seems to have no connection with what I'm doing in-game with what the script does (not).

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1375
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 417
Contact:

Re: Assembling a script - mov to add

Post by TheyCallMeTim13 » Tue Feb 05, 2019 11:38 pm

Mirek_Burczyn wrote:
Tue Feb 05, 2019 3:38 pm
Ok, so each time the game is reloaded, the direct pointers to values stop working. So I was trying to get a script that would always keep track of the pointer I need, even after the game reloads. From what I understand, I need to figure out script for code injections and then ability to modify the value related with that script.
In other words - I'm trying to get a script with modifable value in it.

EDIT
So far any attempts to make it work failed, as it seems to have no connection with what I'm doing in-game with what the script does (not).
What do you mean by "failed", the script just stores the address at EAX. Then you need to create your pointers with that symbol as the base, i.e. "myPointer".

Example:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>87</ID>
      <Description>"ptrHealthHook"</Description>
      <ShowAsHex>1</ShowAsHex>
      <Color>808080</Color>
      <VariableType>8 Bytes</VariableType>
      <Address>ptrHealthHook</Address>
      <CheatEntries>
        <CheatEntry>
          <ID>89</ID>
          <Description>"+0   - "</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>0</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>93</ID>
          <Description>"+4   - Health Max. 1"</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>4</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>91</ID>
          <Description>"+8   - Health Inc. Mul."</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>92</ID>
          <Description>"+C   - "</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>C</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>90</ID>
          <Description>"+10   - Health"</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>10</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>1436</ID>
          <Description>"+20   - Health 2"</Description>
          <Color>000000</Color>
          <VariableType>Float</VariableType>
          <Address>ptrHealthHook</Address>
          <Offsets>
            <Offset>20</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
</CheatTable>

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Wed Feb 06, 2019 11:11 am

Jesus... any chance to explain this, step by step, in layman terms? I have no idea what EAX even is, hell, I have no idea about scripts for CE, because I simply don't understand how they work, what they do and how to make them, not to mention finer details. I don't even know the commands for them. So I'm essentially stumbling in the dark, using tutorials that I barely grasp. Still, there is no table anywhere for Civ 4 and I'm sick and tired of always searching for exact pointer the standard way, so I'm trying to get a script working. 5 days in, still no clue how to make it work.

And when I made a pointer following the wiki and using your script for value storage (the first one, not the later example), the pointer was just showing 0 and changing that value wasn't affecting anything. Hence why it "failed".

User avatar
SunBeam
Administration
Administration
Posts: 2237
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 814

Re: Assembling a script - mov to add

Post by SunBeam » Wed Feb 06, 2019 2:34 pm

Hence start with the basics. Learn ASM:
Good luck.

P.S.: If not interested, we can then all assume you wanna do this just for the sake of your one game. Off ya go :)

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Wed Feb 06, 2019 6:17 pm

How's learning a coding language "basics"? And I'm asking sincerely here.

And I kinda don't have other purpose that making that one script for Civ 4, since there is nowhere any posted, so I don't get your point either.

User avatar
SunBeam
Administration
Administration
Posts: 2237
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 814

Re: Assembling a script - mov to add

Post by SunBeam » Wed Feb 06, 2019 8:13 pm

Sorry.. but.. you clueless fuck. Do you understand that what you see in CE is ASM? How is learning ASM gonna help?? What are those scripts people use I ask? Some CE language?? No.. It's fucking ASM with CE syntax. Really.. study ASM and you won't act like a gook with 'I dunno what registers are' statements.. Before we get all psychology 101 and how I am rude.. get a sense of what you want to achieve in gamehacking and how to get there..

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Thu Feb 07, 2019 1:36 am

See, but I don't want to "achieve" anything. I want a script that displays and allows to edit a pointer for production in Civ 4. Nobody made any, or at least didn't share after making one, so I'm stuck with either manually searching for the pointer each and every god-damn time for each instance of finished production OR to try and get a working script. Couldn't care less about learning how it works, as long as it will just work. It wouldn't be the first time when I "achieved" something without any understanding of what am I doing, but just following tutorials or instructions and brute-forcing obstacles.
In this particular case, the instructions in tutorials aren't clear, dick got stuck, send help.

And I would just ask the guys who apparently manage to get a working script, if not for the fact neither of them is active for quite a while, so I'm on my own with this.

User avatar
SunBeam
Administration
Administration
Posts: 2237
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 814

Re: Assembling a script - mov to add

Post by SunBeam » Thu Feb 07, 2019 6:00 am

Mirek_Burczyn wrote:
Thu Feb 07, 2019 1:36 am
I want a script that displays and allows to edit a pointer for production in Civ 4.
This is where I stop. This is also why people look away and mind their business. In your next game you'll play you'll behave identically -> "please help me do this". At some point I just hope you'll realize you have to do the learning part on your own.

Mirek_Burczyn
Cheater
Cheater
Posts: 35
Joined: Wed Apr 19, 2017 4:31 pm
Reputation: 1

Re: Assembling a script - mov to add

Post by Mirek_Burczyn » Thu Feb 07, 2019 5:33 pm

Oh, so you didn't read the actual important part of the post, but nit-picked the one where you could continue to be passive-aggressive about ungrateful people who just want pre-made tables. I'm asking how to MAKE tables, not getting the ready one. Hell, in your open arrogance you even managed to ignore basic reading comprehension and instead turn desirable effect of my work into a demand to do the job for me, just so you can bitch some more.
If tutorials were enough, I wouldn't even bother with asking cunt like you, because it's always the Offended Mr. Specialist that replies to any sort of question for help, too fucking busy shitting on everyone around to be useful for anything. A sensible solution would involve explaining how (assuming if at all) to change mov to add. Or sending to the right tutorial. But here comes you, Ofended Mr. Specialist, throwing at me learning assemly language with a smug "when you learn this, you will solve your problem". Wow, such fantastic non-solution to anything. And the amount of contempt from your very first post only seals it.
Go fuck yourself and the high horse you ride on. I've kept it civil long enough despite your open hostility. Now you can even ban me, not that I care. Fucking prick.

User avatar
SunBeam
Administration
Administration
Posts: 2237
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 814

Re: Assembling a script - mov to add

Post by SunBeam » Thu Feb 07, 2019 6:49 pm

I did say "before we get all psychology 101 and how I am rude..", didn't I? Closed. Pursue your goals someplace else; we're tired of such digressions when you feel people look down on you. How about you just get on my horse and learn something for a change, pompous prick.

Locked

Who is online

Users browsing this forum: No registered users