Quantcast
Channel: The VG Resource - All Forums
Viewing all articles
Browse latest Browse all 16315

Some General Flash-Ripping Advice

$
0
0
Ok, so...I play a lot of flash games, and I now de-compile a lot of flash games.
Now, over time, I have run-into some issues that can make a flash game hard to rip.
It's taken me some time to figure-out how to deal with these, so i'd like to share my findings, and hopefully help clear the frustrations of anyone else who may have encountered similar problems.
The methods explained here will also work for flash animations/movies, but rips from animations/movies aren't allowed on this site


The first one: vector-based animations
One of the greatest advantages flash has over other web platforms, and maintains to this day, are vector-based animations.
What are these? Vector Graphics are an infinitely scalable type of graphic that instead of being comprised of a fixed set of dots/pixels, are comprised of a fixed set of lines, shapes, gradients,color fills, textures, etc... Instead of having the entire graphic already rendered at a specific size, the instructions to draw as many of that certain graphic as required, at any size, have been provided.  They also can rotate without any distortion whatsoever, other than the limits of square-based pixel grids on your display devices. Most vector-based flash games and animations contain thousands of these, and they can be exported as the svg (Scalable Vector Graphic) file format with your flash decompiler of choice. From there, these can be rendered as .png by programs such as Adobe Illustrator and Inkscape. And then lastly, you re-assemble the sprites, piece by piece... Now ofc, there are two major problems with this. The first one is that this process is TEDIOUS. The second is that it is prone to some degree of inaccuracy.

While researching this issue, I came to a few different answers to more effectively solve it.
The first one, which I don't recommend for most cases, is a .swf to .png converter. A .swf to .png converter is just that, it reads a flash file and exports the animation as a series of transparency-enabled .png's. Sounds pretty awesome, right? Stop right there... Most of these programs are trial/shareware, number one. The typical catch they use to force you to sell-out, and buy their product is a frame count limitation. This typically ranges from 20-50 frames. Sprites exceeding this either won't be processed, or the dirty little watermarked images trick will be used. The games I deal with have hundreds to thousands of frames! There are some free ones, but this brings me to problem number two: nested animations... Whatever .swf to .png converter you find, if it says it supports nested animations, take it lightly. I tried it on one heavily nested flash sprite (which most vector-based flash animations are) . The fail was epic, they all only managed to export some small region of the sprite, ruing it just as much as a watermark would.

So, the next option you have is this:
Export the sprites you want as .fla, and render them through a flash IDE.
Presently, the only program I know that can do the rendering is Adobe Flash...
If you know another one (ideally freeware), do share.
IDK how far back the support for this handy little feature goes, but I advise flash CS5.5
Now, here's what you do.
After exporting the animation as a .fla, open it in Flash.
Now, go to file > export movie > png sequence
voila!
later flash versions, and their plugins, even allow to render a sprite sheet!
Now, one other issue you should be made aware of: you may encounter parts of the sprites that obstruct the rest, or need to be rendered separately, etc... I cannot provide any one size fits all fix for these... This is where you may have to do some trial and error to figure-out how to render what you actually want. (And this is where it can get really tricky, I've solved very few of the many issues of this nature I've encountered)
One extra advantage of exporting flash sprites this way: Seeing that you've exported a new master file for the sprite that you wanted, you also could easily edit that, to add new animations! Then you simply render them as you did the original animation(s) it came with.

Another note: this is not exclusive to vector-based animations, any sprite you can manage to access with a decompiler can have this little trick done, including those comrpized solely of bitmap graphics, like png. However, you're most likely to have problems with a vector-based sprite, due to their complexity.

That is part one!
I'll post part two in the next post.

also, examples/screenshots soon, for many reasons, I cannot get them all right now!

Now, the next major issue you may encounter with a flash game, is the external asset/lib/data file.

This one is generally trivial to solve...
https://www.youtube.com/watch?v=pzFhi5zrRbU

This video explains it all!
I used it to download a full working copy of Radioactive Teddybear Zombies from the Adult Swim Games website.
(which i did primarily to play it at school, since the webfilter blocked their site, but couldn't block local files Wink )
I intend to rip that game, also, so...dibs!
(I had already done it, but at the time, I didn't have an account here, and my dad's computer had a virus delete EVERYTHING! I even designed some custom bosses, that to this day I am PISSED about losing, especially)

Anyways, the linked video should cover almost any case a flash game uses external resources. Then you may extract data and assets from those the same way you'd normally use.

Last major issue (at least, that can be solved) is the embedded asset file, typical of flex-based Flash games.
basically, you open a .swf in a decompiler, and...NO ASSETS. Misc tags will have definebinarydata tags, and the source code will include references to something called a "ByteArrayAsset"

I have recently discovered this one, and it's simple, first de-compress the .swf file using 7zip (first check that the header says "CWS" , indicating it's compressed. To do this, right-click > 7zip > extract archive. This produces a new folder with <yourswfname>~.swf

Now that it's decompressed, you can either manually hex-edit the file (long and tedious) to extract assets
To do this, for .swf, you open it in a hex-editor, and search for the text string "CWS" or "FWS"
After finding this, select 8 bytes, starting at the "C" or "F" , now, take note of the last four bytes in that selection. These represent the filesize, in bytes. This value is written in little-endian order, so smallest value first. Simply take those bytes... so, say... ff c7 00 00 and enter them into any calculator/program capable of converting between hex and decimal in reverse , so 00 00 c7 ff or 0000c7ff , and convert to decimal. Or, just write that hex value somewhere, and select everything from the "C" or "F" until the block size matches the file size value. Then copy-paste that hex to a new file, and save as .swf With any luck, you've gotten a legit .swf If you see a filesize of ff ff ff ff, which is approximately four gigabytes, you probably should skip it!)

With png, you search for "%PNG" or "‰PNG" , select all of that hex , up until you encounter "IEND" , make sure you copy the four bytes after IEND as well, or the .png file could be considered invalid by some programs. As you did with .swf, copy-paste to a new file and save as .png

You can search for xml data by searching for the first few characters in a valid xml header "<?xml"
copy that hex up till the last tag (some hex editors will ruin the formatting, and effectively corrupt the file if you copy the plaintext) and , well... save to a new file as .xml

Alternatively, you can use a new utility I had a friend program for me, called "PwnFlashEmbeddedAssets" .
Basically, this does the same thing as listed above, with the exception it's many times faster, and it only provides hints to where an xml may be tucked-away. (due to the potential complications of detecting an entire xml document)

http://crystalien-redux.com/dev/PwnFlash...ets_v1.zip

This program has enabled me to get assets from Age of war 2 and Enchanted Cave 2, which I also call dibs on!
However, I am holding them off presently for assorted reasons.

That is all for now!

Viewing all articles
Browse latest Browse all 16315

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>