Closed Bug 476880 Opened 15 years ago Closed 6 years ago

Improve avm and tooling support for swf files

Categories

(Tamarin Graveyard :: Tools, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
Future

People

(Reporter: lhansen, Unassigned)

Details

Attachments

(1 file, 2 obsolete files)

swf files are well documented and handy archives containing stuff.  It ought to be possible for the avmshell to load a swf, notably in the case where the swf contains just a sequence of ABC fragments, and then execute those fragments in order.

We need:
 - a utility to stich ABC files together into a swf
 - a utility to dump a SWF (for debugging)
 - code in the avmshell to decode the swf
(In reply to comment #0)
>  - a utility to dump a SWF (for debugging)

abcdump knows how to read swf's (even compressed ones).  it doesn't do much with them except to dump the abc segments, but could do more, easily.
Attachment #360534 - Flags: review?(edwsmith) → review+
Comment on attachment 360534 [details] [diff] [review]
swfmake, v1 - creates uncompressed or compressed swf from multiple abc files.  Goes into the utils/ directory.

off the top of my head i dont remember the definition of the bits in the DoABC flags field, but its used to tell the VM whether to execute that abc's "entry point script" which is the last script.

suggestion, for sooner or later:
given N abc's, the swf should be written so the last one is marked to execute, and the middle ones are libs.  this matches the avmshell cmdline behavior.

marking R+ because we can improve incrementally and this has immediate use.
Pushed swfmake.as.

Looking at abcdump, I consider the swf dumping issue resolved.  (I have a fancier program written in C but it's not necessary here.)

Will look into changes to avmshell next.

Re the flag bit, the spec says "Flags (UI32) A 32-bit flags value, which may
contain the following bits set: kDoAbcLazyInitializeFlag = 1: Indicates that the ABC block should not be executed immediately, but only parsed. A later finddef may cause its scripts to execute."
doesn't asc already build swfs? -swf flag,  I guess another abc utility could
also build swfs by inserting existing abcs into a swf.

I have been working on a utility to load swfs in the shell.  patch is here
https://bugzilla.mozilla.org/show_bug.cgi?id=476720

- decodes the swf tags (uses the code from abcdump/swfdump)
- dynamically loads the DoABC tag code
- any SymbolClass tag containing a string instantiates the class
- loads the avmglue.abc stubbed out glue code implementation so references to 
flash objects like Sprite,MovieClip are known

a simple example works like:
test1.as:
package {
    import flash.display.*;
    import flash.text.*;
    public class test1 extends Sprite {
        public function test1() {
            trace("constructor: start");
            var tf=new TextField();
            tf.text="test1";
            tf.width=200;
            tf.height=50;
            addChild(tf);
            trace("constructor: end");  
        }
    }
}

$ asc -import $PLAYERGLOBALABC -import GLOBALABC -swf test1,550,400 test1.as
$ $AVM playershell.abc -- test1.swf
** loadabcfile avmglue.abc
** parsing test1.swf
frame rate 12
frame count 1
size width=550 size height=400
Tag 69 FileAttributes
    size: 4
Tag 72 DoAbc
DoABC saving abc code as 0
    size: 631
Tag 76 SymbolClass
SymbolClass: count=1
SymbolClass: id=0 name=test1
    size: 10
Tag 1 ShowFrame
    size: 0
** loading blocks
** loading block 0 frame0
loading bytecode block frame0
** loading objects
** constructing test1
[object test1] Sprite constructor
constructor: start (from trace)
[object TextField] TextField.set text('test1')
[object TextField] DisplayObject.set width(200)
[object TextField] DisplayObject.set height(50)
[object test1] DisplayObjectContainer.addChild([object TextField]) parent=null
[object TextField] DisplayObject.set parent([object test1]) [object TextField]
constructor: end (from trace)
[object Stage] DisplayObjectContainer.addChild([object test1]) parent=null
[object test1] DisplayObject.set parent([object Stage]) [object test1]
Flags: in-testsuite?
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
prerequisite for swf support; sticking lots of ScriptBuffers into this table causes problems, but the table is on the chopping block anyway, so this removes it.
Attachment #360534 - Attachment is obsolete: true
Attachment #369887 - Flags: review?(lhansen)
if input file starts with 'FWS' (any version), parse it as a swf.
- skips header
- each DoABC2 tag passed to handleActionBlock() or parseActionBlock() if the DoABC2 lazy bit is set.

supports swfs from swfmake, tested so far on esc (created main.swf and esc.swf)

todo:
- add swfmake step to esc makefile
- support compressed swfs
- better bounds checking
- put swf support code in a separate file (avmshell is dumping ground)

if any of these seem important before landing initial support, lmk
Attachment #369888 - Flags: review?(lhansen)
Attachment #369887 - Flags: review?(lhansen) → review+
Attachment #369888 - Flags: review?(lhansen) → review+
Comment on attachment 369887 [details] [diff] [review]
remove resources hashtable (vestigal code)

pushed http://hg.mozilla.org/tamarin-redux/rev/decc16fdc2c7
Attachment #369887 - Attachment is obsolete: true
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Keeping open because of the 'todo' list in comment #7.
Priority: P3 → --
Target Milestone: --- → Future
Summary: Make avmshell operate on swf files → Improve shell support for swf files
Component: Virtual Machine → Tools
QA Contact: vm → tools
Summary: Improve shell support for swf files → Improve avm and tooling support for swf files
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: