Since the mxmlc compiler doesn't yet support this compression, and since it was a PITA to compile Tinic Uro's zlib2lzma on anything but Windows (http://blog.kaourantin.net/?p=124), and since no one else seems to have done it... I wrote a Python script to do the conversion. Woot. It only requires that the input SWF be compiled with
-swf-version=13
(or higher). It will fail if you feed it an LZMA-compressed SWF -- feel free to fork me on GitHub and fix that.Usage:
python swf2lzma.py in.swf out.swf
Grab the code from: http://github.com/jspiro/swf2lzma
6 comments:
Fantastic work! Thank you - your efforts are appreciated.
Thanks very much for this script, it's very much appreciated! I've run across a problem where it doesn't work on a legacy Python 2.4 installation (which is the only version available by default on a CentOS 5.4 virtual machine I'm working with), because the 'bytearray' global isn't available until a later Python version. Any ideas on how to adjust this script to work without this more recent feature, or is this particularly necessary?
Unfortunately I don't know how to modify it to work with earlier versions of Python. But you should fork me on github if you come up with one!
I am not a Pythonista so I was just working with what I could find on the nets :)
Spent a bit of time with it this morning and got something that works in Python 2.4. Sent you a pull request on GitHub~
I am using Python 3.3.2
I tried to execute command
python swf2lzma.py Main.swf outputMain.swf
got following error:
File "swf2lzma.py", line 50
print 'compression: %d%%' % round(100 - (100.0 * zsize / swf_size))
^
SyntaxError: invalid syntax
Please help on this
Wau man. My gratitude!!
Awesome work, we're using it in our game now.
Feel free to drop at infinitugame.com and ask for "warp".
Thanks.
Martin
Post a Comment