Archive for the 'news' Category

TAAS As A Decompiler

The TAAS compiler is different from the ActionScript compiler since its input is not ActionScript source code but already compiled SWF or SWC files. Just like the haXe compiler can output AS3 instead of a SWF the TAAS compiler can do the same.

Now if you add one and one together you see that the TAAS compiler can be used as a very strong decompiler. My own tests have shown that it will work flawlessly where other commercial decompilers output rubbish. Since the compiler behaves like the Flash Player it will “execute” the bytecode in order to parse it which means it has a very highlevel understanding of the structure inside the SWF.

The only question is now what to do with the source code. I wrote the decompiler for my session at FOTB to show much easier how the optimizations behave. It is also a great tool to debug errors. But should it be opened or not?

To take it one step further one might also be able to write an obfuscator using the TAAS compiler. In my opinion it would be cool to have a strong decompiler and obfuscator, both being open source. We might also add an option to protect SWFs from the decompiler by adding something to the SWF metadata for instance. Of course this is just a simple rule which could be removed by someone once the code is open. What do you think?

FOTB Recordings

The people from Powerflasher were kind enough to upload their recording of my FOTB session. I am sorry that the microphone stopped working at the end. But you might still be able to understand what I was talking about if you turn up the volume of your speakers.
Continue reading ‘FOTB Recordings’

After The Sandbox

In 2006 I got invited to the FlashForum Conference in Düsseldorf, Germany. It was my very first Flash conference and my topic was AS3 code optimization. I have talked a lot about bitwise operators, lookup tables and other techniques to speed your code up.
Now about three years later I wanted to prepare a very special talk for FOTB and make a step forward by getting rid of old habits and idioms.

Before FOTB I was not sure if I can present Apparat at all. For me as an autodidact it is not always easy to solve certain issues. Mario Klingemann talked about Magic Moments in Brighton. I guess I had one after a long time of thinking and failing. I got really into the flow and everything became so clear. Stay tuned for more detailed posts on the technique behind the different compilers.

Continue reading ‘After The Sandbox’

Euro Invasion At MAX 2009

Since the news has spread pretty quickly I want to shed some light on this as well. Influxis has invited a lot of European Flash developers to come to LA and attend Adobe MAX 2009. Those include Seb Lee Delisle, Ralph Hauwert, Mario Klingemann, Andre Michelle and me. I was absolutely overwhelmed when I heard about that idea first. I really want to thank the whole Influxis team for making this possible. You guys definitly rock! But I would also like to thank Adobe for sponsoring MAX passes in order to get everyone invited.

Hopefully I will meet a lot of interesting people and Flash Player engineers. It will be my first MAX so I am really curious.

UML generation using Dump

playerglobal.abc UML

Dump has now another cool feature: UML diagram generation. The UML diagram is exported in DOT format. I think this is a really cool feature because the graph is built by analyzing a SWF file and you get it for free. I will probably create a different tool to make full use of the UML generation since you could link multiple files together for a complete coverage. Since Graphviz is not able to underline text I have choosen to use a dollar sign for static methods. You will also get proper parameter names if you compile your SWF file in debug mode.

This is an example UML diagram for the playerglobal.swc. In order to create it I took the playerglobal.abc from the Tamarin sources and the command was java -jar dump.jar -input playerglobal.abc -uml.

Here are two example representations but be careful. The PNG size is 30831×6232 and might crash your browser. Chrome can display the PNG for me but is not able to show the SVG correct. Firefox displays the SVG very well. You can download the PNG and open it in IrfanView or Photoshop to be safe.

Inheritance Graphs

Inheritance GraphThe Dump tool is now able to export an inheritance graph for a given ABC/SWC/SWF file. This is a very easy and nice way to look at the classes and their relationships. The small image shows the graph for one ABC file of the AudioTool. I think this it is pretty neat.

You will need a program like Graphviz to visualize the exported DOT file. If you want to export the inheritance graph you basically writejava -jar dump.jar -input file.swf -ig. I think this shows a really cool feature of Apparat. It is also very easy to reverse engineer a UML diagram. I am not interested in such a feature but maybe someone else.

Update: Here is a full-size example for the inheritance graph of the unfinished ImageProcessing library I am currently working on.

ImageProcessing Library Inheritance Graph

Dump Disassembler

A very important tool for SWF manipulation is a way to debug them and to have a look at the bytecode. Dump is a tool that does nothing else but listing all SWF Tags and ABC files the way Apparat represents them internally.

I know that there are a lot of other tools out there. swfdump and abcdump are great already. I have used swfdump from the Flex SDK before. But I dislike how they represent namespaces and the fact that not all properties are always shown. Dump is simple. It lists everything and uses the naming form the avm2overview.pdf.

Apparat is now Open Source

The full source code of Apparat is now available at GoogleCode. It is the whole framework behind TDSI and Reducer.

Apparat is released under the GNU Lesser General Public License. Please contact me if you want to contribute to this project. Maybe someone is interested in writing an Ant task for Reducer? I am also happy to receive feedback if you have used the framework to build something cool with it.

Please join the Apparat Discussion Group if you are interested in collaboration.

Reducer

Another spinoff from my current library to optimize SWF/SWC files. Reducer is a tool that will make SWF and SWC files significantly smaller. There is currently a huge problem with filesizes. If you use the [Embed] tag with PNG images they are not compressed at all. For the Hobnox AudioTool we have been using the Flash IDE to export all graphics so that they are smaller which was a pain.

Now with Reducer you are safe to use [Embed] and then run the tool afterwards. It will compress all lossless images and make them lossy. But usually a PNG can be compressed at 100% JPEG quality and you will still safe a lot of data.

Note: You will not loose alpha transparency when using Reducer. The SWF file format allows us to use a special compression where a PNG gets split up into its color and alpha channels. The color channels are encoded using the traditional JPEG algorithm with adjustable quality while the alpha channel is handled seperately. Transparency is always stored in a lossless fashion which means even with a low JPEG quality you will not get any compression artifacts for the alpha channel.

Update: Reducer is now open source!

AS3V Preview

AS3V Here is the first preview of what AS3V looks like in Eclipse. I have written about 30 rules which include cyclomatic complexity checks and unreachable code detection. Most of the time was getting AS3V to link against the asc.jar from the Flex SDK inside Eclipse which is a real nightmare if you ever tried that one for yourself. However — it works. And hopefully I can forget about all the code I had to write pretty soon.

You can see in the screenshot that AS3V places markers in your Eclipse code. It works as an incremental project builder which means it is pretty fast since it only evaluates all your sources that have changed independently. If you have any suggestions for possible rules, please tell me. The Flex SDK coding conventions could be interesting for instance. Right now the Eclipse plug-in has still some problems but I think that a first version might be released in the next few weeks.