@swf2es/player-hosts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/LICENSE.third-party +759 -0
- package/README.md +43 -2
- package/dist/indexeddb.d.ts +27 -0
- package/dist/indexeddb.d.ts.map +1 -0
- package/dist/indexeddb.js +170 -0
- package/dist/indexeddb.js.map +1 -0
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.d.ts.map +1 -0
- package/dist/node-worker.js +12 -0
- package/dist/node-worker.js.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +43 -0
- package/dist/node.js.map +1 -0
- package/dist/precompiled.d.ts +31 -0
- package/dist/precompiled.d.ts.map +1 -0
- package/dist/precompiled.js +125 -0
- package/dist/precompiled.js.map +1 -0
- package/dist/stage3d.d.ts +13 -0
- package/dist/stage3d.d.ts.map +1 -0
- package/dist/stage3d.js +61 -0
- package/dist/stage3d.js.map +1 -0
- package/dist/thread/codegen/codegen.js +308 -0
- package/dist/thread/codegen/index.js +405 -0
- package/dist/thread/format/abc-names.js +126 -0
- package/dist/thread/format/actions.js +222 -0
- package/dist/thread/format/air-descriptor.js +63 -0
- package/dist/thread/format/api-versions.js +22 -0
- package/dist/thread/format/bitmap.js +199 -0
- package/dist/thread/format/button.js +60 -0
- package/dist/thread/format/compression.js +200 -0
- package/dist/thread/format/display.js +305 -0
- package/dist/thread/format/filters.js +136 -0
- package/dist/thread/format/font.js +168 -0
- package/dist/thread/format/index.js +26 -0
- package/dist/thread/format/pbj.js +484 -0
- package/dist/thread/format/shape.js +411 -0
- package/dist/thread/format/sound.js +91 -0
- package/dist/thread/format/swf.js +163 -0
- package/dist/thread/format/tags.js +58 -0
- package/dist/thread/format/text.js +135 -0
- package/dist/thread/format/zip.js +91 -0
- package/dist/thread/native/audio/binary.js +3 -0
- package/dist/thread/native/audio/index.js +72 -0
- package/dist/thread/native/base64.js +9 -0
- package/dist/thread/native/compress/binary.js +3 -0
- package/dist/thread/native/compress/index.js +145 -0
- package/dist/thread/native/instance.js +49 -0
- package/dist/thread/native/mp3/binary.js +3 -0
- package/dist/thread/native/mp3/index.js +48 -0
- package/dist/thread/native/render/binary.js +3 -0
- package/dist/thread/native/render/bitmap-kernel.js +591 -0
- package/dist/thread/native/render/draw-kernel.js +204 -0
- package/dist/thread/native/render/dxt-encoder.js +94 -0
- package/dist/thread/native/render/index.js +10 -0
- package/dist/thread/native/render/lines.js +122 -0
- package/dist/thread/native/render/module.js +26 -0
- package/dist/thread/native/render/pixel-ops.js +235 -0
- package/dist/thread/native/render/tessellator.js +250 -0
- package/dist/thread/player/avm1/amf.js +507 -0
- package/dist/thread/player/avm1/avm1.js +1304 -0
- package/dist/thread/player/avm1/bindings.js +214 -0
- package/dist/thread/player/avm1/classes.js +75 -0
- package/dist/thread/player/avm1/clips.js +229 -0
- package/dist/thread/player/avm1/compile.js +140 -0
- package/dist/thread/player/avm1/external.js +79 -0
- package/dist/thread/player/avm1/focus.js +278 -0
- package/dist/thread/player/avm1/globals/BitmapData.js +542 -0
- package/dist/thread/player/avm1/globals/Button.js +31 -0
- package/dist/thread/player/avm1/globals/Color.js +115 -0
- package/dist/thread/player/avm1/globals/ExternalInterface.js +310 -0
- package/dist/thread/player/avm1/globals/FileReference.js +217 -0
- package/dist/thread/player/avm1/globals/Key.js +60 -0
- package/dist/thread/player/avm1/globals/LoadVars.js +208 -0
- package/dist/thread/player/avm1/globals/LocalConnection.js +92 -0
- package/dist/thread/player/avm1/globals/MovieClip.js +1070 -0
- package/dist/thread/player/avm1/globals/MovieClipLoader.js +90 -0
- package/dist/thread/player/avm1/globals/NetConnection.js +261 -0
- package/dist/thread/player/avm1/globals/PrintJob.js +37 -0
- package/dist/thread/player/avm1/globals/Selection.js +62 -0
- package/dist/thread/player/avm1/globals/SharedObject.js +245 -0
- package/dist/thread/player/avm1/globals/Sound.js +238 -0
- package/dist/thread/player/avm1/globals/Stage.js +12 -0
- package/dist/thread/player/avm1/globals/StyleSheet.js +205 -0
- package/dist/thread/player/avm1/globals/TextField.js +396 -0
- package/dist/thread/player/avm1/globals/TextFormat.js +194 -0
- package/dist/thread/player/avm1/globals/TextSnapshot.js +88 -0
- package/dist/thread/player/avm1/globals/XML.js +396 -0
- package/dist/thread/player/avm1/globals/XMLNode.js +413 -0
- package/dist/thread/player/avm1/globals/XMLSocket.js +205 -0
- package/dist/thread/player/avm1/globals/drawing.js +202 -0
- package/dist/thread/player/avm1/globals/filters.js +635 -0
- package/dist/thread/player/avm1/globals/geom.js +600 -0
- package/dist/thread/player/avm1/input.js +483 -0
- package/dist/thread/player/avm1/keyboard.js +113 -0
- package/dist/thread/player/avm1/loads.js +352 -0
- package/dist/thread/player/avm1/net.js +219 -0
- package/dist/thread/player/avm1/paths.js +104 -0
- package/dist/thread/player/avm1/pointer.js +512 -0
- package/dist/thread/player/avm1/queue.js +303 -0
- package/dist/thread/player/avm1/sound.js +106 -0
- package/dist/thread/player/avm1/swf.js +141 -0
- package/dist/thread/player/avm1/timers.js +113 -0
- package/dist/thread/player/bitmap/bitmap.js +627 -0
- package/dist/thread/player/bitmap/draw.js +68 -0
- package/dist/thread/player/bitmap/dxt.js +11 -0
- package/dist/thread/player/bitmap/filters.js +656 -0
- package/dist/thread/player/bitmap/images.js +240 -0
- package/dist/thread/player/bitmap/kernel.js +65 -0
- package/dist/thread/player/bitmap/ops.js +1239 -0
- package/dist/thread/player/bitmap/pixel-bender.js +911 -0
- package/dist/thread/player/bitmap/png.js +139 -0
- package/dist/thread/player/bitmap/turbulence.js +89 -0
- package/dist/thread/player/clock.js +182 -0
- package/dist/thread/player/display/bitmapobject.js +25 -0
- package/dist/thread/player/display/bounds.js +520 -0
- package/dist/thread/player/display/buttonobject.js +305 -0
- package/dist/thread/player/display/color.js +40 -0
- package/dist/thread/player/display/container.js +150 -0
- package/dist/thread/player/display/display.js +14 -0
- package/dist/thread/player/display/displayobject.js +664 -0
- package/dist/thread/player/display/drawing.js +613 -0
- package/dist/thread/player/display/filters.js +285 -0
- package/dist/thread/player/display/geometry.js +189 -0
- package/dist/thread/player/display/gradients.js +117 -0
- package/dist/thread/player/display/graphicsdata.js +592 -0
- package/dist/thread/player/display/instantiate.js +71 -0
- package/dist/thread/player/display/matrix3d.js +373 -0
- package/dist/thread/player/display/morph.js +226 -0
- package/dist/thread/player/display/movieclip.js +680 -0
- package/dist/thread/player/display/perspective.js +193 -0
- package/dist/thread/player/display/scale9.js +236 -0
- package/dist/thread/player/display/shapeobject.js +131 -0
- package/dist/thread/player/display/shapes.js +407 -0
- package/dist/thread/player/display/textobjects.js +222 -0
- package/dist/thread/player/display/timeline.js +471 -0
- package/dist/thread/player/display/value-lists.js +40 -0
- package/dist/thread/player/display/videoobject.js +6 -0
- package/dist/thread/player/display/walk.js +127 -0
- package/dist/thread/player/files.js +334 -0
- package/dist/thread/player/hosts.js +207 -0
- package/dist/thread/player/input/avm1.js +82 -0
- package/dist/thread/player/input/context-menu.js +63 -0
- package/dist/thread/player/input/keyboard.js +458 -0
- package/dist/thread/player/input/pointer.js +863 -0
- package/dist/thread/player/input/text-editor.js +319 -0
- package/dist/thread/player/input/touch.js +209 -0
- package/dist/thread/player/localconnection.js +90 -0
- package/dist/thread/player/media/audio.js +376 -0
- package/dist/thread/player/media/dynamic-sound.js +90 -0
- package/dist/thread/player/media/extract.js +135 -0
- package/dist/thread/player/media/mp3.js +152 -0
- package/dist/thread/player/media/sounds.js +507 -0
- package/dist/thread/player/media/streaming-audio.js +133 -0
- package/dist/thread/player/player.js +616 -0
- package/dist/thread/player/playerglobal/air/net/WebSocket.js +250 -0
- package/dist/thread/player/playerglobal/air-library.js +8 -0
- package/dist/thread/player/playerglobal/flash/accessibility/Accessibility.js +21 -0
- package/dist/thread/player/playerglobal/flash/crypto/generateRandomBytes.js +32 -0
- package/dist/thread/player/playerglobal/flash/data/EncryptedLocalStore.js +61 -0
- package/dist/thread/player/playerglobal/flash/desktop/Clipboard.js +173 -0
- package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +179 -0
- package/dist/thread/player/playerglobal/flash/display/AVM1Movie.js +19 -0
- package/dist/thread/player/playerglobal/flash/display/Bitmap.js +58 -0
- package/dist/thread/player/playerglobal/flash/display/BitmapData.js +633 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +614 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObjectContainer.js +224 -0
- package/dist/thread/player/playerglobal/flash/display/Graphics.js +345 -0
- package/dist/thread/player/playerglobal/flash/display/InteractiveObject.js +87 -0
- package/dist/thread/player/playerglobal/flash/display/Loader.js +79 -0
- package/dist/thread/player/playerglobal/flash/display/LoaderInfo.js +128 -0
- package/dist/thread/player/playerglobal/flash/display/MovieClip.js +194 -0
- package/dist/thread/player/playerglobal/flash/display/NativeWindow.js +245 -0
- package/dist/thread/player/playerglobal/flash/display/Shader.js +26 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderData.js +85 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderInput.js +64 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderJob.js +181 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderParameter.js +23 -0
- package/dist/thread/player/playerglobal/flash/display/Shape.js +13 -0
- package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +103 -0
- package/dist/thread/player/playerglobal/flash/display/Sprite.js +84 -0
- package/dist/thread/player/playerglobal/flash/display/Stage.js +231 -0
- package/dist/thread/player/playerglobal/flash/display/Stage3D.js +54 -0
- package/dist/thread/player/playerglobal/flash/display/shaders.js +228 -0
- package/dist/thread/player/playerglobal/flash/events/Event.js +58 -0
- package/dist/thread/player/playerglobal/flash/events/EventDispatcher.js +103 -0
- package/dist/thread/player/playerglobal/flash/events/GestureEvent.js +34 -0
- package/dist/thread/player/playerglobal/flash/events/HTTPStatusEvent.js +8 -0
- package/dist/thread/player/playerglobal/flash/events/KeyboardEvent.js +51 -0
- package/dist/thread/player/playerglobal/flash/events/MouseEvent.js +59 -0
- package/dist/thread/player/playerglobal/flash/events/PressAndTapGestureEvent.js +30 -0
- package/dist/thread/player/playerglobal/flash/events/TimerEvent.js +16 -0
- package/dist/thread/player/playerglobal/flash/events/TouchEvent.js +45 -0
- package/dist/thread/player/playerglobal/flash/external/ExternalInterface.js +73 -0
- package/dist/thread/player/playerglobal/flash/filesystem/File.js +340 -0
- package/dist/thread/player/playerglobal/flash/filesystem/FileStream.js +453 -0
- package/dist/thread/player/playerglobal/flash/filesystem/paths.js +156 -0
- package/dist/thread/player/playerglobal/flash/filesystem/writes.js +143 -0
- package/dist/thread/player/playerglobal/flash/filters/BevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/BitmapFilter.js +205 -0
- package/dist/thread/player/playerglobal/flash/filters/BlurFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ColorMatrixFilter.js +11 -0
- package/dist/thread/player/playerglobal/flash/filters/ConvolutionFilter.js +26 -0
- package/dist/thread/player/playerglobal/flash/filters/DisplacementMapFilter.js +51 -0
- package/dist/thread/player/playerglobal/flash/filters/DropShadowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientBevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientGlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ShaderFilter.js +53 -0
- package/dist/thread/player/playerglobal/flash/geom/Matrix3D.js +361 -0
- package/dist/thread/player/playerglobal/flash/geom/PerspectiveProjection.js +122 -0
- package/dist/thread/player/playerglobal/flash/geom/Transform.js +245 -0
- package/dist/thread/player/playerglobal/flash/geom/Utils3D.js +85 -0
- package/dist/thread/player/playerglobal/flash/globalization/Collator.js +149 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyFormatter.js +272 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyParseResult.js +21 -0
- package/dist/thread/player/playerglobal/flash/globalization/DateTimeFormatter.js +463 -0
- package/dist/thread/player/playerglobal/flash/globalization/LocaleID.js +144 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberFormatter.js +444 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberParseResult.js +22 -0
- package/dist/thread/player/playerglobal/flash/globalization/StringTools.js +59 -0
- package/dist/thread/player/playerglobal/flash/globalization/locale.js +190 -0
- package/dist/thread/player/playerglobal/flash/media/Camera.js +89 -0
- package/dist/thread/player/playerglobal/flash/media/Microphone.js +126 -0
- package/dist/thread/player/playerglobal/flash/media/Sound.js +543 -0
- package/dist/thread/player/playerglobal/flash/media/SoundMixer.js +74 -0
- package/dist/thread/player/playerglobal/flash/media/SoundTransform.js +40 -0
- package/dist/thread/player/playerglobal/flash/media/Video.js +43 -0
- package/dist/thread/player/playerglobal/flash/net/FileFilter.js +27 -0
- package/dist/thread/player/playerglobal/flash/net/FileReference.js +197 -0
- package/dist/thread/player/playerglobal/flash/net/LocalConnection.js +167 -0
- package/dist/thread/player/playerglobal/flash/net/NetConnection.js +155 -0
- package/dist/thread/player/playerglobal/flash/net/SharedObject.js +299 -0
- package/dist/thread/player/playerglobal/flash/net/Socket.js +282 -0
- package/dist/thread/player/playerglobal/flash/net/URLRequest.js +93 -0
- package/dist/thread/player/playerglobal/flash/net/URLStream.js +146 -0
- package/dist/thread/player/playerglobal/flash/net/XMLSocket.js +14 -0
- package/dist/thread/player/playerglobal/flash/net/local-modern.js +142 -0
- package/dist/thread/player/playerglobal/flash/net/local-values.js +217 -0
- package/dist/thread/player/playerglobal/flash/net/navigateToURL.js +29 -0
- package/dist/thread/player/playerglobal/flash/profiler/Telemetry.js +25 -0
- package/dist/thread/player/playerglobal/flash/sensors/Accelerometer.js +12 -0
- package/dist/thread/player/playerglobal/flash/system/ApplicationDomain.js +69 -0
- package/dist/thread/player/playerglobal/flash/system/Capabilities.js +163 -0
- package/dist/thread/player/playerglobal/flash/system/FSCommandHost.js +17 -0
- package/dist/thread/player/playerglobal/flash/system/Security.js +46 -0
- package/dist/thread/player/playerglobal/flash/system/SecurityDomain.js +21 -0
- package/dist/thread/player/playerglobal/flash/system/System.js +73 -0
- package/dist/thread/player/playerglobal/flash/system/Worker.js +112 -0
- package/dist/thread/player/playerglobal/flash/text/Font.js +95 -0
- package/dist/thread/player/playerglobal/flash/text/StaticText.js +16 -0
- package/dist/thread/player/playerglobal/flash/text/StyleSheet.js +65 -0
- package/dist/thread/player/playerglobal/flash/text/TextField.js +707 -0
- package/dist/thread/player/playerglobal/flash/text/TextRenderer.js +77 -0
- package/dist/thread/player/playerglobal/flash/text/engine/FontDescription.js +141 -0
- package/dist/thread/player/playerglobal/flash/text/engine/TabStop.js +46 -0
- package/dist/thread/player/playerglobal/flash/trace/Trace.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/ContextMenu.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/GameInput.js +19 -0
- package/dist/thread/player/playerglobal/flash/ui/Keyboard.js +27 -0
- package/dist/thread/player/playerglobal/flash/ui/Mouse.js +127 -0
- package/dist/thread/player/playerglobal/flash/ui/Multitouch.js +46 -0
- package/dist/thread/player/playerglobal/flash/utils/ByteArray.js +155 -0
- package/dist/thread/player/playerglobal/flash/utils/Timer.js +25 -0
- package/dist/thread/player/playerglobal/flash/xml/XMLDocument.js +74 -0
- package/dist/thread/player/playerglobal/index.js +224 -0
- package/dist/thread/player/playerglobal/libraries.js +10 -0
- package/dist/thread/player/playerglobal/playerglobal-library.js +22 -0
- package/dist/thread/player/playerglobal/toplevel.js +122 -0
- package/dist/thread/player/scripting/clipboard.js +146 -0
- package/dist/thread/player/scripting/code.js +900 -0
- package/dist/thread/player/scripting/evaluate.js +144 -0
- package/dist/thread/player/scripting/events.js +172 -0
- package/dist/thread/player/scripting/handover.js +182 -0
- package/dist/thread/player/scripting/lazy.js +38 -0
- package/dist/thread/player/scripting/lifecycle.js +272 -0
- package/dist/thread/player/scripting/loads.js +860 -0
- package/dist/thread/player/scripting/sha256.js +95 -0
- package/dist/thread/player/scripting/symbols.js +348 -0
- package/dist/thread/player/scripting/timers.js +434 -0
- package/dist/thread/player/scripting/workers.js +923 -0
- package/dist/thread/player/scripting.js +1018 -0
- package/dist/thread/player/stage.js +4 -0
- package/dist/thread/player/text/csm.js +113 -0
- package/dist/thread/player/text/css.js +167 -0
- package/dist/thread/player/text/fonts.js +97 -0
- package/dist/thread/player/text/layout.js +393 -0
- package/dist/thread/player/text/static.js +109 -0
- package/dist/thread/player/text/text.js +431 -0
- package/dist/thread/player/workers/thread.js +159 -0
- package/dist/thread/player/workers/wire.js +198 -0
- package/dist/thread/player-hosts/web-worker.js +19 -0
- package/dist/thread/runtime/avm1/activation.js +89 -0
- package/dist/thread/runtime/avm1/case.js +249 -0
- package/dist/thread/runtime/avm1/clips.js +334 -0
- package/dist/thread/runtime/avm1/control.js +280 -0
- package/dist/thread/runtime/avm1/errors.js +50 -0
- package/dist/thread/runtime/avm1/functions.js +249 -0
- package/dist/thread/runtime/avm1/globals/array.js +549 -0
- package/dist/thread/runtime/avm1/globals/broadcaster.js +131 -0
- package/dist/thread/runtime/avm1/globals/date.js +436 -0
- package/dist/thread/runtime/avm1/globals/global.js +344 -0
- package/dist/thread/runtime/avm1/globals/math.js +139 -0
- package/dist/thread/runtime/avm1/globals/number.js +93 -0
- package/dist/thread/runtime/avm1/globals/string.js +201 -0
- package/dist/thread/runtime/avm1/globals/timers.js +129 -0
- package/dist/thread/runtime/avm1/host.js +5 -0
- package/dist/thread/runtime/avm1/index.js +14 -0
- package/dist/thread/runtime/avm1/inheritance.js +132 -0
- package/dist/thread/runtime/avm1/numbers.js +298 -0
- package/dist/thread/runtime/avm1/objects.js +896 -0
- package/dist/thread/runtime/avm1/operators.js +170 -0
- package/dist/thread/runtime/avm1/realm.js +529 -0
- package/dist/thread/runtime/avm1/runtime.js +882 -0
- package/dist/thread/runtime/avm1/scope.js +385 -0
- package/dist/thread/runtime/avm1/urls.js +180 -0
- package/dist/thread/runtime/avm1/values.js +97 -0
- package/dist/thread/runtime/avm2/amf-classes.js +66 -0
- package/dist/thread/runtime/avm2/amf.js +801 -0
- package/dist/thread/runtime/avm2/array-conversion.js +100 -0
- package/dist/thread/runtime/avm2/builtin-library.js +21 -0
- package/dist/thread/runtime/avm2/cache-fill.js +86 -0
- package/dist/thread/runtime/avm2/classes.js +211 -0
- package/dist/thread/runtime/avm2/definitions.js +69 -0
- package/dist/thread/runtime/avm2/descriptors.js +5 -0
- package/dist/thread/runtime/avm2/dictionary-keys.js +295 -0
- package/dist/thread/runtime/avm2/domain-memory.js +75 -0
- package/dist/thread/runtime/avm2/domain.js +280 -0
- package/dist/thread/runtime/avm2/dynamic-properties.js +182 -0
- package/dist/thread/runtime/avm2/enumeration.js +393 -0
- package/dist/thread/runtime/avm2/errors.js +45 -0
- package/dist/thread/runtime/avm2/float-library.js +66 -0
- package/dist/thread/runtime/avm2/float.js +26 -0
- package/dist/thread/runtime/avm2/hooks.js +19 -0
- package/dist/thread/runtime/avm2/index.js +38 -0
- package/dist/thread/runtime/avm2/messages.js +177 -0
- package/dist/thread/runtime/avm2/method-factories.js +95 -0
- package/dist/thread/runtime/avm2/modules.js +105 -0
- package/dist/thread/runtime/avm2/names.js +248 -0
- package/dist/thread/runtime/avm2/natives/aliases.js +47 -0
- package/dist/thread/runtime/avm2/natives/array.js +390 -0
- package/dist/thread/runtime/avm2/natives/bytearray.js +1227 -0
- package/dist/thread/runtime/avm2/natives/case.js +88 -0
- package/dist/thread/runtime/avm2/natives/concurrent.js +199 -0
- package/dist/thread/runtime/avm2/natives/date.js +581 -0
- package/dist/thread/runtime/avm2/natives/define.js +130 -0
- package/dist/thread/runtime/avm2/natives/describe.js +351 -0
- package/dist/thread/runtime/avm2/natives/dictionary.js +12 -0
- package/dist/thread/runtime/avm2/natives/float-vector.js +81 -0
- package/dist/thread/runtime/avm2/natives/float.js +96 -0
- package/dist/thread/runtime/avm2/natives/index.js +64 -0
- package/dist/thread/runtime/avm2/natives/json.js +514 -0
- package/dist/thread/runtime/avm2/natives/number.js +162 -0
- package/dist/thread/runtime/avm2/natives/object.js +237 -0
- package/dist/thread/runtime/avm2/natives/proxy.js +75 -0
- package/dist/thread/runtime/avm2/natives/regexp.js +485 -0
- package/dist/thread/runtime/avm2/natives/shell-workers.js +404 -0
- package/dist/thread/runtime/avm2/natives/shell.js +557 -0
- package/dist/thread/runtime/avm2/natives/sort.js +377 -0
- package/dist/thread/runtime/avm2/natives/string.js +132 -0
- package/dist/thread/runtime/avm2/natives/sync.js +821 -0
- package/dist/thread/runtime/avm2/natives/toplevel.js +139 -0
- package/dist/thread/runtime/avm2/natives/vector-elements.js +46 -0
- package/dist/thread/runtime/avm2/natives/vector.js +406 -0
- package/dist/thread/runtime/avm2/natives/xml/access.js +633 -0
- package/dist/thread/runtime/avm2/natives/xml/build.js +291 -0
- package/dist/thread/runtime/avm2/natives/xml/chars.js +112 -0
- package/dist/thread/runtime/avm2/natives/xml/escape.js +38 -0
- package/dist/thread/runtime/avm2/natives/xml/names.js +204 -0
- package/dist/thread/runtime/avm2/natives/xml/node.js +272 -0
- package/dist/thread/runtime/avm2/natives/xml/operators.js +69 -0
- package/dist/thread/runtime/avm2/natives/xml/parser.js +356 -0
- package/dist/thread/runtime/avm2/natives/xml/strings.js +191 -0
- package/dist/thread/runtime/avm2/natives/xml/values.js +122 -0
- package/dist/thread/runtime/avm2/natives/xml/xml.js +645 -0
- package/dist/thread/runtime/avm2/number-strings.js +110 -0
- package/dist/thread/runtime/avm2/numbers.js +558 -0
- package/dist/thread/runtime/avm2/options.js +16 -0
- package/dist/thread/runtime/avm2/player-messages.js +550 -0
- package/dist/thread/runtime/avm2/property-cache.js +135 -0
- package/dist/thread/runtime/avm2/runtime.js +2644 -0
- package/dist/thread/runtime/avm2/traits.js +509 -0
- package/dist/thread/runtime/index.js +7 -0
- package/dist/web-worker.d.ts +2 -0
- package/dist/web-worker.d.ts.map +1 -0
- package/dist/web-worker.js +20 -0
- package/dist/web-worker.js.map +1 -0
- package/dist/websocket.d.ts +4 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +27 -0
- package/dist/websocket.js.map +1 -0
- package/dist/workers.d.ts +35 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +171 -0
- package/dist/workers.js.map +1 -0
- package/package.json +62 -3
- package/src/indexeddb.ts +227 -0
- package/src/node-worker.ts +13 -0
- package/src/node.ts +49 -0
- package/src/precompiled.ts +166 -0
- package/src/stage3d.ts +76 -0
- package/src/web-worker.ts +24 -0
- package/src/websocket.ts +32 -0
- package/src/workers.ts +255 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// SHA-256 of an ABC's bytes, the fingerprint the AOT side and the cache
|
|
2
|
+
// key name ABCs by: from crypto.subtle where there is one, which only a
|
|
3
|
+
// secure context (https, localhost) has, else computed here, so that a
|
|
4
|
+
// player on a plain http page loads too, with the same fingerprint.
|
|
5
|
+
const K = new Uint32Array([
|
|
6
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
7
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
8
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
9
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
10
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
11
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
12
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
13
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
14
|
+
]);
|
|
15
|
+
/** The digest as 64 hex digits. */
|
|
16
|
+
export async function sha256(bytes) {
|
|
17
|
+
const subtle = globalThis.crypto?.subtle;
|
|
18
|
+
if (subtle) {
|
|
19
|
+
// The bytes are a view of the SWF's buffer, never a shared one, as digest requires.
|
|
20
|
+
return hex(new Uint8Array(await subtle.digest("SHA-256", bytes)));
|
|
21
|
+
}
|
|
22
|
+
return hex(sha256Here(bytes));
|
|
23
|
+
}
|
|
24
|
+
/** FIPS 180-4, one block at a time; the message length goes in the last block as 64 bits big-endian. */
|
|
25
|
+
export function sha256Here(bytes) {
|
|
26
|
+
const h = new Uint32Array([
|
|
27
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
28
|
+
]);
|
|
29
|
+
const w = new Uint32Array(64);
|
|
30
|
+
const n = bytes.length;
|
|
31
|
+
// Padded: 0x80, zeros to 56 mod 64, then the bit length.
|
|
32
|
+
const padded = new Uint8Array(((n + 9 + 63) >> 6) << 6);
|
|
33
|
+
padded.set(bytes);
|
|
34
|
+
padded[n] = 0x80;
|
|
35
|
+
const view = new DataView(padded.buffer);
|
|
36
|
+
view.setUint32(padded.length - 8, Math.floor((n * 8) / 0x100000000));
|
|
37
|
+
view.setUint32(padded.length - 4, (n * 8) >>> 0);
|
|
38
|
+
for (let block = 0; block < padded.length; block += 64) {
|
|
39
|
+
for (let i = 0; i < 16; i++) {
|
|
40
|
+
w[i] = view.getUint32(block + i * 4);
|
|
41
|
+
}
|
|
42
|
+
for (let i = 16; i < 64; i++) {
|
|
43
|
+
const x = w[i - 15];
|
|
44
|
+
const y = w[i - 2];
|
|
45
|
+
const s0 = ((x >>> 7) | (x << 25)) ^ ((x >>> 18) | (x << 14)) ^ (x >>> 3);
|
|
46
|
+
const s1 = ((y >>> 17) | (y << 15)) ^ ((y >>> 19) | (y << 13)) ^ (y >>> 10);
|
|
47
|
+
w[i] = (w[i - 16] + s0 + w[i - 7] + s1) >>> 0;
|
|
48
|
+
}
|
|
49
|
+
let a = h[0];
|
|
50
|
+
let b = h[1];
|
|
51
|
+
let c = h[2];
|
|
52
|
+
let d = h[3];
|
|
53
|
+
let e = h[4];
|
|
54
|
+
let f = h[5];
|
|
55
|
+
let g = h[6];
|
|
56
|
+
let hh = h[7];
|
|
57
|
+
for (let i = 0; i < 64; i++) {
|
|
58
|
+
const S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
|
|
59
|
+
const ch = (e & f) ^ (~e & g);
|
|
60
|
+
const t1 = (hh + S1 + ch + K[i] + w[i]) >>> 0;
|
|
61
|
+
const S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
|
|
62
|
+
const maj = (a & b) ^ (a & c) ^ (b & c);
|
|
63
|
+
const t2 = (S0 + maj) >>> 0;
|
|
64
|
+
hh = g;
|
|
65
|
+
g = f;
|
|
66
|
+
f = e;
|
|
67
|
+
e = (d + t1) >>> 0;
|
|
68
|
+
d = c;
|
|
69
|
+
c = b;
|
|
70
|
+
b = a;
|
|
71
|
+
a = (t1 + t2) >>> 0;
|
|
72
|
+
}
|
|
73
|
+
h[0] = (h[0] + a) >>> 0;
|
|
74
|
+
h[1] = (h[1] + b) >>> 0;
|
|
75
|
+
h[2] = (h[2] + c) >>> 0;
|
|
76
|
+
h[3] = (h[3] + d) >>> 0;
|
|
77
|
+
h[4] = (h[4] + e) >>> 0;
|
|
78
|
+
h[5] = (h[5] + f) >>> 0;
|
|
79
|
+
h[6] = (h[6] + g) >>> 0;
|
|
80
|
+
h[7] = (h[7] + hh) >>> 0;
|
|
81
|
+
}
|
|
82
|
+
const out = new Uint8Array(32);
|
|
83
|
+
const digest = new DataView(out.buffer);
|
|
84
|
+
for (let i = 0; i < 8; i++) {
|
|
85
|
+
digest.setUint32(i * 4, h[i]);
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
function hex(digest) {
|
|
90
|
+
let s = "";
|
|
91
|
+
for (let i = 0; i < digest.length; i++) {
|
|
92
|
+
s += digest[i].toString(16).padStart(2, "0");
|
|
93
|
+
}
|
|
94
|
+
return s;
|
|
95
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
// What SymbolClass binds: the character, and its library, a class makes
|
|
2
|
+
// when a script constructs it, a display object's or a resource's (bitmap,
|
|
3
|
+
// bytes, sound, font); the fonts scripts register; and the decodes of
|
|
4
|
+
// identical sounds, which the libraries alive share.
|
|
5
|
+
import { readSymbolClass, tags } from "../../format/index.js";
|
|
6
|
+
import { BitmapStore } from "../bitmap/bitmap.js";
|
|
7
|
+
import { BitmapObject, ButtonObject, Container, displayFor, EMPTY_TIMELINE, MovieClip, ShapeObject, TextObject, VideoObject, } from "../display/display.js";
|
|
8
|
+
import { INVALID_PIXELS, } from "../display/timeline.js";
|
|
9
|
+
import { FontSet } from "../text/fonts.js";
|
|
10
|
+
export class Symbols {
|
|
11
|
+
s;
|
|
12
|
+
audioEntries = new WeakMap();
|
|
13
|
+
sharedAudio = new Map();
|
|
14
|
+
sharedAudioGone = new FinalizationRegistry(({ hash, entry, serial }) => {
|
|
15
|
+
if (entry.serial !== serial || entry.definition.deref()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.removeSharedAudio(hash, entry);
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The character, and its SWF's library, each class SymbolClass bound
|
|
22
|
+
* makes, for a `new` of the class from a script: by the module that
|
|
23
|
+
* defines the class, as the SWF's domain found it, then its name, so a
|
|
24
|
+
* class of the same name in another domain has its own; `unbound` for a
|
|
25
|
+
* name nothing defined when it was bound. Weakly, by the module: a SWF
|
|
26
|
+
* let go takes its symbols with it.
|
|
27
|
+
*/
|
|
28
|
+
symbols = new WeakMap();
|
|
29
|
+
unbound = new Map();
|
|
30
|
+
/**
|
|
31
|
+
* The font sets of the libraries whose embedded fonts have been made
|
|
32
|
+
* visible to this player, for the fonts registered later. Weakly, so
|
|
33
|
+
* that a SWF let go is not kept for them; but by the set, not the
|
|
34
|
+
* library, as a text field keeps only its library's set, and a field
|
|
35
|
+
* kept from a SWF otherwise let go still takes the fonts registered.
|
|
36
|
+
*/
|
|
37
|
+
fontSets = new Set();
|
|
38
|
+
fontSetsSeen = new WeakSet();
|
|
39
|
+
/** Font classes explicitly registered by scripts, in registration order. */
|
|
40
|
+
registeredFonts = new Map();
|
|
41
|
+
constructor(s) {
|
|
42
|
+
this.s = s;
|
|
43
|
+
}
|
|
44
|
+
/** SymbolClass: bind the SWF's characters to their classes, in its library. */
|
|
45
|
+
bind(swf, library) {
|
|
46
|
+
const domain = library.domain ?? this.s.mainDomain;
|
|
47
|
+
for (const t of swf.tags) {
|
|
48
|
+
if (t.code === tags.SymbolClass) {
|
|
49
|
+
for (const [id, name] of readSymbolClass(swf.bytes, t)) {
|
|
50
|
+
const qualified = qualify(name);
|
|
51
|
+
library.classes.set(id, qualified);
|
|
52
|
+
const character = library.characters.get(id);
|
|
53
|
+
if (character) {
|
|
54
|
+
const abc = this.s.rt.definingAbc(qualified, domain);
|
|
55
|
+
let byName = abc ? this.symbols.get(abc) : this.unbound;
|
|
56
|
+
if (!byName) {
|
|
57
|
+
byName = new Map();
|
|
58
|
+
this.symbols.set(abc, byName);
|
|
59
|
+
}
|
|
60
|
+
// A class keeps the symbol first bound to it: another SWF that
|
|
61
|
+
// binds it, one that finds it in a parent's domain, makes its own
|
|
62
|
+
// timeline's instances of it but not a script's (the corpus's
|
|
63
|
+
// loader_duplicate_class).
|
|
64
|
+
if (!byName.has(qualified)) {
|
|
65
|
+
byName.set(qualified, { character, library });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The bitmap a class SymbolClass bound is of, if `traits` or a base is one's. */
|
|
73
|
+
bitmapSymbol(traits) {
|
|
74
|
+
for (let t = traits; t; t = t.base) {
|
|
75
|
+
const symbol = this.symbolOf(t);
|
|
76
|
+
if (symbol) {
|
|
77
|
+
return symbol.character.type === "bitmap" ? symbol.character : null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The bytes of the DefineBinaryData a class SymbolClass bound, if
|
|
84
|
+
* `traits` or a base is one's: one buffer for all its instances, which
|
|
85
|
+
* see each other's writes, as Flash's.
|
|
86
|
+
*/
|
|
87
|
+
binarySymbol(traits) {
|
|
88
|
+
for (let t = traits; t; t = t.base) {
|
|
89
|
+
const symbol = this.symbolOf(t);
|
|
90
|
+
if (symbol) {
|
|
91
|
+
const character = symbol.character;
|
|
92
|
+
if (character.type !== "binary") {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
character.shared ??= new Uint8Array(character.data);
|
|
96
|
+
return character.shared;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
/** A DefineSound a class or one of its bases was bound to. */
|
|
102
|
+
soundSymbol(traits) {
|
|
103
|
+
for (let t = traits; t; t = t.base) {
|
|
104
|
+
const symbol = this.symbolOf(t);
|
|
105
|
+
if (symbol) {
|
|
106
|
+
return symbol.character.type === "sound" ? symbol.character : null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
/** A DefineFont a class or one of its bases was bound to. */
|
|
112
|
+
fontSymbol(traits) {
|
|
113
|
+
for (let t = traits; t; t = t.base) {
|
|
114
|
+
const symbol = this.symbolOf(t);
|
|
115
|
+
if (symbol) {
|
|
116
|
+
return symbol.character.type === "font" || symbol.character.type === "fontCff"
|
|
117
|
+
? symbol.character
|
|
118
|
+
: null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
/** Keep a SWF's own fonts and fonts registered elsewhere available to its fields. */
|
|
124
|
+
addFontLibrary(library) {
|
|
125
|
+
if (this.fontSetsSeen.has(library.fonts)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
for (const ref of this.fontSets) {
|
|
129
|
+
if (!ref.deref()) {
|
|
130
|
+
this.fontSets.delete(ref);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this.fontSetsSeen.add(library.fonts);
|
|
134
|
+
this.fontSets.add(new WeakRef(library.fonts));
|
|
135
|
+
for (const font of this.registeredFonts.values()) {
|
|
136
|
+
if (font.type === "font") {
|
|
137
|
+
library.fonts.add(font.font);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Make a registered font available to fields made by every loaded SWF. */
|
|
142
|
+
registerFont(cls, font) {
|
|
143
|
+
if (this.registeredFonts.has(cls) ||
|
|
144
|
+
[...this.registeredFonts.values()].some((registered) => registered.name.toLowerCase() === font.name.toLowerCase() &&
|
|
145
|
+
registered.type === font.type &&
|
|
146
|
+
registered.bold === font.bold &&
|
|
147
|
+
registered.italic === font.italic)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.registeredFonts.set(cls, font);
|
|
151
|
+
for (const ref of this.fontSets) {
|
|
152
|
+
const fonts = ref.deref();
|
|
153
|
+
if (!fonts) {
|
|
154
|
+
this.fontSets.delete(ref);
|
|
155
|
+
}
|
|
156
|
+
else if (font.type === "font") {
|
|
157
|
+
fonts.add(font.font);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** Decode a sound on first play; live libraries can share an identical decode. */
|
|
162
|
+
soundClip(character) {
|
|
163
|
+
if (!this.s.audio) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
const own = this.audioEntries.get(character);
|
|
167
|
+
if (own?.pending) {
|
|
168
|
+
return own.pending;
|
|
169
|
+
}
|
|
170
|
+
const ownDecoded = own?.decoded;
|
|
171
|
+
if (ownDecoded) {
|
|
172
|
+
return Promise.resolve(ownDecoded);
|
|
173
|
+
}
|
|
174
|
+
const definition = character.definition;
|
|
175
|
+
const hash = soundHash(definition);
|
|
176
|
+
for (const entry of this.sharedAudio.get(hash) ?? []) {
|
|
177
|
+
const prior = entry.definition.deref();
|
|
178
|
+
if (!prior || !sameSound(prior, definition)) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const decoded = entry.decoded;
|
|
182
|
+
const clip = entry.pending ?? (decoded ? Promise.resolve(decoded) : null);
|
|
183
|
+
if (clip) {
|
|
184
|
+
entry.definition = new WeakRef(definition);
|
|
185
|
+
this.sharedAudioGone.register(definition, {
|
|
186
|
+
hash,
|
|
187
|
+
entry,
|
|
188
|
+
serial: ++entry.serial,
|
|
189
|
+
});
|
|
190
|
+
this.audioEntries.set(character, entry);
|
|
191
|
+
return clip;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const entry = {
|
|
195
|
+
definition: new WeakRef(definition),
|
|
196
|
+
decoded: null,
|
|
197
|
+
pending: null,
|
|
198
|
+
serial: 1,
|
|
199
|
+
};
|
|
200
|
+
const audio = this.s.audio;
|
|
201
|
+
const clip = Promise.resolve().then(() => audio.decode(definition));
|
|
202
|
+
entry.pending = clip;
|
|
203
|
+
const matches = this.sharedAudio.get(hash) ?? [];
|
|
204
|
+
matches.push(entry);
|
|
205
|
+
this.sharedAudio.set(hash, matches);
|
|
206
|
+
this.sharedAudioGone.register(definition, { hash, entry, serial: 1 });
|
|
207
|
+
void clip.then((decoded) => {
|
|
208
|
+
entry.decoded = decoded;
|
|
209
|
+
entry.pending = null;
|
|
210
|
+
}, () => this.removeSharedAudio(hash, entry));
|
|
211
|
+
this.audioEntries.set(character, entry);
|
|
212
|
+
return clip;
|
|
213
|
+
}
|
|
214
|
+
removeSharedAudio(hash, entry) {
|
|
215
|
+
const matches = this.sharedAudio.get(hash)?.filter((candidate) => candidate !== entry) ?? [];
|
|
216
|
+
if (matches.length > 0) {
|
|
217
|
+
this.sharedAudio.set(hash, matches);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this.sharedAudio.delete(hash);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/** What SymbolClass bound the class of `traits` to, if anything: by its defining module, then its name. */
|
|
224
|
+
symbolOf(traits) {
|
|
225
|
+
const abc = traits.abc;
|
|
226
|
+
return (abc && this.symbols.get(abc)?.get(traits.name)) ?? this.unbound.get(traits.name);
|
|
227
|
+
}
|
|
228
|
+
/** A new plain BitmapData of a bitmap's pixels, as a Bitmap of the bitmap gets. */
|
|
229
|
+
bitmapDataOf(character) {
|
|
230
|
+
const data = this.s.rt.construct(this.s.rt.classNamed("flash.display::BitmapData"), 1, 1);
|
|
231
|
+
data.$store = BitmapStore.of(character.pixels ?? INVALID_PIXELS);
|
|
232
|
+
return data;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The display object for an instance a script makes with `new`: the
|
|
236
|
+
* character of a class SymbolClass bound, if the class or a base of it
|
|
237
|
+
* is one, else an empty clip, shape or container by the nearest base.
|
|
238
|
+
*/
|
|
239
|
+
displayFor(traits) {
|
|
240
|
+
const library = this.s.library ?? {
|
|
241
|
+
characters: new Map(),
|
|
242
|
+
root: EMPTY_TIMELINE,
|
|
243
|
+
classes: new Map(),
|
|
244
|
+
construct: null,
|
|
245
|
+
constructLater: null,
|
|
246
|
+
constructPlaced: null,
|
|
247
|
+
uncaught: null,
|
|
248
|
+
removing: null,
|
|
249
|
+
fonts: new FontSet(),
|
|
250
|
+
};
|
|
251
|
+
for (let t = traits; t; t = t.base) {
|
|
252
|
+
// A display object's class bound to data has no display of it.
|
|
253
|
+
const symbol = this.symbolOf(t);
|
|
254
|
+
if (symbol &&
|
|
255
|
+
symbol.character.type !== "binary" &&
|
|
256
|
+
symbol.character.type !== "font" &&
|
|
257
|
+
symbol.character.type !== "fontCff" &&
|
|
258
|
+
symbol.character.type !== "sound") {
|
|
259
|
+
if (symbol.character.type === "text") {
|
|
260
|
+
// A new linked TextField has its symbol's bounds, but not its timeline's initial text.
|
|
261
|
+
const text = new TextObject(symbol.character, false);
|
|
262
|
+
text.fonts = symbol.library.fonts;
|
|
263
|
+
return text;
|
|
264
|
+
}
|
|
265
|
+
const display = displayFor(symbol.character, symbol.library);
|
|
266
|
+
// A bound button a script makes has its states, as a timeline's does.
|
|
267
|
+
if (display instanceof ButtonObject && symbol.character.type === "button") {
|
|
268
|
+
this.s.makeButtonStates(display, symbol.character, symbol.library);
|
|
269
|
+
}
|
|
270
|
+
return display;
|
|
271
|
+
}
|
|
272
|
+
if (t.name === "flash.display::SimpleButton") {
|
|
273
|
+
return new ButtonObject();
|
|
274
|
+
}
|
|
275
|
+
if (t.name === "flash.display::MovieClip") {
|
|
276
|
+
return new MovieClip(EMPTY_TIMELINE, library);
|
|
277
|
+
}
|
|
278
|
+
if (t.name === "flash.display::Shape") {
|
|
279
|
+
return new ShapeObject(null);
|
|
280
|
+
}
|
|
281
|
+
// Only a timeline makes a MorphShape or a StaticText.
|
|
282
|
+
if (t.name === "flash.display::MorphShape") {
|
|
283
|
+
throw this.s.rt.error("ArgumentError", 2012, "MorphShape$");
|
|
284
|
+
}
|
|
285
|
+
if (t.name === "flash.text::StaticText") {
|
|
286
|
+
throw this.s.rt.error("ArgumentError", 2012, "StaticText$");
|
|
287
|
+
}
|
|
288
|
+
// Only a load of an AVM1 SWF makes one (requestLoad).
|
|
289
|
+
if (t.name === "flash.display::AVM1Movie") {
|
|
290
|
+
throw this.s.rt.error("ArgumentError", 2012, "AVM1Movie$");
|
|
291
|
+
}
|
|
292
|
+
if (t.name === "flash.display::Bitmap") {
|
|
293
|
+
return new BitmapObject(null);
|
|
294
|
+
}
|
|
295
|
+
if (t.name === "flash.media::Video") {
|
|
296
|
+
return new VideoObject();
|
|
297
|
+
}
|
|
298
|
+
if (t.name === "flash.text::TextField") {
|
|
299
|
+
const text = new TextObject(null);
|
|
300
|
+
text.fonts = (this.s.code.codeLibrary() ?? library).fonts;
|
|
301
|
+
return text;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return new Container();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/** Compare the bytes too: a 32-bit hash only narrows a bucket, never decides identity. */
|
|
308
|
+
function sameSound(a, b) {
|
|
309
|
+
if (a.format !== b.format ||
|
|
310
|
+
a.sampleRate !== b.sampleRate ||
|
|
311
|
+
a.sampleSize !== b.sampleSize ||
|
|
312
|
+
a.channels !== b.channels ||
|
|
313
|
+
a.sampleCount !== b.sampleCount ||
|
|
314
|
+
a.seekSamples !== b.seekSamples ||
|
|
315
|
+
a.data.length !== b.data.length) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
for (let i = 0; i < a.data.length; i++) {
|
|
319
|
+
if (a.data[i] !== b.data[i]) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
function soundHash(sound) {
|
|
326
|
+
let hash = 0x811c9dc5;
|
|
327
|
+
for (const value of [
|
|
328
|
+
sound.format,
|
|
329
|
+
sound.sampleRate,
|
|
330
|
+
sound.sampleSize,
|
|
331
|
+
sound.channels,
|
|
332
|
+
sound.sampleCount,
|
|
333
|
+
sound.seekSamples,
|
|
334
|
+
]) {
|
|
335
|
+
hash = Math.imul(hash ^ value, 0x01000193);
|
|
336
|
+
}
|
|
337
|
+
// By index: a sound's data runs to megabytes.
|
|
338
|
+
const data = sound.data;
|
|
339
|
+
for (let i = 0; i < data.length; i++) {
|
|
340
|
+
hash = Math.imul(hash ^ data[i], 0x01000193);
|
|
341
|
+
}
|
|
342
|
+
return hash >>> 0;
|
|
343
|
+
}
|
|
344
|
+
/** "pkg.Name", as SymbolClass writes a class, as "pkg::Name". */
|
|
345
|
+
function qualify(name) {
|
|
346
|
+
const i = name.lastIndexOf(".");
|
|
347
|
+
return i < 0 ? name : `${name.slice(0, i)}::${name.slice(i + 1)}`;
|
|
348
|
+
}
|