Tuesday, 28 March 2017

Programmer guideline, what is pointers, how to deal with it.

Break Down of  Pointers in RAM, DMA

This is for software engineering, Cheat Engine and related software like it, and also for programmer.

Pointers are 4-byte (this is machine-dependant) integral values like any other. Literally, they are nothing but unsigned longs (or dwords). Pointers are not magic, and have no special properties that make them confusing. Why are so many people confused about pointers? Because they have been led to believe they are more than they are—they have been given a misunderstanding.

Pointers themselves are not magic; you can not normally look at a chunk of RAM and determine what are pointers and what are not. The only thing that separates pointers from any other unsigned long is how they are used. For the sake of clarity, pointers are always displayed in hexadecimal format. See Introduction to Number Systems.

On the Data Types page, you can see that each data type has specific properties and specific uses. Since pointers are unsigned longs, they have the same range and sign as unsigned longs. Unsigned longs are used to perform mathematical operations on numbers with a large range. Chars are usually used to hold text strings. Shorts are also used for math, but with a smaller range, and floats are used for math, but on a much more precise scale. Doubles are used for even more precise math. Now it becomes clear that data types are actually defined by how they are used rather than their properties—the usage of a data type is defined first, and then it is given properties to facilitate that use.





So What About Pointers?

Now that it is clear that the only true separation between data types is the way they are intended to be used, we can discuss pointers, which are nothing more than another data type with an intended usage. Pointers, however, are not intended to be used for mathematical operations. Pointers are used to indicate the locations of objects (structures, classes, functions, data types, anything) in the RAM space of your game.

That means to understand pointers, you need to understand the RAM in your game.

We view RAM from low to high, with the low addresses on top and the higher ones on bottom. Humans are silly creatures.

This diagram illustrates how RAM generally appears in a game, with the red lines indicating the modules loaded by the game (these are different in every game). A module is any .DLL or .EXE file in this RAM space—the most familiar module is the one at 0x00400000, where your game is almost always loaded. Kernel32.dll, USER32.dll, and SHELL32.dll are other common modules.


Code:

EXTRA
The accessible range (as shown) is from 0x00000000 to 0x7FFFE000, which covers two gigabytes. But wait. What if you don’t have two gigabytes of RAM? And, wait a minute. How can both of your games be loaded at 0x004000000 at the same time? Most of the processes on your computer are running at either 0x00400000 or 0x01000000, so that must mean they each have their own 2 gigabytes of RAM, right? But then, that means every time you load a process, you suddenly gain 2 gigabytes of RAM, right?

In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.

Every address you see here is a lie. You always see 0x00400000 as the base address of your game, but that is not its real address. Windows® hides its real address, and uses a virtual mapping system to give each process its own “set of RAM”. These addresses are virtual. But luckily for us, we don’t need to know this at all! All that is important to know is that when working in any given process, we are working within a virtual space with addresses that have meaning only to that process. For the sake of simplicity we always treat them as literal real addresses


It feels as if we are looking down on an ocean, from so high that all the tiny modules are just thin lines. The cluster of lines at the end are the system modules which generally have no use during hacking. The modules of interest are usually at the very base of this image, from 0x00400000 onward. In this diagram, address 0x00400000 is actually the second line! Address 0x00400000 seems as if it is deep inside the RAM of the game, but in fact it is hardly even a spec at the beginning of the whole. Every pixel in this diagram covers 0x00400000 addresses. Now you can see just how small 0x00400000 really is.






To actually see the modules, we are going to need to zoom in a bit. In this diagram, we have zoomed into the range 0x00300000 to 0x00440000. This entire range is a single line in the above diagram, but it covers the area just before and just after the address where games are typically loaded (0x00400000), and contains several modules.

This diagram illustrates where the modules have been loaded and graphically depicts their sizes. Any value you find inside the space of a module is static. In the diagram, logger.dll is 0x0004C000 bytes in size, ending at 0x0037C000. That means all addresses from 0x00330000 to 0x0037C000 are static, and they belong to logger.dll.


Code:

It is important to be very clear on what a static address is. In our above example, address 0x00340000 would be static. Some people define static addresses as addresses that never move. But quite clearly that would mean every address is static. Address 0x00340000 is always address 0x00340000, address 0x00300000 is always 0x00300000, 3 is always 3, etc. So it isn’t the address that never moves, since addresses never move anyway. It’s the data that never moves. The data for my player may be at address 0x00340000. Address 0x00340000 will always be there, but the data for my player may later move off to address 0x0234C000.

So a static address really means (almost), “An address containing data that never moves.” Thus, all the integers, floats, chars, bytes, structures, classes, etc., from 0x00330000 to 0x0037C000 in logger.dll, will always be at the same addresses. Well, almost, anyway. If you read the EXTRA section above you will remember that there is no such thing as static data.


Windows® reserves the right to load modules to different locations as it desires. That means logger.dll may not be at 0x00330000 next time we start the game. But the addresses from 0x00330000 to 0x0037C000 are static, right? That’s what we just established, right? Well, they are static, but the definition of “static” needs to be modified just a bit.





The Real Definition of Static Addresses

The final, real, true, undisputable definition of static addresses is, “Addresses that move predictably in relation to the module that owns them.” 99.999% of the time your game will always be loaded to 0x00400000, and thus 99.999% of the time, it is accurate to think of static addresses as being data that never moves. But it’s still a dirty lie that has millions of people fooled.

Using the diagram above, we defined addresses from 0x00330000 to 0x0037C000 as being static. Static addresses are relative to the module that owns them, and in this case that means logger.dll. Thus if logger.dll decides to relocate to 0x05000000, it is no problem, because all the values from 0x00330000 to 0x0037C000 have now moved to addresses from 0x05000000 to 0x0504C000.

Static addresses are noted in the format [module+offset]. For example, In logger.dll, we may have discovered a valuable integer at address 0x003304C0. Since logger.dll may move, we don’t just use this address directly. Instead, we use [logger.dll+0x4C0]. Therefore, when logger.dll decides to packs its things and move on to 0x05000000, [logger.dll+0x4C0] gives us 0x050004C0, and we still have our valuable integer.



The Other Kind of Address

Between modules there are many pockets of empty space, as shown in both diagrams above. Not all, but many of these addresses are available to the game to use as it pleases. This is the free store, where the game can use undefined amounts of RAM for undefined purposes. Games never know exactly how much RAM they are going to need at any given moment. Literally, this is up to the user to decide. For example, the user decides which map to play in a first-person shooter. Each map contains different data, and thus will consume different amounts of RAM.

When the game needs more memory, it asks Windows® to give it some. Windows® will create an area of usable RAM and give the game a pointer to it. Ah! Now we are starting to see the so-called magic behind pointers. Windows® will create an area of usable RAM at any location where there is enough unused RAM available. The only way the game is ever going to know where that new RAM is located is by the pointer that Windows® gives back to the game. Because the location where Windows® will find enough free RAM for the game changes, it is called dynamic. When the game requests new RAM, it is called allocation. Thus the process is called dynamic memory allocation, or DMA.



How a Pointer is Used

Remember, a pointer is just another data type, and data types are defined by how they are used. During dynamic memory allocation, Windows® will find an arbitrary address that can not be predicted, thus pointers are used to tell the game where the requested memory has been allocated. A pointer is an unsigned long that, instead of being used for math, is used to indicate the locations of various data the game needs to run. The game knows where the pointer itself is, and then by using that pointer it can determine where other things are—and so can we.



All data in all games have addresses and values. An integer can have an address of 0x00443C0C and have a value of 100 (0x64), and this value is used for mathematical purposes. Likewise, a pointer can have an address of 0x0042104C and a value of 0x004AE804, but this value isn’t used for math. This value is yet another address.

In these diagrams, we have zoomed into the range from 0x00400000 to 0x00500000. Our pointer is at address 0x0042104C, which we note as [lspiro.exe+0x2104C].

In the diagram to the left, the value of this pointer is 0x004AE804. 0x004AE804 is itself another address. That means if we go to address 0x004AE804, we will find more data that the game is using. It can be any kind of data, but let’s assume it is the data for our player.

The largest problem new hackers face is that after they die, they notice that the data for their player is no longer at the same address. This is a result of dynamic memory allocation, mentioned above. The game has decided it no longer needs the data at address 0x004AE804, and has told Windows® to get rid of it, and then to give it a new address where it can store the new data for your player as you respawn.

In the diagram to the right, the pointer at [lspiro.exe+0x2104C] is now pointing to 0x004BD808. The data for our player is now at this location, and we know that because the value of the pointer at [lspiro.exe+0x2104C] is 0x004BD808.


Code:

Notice that the pointer itself did not move—only its value changed to indicate a new address for our player data. The game relies on this pointer staying in the same location, or else it has no way to know where our player data is in RAM. When the game was compiled, address [lspiro.exe+0x2104C] was designated by the compiler as being the location the game can always use to find its player data.

This is why it is important that all the data inside a module moves exactly with the module itself. During compilation, the compiler writes instructions that simply “understand” the way each address (from the module base) is to be used, and if the data in the module does not stay perfectly aligned, the game simply can not run.





So How is This Useful for Hacking?

Surely you jest. If the game knows how to locate the data for our player, we know how to locate the data for our player. And that means always. Every time we die, every time the game is restarted, etc.

The only thing important to note that is that if the value of a pointer is 0x00000000, it does not mean there is actually an object at address 0x00000000. Value 0x00000000 is reserved to tell the game that the pointer itself is invalid, and points to nothing.

It is also worthy of noting that the values of pointers will be divisible by 4 in 99% of all cases. Windows® always gives the game pointers that are aligned on 4-byte boundaries because the architecture of x86 processors allows them to work faster on data that is aligned this way. If data is not aligned by every 4 bytes, the game may suffer from slowdown. Thus the only way pointers can point to addresses that are not divisible by 4 is if the programmers specifically go out of their ways to change the pointers. This is sometimes done as an optimization technique when performing some string-based parsing, but it is never done on objects that are frequently and randomly accessed throughout the execution of the game. Incidentally, these objects are the very objects we are interested in hacking, and thus it is always safe to assume that the data you are trying to find will have its base along a 4-byte boundary.



Structures, and the Pointers that Love Them

In our above examples, the pointer is pointing to our player data. Our player has a weapon, health, magic, experience, a level, gold, and a position in the 3-D game space.



Games organize sets of related data into structures and classes. Because your player has a lot of related data, it will always be organized a structure or class. This is actually done simply so that the programmers themselves (the ones making the games you hack) can work in an organized fashion, making complicated sets of data easier to manage.

These images depict how our player structure might look in RAM. The left image shows our player data at address 0x004EA804 and the right at address 0x004BD808.

Notice that the positions of each data element (officially called members) inside the structures are the same distance from each other, no matter where the structure itself is located in RAM. That is, our GOLD is always 0x10 bytes after the start of the structure. Structures and classes share something in common with modules: when they move in RAM, the data that is related to them also moves exactly with them. For this reason, we note their members the same way as we note addresses in modules: [structbase+offset]. In this case, HEALTH is offset 0x4, MP is offset 0x8, LEVEL is offset 0xA, etc.


We know quite a bit now. Let’s assume we wanted to know our player’s health at any given moment.

Get the base address of lspiro.exe. That is 0x00400000 in this case.
Go to [lspiro.exe+0x2104C]. This means 0x00400000 + 0x2104C. The result is 0x0042104C.
Get the value at 0x0042104C. Let’s assume it is 0x004AE804.
Go to the address depicted by the above value. That means we are now at address 0x004AE804. This is the structbase.
Go to [structbase+offset]. Our structbase is 0x004AE804, and the offset of our health is 0x4. 0x004AE804 + 0x4 = 0x004AE808.
0x004AE808 is the address where our health is, as shown in the above diagram. And getting the value here gives us 9,999.


Pointers to Pointers

We have covered a static pointer ([lspiro.exe+0x2104C]) that points to dynamic data. But pointers are not limited to being static themselves. In the above player structure, the very first member (WPN PTR *) is a pointer to the player’s weapon data. Luckily, this has no special meaning what-so-ever. We already discussed everything there is to know about pointers, and, just because this particular pointer is moving around with our player structure, it does not mean it follows any special set of rules apart from other pointers. The value of this pointer is 0x028F3B0C, and like every other pointer we turn this value into an address. Now we know that at address 0x028F3B0C there is another set of data that is used to give details regarding the weapon our player is using.

Pointers can point to pointers that point to pointers that point to pointers that point to pointers. It doesn’t matter how many layers of pointers there are, because you now know everything there is to know about pointers, and they all work the same. 


More information are welcome.
please share , thanks for sharing.
 

Sunday, 5 March 2017

Rydian's Cheat Engine Guide To Basic AOBs And Scripts


by Rydian Grandmaster Cheater Supreme

1. Intro
So if you're here, it's likely because you've been trying out new cheat tables for new games, and
instead of addresses and pointers you see scripts everywhere. You check these scripts, think
"WTF do these ancient runes mean", but marvel at the black magic they hold (or some crap like that).
I'm going to teach you what these scripts do, why they're used so often nowadays, and how to make
them yourself. First, I think that a brief history of the stages/techniques used in game hacking
is in order so you know why we do this the way we do.

This tutorial assumes that you have at least a basic understanding of cheat engine.
If you don't know how to find and edit stuff in games at all yet, go somewhere else first.



2.a Static Addresses
The first and most basic type of game hacking most people are familiar with is static RAM editing.
You find an address and whatever tool you're using keeps resetting it to a certain value very quickly
to "lock" it there. The Gameshark for the Gameboy and the Action Replay for the SNES worked like this.
These codes were generally short and simple. For example the code to always have the cape in
Super Mario World for the SNES is 7E001902.

We can break this down into...

  • 7E: Bank of memory to work on. 7E is the RAM bank.
  • 0019: The memory address to edit. This is the SNES so there's not that many possible addresses in RAM!
  • 02: The value to set it to (in this case the cape).
The basic idea of just having a single address to edit every time applies on the PC too, but is usually only
useful in very old and/or custom-engine games. Cave Story and Nethack, for example, are PC games that
still use static addresses for the player data. The main downside to this is that if a game doesn't
load it's data into the exact same places each run, then you'll have to rescan every time you play.



2.b Pointers
As systems and games got more complex, they stopped holding the same things in the exact same memory
addresses every single time in order to account for varying numbers of players and entities and monsters
and rules in effect. Since the memory locations were shifting around, pointers are used to keep track
of what exists where. This is what most people will be familiar with as more advanced cheating, because
you can use certain methods/tools to find out the pointer paths and then lock/change the final address.

But even though pointers tend to work after a game has been restarted multiple times, this shares a
downside with just locking the address manually (since that's all that's being done). On the PC, tools
like Cheat Engine can't really "lock" an address. What they do is inject/overwrite it with your chosen
value multiple times a second. In many cases this is enough, but if, for example, your character only
has 100 max HP and you take an attack of 115 damage... in most cases you still die. This is because
the game's logic is running much faster than CE can reset the value, so the game realizes that you
died in that split second. Obviously something other than RAM locking is needed to get around this.



2.c ASM/Code Edits
So, given the above example, how would somebody stop dying if they're dealt more damage than they have
health? The code that deals damage in the first place should be edited. This was the idea behind
the old Game Genie devices for the NES, SNES, and such. They edited the ROM reads instead of RAM,
to change some data around to make the game run differently. After all, you don't need to keep
finding and locking your money amount if you edit the game's code so that your money is never
taken away when you buy something!

"But Rydian, if this is so much more powerful, why did all the Game Genie codes suck ass? If they could make
us invincible or anything they wanted why did they keep making each apple picked up worth 5 apples instead?"

This boils down to two big flaws in the original Game Genie's idea and implementation.
  1. Without any way to debug/trace what games were doing, making your own codes as a customer is a
    shot in the dark. Edit random bytes and see what happens, keep the few positive things as codes,
    discard all the crashy/negative things.
  2. The Game Genie's codes were encrypted, and it wasn't until a few years later that people would
    publicly make converters to allow you to tell the Game Genie to edit arbitrary ROM reads.
These two things combined made it so that the only good/targeted codes were from Galoob itself
(or whoever was doing the distribution of the device at the time). Thankfully that's not the case with
the PC. There's all sorts of debugging, tracing, and logging tools available, in fact Cheat Engine
actually has it's own debugger and tons of other tools (that are hidden by default) that are
specifically geared towards making cheats.



3. Making ASM/Code Edits
For this example I'm going to be using the original version of Cave Story for the PC (which is freeware,
not to be confused with Cave Story+ or the Wii/3DS releases).
Download it here, and there's a link to the translation patch too.

The first thing you'll want to do is to start a new game, and get used to the awkward-as-hell controls.
Then you want to launch+attach Cheat Engine and do the usual bit with scanning for the RAM, in this
case we want to find health. Change it to make sure you found the right value.



Next you want to right-click that table entry, and choose "Find What Writes To This Address".
That will bring up a new window that logs any bits of code that change that address. Go back to the
game and get hit or something a few times and you'll see one or more entries show up in the list.



Once you see a few things show up, hit the "stop" button so the logging stops. Click the entry that
comes up when you get hit (each different type of effect on the health will usually have it's own
entry and they're numbered by how often they happened), then click that "Show Disassembler" button
on the right to open up the Memory Viewer window, which is where the magic is. This is a big window,
but right now we're only concerned with the top half of it. Scroll up a bit so the targeted line
is more or less centered.



What we see right there is the actual assembly that makes up the running game. It doesn't matter
which language a game is written in or which engine it runs on. Anything that runs is assembly
one way or the other. For example you don't run C++ code itself, you put C++ code through the
compiler, which turns it into assembly (more or less). Even interpreted languages like Javascript
get turned into assembly when they run. So if you can edit assembly in RAM, then you can edit any
program's behavior, no matter what language it was written in.

At this point, I suggest you go look at some basic x86 assembly tutorials, or at least a newbie
instruction list, but I will run over some of the very basics you need to know in this instance.

That "mov" instruction that's highlighted is what takes the new calculated health amount and sets
our health address to it. If you look at the bottom of the assembly view, you'll see "copy memory",
which describes the "mov" command. Any time you have an operation/line highlighted, that little
box will show you what it stands for.

The syntax is generally (operation) (destination),(source). So for the mov command, it's moving
whatever's in register cx (part of ecx) into memory address 0049E6CC. Sort of like
$currenthealth = $calculatedhealth; in a more modern language.
And the command above that is a subtraction.

You'll also see things like "eax" and "ecx" everywhere. These are the x86 registers. You can,
for this type of work, think of a register as the simplest form of a variable there is. It's
actually physical memory housed inside the CPU itself.



So in this case we can see that there's math done to determine the damage, then the game moves
the new health into the current health. So if we want to stop taking damage, we can edit either
of these. If we remove the subtraction, your health is never lowered. If we remove the mov right
after it, then even though the game determines what your new health should be, it never
becomes that value. In this case we'll focus on the subtraction.

The simplest kind of edit we can do is to make one of the operations simply not happen. To do this,
we generally replace the bytes that make up that operation with the bytes that stand for "do nothing".
In x86 the "no operation" (nop or noop) byte is 90 (in hex). Cheat Engine, being geared for game
cheating, actually has a quick function to do that, which we'll use just for example.

Right-click the "sub" line (right above the targeted mov line) and choose "Replace With Code That
Does Nothing". Hit enter for the default on the prompt, and you should see the change.



And when you go back into the game, you shouldn't take any damage from enemies anymore. You can have
3 max HP and take 5 damage from the spikes in the starting area, and nothing happens. Yay!

But that was just a quick example to show you the context. You'll rarely be doing that normally,
except for testing. So in the Memory Viewer window again, right-click the edited code and choose
"Restore with original code", because we're going to do something else.



4. Using Scripts
So instead of right-clicking that "sub" line and using a built-in function to remove it, we want to write
a script that focuses on that section of code. Highlight the "sub" command and his CTRL+A (or go to
Tools - Auto Assemble). In the new window that comes up, go to Template - Cheat Table Framework Code and
then Template - Code Injection (and hit okay on the default).

This should make Cheat Engine fill in the Auto Assembly window with something that looks like this,
which is the basic framework you need to customize the game's code. I've marked out, in a basic sense,
which each segment does.



So you can see, for this example, the "originalcode" section is what we want to edit. It put in the
original code for us automatically, but we can do whatever we want. For now though, what you want to
do is hit File - Assign To Current Cheat Table, then close the existing window. This is important,
do NOT hit the "execute" button.
Assign it to the cheat table, then re-open it from there, and the
"execute" button will be replaced with "ok" (which just saves the script).

Now that the script is saved on the cheat table and we can edit it on and off (by toggling/locking it
like a normal cheat), feel free to replace or modify the original code. For example change the "sub"
into an "add", or simply comment it out (//thisisacomment), and when you enable the script Cheat Engine
will interpret what you typed (assuming no syntax errors) and make whatever edits you intend for it to.

The way this works is that Cheat Engine will overwrite the original code with a jump to some new code,
and then include whatever code you want, which then jumps back at the end. This means that you can
insert new code as well, so if you wanted to change the math or logic being done, you generally have
enough room to write a small little assembly routine there to do whatever, so have fun with it.



5. AOBs (Making It Last)

Note: this section assumes that you've messed around with assembly editing in Cheat Engine enough
to have a basic grasp of the concept and know what you're doing.

So making a script that edits the game code is a great way to get around moving memory addresses.
You don't need to scan for pointers or watch changing addresses when you edit the game code to control
things. But... newer games (especially ones written in .NET and such) don't even load their code in
the same order each time! So we need a way to find where certain code snippets are, and then
reference/edit them. We do this with AOBscans. AOB stands for "Array of Bytes", and is just a list of
values in RAM.

You write a script in the Auto Assembler window (CTRL+A in the memory browser, add it to the table
like before and edit it from there), and here's a very basic AOB script for editing some assembly.


Code:
[ENABLE]
aobscan(nodamage, 2B C8 66 89 0D CC E6 49 00 8B 15 50 E6 49 00 81 E2 80 00 00 00 74 1C)
label(_nodamage)
registersymbol(_nodamage)

nodamage:
_nodamage:
db 90 90

[DISABLE]
_nodamage:
db 2B C8

unregistersymbol(_nodamage)


In this specific case, it's a "No Damage" code for Cave Story. The first thing it does is scan for
certain bytes in RAM in a certain order (using aobscan to find a unique sequence of bytes, known here
as a signature). Then it applies a label (_nodamage) to that found address (sort of like a variable).
Then it acts on that address. In this case I'm using the "db" command, which writes specific bytes.
In the "enable" section it's writing the bytes "90 90", which is nop, remember? Then the disable
section writes the original bytes back (2B C8, which was the sub).

Instead of using "db", you could just write out your assembly normally, but with this kind of simple
replacement you can't add more code than was already there, you're only limited to the number of bytes
that already exist, so I usually just use db to keep it simple and remind myself of the limits.

"But wait, what the hell are the bytes at the beginning of the scripts?"
Well... it's the snippet of code we want to find/target.



If you start with the line of code that you want to edit and then select it and a few more instructions
after it, you can right-click and Copy To Clipboard - Bytes Only (No Addresses). This will copy the
string of bytes for you to paste right into the template (and make sure to change the [DISABLE] section
to put the right new bytes back too).

So there's a basic and direct AOB assembly replacement script for making minor changes.

It's very important to remember that when you're manually overwriting bytes like this (without
injection)
that the replacement and disable bytes need to account for eachother.

For example this below code handles it properly...

Code:
_nodamage:
db 90 90

[DISABLE]
_nodamage:
db 2B C8

However this below code it just asking for crashes...

Code:
_nodamage:
db 90 90 90 90

[DISABLE]
_nodamage:
db 2B C8

That's because it's not fixing all of the edited bytes, it's not putting things back the way they were. It's
also the reason that stuff is overwritten with 90 (nop, no operation), to keep the same number of bytes
modified. For inserting more code, you'll want to use either the code injection (step 3) or AOB injection
(step 7) template, in which CE allocates your own little code space and shuffles things around for you.



6. A Good Signature

So let's say you've made some aobscans for various games. Some of them work just fine, but others stop
enabling after a restart of the game or something. This just means that you need to find better
signatures (the sequence of bytes to search for). The two main things you can do to improve your
signatures is to use wildcards to avoid changing addresses/offsets, and to shift your signature up or
down more and then refer to it with an offset in order to target a more unique string of data.

For the wildcards, let's take our Cave Story example aobscan and look at it closer.



The bytes I've circled in red are the kinds of things you usually don't want to reference directly.
They're memory addresses that may change from one run to another. (This isn't the case with Cave Story
specifically, but tons of games do this). So in order to avoid referencing that data directly, we'll
just use wildcards. We replace the digits that can change with a question joe.

So...

Code:
2B C8 66 89 0D CC E6 49 00 8B 15 50 E6 49 00 81 E2 80 00 00 00 74 1C

Becomes

Code:
2B C8 66 89 0D ?? ?? ?? ?? 8B 15 ?? ?? ?? ?? 81 E2 80 00 00 00 74 1C


Generally anything that's a small offset (like +2 or +216) isn't going to change, it's the huge things
(four bytes or so) that do change and should be replaced with wildcards. But beware, the more wildcards
you have, the less unique your signature is, so you may need to add more bytes to search for at the
end if you have a lot of wildcards.

Sometimes you may not be able to find a good signature directly after the code you want to edit. Sometimes
you have the line you want to edit, followed by 4-6 functions that deal with random addresses and numbers
that keep changing. That's okay, you can search ahead of the function you want to work off of too!

So here's the same code, but using both techniques.





7. AOB Injection Template
Now that you know the basics of how to edit game code and what an AOB and such is, you can take a much
shorter method to get custom scripts up and running. Make sure that your version of Cheat Engine is at least
6.4, that's when this feature was included. When you target some code and open up the AA window, this time
go to Template - Cheat Table Framework and then Template - AOB Injection.



It'll ask which address you want the jump on, defaulting to what was highlighted when you opened the AA
window, and this is usually what you want anyways.



Next it'll ask you to name the symbol. Make sure you give it an actual unique name for the table.



Next CE make take a few moments because it'll try to develop and AOB scan that's unique to the code you
targeted, but once it's done it'll present you with a nice AOB injection template.



As before, the orange box indicates the copy of the original game code that will be injected for you to change.



8. Handling FSTP
Once you go off to start making your own things for games, you'll likely run into situations where games use
floats (floating-point numbers) for things. In theory you could use the same sort of techniques here, but the
thing is that a lot of the time the instruction that writes the final value to memory is FSTP. This stands for
FloatingpointSToreandPop (more or less). This unfortunately means that not only does
the instruction modify the target value, but it also modifies the stack. Stack modification is very important
to keep track of, because an unbalanced stack can cause all sorts of problems or outright crashes in games.

This basically means that the safest thing to do when you're dealing with floating-point instructions is to avoid
removing them. Unless you're quite familiar with assembly and the stack and such, what you'll want to do is
overwrite the results instead. For example let's say that this is our target function here, an fstp.



Since we need to insert our own code to handle this type of thing, you'll want to use the AOB injection
template like you were shown earlier in this guide. Once you do that, look at the code section as usual...



Now, in order to overwrite the results of the FSTP into the target address, we'll simply add our own instruction
there which will set it to the value we specifically want. The easiest way to do this is with a mov.



And with that, the code shouldn't cause odd problems or crash the game anymore.



by

Rydian 

Grandmaster Cheater Supreme

http://forum.cheatengine.org/viewtopic.php?t=570083

 

Saturday, 4 March 2017

Rydian's Cheat Engine Guide To Invincibility

 Code Fixes (Segregating Players/Enemies)

by Rydian  Grandmaster Cheater Supreme

 

- Intro
In many cases with making code patches (AOB scripts, injection, what-have-you) for games, the
simplest way to go about making invincibility for the player is to find the code that damages the
player and disable it in one way or another. However for a number of games this will also make
enemies invincible (or whatever the code effect is) and this is undesirable.

This guide will show you three main methods to solve this problem in order of ease. I will be using
Rogue Legacy as the example game and focusing on invincibility, but the basic concepts used here
can apply to almost any other game and code situation. This guide also assumes that you know
the basics of making code edits with CE, otherwise you wouldn't be having this issue.



1 - Target Unique Reads
The basic problem with invincibility codes making monsters invincible too is that the code is shared,
the code you targeted affects all "players" or "entities" or whatever, so when you edit the code it
changes the effect for everything that the code runs on.

So instead of neutering the code that edits your health, take a different approach. Find some
code that reads just your own health, and then edit that code so it also sets your health to full
constantly, overriding other changes to it.

The first thing to do is, as usual, find your health address. This time right-click it and find what
accesses the address. Run around, hit, and be hit by other enemies for a few seconds and
then stop the logging. Check out the instructions, chances are there will be a lot of them.



For this type of case, we want to find one of the codes that's running all the time. It could be a
number of different functions to do this, such as the code that reads your HP in order to draw or
update the health bar on-screen, or code that constantly checks your HP to determine if you died.

We have two opcodes that ran a lot during the short test (the first two), so either of them should
work fine. We'll choose the first one for simplicity here. Click it and click "Show Disassembler"
as usual to bring it up in the memory browser window. The first thing to do is to make sure that
it's an opcode you know enough to edit or overwrite.

If so, then the next step is to make sure that the code only works on us. Right-click the highlighted
line and choose "Find what addresses this code accesses" to bring up a new logging window.



"But Rydian, this is a .NET game, if you click th-" Shhhh. This is a general tutorial so we shouldn't
be relying on things like that which won't give any info for other games. Just follow along as if
the data collector didn't exist because for most games it doesn't and you need to guess+test.



You should run around, hitting other monsters, getting hit, and repeating "SCIENCE HERE, MAKE
WAY FOR SCIENCE HAPPENING" while testing to see if the code edits other addresses. Then check
to see if the targeted opcode works on just player data or the data of other things too.



In this case the targeted opcode only reads our health so we're good. In your case if it reads more,
then you'll want to check out other opcodes that do constant reads in order to find one that works.

Anyways once you have code that reads your address and only your address, you can edit it to
overwrite the value what whatever you want depending on what your goal is. Just because the
original purpose was to read doesn't mean you can't tell it to also write, you know.



So like that the game will constantly refill your health, and only do it to your health.





2 - Hack A Different Mechanic
While normally the fastest and most direct method to avoid taking damage in games is to neuter
the function that subtracts from your health, there's other mechanics you can focus on as well.
One of my favorites is "mercy invincibility" and that's what this will focus on. There's other mechanics
you can focus on as well if you think outside of the box, but this is often simple enough.

This is a concept in many games where, after getting hit, you have a brief period where you can't
get hit again (a mechanic intended to prevent stunlock on the player). Usually during this period
you'll be flashing or faded out or something, and enemies won't be able to harm you (and in many
cases won't even collide with you). Since this is a mechanic originally designed to prevent
annoyance for the player, this tends to be a mechanic that only applies to the player you're
controlling so that means it will rarely run into the issues that health codes can run into.

So since mercy invincibility lasts a specific amount of time, there must be a value to keep track of it
and game code to set, count down, and check that value. There should also be code that checks to
see if the player is invincible or not when trying to hurt him. So there's two ways to go about this.

For both of the methods, depending on the game you may find it useful to be able to pause and resume
the game quickly. If you go into Cheat Engine's settings, in the hotkey settings you can set hotkeys
for speedhack values. I tend to set one hotkey for speed 0 and another for speed 1. This means I can
press one hotkey to "pause" the game and a second hotkey to resume. This gives plenty of time to scan
for short-lived timer values or flags for mercy invincibility. 


In this case we'll search for a value that increases when you get hit, and then decreases as the timer for
invincibility wears off (and then raises again when you get hit). After some time spent searching, the
value has been found!



So there's two ways we could approach this. The first method would be to find what writes to that address
and find the code that's responsible for making it count down. This is what I tend to do when I want a
quick-and-easy invincibility code, because it's a simple process to find the timer and disable it. So here
I ran around and got hit twice, and allowed the timer to count down twice.



And the targeted code is the one we need. It's the one that reduces the timer repeatedly until it's empty,
so if you edit that code to no longer write the edited value then once you get hit the first time your
invincibility shouldn't wear off anymore. Yayyyy.

Now, what if we wanted to, instead, change the logic? With the quick-and-easy invulnerability code, the
player still needs to get hit once to activate it. To see another method of doing it, find what accesses that
address and you'll see some comparisons and stuff.



Now there's three of them here, and it's not immediately obvious which is the one we want. One of them
might be just for the visual effect, one of them might be a check for setting it off instead of on, etc. So
here is where you just need to guess and test. The middle one is the one that fires off when you get
hit and it turns on, so that's the correct one in this case and it's the one I'll be targeting. Looking at it...



So it seems to be comparing the invincibility value to 0, and if it's higher than 0 it jumps to some other
code instead (JG = "Jump if Greater"). If you edit the jg to be jmp instead, then it will always jump
to the other code, so when you contact a monster it'll always think you're invincible and won't damage
you! So this is a secondary method of getting invulnerability, editing the check instead of the write.

Now... a different method for invincibility could be to find the code dealing with an "invulnerable" flag.
This will generally be a byte value (but it could be something different of course) and in most cases will
be 1 or 0. It could either be "1 for invincible" or "1 for attackable", so check both ways. Get hit, pause the
game (either normally or with speedhack) while invulnerable and scan, do a different scan when it wears off,
etc. Depending on the game you may have to do an unknown initial value scan and scan for differences.

However in the case of Rogue Legacy, it seems that it only uses the invincibility timer. So instead of the
game checking for an invincibility flag, the code checks to see if the timer has any time left in it in order
to determine if you're invincible or not. Rogue Legacy isn't the only game that does this, so if the quick
and easy invincibility flag search didn't work, you may need to do the above timer method.





3 - Check The Player Structure
This is one of the more traditional ways of using injection to get invincibility for just the player. However
it also requires learning more about the game (specifically the entity structure for it) in order to use it
effectively, so since it needs more research and work and custom assembly it's the third method listed.

The basic idea is to have the game do a check like "is this a player or an enemy?" by comparing values,
and then either continue with the code to cause damage if it's an enemy, or skip over it if it's the player.

This method involves looking at the structure for entities in the game and comparing two instances (which
will generally be the player versus an enemy) to find differences. To be able to look at and compare the
structures, we should first find the base address of the player structure. To put it simply, for this example
it's the player's health minus the health offset. So let's say my current health address in a certain run is
0368A400 and the offset (code that writes/accesses will show this) is +118. Doing some hex math returns
0368A2E8 as the base address for the player. Remember that putting the Windows calculator into
scientific mode presents you with a hex selection box you can use to do hex math.

Now that we know the base address of the player, we should open the structure dissect window. In the
memory viewer (CTRL+B), go to Tools - Dissect data/structures. In the new window enter the base
address for the player's data into the box at the upper-left and choose Structure - Define New Structure.



Give it a name like Player (for .NET games like Rogue Legacy it offers to use the actual structure name)
and if you're doing this on a different game you'll be asked for a size (the default works) and whether
CE should try to auto-fill some of the data (yes). When that's all done you should see a bunch of stats
or whatever for the structure you chose. Since this is a .NET game we have it easy and it's all mapped
out for us already, but with most games it'll be unlabeled best-guess entries.

The next thing to do is to find the base address... of an enemy. So for this you should find the address
to their health and then subtract the offset (118 for this example) from it. For my run I got an enemy
with a health address of 226F5AD0, so that enemy structure's base address would be 226F59B8. Back
in the structure window, go to File - Add extra address. A second text box should pop up next to the
first one, put the enemy's base address in here. Then the display should show both data sets.



Green addresses are the same for both the player and enemy, red addresses are different. So using
this display, we can try to figure out which pieces of data (offsets) would be good for a comparison to
determine if the target is the player or an enemy. Again, in .NET games like Rogue Legacy we're
granted a big benefit in that the offsets are labeled and stuff. For other games you'll have to poke
around, see what other things in the structure you can find, and guess+test.

For this tutorial we'll just pretend we poked around a lot and found offset +104 (StepUp) and it seems
to always be the same value for the player (10) but different for enemies. Make sure to check what type
of value it is, in this case it's 4byte, gotta' remember that. So now you'll want to go back to making a
generic template script for the health code. Find the code that writes health when hit like usual, and
when you tell CE to generate the template the code: section should look something like this.



What we want to do is add a check (comparison, cmp) to see if some values are as expected (if the target
is the player), and if it's equal skip (je) past the original line of code and jump back to where it continues.



So the first line added is the comparison. Notice how it says "dword" after the cmp? This is to tell AA
how much memory to read and compare. It's very important to note the right size there, because if the
offset in the structure is 1 byte and you're reading 4, the comparison is bound to have false failures.

1 byte = "byte"
2 bytes = "word"
4 bytes = "dword"
8 bytes = "qword"

When it comes to float ("dword") or double ("qword") values, you can do exact comparisons (je or jne).
However doing greater/lesser comparisons may be a bit more complex and/or involve more code. 



Also notice that even though I said the value of StepUp is 10 for the player, it checks against A. Remember
that AA interprets things as hexadecimal values by default!

The second line is je (jump if equal) to the return location that CE sets up when the script executes.

Anyways, now that the script checks part of the structure against the known value for the player, the code
should properly grant you immunity to damage while still letting monsters get damaged. So yay, done!

This guide just covers the basics with a simple example, and if you run into other situations it's expected
that you know at least a little assembly since this type of thing usually needs a good understanding of what
the game is doing and such.





Don't forget that CE automatically allocates a newmem: section for you to use if your custom code is more involved.

by Rydian  Grandmaster Cheater Supreme

http://forum.cheatengine.org/viewtopic.php?t=570083
 










Wednesday, 1 March 2017

Rydian's Cheat Engine Guide To Custom Trainers


by Rydian  Grandmaster Cheater Supreme

http://forum.cheatengine.org/viewtopic.php?p=5576412

Introduction
Tired of Cheat Engine's generic trainer style? Want better ability to edit a trainer that you've already made?
Want to make a trainer that uses more than just hotkeys and can read and write custom values for ease of use?
Follow this tutorial and you should be spitting out fancy trainers at the end!




- Setup / Software / Downloads

  • This tutorial was written for Cheat Engine 6.4, though it should work on 6.3 or later(barring future UI changes).
  • We will be using the freeware game Cave Story as the target.
    You can download it here, the translation patch is linked right below the main download.
  • This post has some attachments which include the table and resources we'll be working with.
    So make sure to scroll down and download those now.


- Meet The Lua Script And Form Interface
The first thing you'll want to do once you have all the files set up is to attach CE to the game (Doukutsu.exe) and then load
the table. You'll see the various addresses and scripts in the table, but we'll barely be touching those. Instead, click the
"Table" menu at the top and click "Show Cheat Table Lua Script". This will bring up a new window where all the coding goes.



It's important to remember that you should not click the "Execute" button at the bottom of this form until you are ready to
actually test the script/trainer's functionality. Changes are automatically saved into the table, so always click the X at
the upper-right to close this form when you want it out of your way.

Now go to "Table" again and click "Create Form". This will bring up three windows... the Form Designer, Object Inspector, and
the Trainer Form itself. However you can think of the three windows using the below labels as well if it makes more sense.



This form will be the actual visible trainer that the users will see and interact with, and it will interact with the Lua
script to actually do stuff. After you've created a form, it has a sub-menu for it added in the "Table" menu, so you can bring
it back up or go edit it some more later.




- Basic Setup
The first goal will be to give the Lua script some basic working code and then set the trainer form up with a working "About"
button. To start, we'll copy-paste some basic code to the bottom of the Lua script window.

Code:
AboutText=[[Sample About Text Here]]

form_show(UDF1)
getAutoAttachList().add("doukutsu.exe")

function CloseClick()
  closeCE()
  return caFree
end

UDF1.OnClose = CloseClick

addresslist=getAddressList()


  • The first line sets some text for our "about" box, feel free to replace it with what you want (linebreaks work too).

  • The second line tells the script to show the form when the trainer runs. It uses the default name of "UDF1" for the main
    form, if you rename the main form then make sure to change this line as well.

  • The third line tells CE which process name you want the trainer to automatically attach to. If, for some reason there's
    more than one process name (DX/GL or DX9/11 installs) then you can copy-paste that line to add more process names the
    trainer should look for.

  • The lines that involve closing tells the background processes and such to close when the user closes the trainer,
    so leave these alone.

  • The final line loads the table's address list, for when we want to freeze values and such.

Now you'll want to look at the Trainer form (those three boxes). In the Object Inspector box (where you edit the properties
of things) click on the main form in the list at the top (UDF1, the default name for the trainer in general) and scroll down
to see the properties. You can click in the property boxes to edit them. You'll want to change the Width and Height of the
trainer to 300 each, and also change the Caption, because that's what determines what the Trainer window is named.



Now look at the Tool Box (Form Designer), click the second button and then click and drag in the trainer form somewhere to
make a simple button.



Then select this button (either click it in the Form or click it's entry in the Properties / Object Inspector) and tweak
it as well. Make it have "About" for a caption, and then change the Width, Height, Top and Left properties to resize and move
it. The Top and Left properties are the distance in pixels from the upper-left corner. For this tutorial, you're going to want
to position the button in the bottom-right, and remember to change "Caption" for the display text, not "name"!

Once the button is positioned where you want and looks the way you want it to, it's time to make it do something. Make sure
the button is selected and then go to the "events" tab and check out the "OnClick" entry. It will have both a dropdown box and
a "..." button. The dropdown box will list various functions to be run when the button is clicked... but we don't have a
function for it yet, so clicking the "..." button will open the Lua form and insert a function for it at the bottom.




So when the user clicks the button, it will call this function. The function is just one blank line right now, so you'll
want to copy-paste "showMessage(AboutText)" into it, which is the function it should call. This is a function that shows a
message box containing the AboutText that was part of the first stuff we put into the script.



So overall the Lua script should look something like this right now.


Code:
AboutText=[[Sample About Text Here]]

form_show(UDF1)
getAutoAttachList().add("doukutsu.exe")

function CloseClick()
  closeCE()
  return caFree
end

UDF1.OnClose = CloseClick

addresslist=getAddressList()

function CEButton1Click(sender)
  showMessage(AboutText)
end


The next thing we'll be doing is adding a sidebar image. Click the picture button in the Form Designer and then click in
the Trainer form to insert the image.



Then with the image selected in the Object Inspector, go to the "Picture" attribute, click the "..." button, then browse to
and select the sidebar image I attached to this post.



Make sure to change the image object's size and location to 100x300 (the size of the included sidebar image) and position it
on the left (top 0 and left 0 will make it fit exactly on the lefthand side).



When you're done resizing it and such, it's time to test it. Close the Form windows and leave just the main CE window and Lua
form open. Then in the Lua form, click the "Execute" button at the bottom. This should open the trainer and you should be able
to click the "About" button and have it show the info.



If so, move onto the next section. If not, make sure you didn't typo or accidentally misname something.




- Checkbox & Button Toggles
Well it's about time to actually add some cheat scripts and make the trainer do something useful, isn't it? The first thing
we're going to add is a checkbox that will toggle an address freeze. In The Form Designer click the checkbox tool and then
click in the Trainer Form to add the checkbox. Give it a nice Caption (not "name") and position it the way you want.



After that, just like we did for the About button, we're going to add a function to the "OnChange" event.



This time, we're going to need to make the script a little more involved. When the user clicks the checkbox, we want the
script to determine the new state (checked or unchecked) and act based on that. So we'll use this, sticking it inside the
blank function that CE inserted for us.

Code:
  if (checkbox_getState(UDF1.CECheckBox1) == 1) then

  else

  end


Note the phrase "UDF1.CECheckbox1". This is made up of two parts. The "UDF1" part is the name of the trainer form, while
"CECheckbox1" is the name of the checkbox we added. If you've renamed anything or when you go to add more things, be sure
that the names match.

So now that the function checks the status of the checkbox and does two separate things based on that, let's actually tell it
to freeze or unfreeze the first address in the cheat table (which is index 0).

Code:
  if (checkbox_getState(UDF1.CECheckbox1) == 1) then
    CheatEntry=addresslist_getMemoryRecordByID(addresslist,0)
    memoryrecord_freeze(CheatEntry)
  else
    CheatEntry=addresslist_getMemoryRecordByID(addresslist,0)
    memoryrecord_unfreeze(CheatEntry)
  end


So the entire function should look like this.



And it's time to test it! Close the Trainer Form and related boxes, then click "Execute" on the Lua Script window, if
everything went well you should see the trainer, and checking the box should have the desired effect.

But simply freezing values isn't enough in a lot of cases. Cave Story in particular starts you out with 3 HP, but the
starting area has spikes that do more than 3 damage, so they'll still kill you. In this case, we want to take the
"No HP Loss" script from the table and use that.

This time we'll make a toggle box (button) for the script. Find the "Togglebox" icon on the Form Designer toolbar
and then click and drag in the Trainer Form to create a toggle box. Resize and position and name it the way you want.
After this, just like before you want to go to the Events tab, and click "..." on the OnChange event to add the
function like you've done twice now. Go ahead and add the "if / else /end" code from before too since we're working
with a toggleable object, and make sure to rename the object being checked. If you did it right, it'll be this.

Code:
function CEToggleBox1Change(sender)
  if (checkbox_getState(UDF1.CEToggleBox1) == 1) then

  else

  end
end


Now, in those two blank spaces we want to run our script for "No HP Loss". For this we want to use the autoAssemble()
function which will let us run AA scripts. We'll want to copy everything in the [ENABLE] section of the "No HP Loss"
script into the first blank section, and everything under [DISABLE] into the second blank section, like below.
(Note that the script has [[ at the start and ]] at the end, this is used to denote multi-line scripts.)

Code:
function CEToggleBox1Change(sender)
  if (checkbox_getState(UDF1.CEToggleBox1) == 1) then
    autoAssemble([[
      alloc(newmem,2048) //2kb should be enough
      label(returnhere)
      label(originalcode)
      label(exit)
      newmem:
      originalcode:
      exit:
      jmp returnhere
      "Doukutsu.exe"+1997A:
      jmp newmem
      nop
      nop
      returnhere:
    ]])
  else
    autoAssemble([[
      dealloc(newmem)
      "Doukutsu.exe"+1997A:
      mov [Doukutsu.exe+9E6CC],cx
    ]])
  end
end


Quite a bit to put in, eh? But once you have this, you can just copy-paste it for each code you want and then replace
the script with the one from the table (I just strip comments and empty lines when doing this for visual clarity).

Anyways like before, once you have this in there, close the Trainer Form and related windows, then click the "Execute"
button at the bottom of the Lua window to run your trainer script and make sure stuff works out.




- Read & Write Forms
Let's say that we want to add some basic teleport functions to the trainer. We have addresses for the X and Y
coordinates in the table, and we want to let the user edit those values in the trainer for controlled teleportation.
In order to do this, we'll need two Edit boxes and two normal buttons. Add them, and this time we actually do want
to change the Names, not just the Captions. I'll name the boxes CEEditX and CEEditY, and the buttons will be
CEButtonRead and CEButtonWrite so that we don't get confused. You'll want to clear their "Text" properties as well
so you don't have the placeholder text that I left in the screenshot there...



Now in order to make this setup functional, we'll first add a script to the OnClick Event of the "Read" button we made.

Code:
function CEButtonReadClick(sender)
  setProperty(UDF1.CEEditX,"Text", readInteger("Doukutsu.exe+9E654"))
  setProperty(UDF1.CEEditY,"Text", readInteger("Doukutsu.exe+9E658"))
end

The setProperty() function changes the Trainer Form, editing a property of one of the objects. In this case we're
targeting (by Name) the X and Y edit boxes we made. We're editing their Text properties (their contents) and for the
value to put in there we're using the readInteger() function to pull the coordinates in from the addresses (in the table).

Now we want to make the Write button do something too, so as usual select it and give it an OnClick event, use this code.
It's basically the last stuff but in reverse, we give it an address and then a value to write to, reading from the form.

Code:
function CEButtonWriteClick(sender)
  writeInteger("Doukutsu.exe+9E654", getProperty(UDF1.CEEditX,"Text"))
  writeInteger("Doukutsu.exe+9E658", getProperty(UDF1.CEEditY,"Text"))
end


If everything went as planned, you should be able to Execute the script and get the controlled teleportation!



- Saving / Distributing
Now that you have a (relatively-)fancy trainer, it's time to share it with the world, right? Go to File -> Save As
and choose to save the table as a standalone trainer (.exe). I highly suggest renaming the trainer (even just
appending "_trainer" to the name), you don't want it to have the same name as the process you're targeting,
despite the default name in CE tending to be just that.



After you've selected the location and file name to save as, you get the final step of making the trainer. This is
where you can choose an icon file (32x32 or 48x48 .ico format, I unfortunately can't attach the one I used) and some
final technical details. In general the options are either self-explanatory or CE will choose the right default for
your trainer, the only suggestion I have is to set the compression to "None" because AVs tend to complain about it.



Once you click the "Generate" button, you're done! There's your fancy-pants trainer, have fun with it.
If you need some software to make an image into a, .ico file, IcoFX's freeware version is here.



Doukutsu.CT
 Description:
Table to work from.

Download
 Filename:  Doukutsu.CT
 Filesize:  8.2 KB
 Downloaded:  1253 Time(s)




The auto tool actually edits the table entries by adding hotkeys on any entry you have added, so you'd need to go and delete those manually if you don't want them there ('cause they function even outside the realm of the trainer).



And for tables that had more than just a few entries...
http://forum.cheatengine.org/viewtopic.php?t=568669
That process was getting annoying as fuck 'cause it'd overwrite and reset them (though that may have been a bug at the time, the generic trainer generator tends to throw errors if you try to edit some things).





D1g1Byt3 wrote:

Is there a way you can Freeze the value of a Pointer? I can't seem to get it to work with a Pointer I found.

At this part:
Quote:

function CECheckbox1Change(sender)
if (checkbox_getState(UDF1.CECheckBox1) == 1) then
CheatEntry=addresslist_getMemoryRecordByID(addresslist,0)
memoryrecord_freeze(CheatEntry)
else
CheatEntry=addresslist_getMemoryRecordByID(addresslist,0)
memoryrecord_unfreeze(CheatEntry)
end
end


I made sure its the first Address in My list, if I change the value at:(addresslist,0) from 0 to 1. It just Freezes the Script for the NOP Patch. I'm probably doing something wrong, but would appreciate some help. Thanks in Advance.
The way you have it set up right now, when it's clicked if it's already checked then it will freeze it, if it's not checked and you check it it will unfreeze it? So you'll want to invert the check or swap the freeze/unfreeze.



sti228 wrote:
Great tutorial but can you explain how to make buttons ? 

Something like this but with new CE 6.5 , This is old tutorial.

https :// www . youtube . com / watch?v = Xtro9 _ bMoa0
This guide is where you start.

If you want to do fancier custom things, then you will need to learn Lua and how to do fancier custom things.




by Rydian

Grandmaster Cheater Supreme


Get paid to share your links!