- Jun 6, 2020
- 597
- 4,562
- 426
Unity Cracking Tutorial
Quick[er] Navigation:- Introduction and First Crack
- Level 1 - Unity Basics
- Level 2 - Removing password validation
- Level 3 - Writing BepInEx plugin
- Level 4 - Cracking Il2cpp game
I will explain everything as if I'm teaching the very beginner, so expect oversimplification of heavy tech stuff if you're experienced
I'll try to tell you only the things you need and drop everything that is not required to create a crack
You will learn how to:
- Remove paywalls
- Create cheats
- Add new functionality to the game
- Analyze how the game works
- Check if the game is free of malware
There will be a Unity Game attached to every level of difficulty. You're meant to follow along, download game for each level and crack it with me
You can preamtively download the archive with all the example games:
You must be registered to see the links
Prerequisites:
- You have to know very basics of programming or be willing to learn it elsewhere, this tutorial won't cover it, we will do basic programming in C#
Preparations
Step 0 - Installing tools
Game Link:
You must be registered to see the links
DnSpy Link:
You must be registered to see the links
Forked DnSpy Link:
You must be registered to see the links
To start we will need a game itself and some tools. Our first and most important tool will be
You must be registered to see the links
, it allows us to "look inside" .dll files that contain C# code. Read and Modify them. So download everything we need and proceed...You can download either one of provided links here, the official developer of DnSpy stopped supporting it in 2021, so if you want more features use the fork link instead
Step 1 - Figuring out the game engine
Before even starting a game there are some quick steps we should do that will help us understand the game better and know how to approach it.
The first and very obvious step is to make sure our game was made with Unity, let's look at file structure:
We have
- %GameName%.exe
- %GameName%_Data
- UnityCrashHandler
- UnityPlayer
Step 2 - Figuring out scripting backend
Now comes less obvious but very important step
You see, Unity offers two scripting backends to choose from:
Mono and il2cpp.To put it simply:
mono option compiles the game into those .dlls we can freely read and modify, so it will be easy for usil2cpp option compiles game into assembly code. We can still modify il2cpp game, but it's the topic for later chaptersLet's open
%GameName%_Data folderTwo options here:
- If there is
Managedfolder - it ismono - If there is
il2cpp_datafolder - it isil2cpp
mono scripting backend, who would've thought (Like I didn't make this game myself), so we can proceedLevel 0 - First Crack
Game Link:
You must be registered to see the links
It is finally time to run the game and see what it has to offer
Oh no! Look at that bitch, she wants our money to activate NSFW content, what a shame, $60/month! There is no way we're paying that for a game we already downloaded to our PC with all the content hidden inside
Let's not waste any more time and crack our first game.
Open
%GameName%_Data/Managed folder, that is where all the .dlls with game code are locatedThere are bunch of
dlls here, each of them contains different code that is used in the game, to make things simplier think of them as "modules" or "folders" for a code. For example UnityEngine.UI.dll is a part of Unity Engine that contains code for UI elements.The one we're interested in is
Assembly-CSharp.dll, that is where Unity puts the developer's code that is not part of Unity itself. By default. There could be exceptions if developer creates his own assemblies, but let's not focus on that for nowLet's open DnSpy
Not much to see right now, let's drag our
Assembly-CSharp.dll onto Assembly Explorer window or open it via File menuYou can click on the assembly to open namespaces and classes it contains. DnSpy will also load other assemblies from the same folder that are being referenced by the code inside of our
Assembly-CSharp, just ignore them and focus on Assembly-CSharpWe don't have a ton of code here because it's a small example game, however in real game you may find a lot of stuff inside, so be a good student and just imagine there are lots of classes with too much code to handle
There should be some kind of Patreon check inside the game, having experience with porn games I designed "levels" from the most common and easy to the rarest and more difficult examples of Patreon validations you can find in a wild
So lets do the most easy thing I always start with: open the search window (Ctrl+Shift+K or magnifying lens icon near start button) and search for the word
patreonMake sure the option "Search For:" is set to "All of the Above" or you may miss something
Would you look at that! We found a field called
_isPatreonVersion inside GameManager classlooks like the very thing we need, double click it to navigate to it's location
Here we go. Basic
static bool that seems to determine if the version we're running is patreon version or notYou can right click on it and hit "Analyse" to see where it is used. Check "Read By" section
You may navigate to the method this
_isPatreonVersion field is referenced at and see how exactly it is used. We can skip this part since it's pretty obvious this is what we need. Not to mention I'm running out of available attachments on F95So lets make it so our bool is set to true instead of false (it is false by default in C#)
For that we right click on this field or somewhere near it and choose "Edit Class (C#)..."
Make it so this bool is set to true like so:
We just add
= true;Then click "Compile"
We're done! Now we need to save recompiled
dll back to where we took it from.Click "File -> Save All..."
You can overwrite original
dll or copy it beforehand in case you messed something up.But we don't do that, we're pros, so destroy it is
Click "OK"
Lets run our game again and see if it made any effect
Voila!
Cool, we cracked our first game, lets go!
I've blurred the good parts on purpose so you would have more motivation to follow along and crack the game by yourself, though it's only a simple AI image made for educational purposes
And that's pretty much it for the very basics. Trust me, this is enough to crack at least 25% of the Unity games on F95
We've learned how to:
- Differentiate between
monoandil2cppscripting backends - Use DnSpy to read source code of
monoUnity game - Modify default values for fields in assembly
Share you thoughts and progress in this thread I'm always happy to answer questions and read feedback
Last edited: