Decompilers?

This is a discussion on Decompilers? within the C++ Programming forums, part of the General Programming Boards category; Is there such a thing, I have a really ancient game that I'd like to decompile and see if I ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    13

    Decompilers?

    Is there such a thing, I have a really ancient game that I'd like to decompile and see if I can't fix a few problems with it.

    Anyone know where to get one?

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    55
    As far as i know... no.. because once a program is compiled the code pretty much disappears. there is no way to view the code of a program that has already been compiled. the program kind of forgets about the code once it knows what to calculate... at least this is what my C++ professor said.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    13
    Hmm, the way I thought it worked was the compiler takes the code down into machine code. And while the program itself may not recognize it is code. There is still recoverable code from the file itself. You would just have to "decompile" it. I'm probably wrong though.

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I know there are programs that will convert the machine code in executables to something resembling normal code, but it's very approximate and would likely be very hard to read. You might be better off learning some machine code.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    mostly hard to read because variable and function names are all lost. A decompiler would have to give everything names which is likely to be some rediculous name. func1, func2, var1, var2 etc.. Plus, in large part assembly works off of offsets in memory. Not really variables the way we're used to them in C. A decompiler would have to make "best guesses" as to which parts of base/stack/heap memory make up what type of variable.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  6. #6
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Good piece of advice: learn ASM, else, it's hopeless...

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    13
    Thanks for the replies. I'll learn ASM after I get C++ finished off and perhaps Java.

  8. #8
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Java and ASM? Well, do as you like but those two aren't getting easily mixed, so I wonder what kind of programmer you will become. ^^

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Your ambitious! C++ is tough enough to learn and impossible to completely master (you can never stop learning). Assembly is even tougher imo.

    Java isn't too bad though and in many ways simpler but it may take a year to even become somewhat proficint at c++ and if you don't use both you will probably forget many aspects of one of the languages.

  10. #10
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Well, C++ is not that "tough", and you will end learning new concepts and aspects of the language one day.
    ASM is, well, very simple and complex at the time, you will see how much depending on how far you dwell into the language.

  11. #11
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    A tough task no matter how you approach it.

    Decompilers do exist! This one's kinda expen$ive!

    But, compilation is NOT a reversable process. Although the original source and the decompiled code might produce the same executable on some particular compiler, the original and decompiled code will NOT be identical. In addition to what FillYourBrain said, the functions will not be identical. (There is always more than one way to do something.) You don't really care about that. But of course, there won't be any (useful) comments either.

    A disassembler is a different story. Assembly is a human-readable representation of the exact machine code. Except for variable names, labels, and comments, assembly is reversable. You will get the identical machine code when you re-assemble.

    Back in ancient times, when as I recall the 8086 had about 30 instructions, I wrote a few small programs in assembly. Now, the Pentium has about 300 instructions!!!

    And, if you've ever looked a the size of an exe file... they get big! A simple 1K of source can turn-into a 30k exe file. It's going to be difficult to understand what the machine/assembly code is doing with thousands of lines of undocumented assembly code.

    If this wasn't a game, I'd say it would be easier to start-over and re-create the program from scratch. In the "real world", I think it's more common to start-over and reverse-engineer when the source isn't available. The "problem" with games is that there are usually lots of undocumented conditional branches that are difficult to discover, test and understand. It might take an infinite amount of time to discover & quantify the various randomizing algorithms, etc.

    If you're able to fix the problems with a decompiler or a disassembler, you get an official boy-scout hacker-badge! If you re-write the program, you get a programming-badge!
    Last edited by DougDbug; 09-29-2003 at 05:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decompilers ?
    By samudrala_99 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 05:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21