How do AR cheats like 300cc work

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
Country
So I'm getting a gateway soon so I can learn to make Action Replay/Cheat Engine style cheats. I don't have it yet but I thought it would be good to learn a bit before I actually get to try it out

Since cheat codes only really mess with the memory, then how are cheats like this made?



My theory is that when they were coding the games they used symbolic constants to hold the values of things like speed, max items etc but aren't constant variables read only, which makes you unable to write to them?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Most games do not use anything resembling "safe" coding practices* and often do not use an entire range either (no sense if you do count in individual numbers), however as registers, reads and whatnot might be minimum 32 bits and memory and storage is cheap then no sense packing things into smaller units. A new pickup, new life... will then often reset this which is why some cheats come with a warning like will not survive a level up/if you save and load it will be back to the normal maximum...
In the case of Mario Kart I would also have to wonder if the headroom was not left in there to allow for an easy way for the AI to rubber band (in case you were unaware then AI in mario kart will catch up very quickly if you take shortcuts and whatnot, far faster than any conventional powerups and such would allow) and the high speed cheats just tap into that.

* http://courses.cs.vt.edu/professionalism/Therac_25/Therac_1.html for a nice real world example of the concept, in games the closest you will see is what is usually dubbed anti cheat. Most commonly seen in health values you will tend to see the value copied, mirrored and possibly inverted, maybe subtracted from a maximum or otherwise noted elsewhere and used to determine things. The would be cheater then looks for the health as displayed on the screen and though that might change the game still knows what the real health is/was.

I should also say that depending upon the system, the DS very much counting here, you may find the binary is in actually in memory and thus you can make a binary patch via simple memory editing. Being in memory and running it will also tend not to be compressed either.
 
  • Like
Reactions: Scarlet

Scarlet

Onion Soup
Editorial Team
GBAtemp Patron
Joined
Jan 7, 2015
Messages
5,090
Trophies
2
Location
Middleish North-Right
Website
scarlet.works
XP
14,458
Country
United Kingdom
Most games do not use anything resembling "safe" coding practices* and often do not use an entire range either (no sense if you do count in individual numbers), however as registers, reads and whatnot might be minimum 32 bits and memory and storage is cheap then no sense packing things into smaller units. A new pickup, new life... will then often reset this which is why some cheats come with a warning like will not survive a level up/if you save and load it will be back to the normal maximum...
In the case of Mario Kart I would also have to wonder if the headroom was not left in there to allow for an easy way for the AI to rubber band (in case you were unaware then AI in mario kart will catch up very quickly if you take shortcuts and whatnot, far faster than any conventional powerups and such would allow) and the high speed cheats just tap into that.

* http://courses.cs.vt.edu/professionalism/Therac_25/Therac_1.html for a nice real world example of the concept, in games the closest you will see is what is usually dubbed anti cheat. Most commonly seen in health values you will tend to see the value copied, mirrored and possibly inverted, maybe subtracted from a maximum or otherwise noted elsewhere and used to determine things. The would be cheater then looks for the health as displayed on the screen and though that might change the game still knows what the real health is/was.

I should also say that depending upon the system, the DS very much counting here, you may find the binary is in actually in memory and thus you can make a binary patch via simple memory editing. Being in memory and running it will also tend not to be compressed either.
My answer suddenly feels lacking... Aha, great information though :P
 

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
Country
Most games do not use anything resembling "safe" coding practices* and often do not use an entire range either (no sense if you do count in individual numbers), however as registers, reads and whatnot might be minimum 32 bits and memory and storage is cheap then no sense packing things into smaller units. A new pickup, new life... will then often reset this which is why some cheats come with a warning like will not survive a level up/if you save and load it will be back to the normal maximum...
In the case of Mario Kart I would also have to wonder if the headroom was not left in there to allow for an easy way for the AI to rubber band (in case you were unaware then AI in mario kart will catch up very quickly if you take shortcuts and whatnot, far faster than any conventional powerups and such would allow) and the high speed cheats just tap into that.

* http://courses.cs.vt.edu/professionalism/Therac_25/Therac_1.html for a nice real world example of the concept, in games the closest you will see is what is usually dubbed anti cheat. Most commonly seen in health values you will tend to see the value copied, mirrored and possibly inverted, maybe subtracted from a maximum or otherwise noted elsewhere and used to determine things. The would be cheater then looks for the health as displayed on the screen and though that might change the game still knows what the real health is/was.

I should also say that depending upon the system, the DS very much counting here, you may find the binary is in actually in memory and thus you can make a binary patch via simple memory editing. Being in memory and running it will also tend not to be compressed either.
I barely understood the first paragraph
I thought my basic understanding of memory in programming would be enough to make cool cheats but I guess not :cry:
thanks for the help though, I'm still getting a gateway because the cheat situation looks a lot better on there than on NTR CFW
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
A basic appreciation for the ideas of variables and memory layout is more than enough to make cheats, and probably even cheats like these that you describe. I would have to analyse the ones in question to see what goes ( http://gbatemp.net/threads/reverse-engineering-golden-sun-dark-dawn-exp-multiplyer-code.272880/ for an example of something fancy) as it could be something else, and in any case it might be easier if you did also understand some assembly coding and general ways code works (if I can disassemble something and see exactly how it works it is far nicer than having to watch something change 400 times and sort of guess and fiddle to learn the same thing). However if all you understand is what hex is, what memory is, what data encoding is and so forth then it is more than enough to make cheats beyond infinite health, ammo and money.
The other stuff was more that though I can set a 32 bit value and then have FFFF be the max and 0000 be the minimum and have 3 values in between there is no point if I can count up instead and not have to do some kind of almost analogue interpretation. Equally modern computers have lots of memory so unlike some older systems where every sperm is sacred no bit is wasted the CPU time needed to unpack data is worth more than the memory it might save to put two different variables into one 32 bit value, to that end to assign a 32 bit value but only count to 6 using it is quite fine to do and commonly seen in modern computers.

The rubber band stuff was just me pondering things -- if you want the AI to catch you up in mario kart you could have them have some odd powerup that you can not see and functions to handle all that, or have them teleport or have something else odd happen. If however you can write a function like if distance behind is greater than ?? then set speed to ludicrous speed and you have the option to do that in basic "CC" value* then that is far easier than messing with teleports and whatnot. If that room is there to go way over the normal max CC value that menus allow you then a simple cheat would be able to do it. That might mean mario kart is a unique case and other games might not have it so easy.
*it is less obvious in newer ones but if you look at the racers in 8th place in the older ones as you lap them (baby park in GC mario kart is a good example) then you will also see them going really slow so it might also be a simple way to make AI, and a simple way to ensure that random AI do not win each race to give the player a bit of a challenge in grand prix mode rather than just getting an unbeatable points lead.
Oh yeah learning to code and make cheats and hack ROMs will lead to you noticing things like that in every game you play. I don't mind it but some people come to regret being able to see such things.

When you spoke of constants and such it usually comes from safe coding (it is to that what teaching people about factorial numbers is to recursion) so I assumed you went from there.
 

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
Country
A basic appreciation for the ideas of variables and memory layout is more than enough to make cheats, and probably even cheats like these that you describe. I would have to analyse the ones in question to see what goes ( http://gbatemp.net/threads/reverse-engineering-golden-sun-dark-dawn-exp-multiplyer-code.272880/ for an example of something fancy) as it could be something else, and in any case it might be easier if you did also understand some assembly coding and general ways code works (if I can disassemble something and see exactly how it works it is far nicer than having to watch something change 400 times and sort of guess and fiddle to learn the same thing). However if all you understand is what hex is, what memory is, what data encoding is and so forth then it is more than enough to make cheats beyond infinite health, ammo and money.
The other stuff was more that though I can set a 32 bit value and then have FFFF be the max and 0000 be the minimum and have 3 values in between there is no point if I can count up instead and not have to do some kind of almost analogue interpretation. Equally modern computers have lots of memory so unlike some older systems where every sperm is sacred no bit is wasted the CPU time needed to unpack data is worth more than the memory it might save to put two different variables into one 32 bit value, to that end to assign a 32 bit value but only count to 6 using it is quite fine to do and commonly seen in modern computers.

The rubber band stuff was just me pondering things -- if you want the AI to catch you up in mario kart you could have them have some odd powerup that you can not see and functions to handle all that, or have them teleport or have something else odd happen. If however you can write a function like if distance behind is greater than ?? then set speed to ludicrous speed and you have the option to do that in basic "CC" value* then that is far easier than messing with teleports and whatnot. If that room is there to go way over the normal max CC value that menus allow you then a simple cheat would be able to do it. That might mean mario kart is a unique case and other games might not have it so easy.
*it is less obvious in newer ones but if you look at the racers in 8th place in the older ones as you lap them (baby park in GC mario kart is a good example) then you will also see them going really slow so it might also be a simple way to make AI, and a simple way to ensure that random AI do not win each race to give the player a bit of a challenge in grand prix mode rather than just getting an unbeatable points lead.
Oh yeah learning to code and make cheats and hack ROMs will lead to you noticing things like that in every game you play. I don't mind it but some people come to regret being able to see such things.

When you spoke of constants and such it usually comes from safe coding (it is to that what teaching people about factorial numbers is to recursion) so I assumed you went from there.
ok
and btw, do things like Cheat Engine/Action Replay/Gateshark tend to follow the same syntax or are they different?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Some of the really old ones are encrypted and obfuscated (they had to sell those code books). Others are a little bit different to each other and may have different abilities (some might not do boolean logic where others will, equally some of the really old stuff might be very basic indeed). However if you are familiar with general operations you will probably get along with things well enough.
Have a read of http://doc.kodewerx.org/ if you want to quickly be able to compare and contrast different systems and things within the same system.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: "Now I know why he took his own life"