Let's Hack: Enter The Gungeon

Welcome back! A quick note before we start: all of my game hacking videos are done to learn reverse engineering and explore video game mechanics in a fun way. This is game hacking with single player PC games in an effort to enjoy reverse engineering a game and modifying games to achieve new, wacky things. This is not to cheat other players, hack some high score, or anything like that. I feel like I needed to say this because my past god mode videos have been somewhat controversial. So here's a laid back, game hacking post to give you more insight into the how and why, now Let's Hack!

I just picked up Enter the Gungeon, and with any new game I like to use some basic monitoring tools like Process Explorer and Process Monitor to get a more general sense of what a program is doing. I isolate the process in Process Monitor, and quickly find an output log. This output log reveals a bunch of other game files and some simple error messages about how this game is written in Unity. Later I use this output log to learn our health value is a float and find the location of the save file, but those save files are obfuscated at rest so this doesn't yield too much, other than helpful info:


But we did learn enough useful information to move forward in our last step. Unity games are written in Mono, making them an excellent target for Cheat Engine which can decompile the Mono IL in-memory, allowing me to reverse engineer the code easier. Flash forward through learning the game basics, and onto level 1, first thing I go after is god mode via editing some IL in-memory. My first attempt at god mode was turning off the projectile clipping so that I couldn't get shot. But it turns out the way this game is designed this doesn't let me shoot enemies either. Each projectile is a neutral object with a property in the object specifying if it's an enemy or a player character. Things get pretty wacky, but this isn't true god mode yet, meaning we will have to dig deeper than this hack.


In the mean time, it turns out classic search and replace for in-memory values works. Coins are a 4 byte value and health is a float, which was revealed in the output_log from earlier. This is the age old CE method of finding values in-memory and modifying or fixing them. This will get us by with health and money to start, but we will want to make this god mode more dynamic so we can survive a crash or restart. If this part feels basic you can probably skip it. Later we will see these fields are part of much richer mono objects that we can decompile with CE, but for now let's find the values.


That was fun, but let's add some persistence to our previous life hack by turning it into an AOB script. This will make it dynamic and able to survive re-instancing. Remember in part 2 where we learned god mode will be tricky due to the abstract nature of the projectiles, and even health, in this game? Well we can use the decompiled Mono objects to find the exact address of the "isPlayerCharcter" property, and check this before we apply our god mode. This will add proper dynamic god mode, to only human player charters. I use some hot keys you may find helpful in the video below, such as ctrl+v to bring up the memory viewer and ctrl+shift+a to bring up the auto assembler window. Once in the auto assembler we can easily generate some template AOB code. We can also dissect any object structures based on their offset in-memory, from the memory view window by pressing ctrl+d (this requires CE's mono features to be active).


That's cool but we are still missing unlimited ammo and some aspect of superior fire power. While I was messing with the projectile "owners" in an attempt to unlock god mode, I stumbled across a really nifty hack that shorts out the shooting function. I'm not going to claim I know exactly how it works, but at a high level it seems that modifying this function will then short / reset the shooting action just after projectiles are assigned an owner. This results in a really epic infinite shot, that doesn't even cost ammo! Some enemies also gain our new shot too, due to the abstract nature of projectiles, but I'll take it.


Awesome! Put it all together and we are an unstoppable, Gungeon killing machine! There is still a ton more to explore and hack with this game, but this covers the basics of what I like to achieve per game. This final video is more akin to one of the god mode videos I normally post, most of which are some combination of techniques I've previously covered on this blog (seriously, just search my blog for "game hacking"), which is why I don't do a long tutorial for each video anymore. That said, if people dig this style of more in-depth post, I can do more like this in the future.