why it is only possible to insert custom code into some games but not others?

464 views

The two examples that come to mind are Mario World and Paper Mario, where custom code injections are frequently used by speed runners (credit warps) or even to write custom programs within the game like Flappy Bird which Sethbling did. What is it about the design of these games which allow for this type of manipulation, whilst in other games this isn’t possible?

In: Technology

3 Answers

Anonymous 0 Comments

Sethbling explains it about as well as can be: https://m.youtube.com/watch?v=hB6eY73sLV0

But the tldr is:

– Games often contain programming errors.
– Sometimes these errors make it possible to control contents of memory.
– And sometimes the errors make it possible to tell the console to execute the contents of some memory you control the contents of.
– The previous two things together let you corrupt the program in a controlled way, so it runs YOUR code instead of the regular code. This is a lot like a security exploit used to attack a computer, but used in a fun rather than malicious way.

In Sethbling’s case, those pixel-perfect object locations get turned into a list of numbers in memory. Those numbers are later (mis)interpreted as code. Seth worked with an assembly programmer who had studied the game’s code to determine what numbers needed to be in memory to corrupt the game to behave like flappy bird. Then they came up with a complex way to force the game to store those numbers in memory using only regular game controller inputs (which is a difficult and unusual way to manipulate memory), and later on to execute the contents of that memory as machine code (which is also stored as numbers).

When you enter the numbers, the game thinks they’re x-coordinates where objects are stored. Later on when you execute them, it thinks the numbers are code that shipped with the game. Obviously you have to confuse the f*ck out of the game to make this happen, but if the game has the right bugs in it, it’s possible if you work hard enough and study the game code closely enough. This takes a ludicrous amount of work. People have spent thousands of hours studying the code for the games Sethbling has hacked. In cases where people don’t know how to insert custom code, it’s because they haven’t studied the game enough to find the needed bugs, or to figure out how to use the bugs in a controlled way just using regular game inputs.

You are viewing 1 out of 3 answers, click here to view all answers.