Open main menu

Difference between revisions of "OpenTasks"

694 bytes added ,  12:33, 19 March 2009
Line 335: Line 335:
''Background:''
''Background:''


Most (all?) adventure engines ScummVM supports are driven by bytecode scripts, which control the game behavior. For various reasons (in particular, debugging), it's very useful to be able to take such a script and decompile it into something resembling regular code (with variables, loops, if statements etc.). We have a tool for doing this for the bytecode used by SCUMM games. This tool is called descumm.
Most adventure engines ScummVM supports are driven by bytecode scripts, which control the game behavior. For various reasons (in particular, debugging), it's very useful to be able to take such a script and decompile it into something resembling regular code (with variables, loops, if statements etc.). We have a tool for doing this for the bytecode used by SCUMM games. This tool is called descumm. We also have similar (but less advanced) tools for various other engines, in our [http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/trunk tools module in SVN].


Currently, descumm use a relatively crude heuristic to detect "if" statements, loops and so on. In particular, it only supports loops with the condition at the start (think "while(...) { ... }" ), not such with the condition at the end (as in "do { ... } while(...)" and also suffers from various other limitations (like not being able to correctly recognize "continue" and "break" statements.
Currently, descumm use a relatively crude heuristic to detect "if" statements, loops and so on. In particular, it only supports loops with the condition at the start (think "while(...) { ... }" ), not such with the condition at the end (as in "do { ... } while(...)" and also suffers from various other limitations (like not being able to correctly recognize "continue" and "break" statements.


The whole thing is somewhat complicated by the fact that there are two main versions of this bytecode: V5 and older (register based bytecode), and V6 and newer (stack based).  
The whole thing is somewhat complicated by the fact that there are two main versions of this bytecode: V5 and older (register based bytecode), and V6 and newer (stack based). We handle the registed based code quite well, but not so the stack based one. And in fact most non-SCUMM engines use a stack based virtual machine.


Note: 'This task was [http://code.google.com/soc/2007/scummvm/about.html being worked on] as part of the Google Summer of Code 2007, but the end result sadly is incomplete and never reached a status we are satisfactory with. It is probably best to start from scratch, but you can find the code from then [http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/branches/gsoc2007-decompiler/ here in our repository.]
''The Task:''


''The Task:''
Write a ''generic'' bytecode decompiler with the goal of ultimately being able to decompile bytecode of all games which use a stack based bytecode virtual machine. You can look at existing work from GSoC 2007, our descumm compiler (only SCUMM v6 and newer is stack based) and some other de*.cpp files in our [http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/trunk/ tools SVN module]. Your goal should be to support at least two different bytecode systems (i.e., from two different ScummVM engines). But everything should be designed and implemented with the ultimate goal of being able to support all such bytecode systems (e.g. by providing a suitable API or subclassing facilities that make it possible to hook in parsers for arbitrary bytecode variants). Engines which use a stack based virtual machine include SCUMM v6+, KYRA, SWORD1, SWORD2, ... For many of these, free game demos are available, too. We would help you by providing dumps of scripts etc.
 
A good starting point for this might be the [[http://jode.sf.net Jode]] Java bytecode decompiler which does a pretty good job at decompiling. Another useful site might be [http://www.program-transformation.org/Transform/DeCompilation]. The technical contact has several ideas on how to approach this project, too -- as usual, you are expected to talk to us and ask for help and ideas!


Write an improved bytecode decompiler any games using a stack based bytecode system. You can look at existing work from GSoC 2007, our descumm compiler (only SCUMM v6 and newer is stack based) and some other de*.cpp files in our [http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/trunk/ tools SVN module]. Initially, support for only one stack based engine's bytecode is needed (e.g. SCUMM v8, as used in Curse of Monkey Island), but everything must be designed and implemented such that it is possible to support other stack based engines. In particular, the final version of the code should support at least one other different bytecode set. Engines which use a stack based virtual machine include SCUMM v6+, KYRA, SWORD1, SWORD2, ... <font color="red">TODO</font>
The tool should run on at least Windows, Mac OS X and Linux. Acceptable languages include C/C++, Python, Perl -- other languages might be OK, but please consult with us first -- after all, other developers also will have to use and maintain your code. For the same reason is is obviously mandatory that your code be well documented.


A good starting point for this might be the [[http://jode.sf.net Jode]] Java bytecode decompiler. Another useful site might be [http://www.program-transformation.org/Transform/DeCompilation]. The technical contact has several ideas on how to approach this project, too.
''Note:''


The tool should run on at least Windows, Mac OS X and Linux. Acceptable languages include C/C++, Python, Perl, Ruby -- other languages might be OK, but please consult with us first (after all, other developers also will have to use and maintain your code).
This task was [http://code.google.com/soc/2007/scummvm/about.html being worked on] as part of the Google Summer of Code 2007, but the end result sadly is incomplete and never reached a status we are satisfactory with. It is probably best to start from scratch, but you can find the code from then [http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/branches/gsoc2007-decompiler/ here in our repository].


== Engine/game specific ==
== Engine/game specific ==
1,079

edits