open-source-flash / open-source-flash

Petition to open source Flash and Shockwave spec
7.35k stars 113 forks source link

If Flash is to be preserved, the first step is low level decompilation code #40

Open joncampbell123 opened 7 years ago

joncampbell123 commented 7 years ago

Whether Adobe opens up the Flash player or not, I think it would be a good first step if this project were to first produce tools to dump and analyze the SWF file format.

Being able to look at the SWF tags and their contents would help in reproducing a working Flash player.

I have some basic experimental code on my systems that I wrote awhile back that basically parse a SWF and dump the tags, that I could post on my Github account for reference if it helps this project.

Adobe: there are millions of good old Flash animation files around that could be historically preserved if the flash player were open sourced, especially on sites like Newgrounds.com.

For security purposes, the open sourced Flash player could be built to play ONLY locally unless explicitly given permission by the user to access network resources.

If the JIT (as I understand how ActionScript 3 is executed) cannot be open-sourced, I would be perfectly fine with that so long as the VM can execute ActionScript 3 regardless in an interpreter.

If there is browser-or OS-specific code that cannot be provided, that is OK as well, so long as open source developers can wrap the code into something that talks to the screen in Linux or otherwise. I would love to give it a fresh and portable start with the SDL library, for example.

If the current Flash player cannot be open sourced, then would it at least be possible to open source an older build, say, Flash 7 or 8, and work forward from there while a subset of the open source community works with you guys to stub out or eliminates vulnerabilities in the latest code? I understand that time is money and I hope this can be arranged with minimal load on Adobe's developers.

If any audio or video codecs cannot be open sourced, would you guys (Adobe or otherwise) be OK with leaving stubs in the code which open source developers can then fill with calls to, say, FFMPEG, to carry out decoding?

ghost commented 7 years ago

So I'm curious, how similar are DIR/DCR and SWF/FLA to each other that shockwave and flash uses?

joncampbell123 commented 7 years ago

I'm not familiar with DIR/DCR.

I do know that SWF files are a header and a series of tags that define the Flash movie, sequentially. The tag structure is such that you can skip unknown tags.

I also know that FLA files are an unknown proprietary format stored in Microsoft's compound OLE container format.

joncampbell123 commented 7 years ago

Here is what I have for the SWF Flash file format:

Adobe Flash 19 File Format Specification (September 2014).pdf

joncampbell123 commented 7 years ago

Here's the code, roughly dumped from the original source and cleaned up a bit. I will be making a few commits yet to clean it up some more.

https://github.com/joncampbell123/swfhax

pakastin commented 7 years ago

Good stuff! Could you write something to README explaining what things Adobe would need to open source?

joncampbell123 commented 7 years ago

Sure.

I personally care the most about the basic Flash playback and ActionScript VM. There are a lot of good Flash animations I would like to see live on as well as lots of Flash games. I would like to see as much open sourced as possible, however I also recognize there may be a lot about the Flash player that cannot be open sourced and I would be perfectly fine if Adobe were to release the source code with those parts stubbed out. Depending on what is stubbed out, we can replace it with open source libraries.

My best guess is that the audio/video codecs (anything beyond the IMA-ADPCM compression) were probably licensed and cannot be open sourced, but in the open source world that doesn't matter as we could put in code to call into FFMPEG to accomplish the same functions.

I'm also guessing anything related to DRM (such as RTMPE) cannot be open sourced. That's fine, not a problem to me.

Network connectivity code, if stubbed out, could be made to call libcurl and an open source RTMP library if needed.

As stated above, I also don't care if the ActionScript 3 JIT compiler is not open sourced, I only care if the ActionScript 3 interpreter is open sourced. I say JIT compiler as I remember vaguely a claim back when AS3 first appeared that the Flash player would compile AS3 to native code to execute it faster (or am I remembering wrong?)

If nothing else, at least open source the base Flash player and renderer and AS/AS2/AS3 VM so that Flash animation and games can be fully played offline with no net connectivity. The open source world will fill in the gaps where people care to.

I envision myself compiling it into a Flash player with at least the SDL library as a start.

ROBERT-MCDOWELL commented 7 years ago

yes, it's a good initiative, maybe start with the VM1, AS2 which is easier to decompile and hack. anyhow, cut the grass under adobe feet is the best way to prevent millions websites to be dead. And frankly today, after 20 years of web dev, flash is still much better than anything for web animation, video, applications and so on. I really doubt adobe will release flash in open source since they, google, microsoft, mozilla and other corporations control fake open source HTML5 and javascript evolution. People dont' realize that this fake open source game from the corporations save billions $$ and help them to grow significantly and control the web. I'm pretty sure that if we relay the wonderful job that developers did for flash player we can goes beyond html5 javascript.

pakastin commented 7 years ago

Just keep pull requests coming! I don't know about technical aspects and it's good to have lots of good project links as well.. 😉

If you have any ideas for the README, feel free to edit and send a PR

joncampbell123 commented 7 years ago

@madovsky I know Adobe might not open source the Flash player, but at least I can hope they do. If they don't, the code I provide to decompile, plus other open source SWF tools and GNASH will fill the void anyway. If they do, it would save a lot of duplicate effort. Offloading to the open source community would be a great way for Adobe to wash their hands of the Flash player entirely without losing it to the dustbin of history, if that is what Adobe is trying to do.

I'm not quite happy with the mess of HTML5, but being able to draw to a JS canvas and play through audio/video tags is a welcome change from the way the web used to be in my opinion.

joncampbell123 commented 7 years ago

@madovsky Also, if you don't want corporations to control the web, then put in some work to develop standards that are more independent and portable, and write some code to support it. Donate your time and programming skills alongside the open source community. That's what has allowed open source to flourish so far. Letting corporations to do all the work is how you let corporations control the web, and when they claim it as their own, they'll be right to do so because they did all the work and you get to live with it.

ROBERT-MCDOWELL commented 7 years ago

You didn't understand my words. I don't blame open source developers, I blame corporations to profit from it and not the real open source developers. Just take a look how they play the open source game, the sad side is usually open source developers are too blind (or to much ego) to accept this fact. So, we are at the edge of the jungle law, which means that if we continue to be stupid to follow (their) rules of if this code is open source or not, without to take care of that they are absolutely doing the opposite so there is nothing else but a major issue. Sadly too many developers will realize it too late when they will get too old. Personally I spent 20 years of sacrifices to share my code and various projects for free to use. Today I'm without a penny and survive like a homeless at almost 50 years old if you want to know, and thus because of what I said above, easy to understand or not?

joncampbell123 commented 7 years ago

@madovsky I don't think there's any particular sin in profiting from open source, so long as you stick to the principles of open source.

What does "jungle law" mean?

joncampbell123 commented 7 years ago

You might also consider incorporating Gnash:

https://www.gnu.org/software/gnash/

ajwfrost commented 7 years ago

Adobe have got an open source SWF analyser/decompiler: http://labs.adobe.com/technologies/swfinvestigator/

For details on the ActionScript virtual machine itself, please see: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/actionscript/articles/avm2overview.pdf for the spec and the code is at: https://github.com/adobe/avmplus

The code is there for both the interpreter and the JIT-compilers for some of the supported CPU architectures. And of course if you just want to be able to play back SWF content, then you can just download the standalone players from Adobe (debugger/projectors I think they're known as): https://www.adobe.com/support/flashplayer/debug_downloads.html

pakastin commented 7 years ago

Please create a pull request, thanks!