How to decompile a game .exe file?

Programming related discussions related to game research
prohackernoob
Posts: 3
Joined: Wed Sep 07, 2016 2:34 am

How to decompile a game .exe file?

Post by prohackernoob »

Hey, I am trying to get a usable code by decompiling Battles-Win.exe . The steam version of the game Bloons TD Battles. Every decompilier I have tried so far does not work and I am wondering if you guys know of any?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: How to decompile a game .exe file?

Post by aluigi »

It depends by what you exactly need because "decompiling" may have different meaning depending by the person, and usually it's the wrong meaning because users want to do something for which they have no knowledge and experience.

Often some people want to extract resources from an executable, and that's a job for a resource extractor like ResHacker, 7-Zip (that has a feature to parse PE files) or my parse_exe.bms script.

Other people refer to "disassembling" the executable for viewing the x86 assembly code, that's a job for IDA Pro (there is also a free version).

If you mean "debugging" for finding specific functions and understanding how data is read/write in real-time then you have choices like Ollydbg, ImmunityDbg and x64dbg (Windbg is not user-friendly for first-time users).

The correct meaning of decompiling is converting the low level assembly language of an executable in a higher language, usually C-like, in this case the free tools are RecStudio and Snowman for IDA Pro (Boomerang is a pain to compile, use and for the results, not suggested), otherwise IDA Pro has its own native decompiler but it's not free.

Please note that the Steam executables are encrypted and you need to decrypt them first, 2 ways:
- Steamless: viewtopic.php?f=17&t=1354
- get directly the no-cd executable :D

I'm sure that other users have something to add to this topic.
prohackernoob
Posts: 3
Joined: Wed Sep 07, 2016 2:34 am

Re: How to decompile a game .exe file?

Post by prohackernoob »

Well the main thing I am looking to do is just modify the game entirely through the code. I already managed to change a ton of shit using the password for the data.jet file, but there is just so much stuff that is solely coded in the .exe. Like lets say I want to add a new map to the game entirely, it won't work and the game will crash when I try to play that map, buut if I change the textures and pathing of an existing map it works fine. Went a bit off topic there, but the main thing I am looking for is to be able to change the code of the game, and compile it back to the .exe. Will I be able to do all that with IDA Pro?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: How to decompile a game .exe file?

Post by aluigi »

IDA Pro is just a tool to do things, what you say requires personal skills, experience and effort... you need to know what you do.
Modifying a constant or a string or a very small part of a function are ok for most people with some skills, but being "able to change the code of" a closed-source generic game is a completely different story.
If you ask about these things here it means you don't have the necessary knowledge, sorry.
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: How to decompile a game .exe file?

Post by bugmenot »

EXE files are different. It is true that those written with low level languages like C++ can't be decompiled from machine code, but can only be disassembled. However there are also .exe files written with C# and they can easily be decompiled back to the source code.
atom0s
Posts: 250
Joined: Sat Dec 27, 2014 8:49 pm

Re: How to decompile a game .exe file?

Post by atom0s »

C++ and other lower-level languages can be decompiled, just not to guaranteed working/original code.
There are a handful of decompilers made that can take x86/x64 assembly and translate it back to a C-style pseudo format.

- IDA (HexRays plugin)
- Ghidra
- Snowman
- BinaryNinja (Their new decompiler.)
- Retdec
- Boomerang
- SmartDec
- etc.

Along with some new ones that are up and coming. A main one being 'rev.ng'.