@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,139 @@
|
|
|
1
|
+
// BitmapData.encode's PNG: a file of IHDR, one IDAT and IEND, as Flash
|
|
2
|
+
// writes, RGBA for a transparent bitmap and RGB for an opaque one. The
|
|
3
|
+
// colours are divided out of alpha as Flash's encoder does it,
|
|
4
|
+
// floor(c * 256 / a) up to 255 (every alpha and value checked under adl),
|
|
5
|
+
// which is not getPixel32's rounding. The bytes need not be Flash's, only
|
|
6
|
+
// what they decode to: fast compression filters no row and deflates at
|
|
7
|
+
// level 1, as Flash does; otherwise each row takes the filter whose output
|
|
8
|
+
// sums smallest, libpng's heuristic, deflated at level 6 where Flash uses
|
|
9
|
+
// 9: a 1080p frame takes a quarter of the time for 1% more bytes.
|
|
10
|
+
import { zlibCompress } from "../../format/index.js";
|
|
11
|
+
const CRC = new Uint32Array(256);
|
|
12
|
+
for (let n = 0; n < 256; n++) {
|
|
13
|
+
let c = n;
|
|
14
|
+
for (let k = 0; k < 8; k++) {
|
|
15
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
16
|
+
}
|
|
17
|
+
CRC[n] = c >>> 0;
|
|
18
|
+
}
|
|
19
|
+
function crc32(bytes, start, end) {
|
|
20
|
+
let c = 0xffffffff;
|
|
21
|
+
for (let i = start; i < end; i++) {
|
|
22
|
+
c = CRC[(c ^ bytes[i]) & 0xff] ^ (c >>> 8);
|
|
23
|
+
}
|
|
24
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
25
|
+
}
|
|
26
|
+
/** `rect` of the store, clipped to it and not empty, as a PNG file. */
|
|
27
|
+
export function encodePng(store, rect, fast) {
|
|
28
|
+
const { x: x0, y: y0, width, height } = rect;
|
|
29
|
+
const channels = store.transparent ? 4 : 3;
|
|
30
|
+
const stride = 1 + width * channels;
|
|
31
|
+
const raw = new Uint8Array(stride * height);
|
|
32
|
+
const pixels = store.drawable;
|
|
33
|
+
for (let y = 0; y < height; y++) {
|
|
34
|
+
let j = y * stride + 1;
|
|
35
|
+
for (let i = (y0 + y) * store.width + x0, end = i + width; i < end; i++) {
|
|
36
|
+
const p = pixels[i];
|
|
37
|
+
const a = p >>> 24;
|
|
38
|
+
let r = (p >>> 16) & 0xff;
|
|
39
|
+
let g = (p >>> 8) & 0xff;
|
|
40
|
+
let b = p & 0xff;
|
|
41
|
+
if (a === 0) {
|
|
42
|
+
r = g = b = 0;
|
|
43
|
+
}
|
|
44
|
+
else if (a !== 255) {
|
|
45
|
+
r = Math.min(255, ((r << 8) / a) | 0);
|
|
46
|
+
g = Math.min(255, ((g << 8) / a) | 0);
|
|
47
|
+
b = Math.min(255, ((b << 8) / a) | 0);
|
|
48
|
+
}
|
|
49
|
+
raw[j++] = r;
|
|
50
|
+
raw[j++] = g;
|
|
51
|
+
raw[j++] = b;
|
|
52
|
+
if (channels === 4) {
|
|
53
|
+
raw[j++] = a;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!fast) {
|
|
58
|
+
filterRows(raw, stride, height, channels);
|
|
59
|
+
}
|
|
60
|
+
const data = zlibCompress(raw, fast ? 1 : 6);
|
|
61
|
+
const out = new Uint8Array(8 + 25 + 12 + data.length + 12);
|
|
62
|
+
const view = new DataView(out.buffer);
|
|
63
|
+
out.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
64
|
+
let at = 8;
|
|
65
|
+
const chunk = (type, length, write) => {
|
|
66
|
+
view.setUint32(at, length);
|
|
67
|
+
for (let k = 0; k < 4; k++) {
|
|
68
|
+
out[at + 4 + k] = type.charCodeAt(k);
|
|
69
|
+
}
|
|
70
|
+
write(at + 8);
|
|
71
|
+
view.setUint32(at + 8 + length, crc32(out, at + 4, at + 8 + length));
|
|
72
|
+
at += 12 + length;
|
|
73
|
+
};
|
|
74
|
+
chunk("IHDR", 13, (p) => {
|
|
75
|
+
view.setUint32(p, width);
|
|
76
|
+
view.setUint32(p + 4, height);
|
|
77
|
+
// 8 bits a channel, RGBA (6) or RGB (2), deflate, adaptive filtering, no interlace.
|
|
78
|
+
out.set([8, channels === 4 ? 6 : 2, 0, 0, 0], p + 8);
|
|
79
|
+
});
|
|
80
|
+
chunk("IDAT", data.length, (p) => out.set(data, p));
|
|
81
|
+
chunk("IEND", 0, () => { });
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Each row, its filter byte 0 as written, given the filter of the five
|
|
86
|
+
* whose output's bytes, taken as signed, sum smallest; rows are filtered
|
|
87
|
+
* bottom up, so each still sees the unfiltered row above it.
|
|
88
|
+
*/
|
|
89
|
+
function filterRows(raw, stride, height, bpp) {
|
|
90
|
+
const length = stride - 1;
|
|
91
|
+
const candidates = Array.from({ length: 5 }, () => new Uint8Array(length));
|
|
92
|
+
for (let y = height - 1; y >= 0; y--) {
|
|
93
|
+
const row = y * stride + 1;
|
|
94
|
+
const up = y > 0 ? row - stride : -1;
|
|
95
|
+
let best = 0;
|
|
96
|
+
let bestSum = Number.POSITIVE_INFINITY;
|
|
97
|
+
for (let f = 0; f < 5; f++) {
|
|
98
|
+
const out = candidates[f];
|
|
99
|
+
let sum = 0;
|
|
100
|
+
for (let i = 0; i < length; i++) {
|
|
101
|
+
const x = raw[row + i];
|
|
102
|
+
const a = i >= bpp ? raw[row + i - bpp] : 0;
|
|
103
|
+
const b = up >= 0 ? raw[up + i] : 0;
|
|
104
|
+
const c = up >= 0 && i >= bpp ? raw[up + i - bpp] : 0;
|
|
105
|
+
let v;
|
|
106
|
+
switch (f) {
|
|
107
|
+
case 0:
|
|
108
|
+
v = x;
|
|
109
|
+
break;
|
|
110
|
+
case 1:
|
|
111
|
+
v = x - a;
|
|
112
|
+
break;
|
|
113
|
+
case 2:
|
|
114
|
+
v = x - b;
|
|
115
|
+
break;
|
|
116
|
+
case 3:
|
|
117
|
+
v = x - ((a + b) >> 1);
|
|
118
|
+
break;
|
|
119
|
+
default: {
|
|
120
|
+
const p = a + b - c;
|
|
121
|
+
const pa = Math.abs(p - a);
|
|
122
|
+
const pb = Math.abs(p - b);
|
|
123
|
+
const pc = Math.abs(p - c);
|
|
124
|
+
v = x - (pa <= pb && pa <= pc ? a : pb <= pc ? b : c);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
out[i] = v;
|
|
128
|
+
const s = out[i];
|
|
129
|
+
sum += s < 128 ? s : 256 - s;
|
|
130
|
+
}
|
|
131
|
+
if (sum < bestSum) {
|
|
132
|
+
bestSum = sum;
|
|
133
|
+
best = f;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
raw[row - 1] = best;
|
|
137
|
+
raw.set(candidates[best], row);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Perlin noise as BitmapData.perlinNoise makes it: the reference
|
|
2
|
+
// implementation of SVG's feTurbulence, which Flash's matches, with an
|
|
3
|
+
// offset for each octave, as Ruffle ports it (turbulence.rs).
|
|
4
|
+
//
|
|
5
|
+
// Derived from https://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement,
|
|
6
|
+
// Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), under the W3C software
|
|
7
|
+
// license.
|
|
8
|
+
const RAND_M = 2147483647;
|
|
9
|
+
const RAND_A = 16807;
|
|
10
|
+
const RAND_Q = 127773;
|
|
11
|
+
const RAND_R = 2836;
|
|
12
|
+
const B_SIZE = 0x100;
|
|
13
|
+
/** Park and Miller's minimal standard seed: in [1, 2^31 - 2]. */
|
|
14
|
+
function setupSeed(seed) {
|
|
15
|
+
let s = seed;
|
|
16
|
+
if (s <= 0) {
|
|
17
|
+
s = -(s % (RAND_M - 1)) + 1;
|
|
18
|
+
}
|
|
19
|
+
if (s > RAND_M - 1) {
|
|
20
|
+
s = RAND_M - 1;
|
|
21
|
+
}
|
|
22
|
+
return s;
|
|
23
|
+
}
|
|
24
|
+
function random(seed) {
|
|
25
|
+
let result = RAND_A * (seed % RAND_Q) - RAND_R * Math.trunc(seed / RAND_Q);
|
|
26
|
+
if (result <= 0) {
|
|
27
|
+
result += RAND_M;
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* perlinNoise's set-up of `seed`: the lattice, and four channels'
|
|
33
|
+
* gradients, x and y interleaved, one after another; the frequencies,
|
|
34
|
+
* adjusted where stitching to tile a `width` by `height` image, and the
|
|
35
|
+
* tile in lattice cells at the first octave. The render module draws the
|
|
36
|
+
* noise of them (pixels.zig).
|
|
37
|
+
*/
|
|
38
|
+
export function perlinSetup(seed, base, stitching, width, height) {
|
|
39
|
+
const lattice = new Int32Array(B_SIZE + B_SIZE + 2);
|
|
40
|
+
const cells = (B_SIZE + B_SIZE + 2) * 2;
|
|
41
|
+
const gradients = new Float64Array(cells * 4);
|
|
42
|
+
let s = setupSeed(seed);
|
|
43
|
+
for (let c = 0; c < 4; c++) {
|
|
44
|
+
const g = gradients.subarray(c * cells, (c + 1) * cells);
|
|
45
|
+
for (let i = 0; i < B_SIZE; i++) {
|
|
46
|
+
lattice[i] = i;
|
|
47
|
+
for (let j = 0; j < 2; j++) {
|
|
48
|
+
s = random(s);
|
|
49
|
+
g[i * 2 + j] = ((s % (B_SIZE + B_SIZE)) - B_SIZE) / B_SIZE;
|
|
50
|
+
}
|
|
51
|
+
const length = Math.sqrt(g[i * 2] * g[i * 2] + g[i * 2 + 1] * g[i * 2 + 1]);
|
|
52
|
+
g[i * 2] /= length;
|
|
53
|
+
g[i * 2 + 1] /= length;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (let i = B_SIZE - 1; i > 0; i--) {
|
|
57
|
+
const k = lattice[i];
|
|
58
|
+
s = random(s);
|
|
59
|
+
const j = s % B_SIZE;
|
|
60
|
+
lattice[i] = lattice[j];
|
|
61
|
+
lattice[j] = k;
|
|
62
|
+
}
|
|
63
|
+
for (let i = 0; i < B_SIZE + 2; i++) {
|
|
64
|
+
lattice[B_SIZE + i] = lattice[i];
|
|
65
|
+
for (let c = 0; c < 4; c++) {
|
|
66
|
+
gradients[c * cells + (B_SIZE + i) * 2] = gradients[c * cells + i * 2];
|
|
67
|
+
gradients[c * cells + (B_SIZE + i) * 2 + 1] = gradients[c * cells + i * 2 + 1];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let [fx, fy] = base;
|
|
71
|
+
let stitchWidth = 0;
|
|
72
|
+
let stitchHeight = 0;
|
|
73
|
+
if (stitching) {
|
|
74
|
+
if (fx !== 0) {
|
|
75
|
+
const lo = Math.floor(width * fx) / width;
|
|
76
|
+
const hi = Math.ceil(width * fx) / width;
|
|
77
|
+
fx = fx / lo < hi / fx ? lo : hi;
|
|
78
|
+
}
|
|
79
|
+
// Not the reference's slip, which Ruffle keeps, the y frequency's floor from the x one (adl).
|
|
80
|
+
if (fy !== 0) {
|
|
81
|
+
const lo = Math.floor(height * fy) / height;
|
|
82
|
+
const hi = Math.ceil(height * fy) / height;
|
|
83
|
+
fy = fy / lo < hi / fy ? lo : hi;
|
|
84
|
+
}
|
|
85
|
+
stitchWidth = Math.trunc(width * fx + 0.5);
|
|
86
|
+
stitchHeight = Math.trunc(height * fy + 0.5);
|
|
87
|
+
}
|
|
88
|
+
return { lattice, gradients, fx, fy, stitch: stitching, stitchWidth, stitchHeight };
|
|
89
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// A script's clock that skips a spin on getTimer: a loop that only reads
|
|
2
|
+
// the clock until it reaches a time, as a game that caps its frame rate
|
|
3
|
+
// waits for the next frame. In Flash the wait costs nothing visible; in a
|
|
4
|
+
// browser it holds the main thread. Once a spin is told from other reads,
|
|
5
|
+
// each read moves the clock a small step on instead, so the wait ends at
|
|
6
|
+
// once, and the clock holds at the time it waited for until the real one
|
|
7
|
+
// passes it, the next frame with it (Player.advance). AS3's getTimer
|
|
8
|
+
// (scripting/timers.ts) and AVM1's (avm1/timers.ts) share one of these
|
|
9
|
+
// each, so both clocks skip alike.
|
|
10
|
+
/**
|
|
11
|
+
* The clock of one movie's scripts on a real clock: what getTimer tells,
|
|
12
|
+
* unrounded, and how far ahead of the real clock a spin has moved it.
|
|
13
|
+
*/
|
|
14
|
+
export class SpinClock {
|
|
15
|
+
elapsed;
|
|
16
|
+
/**
|
|
17
|
+
* How far a spin on getTimer in the running pass has moved the clock
|
|
18
|
+
* ahead of the real one, in ms; once the pass is over, `floor` holds it.
|
|
19
|
+
*/
|
|
20
|
+
skip = 0;
|
|
21
|
+
/** The least time the clock tells: where the last pass that skipped left it, until the real clock passes it. */
|
|
22
|
+
floor = Number.NEGATIVE_INFINITY;
|
|
23
|
+
/** The time getTimer last told, unrounded: a spin's steps go on from it. */
|
|
24
|
+
told = Number.NEGATIVE_INFINITY;
|
|
25
|
+
/** The spin's detection: the real time of the last call to getTimer, and of the run of calls. */
|
|
26
|
+
lastCall = Number.NEGATIVE_INFINITY;
|
|
27
|
+
windowStart = Number.NaN;
|
|
28
|
+
windowCalls = 0;
|
|
29
|
+
denseSince = Number.NaN;
|
|
30
|
+
/** Set while the running pass's calls to getTimer are a spin, each moving the clock a step. */
|
|
31
|
+
spinning = false;
|
|
32
|
+
/** Set once the running pass's dense calls came from more than one place: no spin in it. */
|
|
33
|
+
refused = false;
|
|
34
|
+
/** A call site being checked over the next calls, and how many are still to be checked. */
|
|
35
|
+
checking = "";
|
|
36
|
+
checks = 0;
|
|
37
|
+
/** Where the last spin called getTimer from: the same loop next time is known at once. */
|
|
38
|
+
site = null;
|
|
39
|
+
/** `elapsed`: the real clock's ms since the start, unrounded, never going back. */
|
|
40
|
+
constructor(elapsed) {
|
|
41
|
+
this.elapsed = elapsed;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What getTimer tells, unrounded: the real time, or past it by what a
|
|
45
|
+
* spin has skipped. Each call counts towards telling a spin.
|
|
46
|
+
*/
|
|
47
|
+
read() {
|
|
48
|
+
const real = this.elapsed();
|
|
49
|
+
let time = Math.max(real + this.skip, this.floor);
|
|
50
|
+
if (real - this.lastCall > SPIN_GAP) {
|
|
51
|
+
// A pause between calls: whatever ran was no spin, or the spin is over.
|
|
52
|
+
this.spinning = false;
|
|
53
|
+
this.checks = 0;
|
|
54
|
+
this.windowStart = real;
|
|
55
|
+
this.windowCalls = 0;
|
|
56
|
+
this.denseSince = Number.NaN;
|
|
57
|
+
}
|
|
58
|
+
this.lastCall = real;
|
|
59
|
+
if (this.spinning || this.spins(real)) {
|
|
60
|
+
// Each call a small step on from the last, so the wait ends within a
|
|
61
|
+
// step of its time, and the time read just after it is the same ms.
|
|
62
|
+
const next = Math.max(time, this.told + SPIN_STEP);
|
|
63
|
+
if (next - real <= MAX_SKIP) {
|
|
64
|
+
this.skip = next - real;
|
|
65
|
+
time = next;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Waiting longer than any frame limiter: it spins in real time, as it did.
|
|
69
|
+
this.spinning = false;
|
|
70
|
+
this.refused = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
this.told = time;
|
|
74
|
+
return time;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether the calls to getTimer up to this one make a spin, a loop that
|
|
78
|
+
* does nothing but read the clock until it reaches a time: at least
|
|
79
|
+
* SPIN_DENSITY calls a ms, for SPIN_MS on end, all from one place in the
|
|
80
|
+
* script. Code that times itself, or does work between its reads, calls
|
|
81
|
+
* it far less often; a profiler's begin and end are two places. A place
|
|
82
|
+
* that spun before is known after one dense window.
|
|
83
|
+
*/
|
|
84
|
+
spins(real) {
|
|
85
|
+
if (this.refused) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (this.checks === 0) {
|
|
89
|
+
this.windowCalls++;
|
|
90
|
+
if (this.windowCalls < SPIN_WINDOW) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const dense = real - this.windowStart <= SPIN_WINDOW / SPIN_DENSITY;
|
|
94
|
+
if (dense && Number.isNaN(this.denseSince)) {
|
|
95
|
+
this.denseSince = this.windowStart;
|
|
96
|
+
}
|
|
97
|
+
else if (!dense) {
|
|
98
|
+
this.denseSince = Number.NaN;
|
|
99
|
+
}
|
|
100
|
+
this.windowStart = real;
|
|
101
|
+
this.windowCalls = 0;
|
|
102
|
+
if (!dense) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Read on this one line alone: the stacks differ by where they were read.
|
|
107
|
+
const site = callSite();
|
|
108
|
+
if (this.checks > 0) {
|
|
109
|
+
this.checks--;
|
|
110
|
+
if (site !== this.checking) {
|
|
111
|
+
this.refused = true;
|
|
112
|
+
this.checks = 0;
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (this.checks > 0) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
this.site = site;
|
|
119
|
+
}
|
|
120
|
+
else if (site !== this.site) {
|
|
121
|
+
if (real - this.denseSince >= SPIN_MS) {
|
|
122
|
+
this.checking = site;
|
|
123
|
+
this.checks = SPIN_CHECKS;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
this.spinning = true;
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A pass is over: a spin's skip becomes the floor the clock holds at
|
|
132
|
+
* until the real clock passes it, and the next pass's calls start anew.
|
|
133
|
+
*/
|
|
134
|
+
settle() {
|
|
135
|
+
if (this.skip > 0) {
|
|
136
|
+
this.floor = Math.max(this.floor, this.elapsed() + this.skip);
|
|
137
|
+
this.skip = 0;
|
|
138
|
+
}
|
|
139
|
+
this.spinning = false;
|
|
140
|
+
this.refused = false;
|
|
141
|
+
this.checks = 0;
|
|
142
|
+
this.lastCall = Number.NEGATIVE_INFINITY;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* How far getTimer and the timers run ahead of the real clock, in ms,
|
|
146
|
+
* since a spin had the clock skip to the time it waited for: the frames
|
|
147
|
+
* wait for the real clock (Player.advance). Ends the pass that ran.
|
|
148
|
+
*/
|
|
149
|
+
ahead() {
|
|
150
|
+
this.settle();
|
|
151
|
+
return Math.max(0, this.floor - this.elapsed());
|
|
152
|
+
}
|
|
153
|
+
/** What the clock tells beyond the real clock at `real`: the timers' time keeps to getTimer's. */
|
|
154
|
+
lead(real) {
|
|
155
|
+
return Math.max(real + this.skip, this.floor) - real;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Calls to getTimer a spin's dense windows are counted in. */
|
|
159
|
+
const SPIN_WINDOW = 1024;
|
|
160
|
+
/**
|
|
161
|
+
* Calls a ms that a window must reach to be dense: a loop that only reads
|
|
162
|
+
* the clock makes 5,000 to 10,000 in Chrome, one with a microsecond's
|
|
163
|
+
* work between its reads at most 1,000.
|
|
164
|
+
*/
|
|
165
|
+
const SPIN_DENSITY = 1000;
|
|
166
|
+
/** Real ms of dense calls before a place not seen spinning before counts as a spin. */
|
|
167
|
+
const SPIN_MS = 2;
|
|
168
|
+
/** Consecutive calls whose place is checked to be the first's. */
|
|
169
|
+
const SPIN_CHECKS = 3;
|
|
170
|
+
/** Real ms between two calls that end a spin or a run of dense calls. */
|
|
171
|
+
const SPIN_GAP = 1;
|
|
172
|
+
/** How far each call in a spin moves the clock on, in ms: a wait overshoots its time by about that. */
|
|
173
|
+
const SPIN_STEP = 1 / 8;
|
|
174
|
+
/** The most a pass's spin moves the clock ahead of the real one, in ms. */
|
|
175
|
+
const MAX_SKIP = 1000;
|
|
176
|
+
/**
|
|
177
|
+
* Where getTimer was called from, the script's frames included, AS3's or
|
|
178
|
+
* AVM1's: the same loop's calls give the same, whatever depth they are at.
|
|
179
|
+
*/
|
|
180
|
+
function callSite() {
|
|
181
|
+
return new Error().stack ?? "";
|
|
182
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CONTENT, DisplayObject } from "./displayobject.js";
|
|
2
|
+
/** A Bitmap: a display object that shows a BitmapData's pixels, its bounds the data's size. */
|
|
3
|
+
export class BitmapObject extends DisplayObject {
|
|
4
|
+
shown = null;
|
|
5
|
+
smoothing = false;
|
|
6
|
+
pixelSnapping = "auto";
|
|
7
|
+
/** The SWF's bitmap it shows a copy of, placed by a timeline or made by its class; null for one a script made. */
|
|
8
|
+
character = null;
|
|
9
|
+
/** PlaceObject3's HasImage where a timeline placed it: Flash then takes a bound class for its data's. */
|
|
10
|
+
hasImage = false;
|
|
11
|
+
constructor(store) {
|
|
12
|
+
super();
|
|
13
|
+
this.store = store;
|
|
14
|
+
}
|
|
15
|
+
/** The store shown; the object watches it, so a pixel set marks the object for the renderer. */
|
|
16
|
+
get store() {
|
|
17
|
+
return this.shown;
|
|
18
|
+
}
|
|
19
|
+
set store(store) {
|
|
20
|
+
this.shown?.views.delete(this.ref);
|
|
21
|
+
this.shown = store;
|
|
22
|
+
store?.views.add(this.ref);
|
|
23
|
+
this.invalidate(CONTENT);
|
|
24
|
+
}
|
|
25
|
+
}
|