Mixed SWF Versions

From Gnash Project Wiki

Jump to: navigation, search

When an SWF movie of version X loads an SWF movie of version Y, each of the two movies run depending on its own version, not on the version of the loader.

Contents

Exceptions

Resolution of _root, as modified by 'lockroot' isn't only dependent of version if the code requesting the resolution, but also on something else. For now, gnash uses the first-loaded movie version as this something else, as it's what's been doing for some time and been tested enough.

Realworld cases

Games from orisinal morning sunshine are mostly SWF6 but still all loaded from an SWF4 loader. This is the reason why Gnash fails a lot of them.

Testing

Early manual tests have been done by having an SWF4 loader load String-v6.swf in _level1. The adobe player was found to give all successes, Gnash fails a lot. Ming head was patched to support loadMovieNum in SWF4 for this to be easier.

I didn't test if loading a movie into a movieclip rather then into a level changes behaviour, should do!!!.

Automating testing for this shouldn't be too hard. Basically, a possibility would be to have a loader load each of the tests in actionscript.all. So we'd have loaders targetting versions from 4 to 9 each loading tests of all versions. The loader should ideally load both in a level and in a target movieclip.

Design

The VM instance will keep track of the SWF version of the currently being executed code. This version will be updated whenever execution of a code block starts (be it a function or global code). ActionExec takes care of switching.

In order for the model to work, all of the player API should be always registered. Not only natives, but actual properties too, appropriately flagged for version based visibility. At time of writing (Nov 20 2008) this was started, but must be completed.