@swf2es/player-hosts 0.0.0-stage → 0.1.1
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,231 @@
|
|
|
1
|
+
// flash.display.Stage: the stage's size and frame rate, invalidate, which
|
|
2
|
+
// asks for a RENDER event before the frame is drawn, focus, which keys go
|
|
3
|
+
// to (input/keyboard.ts), and the two container methods Stage declares native
|
|
4
|
+
// again, which do as a container's do.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { setFocus } from "../../../input/keyboard.js";
|
|
7
|
+
import { stageAlignment } from "../../../stage.js";
|
|
8
|
+
import { displayOf } from "./DisplayObject.js";
|
|
9
|
+
import { containerNatives } from "./DisplayObjectContainer.js";
|
|
10
|
+
import { nativeWindowOf } from "./NativeWindow.js";
|
|
11
|
+
export function stageNatives(s) {
|
|
12
|
+
const natives = {};
|
|
13
|
+
class StageNatives {
|
|
14
|
+
"flash.display:Stage::requireOwnerPermissions"() {
|
|
15
|
+
// One owner: the SWF the player runs.
|
|
16
|
+
}
|
|
17
|
+
get frameRate() {
|
|
18
|
+
return s.frameRate;
|
|
19
|
+
}
|
|
20
|
+
/** The AIR application's window the stage is in; null outside AIR, or where the host has none. */
|
|
21
|
+
get nativeWindow() {
|
|
22
|
+
return nativeWindowOf(s);
|
|
23
|
+
}
|
|
24
|
+
set frameRate(v) {
|
|
25
|
+
s.frameRate = Math.max(0.01, Math.min(1000, Number(v)));
|
|
26
|
+
}
|
|
27
|
+
get stageWidth() {
|
|
28
|
+
return s.stageWidth;
|
|
29
|
+
}
|
|
30
|
+
/** The embedding page sizes the stage: a SWF's own sizes are taken and dropped, as in Ruffle. */
|
|
31
|
+
set stageWidth(_v) { }
|
|
32
|
+
get stageHeight() {
|
|
33
|
+
return s.stageHeight;
|
|
34
|
+
}
|
|
35
|
+
set stageHeight(_v) { }
|
|
36
|
+
/** Undocumented; null in AIR's adl, and in Flash Player as Ruffle found it. */
|
|
37
|
+
get displayContextInfo() {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
invalidate() {
|
|
41
|
+
s.invalidated = true;
|
|
42
|
+
}
|
|
43
|
+
get scaleMode() {
|
|
44
|
+
return s.liveStageLayout ? s.stageScaleMode : "showAll";
|
|
45
|
+
}
|
|
46
|
+
set scaleMode(v) {
|
|
47
|
+
if (!s.liveStageLayout) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (v == null) {
|
|
51
|
+
throw s.rt.error("TypeError", 2007, "scaleMode");
|
|
52
|
+
}
|
|
53
|
+
const value = s.rt.toString(v);
|
|
54
|
+
switch (value) {
|
|
55
|
+
case "showAll":
|
|
56
|
+
case "noScale":
|
|
57
|
+
case "noBorder":
|
|
58
|
+
case "exactFit":
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
throw s.rt.error("ArgumentError", 2008, "scaleMode");
|
|
62
|
+
}
|
|
63
|
+
s.stageScaleModeSet = true;
|
|
64
|
+
if (value !== s.stageScaleMode) {
|
|
65
|
+
s.stageScaleMode = value;
|
|
66
|
+
s.onStageLayout?.();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
get align() {
|
|
70
|
+
return s.liveStageLayout ? s.stageAlign : "";
|
|
71
|
+
}
|
|
72
|
+
set align(v) {
|
|
73
|
+
if (!s.liveStageLayout) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (v == null) {
|
|
77
|
+
throw s.rt.error("TypeError", 2007, "align");
|
|
78
|
+
}
|
|
79
|
+
const value = stageAlignment(s.rt.toString(v));
|
|
80
|
+
s.stageAlignSet = true;
|
|
81
|
+
if (value !== s.stageAlign) {
|
|
82
|
+
s.stageAlign = value;
|
|
83
|
+
s.onStageLayout?.();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
get quality() {
|
|
87
|
+
return s.quality;
|
|
88
|
+
}
|
|
89
|
+
set quality(v) {
|
|
90
|
+
s.quality = String(v).toUpperCase();
|
|
91
|
+
}
|
|
92
|
+
get displayState() {
|
|
93
|
+
return "normal";
|
|
94
|
+
}
|
|
95
|
+
set displayState(_v) {
|
|
96
|
+
// No full screen.
|
|
97
|
+
}
|
|
98
|
+
get focus() {
|
|
99
|
+
return s.focus?.object ?? null;
|
|
100
|
+
}
|
|
101
|
+
// A field given focus keeps its selection (the corpus's edittext_focus_selection).
|
|
102
|
+
set focus(v) {
|
|
103
|
+
setFocus(s, v ? (displayOf(v) ?? null) : null);
|
|
104
|
+
}
|
|
105
|
+
get showDefaultContextMenu() {
|
|
106
|
+
return s.showDefaultContextMenu;
|
|
107
|
+
}
|
|
108
|
+
set showDefaultContextMenu(v) {
|
|
109
|
+
s.showDefaultContextMenu = s.rt.toBoolean(v);
|
|
110
|
+
}
|
|
111
|
+
// Kept, though no focus rectangle is drawn.
|
|
112
|
+
get stageFocusRect() {
|
|
113
|
+
return focusRect;
|
|
114
|
+
}
|
|
115
|
+
set stageFocusRect(v) {
|
|
116
|
+
focusRect = !!v;
|
|
117
|
+
}
|
|
118
|
+
/** The background, opaque: what a SWF's SetBackgroundColor gave until set, the alpha set ignored. */
|
|
119
|
+
get color() {
|
|
120
|
+
return ((s.stageColor ?? 0xffffff) | 0xff000000) >>> 0;
|
|
121
|
+
}
|
|
122
|
+
set color(v) {
|
|
123
|
+
s.stageColor = s.rt.toUint(v) & 0xffffff;
|
|
124
|
+
// A redraw asked for: a host that reads Player.background as it draws shows it.
|
|
125
|
+
s.updates++;
|
|
126
|
+
}
|
|
127
|
+
get allowsFullScreen() {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
get allowsFullScreenInteractive() {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
get browserZoomFactor() {
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
get contentsScaleFactor() {
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
get fullScreenWidth() {
|
|
140
|
+
return s.screenCapabilities.screenResolutionX;
|
|
141
|
+
}
|
|
142
|
+
get fullScreenHeight() {
|
|
143
|
+
return s.screenCapabilities.screenResolutionY;
|
|
144
|
+
}
|
|
145
|
+
get fullScreenSourceRect() {
|
|
146
|
+
return fullScreenSource;
|
|
147
|
+
}
|
|
148
|
+
set fullScreenSourceRect(v) {
|
|
149
|
+
fullScreenSource = v ?? null;
|
|
150
|
+
}
|
|
151
|
+
get colorCorrection() {
|
|
152
|
+
return colorCorrection;
|
|
153
|
+
}
|
|
154
|
+
set colorCorrection(v) {
|
|
155
|
+
if (v === null || v === undefined) {
|
|
156
|
+
throw s.rt.error("TypeError", 2007, "colorCorrection");
|
|
157
|
+
}
|
|
158
|
+
colorCorrection = s.rt.toString(v);
|
|
159
|
+
}
|
|
160
|
+
get colorCorrectionSupport() {
|
|
161
|
+
return "unsupported";
|
|
162
|
+
}
|
|
163
|
+
// Kept: the pointer is not locked, which only full screen allows.
|
|
164
|
+
get mouseLock() {
|
|
165
|
+
return mouseLock;
|
|
166
|
+
}
|
|
167
|
+
set mouseLock(v) {
|
|
168
|
+
mouseLock = !!v;
|
|
169
|
+
}
|
|
170
|
+
get wmodeGPU() {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
get softKeyboardRect() {
|
|
174
|
+
return s.rt.construct(s.rt.classNamed("flash.geom::Rectangle"), 0, 0, 0, 0);
|
|
175
|
+
}
|
|
176
|
+
get orientation() {
|
|
177
|
+
return "unknown";
|
|
178
|
+
}
|
|
179
|
+
get deviceOrientation() {
|
|
180
|
+
return "unknown";
|
|
181
|
+
}
|
|
182
|
+
get autoOrients() {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
"flash.display:Stage::setAutoOrients"(_v) { }
|
|
186
|
+
get supportedOrientations() {
|
|
187
|
+
const strings = s.rt.resolve(s.rt.vector("String")).$it.instance();
|
|
188
|
+
strings.$a = [];
|
|
189
|
+
return strings;
|
|
190
|
+
}
|
|
191
|
+
static get supportsOrientationChange() {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
isFocusInaccessible() {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
/** No StageVideo: the vector is empty. */
|
|
198
|
+
get stageVideos() {
|
|
199
|
+
return vectorOf("flash.media::StageVideo", []);
|
|
200
|
+
}
|
|
201
|
+
/** Flash's four, each of which fails to get a Context3D, as Flash without a GPU (Stage3D.ts). */
|
|
202
|
+
get stage3Ds() {
|
|
203
|
+
stage3Ds ??= [0, 1, 2, 3].map(() => s.rt.construct(s.rt.classNamed("flash.display::Stage3D")));
|
|
204
|
+
return vectorOf("flash.display::Stage3D", stage3Ds, true);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
let focusRect = true;
|
|
208
|
+
let fullScreenSource = null;
|
|
209
|
+
let colorCorrection = "default";
|
|
210
|
+
let mouseLock = false;
|
|
211
|
+
let stage3Ds = null;
|
|
212
|
+
/** A Vector of the named class holding `values`. */
|
|
213
|
+
const vectorOf = (name, values, fixed = false) => {
|
|
214
|
+
const cls = s.rt.applyType(s.rt.classNamed("__AS3__.vec::Vector"), [s.rt.classNamed(name)]);
|
|
215
|
+
const o = cls.$it.instance();
|
|
216
|
+
o.$a = [...values];
|
|
217
|
+
o.$fixed = fixed;
|
|
218
|
+
return o;
|
|
219
|
+
};
|
|
220
|
+
avm2.registerNativeClass(natives, "flash.display::Stage", StageNatives);
|
|
221
|
+
const container = containerNatives(s);
|
|
222
|
+
for (const name of ["removeChildAt", "swapChildrenAt"]) {
|
|
223
|
+
natives[`flash.display::Stage#${name}`] =
|
|
224
|
+
container[`flash.display::DisplayObjectContainer#${name}`];
|
|
225
|
+
}
|
|
226
|
+
// Undocumented accessors Stage declares: null, and a write that changes
|
|
227
|
+
// nothing, as adl gives them. A JavaScript class cannot spell them.
|
|
228
|
+
natives["flash.display::Stage#get:constructor"] = avm2.plain(() => null);
|
|
229
|
+
natives["flash.display::Stage#set:constructor"] = avm2.plain(() => undefined);
|
|
230
|
+
return natives;
|
|
231
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// flash.display.Stage3D without Stage3D rendering: its position and
|
|
2
|
+
// visibility kept, and each request for a Context3D answered as Flash
|
|
3
|
+
// answers it without a GPU, an ErrorEvent #3702 in a later frame, so that
|
|
4
|
+
// content that falls back to the display list can.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { dispatchEvent } from "../../../scripting/events.js";
|
|
7
|
+
export function stage3DNatives(s) {
|
|
8
|
+
const natives = {};
|
|
9
|
+
const unavailable = (target) => {
|
|
10
|
+
s.loads.deferHostEvent(() => dispatchEvent(s, target, s.rt.construct(s.rt.classNamed("flash.events::ErrorEvent"), "error", false, false, "Error #3702: Context3D not available.", 3702)));
|
|
11
|
+
};
|
|
12
|
+
/** A position within -8192 to 8191; else ArgumentError 2006, as the corpus's `stage3d_x_y` has Flash's. */
|
|
13
|
+
const position = (v) => {
|
|
14
|
+
const n = s.rt.toNumber(v);
|
|
15
|
+
if (!(n >= -8192 && n <= 8191)) {
|
|
16
|
+
throw s.rt.error("ArgumentError", 2006);
|
|
17
|
+
}
|
|
18
|
+
return n;
|
|
19
|
+
};
|
|
20
|
+
class Stage3DNatives {
|
|
21
|
+
get context3D() {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
requestContext3D(_mode = "auto", _profile = "baseline") {
|
|
25
|
+
unavailable(this);
|
|
26
|
+
}
|
|
27
|
+
requestContext3DMatchingProfiles(profiles) {
|
|
28
|
+
if (profiles === null || profiles === undefined) {
|
|
29
|
+
throw s.rt.error("TypeError", 2007, "profiles");
|
|
30
|
+
}
|
|
31
|
+
unavailable(this);
|
|
32
|
+
}
|
|
33
|
+
get x() {
|
|
34
|
+
return this.$x ?? 0;
|
|
35
|
+
}
|
|
36
|
+
set x(v) {
|
|
37
|
+
this.$x = position(v);
|
|
38
|
+
}
|
|
39
|
+
get y() {
|
|
40
|
+
return this.$y ?? 0;
|
|
41
|
+
}
|
|
42
|
+
set y(v) {
|
|
43
|
+
this.$y = position(v);
|
|
44
|
+
}
|
|
45
|
+
get visible() {
|
|
46
|
+
return this.$visible ?? true;
|
|
47
|
+
}
|
|
48
|
+
set visible(v) {
|
|
49
|
+
this.$visible = !!v;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
avm2.registerNativeClass(natives, "flash.display::Stage3D", Stage3DNatives);
|
|
53
|
+
return natives;
|
|
54
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// What a Shader's kernel runs with, read from its ShaderData as adl reads
|
|
2
|
+
// it: each parameter's numbers and each input's image. A ShaderJob reads
|
|
3
|
+
// them as it starts; a ShaderFilter, a blend shader and a shader fill as
|
|
4
|
+
// they are set, and draw with those after, whatever the script sets later
|
|
5
|
+
// (the shader-filters and shader-blends cases).
|
|
6
|
+
import { PBJ_TYPE_SIZES, PBJ_TYPES, pbjFloatType, } from "../../../../format/index.js";
|
|
7
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
8
|
+
import { OUT_COORD } from "../../../bitmap/pixel-bender.js";
|
|
9
|
+
import { storeOf } from "./BitmapData.js";
|
|
10
|
+
import { programOf } from "./ShaderData.js";
|
|
11
|
+
import { shaderClasses } from "./ShaderInput.js";
|
|
12
|
+
/** A parameter value's number as its register takes it: float32, or an int as SSE truncates one. */
|
|
13
|
+
function numberOf(v, float) {
|
|
14
|
+
if (float) {
|
|
15
|
+
return Math.fround(v);
|
|
16
|
+
}
|
|
17
|
+
const t = Math.trunc(v);
|
|
18
|
+
return t >= -2147483648 && t <= 2147483647 ? t : -2147483648;
|
|
19
|
+
}
|
|
20
|
+
/** The kernel a Shader holds: its ShaderData's, or null for none. */
|
|
21
|
+
export function kernelOfShader(shader) {
|
|
22
|
+
const data = shader?.$data ?? null;
|
|
23
|
+
const kernel = data?.$kernel;
|
|
24
|
+
return data && kernel ? { data, kernel } : null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A parameter's numbers: those of the ShaderParameter of its name, where
|
|
28
|
+
* one of its type is there, else its default, as adl takes them; each a
|
|
29
|
+
* number, or ArgumentError 2004, as many as its type holds, 0 past the
|
|
30
|
+
* Array's end.
|
|
31
|
+
*/
|
|
32
|
+
export function parameterValues(s, data, p) {
|
|
33
|
+
const classes = shaderClasses(s);
|
|
34
|
+
const size = PBJ_TYPE_SIZES[p.type] ?? 0;
|
|
35
|
+
const float = pbjFloatType(p.type);
|
|
36
|
+
const own = data.$d.get(p.name);
|
|
37
|
+
let value;
|
|
38
|
+
if (s.rt.isInstance(own, classes.shaderParameter) && own.$type === (PBJ_TYPES[p.type] ?? null)) {
|
|
39
|
+
value = own.$value ?? null;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const fallback = p.metadata.filter((m) => m.key === "defaultValue").pop();
|
|
43
|
+
value = fallback && typeof fallback.value !== "string" ? s.rt.array([...fallback.value]) : null;
|
|
44
|
+
}
|
|
45
|
+
const values = [];
|
|
46
|
+
const items = s.rt.isInstance(value, classes.array) ? value.$a : [];
|
|
47
|
+
for (let k = 0; k < size; k++) {
|
|
48
|
+
if (k >= items.length) {
|
|
49
|
+
values.push(0);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const item = items[k];
|
|
53
|
+
if (typeof item !== "number") {
|
|
54
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
55
|
+
}
|
|
56
|
+
values.push(numberOf(item, float));
|
|
57
|
+
}
|
|
58
|
+
return values;
|
|
59
|
+
}
|
|
60
|
+
/** Every input parameter's numbers, but _OutCoord's, which each pixel sets. */
|
|
61
|
+
export function kernelValues(s, data, kernel) {
|
|
62
|
+
const values = new Map();
|
|
63
|
+
for (const p of kernel.parameters) {
|
|
64
|
+
if (!p.output && p.name !== OUT_COORD) {
|
|
65
|
+
values.set(p, parameterValues(s, data, p));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return values;
|
|
69
|
+
}
|
|
70
|
+
/** How a use takes its inputs' images: read as they are now, copied to draw with later, or checked alone. */
|
|
71
|
+
export const READ = 0;
|
|
72
|
+
export const COPY = 1;
|
|
73
|
+
export const CHECK = 2;
|
|
74
|
+
/**
|
|
75
|
+
* The copy of each input taken last, by its BitmapData's store, its Vector
|
|
76
|
+
* or its ByteArray: kept while a use holds it, and shared by the uses that
|
|
77
|
+
* take the same pixels (its store's version) or numbers (their hash), as a
|
|
78
|
+
* fill begun on every frame takes them, its texture with them.
|
|
79
|
+
*/
|
|
80
|
+
const copies = new WeakMap();
|
|
81
|
+
/** The copy of `source` kept for `version` and this size, else the one `make` makes, kept now. */
|
|
82
|
+
function shared(source, version, width, height, channels, make) {
|
|
83
|
+
const kept = copies.get(source);
|
|
84
|
+
const image = kept &&
|
|
85
|
+
kept.version === version &&
|
|
86
|
+
kept.width === width &&
|
|
87
|
+
kept.height === height &&
|
|
88
|
+
kept.channels === channels
|
|
89
|
+
? kept.image.deref()
|
|
90
|
+
: undefined;
|
|
91
|
+
if (image) {
|
|
92
|
+
return image;
|
|
93
|
+
}
|
|
94
|
+
const made = make();
|
|
95
|
+
copies.set(source, { version, width, height, channels, image: new WeakRef(made) });
|
|
96
|
+
return made;
|
|
97
|
+
}
|
|
98
|
+
/** A hash of `floats`' bits, FNV-1a, which says whether numbers taken again are the same. */
|
|
99
|
+
function hashOf(floats) {
|
|
100
|
+
const words = new Uint32Array(floats.buffer, floats.byteOffset, floats.length);
|
|
101
|
+
let h = 0x811c9dc5;
|
|
102
|
+
for (let i = 0; i < words.length; i++) {
|
|
103
|
+
h = Math.imul(h ^ words[i], 0x01000193);
|
|
104
|
+
}
|
|
105
|
+
return h >>> 0;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* An input's image, read now: a BitmapData's pixels, or as many floats
|
|
109
|
+
* as its size needs; a ByteArray's position is moved past them by
|
|
110
|
+
* `read`, once nothing refuses the job, as adl leaves it where it was
|
|
111
|
+
* then. `how` READ takes them as they are, COPY as a copy (shared, as
|
|
112
|
+
* `copies` keeps them) for a use that draws with them later, and CHECK
|
|
113
|
+
* only checks them, null.
|
|
114
|
+
*/
|
|
115
|
+
export function inputImage(s, data, name, channels, read, how = READ) {
|
|
116
|
+
const classes = shaderClasses(s);
|
|
117
|
+
const refuse = (id, ...args) => {
|
|
118
|
+
throw s.rt.error("ArgumentError", id, ...args);
|
|
119
|
+
};
|
|
120
|
+
const own = data.$d.get(name);
|
|
121
|
+
if (!s.rt.isInstance(own, classes.shaderInput)) {
|
|
122
|
+
refuse(2167);
|
|
123
|
+
}
|
|
124
|
+
const o = own;
|
|
125
|
+
const input = o.$input ?? null;
|
|
126
|
+
if (input === null) {
|
|
127
|
+
refuse(2164, name);
|
|
128
|
+
}
|
|
129
|
+
if (s.rt.isInstance(input, classes.bitmapData)) {
|
|
130
|
+
const store = storeOf(s, input);
|
|
131
|
+
const { width, height } = store;
|
|
132
|
+
switch (how) {
|
|
133
|
+
case CHECK:
|
|
134
|
+
return null;
|
|
135
|
+
case COPY:
|
|
136
|
+
return shared(store, store.version, width, height, channels, () => ({
|
|
137
|
+
width,
|
|
138
|
+
height,
|
|
139
|
+
pixels: store.readable.slice(),
|
|
140
|
+
channels,
|
|
141
|
+
}));
|
|
142
|
+
default:
|
|
143
|
+
return { width, height, pixels: store.readable, channels };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const width = o.$width ?? 0;
|
|
147
|
+
const height = o.$height ?? 0;
|
|
148
|
+
if (width <= 0 || height <= 0) {
|
|
149
|
+
refuse(2166, name);
|
|
150
|
+
}
|
|
151
|
+
// Allocated once the input is known to hold them, whatever size the script set.
|
|
152
|
+
const count = width * height * channels;
|
|
153
|
+
if (s.rt.isInstance(input, classes.vector)) {
|
|
154
|
+
const items = input.$a;
|
|
155
|
+
if (items.length < count) {
|
|
156
|
+
refuse(2165, name);
|
|
157
|
+
}
|
|
158
|
+
if (how === CHECK) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const floats = Float32Array.from(items.slice(0, count));
|
|
162
|
+
const image = { width, height, floats, channels };
|
|
163
|
+
return how === COPY
|
|
164
|
+
? shared(input, hashOf(floats), width, height, channels, () => image)
|
|
165
|
+
: image;
|
|
166
|
+
}
|
|
167
|
+
// From the start, whatever the position, which is left past what was read.
|
|
168
|
+
const bytes = avm2.bytesOf(s.rt, input);
|
|
169
|
+
if (bytes.length < count * 4) {
|
|
170
|
+
refuse(2165, name);
|
|
171
|
+
}
|
|
172
|
+
if (how === CHECK) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const floats = new Float32Array(count);
|
|
176
|
+
for (let i = 0; i < count; i++) {
|
|
177
|
+
floats[i] = bytes.view.getFloat32(i * 4, bytes.littleEndian);
|
|
178
|
+
}
|
|
179
|
+
read.push(() => {
|
|
180
|
+
bytes.position = count * 4;
|
|
181
|
+
});
|
|
182
|
+
const image = { width, height, floats, channels };
|
|
183
|
+
return how === COPY
|
|
184
|
+
? shared(input, hashOf(floats), width, height, channels, () => image)
|
|
185
|
+
: image;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* What a ShaderFilter, a blend shader or a shader fill draws with, read as
|
|
189
|
+
* it is set, and what applyFilter runs with: `bound` inputs, the first
|
|
190
|
+
* ones, are the use's own (a filter's object, a blend's background and
|
|
191
|
+
* foreground), and the rest must be set; each needs `bound` inputs at
|
|
192
|
+
* least (2167), and a filter and a blend a kernel of four channels out
|
|
193
|
+
* (2162). `how` takes its inputs' images (inputImage); CHECK takes no
|
|
194
|
+
* values either, and moves no ByteArray.
|
|
195
|
+
*/
|
|
196
|
+
export function shaderUse(s, shader, bound, how = COPY) {
|
|
197
|
+
const found = kernelOfShader(shader);
|
|
198
|
+
const { data, kernel } = found;
|
|
199
|
+
const outputs = kernel.parameters.filter((p) => p.output);
|
|
200
|
+
if (bound > 0 && outputs[outputs.length - 1]?.type !== 0x4) {
|
|
201
|
+
throw s.rt.error("ArgumentError", 2162);
|
|
202
|
+
}
|
|
203
|
+
if (kernel.inputs.length < bound) {
|
|
204
|
+
throw s.rt.error("ArgumentError", 2167);
|
|
205
|
+
}
|
|
206
|
+
const images = new Map();
|
|
207
|
+
const read = [];
|
|
208
|
+
for (const input of kernel.inputs.slice(bound)) {
|
|
209
|
+
const image = inputImage(s, data, input.name, input.channels, read, how);
|
|
210
|
+
if (image) {
|
|
211
|
+
images.set(input.index, image);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// A texture sampled that no input declares, as a job refuses it.
|
|
215
|
+
for (const texture of programOf(kernel).sampled) {
|
|
216
|
+
if (!kernel.inputs.some((input) => input.index === texture)) {
|
|
217
|
+
throw s.rt.error("ArgumentError", 2167);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (how === CHECK) {
|
|
221
|
+
return { kernel, values: new Map(), images };
|
|
222
|
+
}
|
|
223
|
+
const values = kernelValues(s, data, kernel);
|
|
224
|
+
for (const move of read) {
|
|
225
|
+
move();
|
|
226
|
+
}
|
|
227
|
+
return { kernel, values, images };
|
|
228
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// flash.events.Event's natives, which Flash Player's playerglobal has:
|
|
2
|
+
// its constructor's private native ctor keeps the type and flags, and
|
|
3
|
+
// dispatch sets the target, current target and phase in the fields they
|
|
4
|
+
// read (scripting/events.ts's eventFields). Ours keeps them all in AS3.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { AT_TARGET } from "../../../scripting/events.js";
|
|
7
|
+
export function eventNatives(s) {
|
|
8
|
+
const natives = {};
|
|
9
|
+
class EventNatives {
|
|
10
|
+
"flash.events:Event::ctor"(type, bubbles, cancelable) {
|
|
11
|
+
if (type == null) {
|
|
12
|
+
throw s.rt.error("TypeError", 2007, "type");
|
|
13
|
+
}
|
|
14
|
+
this.$type = String(type);
|
|
15
|
+
this.$bubbles = !!bubbles;
|
|
16
|
+
this.$cancelable = !!cancelable;
|
|
17
|
+
this.$target = null;
|
|
18
|
+
this.$currentTarget = null;
|
|
19
|
+
this.$phase = AT_TARGET;
|
|
20
|
+
this.$stopped = 0;
|
|
21
|
+
this.$prevented = false;
|
|
22
|
+
}
|
|
23
|
+
get type() {
|
|
24
|
+
return this.$type;
|
|
25
|
+
}
|
|
26
|
+
get bubbles() {
|
|
27
|
+
return this.$bubbles;
|
|
28
|
+
}
|
|
29
|
+
get cancelable() {
|
|
30
|
+
return this.$cancelable;
|
|
31
|
+
}
|
|
32
|
+
get target() {
|
|
33
|
+
return this.$target;
|
|
34
|
+
}
|
|
35
|
+
get currentTarget() {
|
|
36
|
+
return this.$currentTarget;
|
|
37
|
+
}
|
|
38
|
+
get eventPhase() {
|
|
39
|
+
return this.$phase;
|
|
40
|
+
}
|
|
41
|
+
stopPropagation() {
|
|
42
|
+
this.$stopped = Math.max(this.$stopped, 1);
|
|
43
|
+
}
|
|
44
|
+
stopImmediatePropagation() {
|
|
45
|
+
this.$stopped = 2;
|
|
46
|
+
}
|
|
47
|
+
preventDefault() {
|
|
48
|
+
if (this.$cancelable) {
|
|
49
|
+
this.$prevented = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
isDefaultPrevented() {
|
|
53
|
+
return this.$prevented;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
avm2.registerNativeClass(natives, "flash.events::Event", EventNatives);
|
|
57
|
+
return natives;
|
|
58
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// flash.events.EventDispatcher: listeners by type on the object itself,
|
|
2
|
+
// which the player's dispatch (scripting/events.ts) calls along a display
|
|
3
|
+
// object's parent chain. The player broadcasts its frame and activation
|
|
4
|
+
// events through it.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
import { dispatchEvent, displayOf } from "../../../scripting/events.js";
|
|
7
|
+
/** The events Flash broadcasts to every display object that listens, on the display list or not, target only. */
|
|
8
|
+
const BROADCAST = new Set(["enterFrame", "frameConstructed", "exitFrame", "render"]);
|
|
9
|
+
/**
|
|
10
|
+
* The events Flash broadcasts to every EventDispatcher that listens, display
|
|
11
|
+
* object or not, target only: the player's activation, which, unlike a
|
|
12
|
+
* frame's events, holds no listener alive (Scripting.activationTargets).
|
|
13
|
+
*/
|
|
14
|
+
const ACTIVATION = new Set(["activate", "deactivate"]);
|
|
15
|
+
function listeners(o) {
|
|
16
|
+
if (!o.$listeners) {
|
|
17
|
+
o.$listeners = new Map();
|
|
18
|
+
}
|
|
19
|
+
return o.$listeners;
|
|
20
|
+
}
|
|
21
|
+
/** An event type, declared String: refused as null, as Flash refuses it. */
|
|
22
|
+
function eventType(s, type) {
|
|
23
|
+
if (type === null || type === undefined) {
|
|
24
|
+
throw s.rt.error("TypeError", 2007, "type");
|
|
25
|
+
}
|
|
26
|
+
return type;
|
|
27
|
+
}
|
|
28
|
+
/** `fn` added to `o`'s listeners for `type`, as EventDispatcher.addEventListener adds it; whether it was new. */
|
|
29
|
+
export function addListener(s, o, type, fn, useCapture, priority) {
|
|
30
|
+
const key = eventType(s, type);
|
|
31
|
+
if (typeof fn !== "object" && typeof fn !== "function") {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const list = listeners(o).get(key) ?? [];
|
|
35
|
+
const capture = !!useCapture;
|
|
36
|
+
if (list.some((l) => l.fn === fn && l.capture === capture)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const listener = { fn, capture, priority: Number(priority) | 0 };
|
|
40
|
+
// Higher priority first; the same priority in the order added.
|
|
41
|
+
let at = list.length;
|
|
42
|
+
while (at > 0 && list[at - 1].priority < listener.priority) {
|
|
43
|
+
at--;
|
|
44
|
+
}
|
|
45
|
+
list.splice(at, 0, listener);
|
|
46
|
+
listeners(o).set(key, list);
|
|
47
|
+
// A display object listening for a frame event is broadcast to, wherever it is; any
|
|
48
|
+
// dispatcher listening for activation is, held weakly.
|
|
49
|
+
if (BROADCAST.has(key) && o.$display) {
|
|
50
|
+
s.broadcastTargets(key).add(o);
|
|
51
|
+
}
|
|
52
|
+
else if (ACTIVATION.has(key)) {
|
|
53
|
+
s.activationTargets(key).add(o);
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
/** `fn` taken from `o`'s listeners for `type`, as EventDispatcher.removeEventListener takes it. */
|
|
58
|
+
export function removeListener(s, o, type, fn, useCapture) {
|
|
59
|
+
const key = eventType(s, type);
|
|
60
|
+
const list = o.$listeners?.get(key);
|
|
61
|
+
const at = list?.findIndex((l) => l.fn === fn && l.capture === !!useCapture) ?? -1;
|
|
62
|
+
if (list && at >= 0) {
|
|
63
|
+
list.splice(at, 1);
|
|
64
|
+
if (list.length === 0 && BROADCAST.has(key)) {
|
|
65
|
+
s.broadcastTargets(key).delete(o);
|
|
66
|
+
}
|
|
67
|
+
else if (list.length === 0 && ACTIVATION.has(key)) {
|
|
68
|
+
s.activationTargets(key).delete(o);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function eventDispatcherNatives(s) {
|
|
73
|
+
const natives = {};
|
|
74
|
+
const typeOf = (type) => eventType(s, type);
|
|
75
|
+
class EventDispatcherNatives {
|
|
76
|
+
"flash.events:EventDispatcher::ctor"(target) {
|
|
77
|
+
this.$target = target ?? null;
|
|
78
|
+
}
|
|
79
|
+
addEventListener(type, fn, useCapture, priority) {
|
|
80
|
+
addListener(s, this, type, fn, useCapture, priority);
|
|
81
|
+
}
|
|
82
|
+
removeEventListener(type, fn, useCapture) {
|
|
83
|
+
removeListener(s, this, type, fn, useCapture);
|
|
84
|
+
}
|
|
85
|
+
hasEventListener(type) {
|
|
86
|
+
return (this.$listeners?.get(typeOf(type))?.length ?? 0) > 0;
|
|
87
|
+
}
|
|
88
|
+
willTrigger(type) {
|
|
89
|
+
const key = typeOf(type);
|
|
90
|
+
for (let o = this; o; o = displayOf(o)?.parent?.object ?? null) {
|
|
91
|
+
if ((o.$listeners?.get(key)?.length ?? 0) > 0) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
"flash.events:EventDispatcher::dispatchEventFunction"(event) {
|
|
98
|
+
return dispatchEvent(s, this, event);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
avm2.registerNativeClass(natives, "flash.events::EventDispatcher", EventDispatcherNatives);
|
|
102
|
+
return natives;
|
|
103
|
+
}
|