Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: is there a c++ compiler and decompiler for df.exe? i got a curse from a mummy :(  (Read 11458 times)

azrael300

  • Bay Watcher
  • WERE GOING TO LIVE :)
    • View Profile

so your saying that exe files cant be decompiled for free?
I'm saying that they can't readily be decompiled at all.  Decompiling C++ code (or really any language compiled to native machine code) is Hard.  Even the available for-pay tools don't do a full job of it; human intervention is typically required to convert the output of even the best tools into something that can be made sense of.

To make it more clear:

Compiling source code (C++ in this case) to an executable is non-reversible. Given an executable file, and nothing else, you can't know what the source code looks like. The best that any software could do is guess.
perhaps time will tell,if there ever will be a software that can decompile. wait ....(if you turn c++ into something else that can still be read by a pc,then how can it not be decompiled?if it cant be decompiled then how does the pc understand the language? if you can understand the language then it can be changed into another language that you understand like translating english into spanish and then spanish back to english.)

[edit]and when translating you dont guess....so therefore if you understand the language that must have bin invented or made by someone and he translate english into that language then it should be able to be reversed because he just translated it into that language then why not back again?
because there is more than one way to translate things from one language to other (in this case c++ -> machine code)
c++ -> machine code is made by humans
Logged
Edit. Oh Jesus Christ, Necro would be proud. The second horse in the caravan came in and immediately caught on fire. I looked into his inventory and found a burning pig tail fiber bag. Curious, I looked inside.
quote above is by yuriruler90

G-Flex

  • Bay Watcher
    • View Profile

perhaps time will tell,if there ever will be a software that can decompile. wait ....(if you turn c++ into something else that can still be read by a pc,then how can it not be decompiled?if it cant be decompiled then how does the pc understand the language? if you can understand the language then it can be changed into another language that you understand like translating english into spanish and then spanish back to english.)

I don't think you understand how... any of this works.

"Compiling" is, in this context, taking source code written in a comprehensible language like C++ and turning it into machine code your computer can actually run. The computer does not "understand" the source code at all. In the simplest cases, the computer doesn't even have a way of knowing what language was used.

Time won't "tell" because the process is non-reversible. For a given compiled program, you can't know what the source code was, because 1) a lot of information in the source code (like what things are named, for instance) is completely lost, and 2) more importantly, a compiled program could theoretically be the result of one of any number of original source code examples, and conversely, depending on the compiler and its settings, any given source code could even result in different compiled programs. In other words, the same compiled program could come from one of many hypothetical examples of source code, and the same source code could (to a lesser degree) be compiled to one of many hypothetical compiled programs.

This is why a decompiler would have to "guess": Because there is no way, not even in theory, to know the exact source code that was used to write a program, so the best it can do is figure out an example of source code that would happen to compile to the same thing under certain settings by a certain compiler.


I'm going to suggest that you research this subject a little first. You obviously don't understand very fundamental and basic aspects of programming and how it works, so it would do you some good to read up a little first.
« Last Edit: May 20, 2012, 01:42:26 pm by G-Flex »
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

CodexDraco

  • Bay Watcher
  • [SARCASTIC]
    • View Profile

In particular, machine code has no concept of variables, objects, types or even functions. The only thing a machine understand are memory adresses, instructions, registers and jumps. In the translation analogy, a compiler is translating from English to Ant.
Logged
Finely minced dwarven wine... what?

Uristocrat

  • Bay Watcher
  • Dwarven Railgunner
    • View Profile
    • DF Wiki User Page

He might be confused because there is a Java decompiler called jad.  It really wouldn't help fix a mummy curse, though.

DFHack is the only realistic hope.  Having a "remove mummy curse" function would be a very useful plug-in, I just don't think that anyone has written one yet?
Logged
You could have berries on the rocks and the dwarves would say it was "berry gneiss."
You should die horribly for this. And I mean that in the nicest possible way.

slaytanic

  • Bay Watcher
    • View Profile
    • my DFFD pack

yeah I have played with the java decompilers myself, but I have no knowledge of C really. It can not be done accurately if at all I'm sure. It would be somewhat incomprehensible. I can right click the .exe with 7zip and open the archive. I'm not sure about messing with anything in there though.
Logged
So let me get this straight....We are talking monkeys living on a dirt ball that circles a fireball ? WTF ?

SmileyMan

  • Bay Watcher
    • View Profile

Computer Science 101

a) Reseach 'Pigeonhole Principle'
b) Download some arbitrarily complex source code from e.g. SourceForge. Note the total size of the source code files.
c) Compile the code. Note the size of the compiled executable
d) Examine your results from b) and c) in light of the research in a)

Now you know why a decompiler doesn't exist, and you can move onto trying to get a perpetual motion machine going.
Logged
In a fat-fingered moment while setting up another military squad I accidentally created a captain of the guard rather than a militia captain.  His squad of near-legendary hammerdwarves equipped with high quality silver hammers then took it upon themselves to dispense justice to all the mandate breakers in the fortress.  It was quite messy.

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile

Basically without doing research or anything, let's put it like this:

Decompiling a C/C++ program will lead to a result that is every bit as confusing, if a little better formatted than, regular executable code.

This is because the names of the variables, specific structures, comments, and other such niceties will NOT be translated.

Add on the fact that even if you do this you wouldn't be able to undo a mummy curse means exactly what people have been saying.  Decompilation isn't what you're looking for.  Memory hacking IS.  And there are plenty of hacking tools that could help you here.
Logged
I like fortresses because they are still underground.

slaytanic

  • Bay Watcher
    • View Profile
    • my DFFD pack

It's all math. It's like trying to figure out the problem with just the answer.
Yay. I like cheese...for it's texture.
Logged
So let me get this straight....We are talking monkeys living on a dirt ball that circles a fireball ? WTF ?

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile

The main problem with decompiling C++ is that "classes" don't exist in machine code. All you see is "allocate x bytes" in one part of code and "store adx register into bytes 4-8 of pointer" in a completely different part and so on. It takes great skill to translate that into having a class called creature created in the first location, and realising that the 2nd is also using the creature class and manipulating its health variable. Even better skill to untangle inheritance of classes...

It's theoretically much easier to do if debug symbols are available, but they aren't for DF.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

therahedwig

  • Bay Watcher
    • View Profile
    • wolthera.info

Well, I know a few guys who are pretty fluent in assembly.

But say you are completely fluent in whatever the decompiler spits out, your problems are still not over.

1) dwarf fortress is an incredibly complicate program.
2) Toady has a doctorate in maths. Half of his generation solutions use high-end maths, I'm not surprised if most of his coding solutions contain high-end maths. Mathematics is a very weird science.

Even if you were fluent in machine language, it will still be an enormous pain to understand DF enough to change things.

Also, do note that Java isn't the same as C/C++. Most notably, Java compiles at runtime, while C/C++ are compiled on the computer of the distributor. This means that the files you receive of a Java program are indeed the actual code, but what you receive with a c/c++ program is zeros and ones that only the computer can understand.
Logged
Stonesense Grim Dark 0.2 Alternate detailed and darker tiles for stonesense. Now with all ores!

slothen

  • Bay Watcher
    • View Profile


2) Toady has a doctorate in maths. Half of his generation solutions use high-end maths, I'm not surprised if most of his coding solutions contain high-end maths. Mathematics is a very weird science.

math is awesome!  a bastion of absolute certainty and logic.  However, 95% of the gruntwork in coding an application makes very little use of advanced mathematics.
Logged
While adding magma to anything will make it dwarfy, adding the word "magma" to your post does not necessarily make it funny.
Thoughts on water
MILITARY: squad, uniform, training
"DF doesn't mold players into its image - DF merely selects those who were always ready for DF." -NW_Kohaku

caddybear

  • Bay Watcher
  • Elf Supporter
    • View Profile

You'd need to be a wizard to do what you want to do in the way that you want to do it. And if you are a wizard, you don't actually need to decompile to do what you want to do. I would know.
Logged
And then did ARMOK say, the east is the holiest of directions, and thou shouldst not stand there lest thou be strucketh down by my holiest of beards. And then did the dorfs did say, we shall build from the west, for more do we fear the beard of ARMOK than the strike of the elephant.

therahedwig

  • Bay Watcher
    • View Profile
    • wolthera.info


2) Toady has a doctorate in maths. Half of his generation solutions use high-end maths, I'm not surprised if most of his coding solutions contain high-end maths. Mathematics is a very weird science.

math is awesome!  a bastion of absolute certainty and logic.  However, 95% of the gruntwork in coding an application makes very little use of advanced mathematics.
Except everything regarding the world-gen, which uses fractals if I'm not mistaken.
Logged
Stonesense Grim Dark 0.2 Alternate detailed and darker tiles for stonesense. Now with all ores!

Draco18s

  • Bay Watcher
    • View Profile

Mathematics is a very weird science.

True statement: There are no paradoxes in math.  A statement is either true or false.
Postulate: This statement is unprovable.

And it is correct.
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: is there a c++ compiler and decompiler for df.exe?
« Reply #29 on: May 21, 2012, 10:14:38 am »

Except everything regarding the world-gen, which uses fractals if I'm not mistaken.

I thought they were perlin noise maps?
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare
Pages: 1 [2] 3