Is it possible to edit and re-compile by reverting the source code?

Asked

Viewed 820 times

4

For example, assuming I take an Atari ROM, if I reverse engineer this ROM I would have to make edits (change a color or change a text) and generate a valid ROM only with the information contained in this ROM?

I once had to use a decompiler to retrieve a lost source code from an application of mine in Java, but to recompile I used the Java compiler itself, but in this case the question is whether I would have, in addition to decompile, create a compiler based only on the compiled program.

Taking advantage, there is a lot of difference between emulating a ROM and decompiling a?

  • 1

    ROM - Ready Only Memory ...." Read Only"

  • Poxa Magic, the fact of being read-only not invalid the question.

  • I didn’t answer "besides decompile, create a compiler only based on the compiled program" because that phrase doesn’t make much sense.

  • 1

    But why do you think I invalidated your question ? Just so you know I gave +1 on your question... because I thought it was good, and I didn’t deserve the -1 that someone gave...

  • Valeu Magic! :)

  • @Bigown what I wanted to know is whether the "compiled" has enough information to create a re-compiler. Assuming the example of a ROM translator, where I have the word you and want to exchange for voce which will not fit in the place of the original sentence. I can’t think of how much information I would need to reallocate pointers and create a new file with the translation in place of the original phrase.

  • There is no re-compiler. Changing only the texts is usually easier and I may have to change all references of it because the sizes are different, but it is very quiet. You don’t need to know almost anything about the code to change only the text. Of course it depends a little on how it was done. Might have some things done on purpose to make it harder.

  • Under "There is no re-compiler", suppose I generate a . java of a . class, change that . java and want to convert it to . class again, but without using the "original compiler".

  • @Marcusbecker and what he would use in place of the "original compiler"?

  • The program that generated the source code initially.

  • @Marcusbecker again it doesn’t make any sense.

  • Sorry, I can’t explain. Let me try one last time. I found a Prog program. k, I know this program was generated by a compiler that no longer exists, very old, but I love this program and would like to create similar programs. It runs through a VM that still exists. Can I reverse every binary into source code? (Yes, you already answered). I will be able to make any changes to that source or I will be limited to generating the same output, always generating the same number of bytes as the Prog. k initial?

  • @Marcusbecker If you get the source, you do what you want with it, it’s code like any other, probably less readable, but do what you want. In abstract, generic terms, this is it, concretely whether or not you will succeed in this case is another story.

  • I think I’ll be tied to the functions found in the source. For example, I decompile a function draw, I can create an editor to generate this function and generate a new version of the game by calling draw as many times as I want. In other words, if I had no more Ataris on Earth and found a single tape and decompiled her code I would be doomed to only.

Show 9 more comments

1 answer

7


Yes, it is possible to modify any code. Of course in ROM you will have to generate a new one, since it does not allow writing.

It is possible to decompile virtually any code, but some are very difficult. It needs to have a lot of information that is not always available. In general reverse engineering is done on top of the same Assembly, which is possible to obtain easy in 100% of the situations.

Of course no decompiled code will be as readable as the original. in many cases not nearly..

Some languages use a bytecode standard intermediate and information rich, so it is possible to recreate the original code very closely. In general there will be small changes of the original form of the algorithm, but doing the same thing, the style will obviously be of the decompiler, will not have comments and usually lose the names of local variables.

Java, C# and any language that doesn’t usually generate a native binary are like this. Note that C# can generate native code.

There’s nothing you can do to stop it. What you can do is make it difficult, create situations that the decompiler complicates, that change meaningful names to unreadable things. But the obfuscators can cause code execution problems.

Emulating a ROM has nothing to do with decompiling one. It is not necessary to decompile to emulate it.

Perhaps there is some confusion of what a compiler is. There is a question that speaks of this: What is a programming language, IDE and compiler?. And another who talks about how it works: How is a compiler made?.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.