How do GameShark codes work?

[BACK]
How do GameShark codes work?
Posted On: July 22, 2013

This has always boggled me. Obviously GameShark and Game Genie never got inside access to place their own cheats into every game. I don't think any developers gave them the source code to pour over for codes. And I don't think the original development process for these games included placing any of these codes themselves. So, what is a GameShark or Game Genie code, really?


Both of them usually take the form of a relatively short hexadecimal string (or multiple if that is the case) so my intuition tells me they use the same principle. But are they just memory addresses to flip a bit? Or lock it? Or XOR a series of bits with something? What is the code, and what does it do?


Question from user LoveAndCoding at gaming.stackexchange.com.


Answer:

How it works.


When GameShark (and other game enhancer products/homebrew) gets loaded by the console, the enhancer is what launches the actual game. In doing so, it leaves behind a Code Handler in the system RAM and "hooks" the game's programming.


Specific locations in a game's programming that get executed roughly every frame (like reading the controller data) are where "hooks" will be placed. (because SDKs are used, this makes finding hooks that work in all games for a system much easier).


What the hook actually does is redirect the flow of programming to the Code Handler the enhancer left behind. Once the Code Handler is finished executing, it returns the flow of programming back to the point of hijacking.


If you are familiar with GameShark's "Master Code", that is what sets the hook.


(other enhancers - like Gecko OS for Wii - don't need master codes because the enhancer itself has a handful of SDK-based hooks that it can "find" in the game while it loads.).


Structure of codes.


Now a code itself is separated into THREE parts:.


The CodeType (this is USUALLY the first byte of the code-- the first 2 Hex Characters). CodeTypes are specific to the enhancer.


The address in ram that the CodeType will use.


The value the codetype will use at the specified address.


The most common CodeTypes are:.


RAM Writes (typical options are 8bit, 16bit, or 32bit).


With RAM Write, the CodeHandler will take the value and place it at the address. (changing whatever was there, like setting your health to 100!).


Conditionals (typical options are >, <, =, !=).


With Conditionals, the CodeHander reads the value at the code's address and compares it to the value in the code. IF the comparison returns true, then the CodeHander will execute the next line in the code. (how many lines it executes is up to the enhancer and often is an option in the codetype itself!).


There is plenty more info we could dive into, but that should give you a good basis for understanding. =).


Source: Game hacker since 1999, founder of http://GeckoCodes.org.


Answer from user James0x57 at gaming.stackexchange.com.



[BACK]
How do GameShark codes work?
Posted On: July 22, 2013

This has always boggled me. Obviously GameShark and Game Genie never got inside access to place their own cheats into every game. I don't think any developers gave them the source code to pour over for codes. And I don't think the original development process for these games included placing any of these codes themselves. So, what is a GameShark or Game Genie code, really?


Both of them usually take the form of a relatively short hexadecimal string (or multiple if that is the case) so my intuition tells me they use the same principle. But are they just memory addresses to flip a bit? Or lock it? Or XOR a series of bits with something? What is the code, and what does it do?


Question from user LoveAndCoding at gaming.stackexchange.com.


Answer:

How it works.


When GameShark (and other game enhancer products/homebrew) gets loaded by the console, the enhancer is what launches the actual game. In doing so, it leaves behind a Code Handler in the system RAM and "hooks" the game's programming.


Specific locations in a game's programming that get executed roughly every frame (like reading the controller data) are where "hooks" will be placed. (because SDKs are used, this makes finding hooks that work in all games for a system much easier).


What the hook actually does is redirect the flow of programming to the Code Handler the enhancer left behind. Once the Code Handler is finished executing, it returns the flow of programming back to the point of hijacking.


If you are familiar with GameShark's "Master Code", that is what sets the hook.


(other enhancers - like Gecko OS for Wii - don't need master codes because the enhancer itself has a handful of SDK-based hooks that it can "find" in the game while it loads.).


Structure of codes.


Now a code itself is separated into THREE parts:.


The CodeType (this is USUALLY the first byte of the code-- the first 2 Hex Characters). CodeTypes are specific to the enhancer.


The address in ram that the CodeType will use.


The value the codetype will use at the specified address.


The most common CodeTypes are:.


RAM Writes (typical options are 8bit, 16bit, or 32bit).


With RAM Write, the CodeHandler will take the value and place it at the address. (changing whatever was there, like setting your health to 100!).


Conditionals (typical options are >, <, =, !=).


With Conditionals, the CodeHander reads the value at the code's address and compares it to the value in the code. IF the comparison returns true, then the CodeHander will execute the next line in the code. (how many lines it executes is up to the enhancer and often is an option in the codetype itself!).


There is plenty more info we could dive into, but that should give you a good basis for understanding. =).


Source: Game hacker since 1999, founder of http://GeckoCodes.org.


Answer from user James0x57 at gaming.stackexchange.com.



[BACK]

Is it possible to beat Infinity Blade on the first bloodline? Is it possible to beat Infinity Blade on the first bloodline?

Posted On: September 22, 2023
I've played through two bloodlines so far in Infinity Blade. Both times I made it to the boss, and both times he beat me. I imagine it's possible to beat him after leveling up over the course ...[More]


[Warning: Spoiler] I feel so alone in liking Natsai in Hogwarts [Warning: Spoiler] I feel so alone in liking Natsai in Hogwarts

Posted On: June 24, 2023
I feel like I'm in the twilight zone because I seem to be liking characters in this game that aren't liked by most players. I like Natty the most, and then Ominis and Poppy. Though Poppy is...[More]


Fallout 4 wont launch after a December 2023 Xbox update Fallout 4 wont launch after a December 2023 Xbox update

Posted On: April 26, 2024
After the Xbox update on December 6th to version 10.0.25398.2917, I am unable to start Fallout 4 anymore. The loading screen is shown, but nothing else happens.I have already tried restarting my Xbox ...[More]


Most Frustrating Thing Ever in Hogwarts Legacy Most Frustrating Thing Ever in Hogwarts Legacy

Posted On: April 20, 2023
I have 139 out of 140 conjurations. Fairly certain I found all the butterflies and the chests in the Vivarium's so now I have to start all over again and recheck them all. Question from user...[More]


Is there an in-world explanation why Aloy needs to learn skills again? Is there an in-world explanation why Aloy needs to learn skills again?

Posted On: April 14, 2023
I just finished playing Horizon: Zero Dawn on PC. While waiting for a PC version of Forbidden West, or ability to buy PlayStation 5, I have read the reviews and it looks like in Forbidden West Aloy ne...[More]


In Civilization5, is there a hotkey for the general Next Move button? In Civilization5, is there a hotkey for the general Next Move button?

Posted On: April 8, 2023
I'm looking for a keyboard hotkey for the generalized "Next Move", "Choose Research", "Unit Waiting for Order" button in the bottom-right corner of the interface. ...[More]


What does the keyword Treble do? What does the keyword Treble do?

Posted On: April 14, 2024
What does the keyword Treble do? The following description is not clear to me.Add Treble to the left side. Other Keywords x2 -> x3.Question from user GnomeSlice at gaming.stackexchange.com.Answer:Ot...[More]


Yenna doesn't get enough love. Yenna doesn't get enough love.

Posted On: March 6, 2026
I was going through a few reddit threads to get an idea of whether or not to accept the deals of Orin and Gortash, and whenever someone mentioned the kidnapping, they showed the least care for poor Ye...[More]


How many people wish they could Use the killing curse on the flu flame lady How many people wish they could Use the killing curse on the flu flame lady

Posted On: August 3, 2023
I’m getting sick and tired of hearing her say You Wouldn’t believe how inconvenient travel was before I invited Floo powder.Question from user DavidCopeland276 at HogwartsLegacyGaming at...[More]


What is the most feasible option to play (almost) all Zelda games? What is the most feasible option to play (almost) all Zelda games?

Posted On: January 23, 2023
Given the timeline list of games on The Legend of Zelda - Wikipedia, what would be the most feasible option to preferably legally play all (or a vast majority of) the games in the series? These are...[More]