Commit Graph

7077 Commits

Author SHA1 Message Date
michiel2005 5fc2505c07 core: made text fields scrollable 2024-03-18 22:17:32 +01:00
michiel2005 ec99bedcf8 avm1: added mouse_wheel_enabled to text fields 2024-03-18 22:17:32 +01:00
Adrian Wielgosik 3c2d629e0d core: Cull text under textfield 2024-03-18 22:00:34 +01:00
TÖRÖK Attila 7a269c054d fix(deps): update rust dependencies 2024-03-18 12:21:47 +01:00
Crowdin Bot 8345ace97e chore: Update translations from Crowdin 2024-03-18 11:49:48 +01:00
Lord-McSweeney e7924e564b avm2: Fix some parameter types and signatures for XML 2024-03-17 20:01:19 -07:00
Adrian Wielgosik 27cd08deeb avm2: Provide an option to disable the optimizer 2024-03-16 22:40:15 +01:00
soonsouth abf7d3fa20 chore: remove repetitive words
Signed-off-by: soonsouth <cuibuwei@163.com>
2024-03-15 21:10:53 +01:00
Adrian Wielgosik 69ba551f0d avm2: Add extra type propagation to astype 2024-03-14 22:32:48 +01:00
Adrian Wielgosik 88e5f9a898 avm2: unify abstract type propagation 2024-03-14 22:32:48 +01:00
renovate[bot] 3f9f19b7ac fix(deps): update rust dependencies 2024-03-14 16:45:29 +01:00
sleepycatcoding c7a34bb7dd avm2: Set default for XML.elements `name` argument in AS
This makes it consistent with other methods on XML and XMLList.
2024-03-14 15:38:49 +01:00
sleepycatcoding 2a70f45423 avm2: Implement XMLList.elements 2024-03-14 15:38:49 +01:00
Tom Schuster eabf7a0d58 avm2: Add Namespace.prototype.toString 2024-03-13 22:26:47 +01:00
Tom Schuster 623dba6f1f avm2: Remove all to_string implementations except Object and Class.
Turns out the Vector to_string function that I added (#15562) was just duplicating what the
default implementation did. The Namespace one was just plain wrong.

Fixes #15474
2024-03-13 22:26:47 +01:00
Tom Schuster 09a7bd61b5 avm2: Fix Object.prototype.toString applied to Vector 2024-03-13 20:16:49 +01:00
Tom Schuster 8ec203a227 avm2: Add Function.prototype.toString and toLocaleString 2024-03-13 10:14:27 +01:00
Tom Schuster 3f17523879 avm2: Fix toString for primitive objects 2024-03-12 21:00:26 -07:00
Adrian Wielgosik dce71fdfcb avm2: Make Activation::from_builtin non-Result 2024-03-10 23:08:04 +01:00
Adrian Wielgosik 064cc14905 avm2: Reduce memcpy overhead in BytecodeMethod calls 2024-03-10 23:08:04 +01:00
Tom Schuster 53aee62c38 avm2: Re-implement RegExp.prototype.toString
Also remove the TObject to_string implementation that isn't necessary.
2024-03-10 21:27:39 +01:00
Lord-McSweeney 788c3da4aa avm2: Add a `make_error_1014` function and use it 2024-03-10 09:49:24 -07:00
Lord-McSweeney f76117a2be avm2: Better target class and target variable name handling for exceptions
Lookup on the target class and variable name is now done in the verifier.
2024-03-10 09:49:24 -07:00
Lord-McSweeney b5f7fa0cd0 swf: `CallMethod` takes a `disp_id`, not any sort of `Index` 2024-03-10 09:49:24 -07:00
Lord-McSweeney 028a61e744 avm2: Pre-pool multiname for `FindDef` 2024-03-10 09:49:24 -07:00
Lord-McSweeney fdf92a9f2d avm2: Also early lookup classes for `IsType` and `AsType` 2024-03-10 09:49:24 -07:00
Lord-McSweeney 51b9dcfb1d avm2: Pool strings in verifier 2024-03-10 09:49:24 -07:00
Lord-McSweeney b69eabfcdc avm2: Lookup multinames in verifier and store them in `Op` 2024-03-10 09:49:24 -07:00
Aaron Hill 7752c32c8e
avm2: Stub GameInput.getDeviceAt and GameInputControl (#15409) 2024-03-09 22:01:10 +00:00
Tom Schuster ed4bb00115 avm2: Stage.stage3Ds must return a vector
Fixes #15472
2024-03-07 19:33:09 +01:00
Lord-McSweeney 12ffc8a347 avm2: Remove unused and unnecessary `init_slot` 2024-03-06 20:49:19 -08:00
Nathan Adams 1a6b73f496 avm2: Use chrono's new Duration::try_ methods 2024-03-06 21:58:40 +01:00
renovate[bot] a916369f21 fix(deps): update rust dependencies 2024-03-06 21:58:40 +01:00
Lord-McSweeney 95b5c700f5 avm2: Fix a minor optimizer bug 2024-03-06 07:21:28 -08:00
Lord-McSweeney 24d194a8b1 avm2: Propagate normal error for bad Multiname read in verifier 2024-03-06 07:21:28 -08:00
Lord-McSweeney 9a1196a7a0 avm2: Fix bugs and resolve reviews 2024-03-06 07:21:28 -08:00
Lord-McSweeney c98d61c376 avm2: Add a `make_error_1021` function and use it 2024-03-06 07:21:28 -08:00
Lord-McSweeney f28928dbc9 avm2: Match verifier reading implementation with FP's 2024-03-06 07:21:28 -08:00
Kamil Jarosz c260a45603 core: Close sockets and timers when replacing the root movie
Turns out that the comment from `set_root_movie` was right all along!
`set_root_movie` should not be used when replacing the root movie,
because it will leave out unclosed resources.
This patch introduces `replace_root_movie`, which is dedicated to be
used when replacing (instead of just setting) the root movie.

The best solution would be to use RAII, e.g. destroy and recreate
the whole Player instance, but this patch is a first step towards
proper resource control.
2024-03-05 23:14:08 +01:00
Nathan Adams 09dfa6427e desktop: Allow changing the language in Preferences 2024-03-05 00:02:27 +01:00
renovate[bot] fae1c458ec fix(deps): update rust dependencies 2024-03-04 22:18:19 +01:00
TÖRÖK Attila 7f268bf50e chore: Update `wasm-bindgen` to `v0.2.92`, wasm-bindgen-futures to `v0.4.42` 2024-03-04 19:01:04 +01:00
TÖRÖK Attila 755fa6cded chore: Switch `fluent-templates` back from `master` to `v0.9.0` 2024-03-04 11:05:08 +01:00
TÖRÖK Attila 85dd258168 cleanup: Remove a stale workaround for a `generational-arena` bug 2024-03-03 21:18:39 +01:00
TÖRÖK Attila 8764c08b01 cleanup: Define distinct key types for different kinds of slotmaps 2024-03-03 21:18:39 +01:00
TÖRÖK Attila 5bfd8af257 cleanup: Rename `Handle` in `loader.rs` to `LoaderHandle` to follow convention 2024-03-03 21:18:39 +01:00
Adrian Wielgosik 17c5b38bb1 avm2: Only construct type_error on error in astype, instanceof 2024-03-03 20:58:54 +01:00
MrCheeze a119e3e130 core: Improve placement of cursor when clicking in textbox
Currently when clicking in a textbox, the cursor will only be placed
correctly if you click exactly on top of a letter. The basic purpose of
this commit is to make it so that clicking in the surrounding margin
will put the cursor in the closest available position, as in Flash Player.

The logic is a bit complex because a single row of text can contain
multiple layout boxes, each with a different Y offset (but all with the
same Y extent). To be accurate, we need to treat each layout box in the
row "as if" it had the same Y offset that the tallest box in its row has.

This commit also contains a fix for an issue where lower_from_text_spans
was passing the wrong text strings and indexes to fixup_line for
newlines, which needed to be fixed in order to be able to click to place
the cursor in an empty row that was created by newlines.
2024-03-02 20:30:50 +01:00
Lv Yitian 556d16302b
avm2: Implement flash.media.ID3Info (#14916) 2024-03-02 19:13:31 +00:00
TÖRÖK Attila 55773f0205 chore: Replace `generational-arena` with `slotmap` 2024-03-02 19:42:11 +01:00
renovate[bot] c2179e88db fix(deps): update rust dependencies 2024-03-02 10:05:43 +01:00
renovate[bot] 35d72115a4 fix(deps): update wasm-bindgen 2024-03-02 02:42:45 +01:00
renovate[bot] 6e84b05b66 fix(deps): update rust dependencies 2024-03-01 22:46:32 +01:00
TÖRÖK Attila 10fa4175c4 chore: Bump jpegxr and nellymoser-rs git references 2024-03-01 21:54:18 +01:00
Tom Schuster 0cea5a0a9e core: Introduce gamepad button mapping support 2024-02-28 21:21:09 +01:00
Kamil Jarosz f6907a5c73 desktop: Add tests for connect_socket
Add tests for ExternalNavigatorBackend::connect_socket.
2024-02-28 19:42:54 +01:00
Kamil Jarosz cc8b0aa5dd core: Use async channels in NavigatorBackend
This has several advantages:
1. it allows using async variants of send and recv,
2. it adds consistency as until now Receiver was async,
   and Sender was not.
2024-02-28 19:42:54 +01:00
Aaron Hill 3e99dd3999 core: Use latest fluent-templates `master` for reproducible builds 2024-02-27 21:36:28 -05:00
Aaron Hill 900a8407d6 core: Implement lazy decoding of bitmaps
We hit a pathological case in House
(https://github.com/ruffle-rs/ruffle/issues/15154),
where eagerly decoding bitmaps during preloading results in
over 10GB of ram being used.

With this PR, we store the compressed bitmap, and only decode it
each time we instantiate it. In order to support bitmap fills,
we store the decoded width/height and a lazily-initialized GPU handle
in `Character::Bitmap`
2024-02-27 21:18:18 -05:00
TÖRÖK Attila ee0c1f42ff core,avm2: Make Timer.setDelay not change the timer ID. Fix #15005. 2024-02-27 23:56:33 +01:00
renovate[bot] 9cdb2f31cc fix(deps): update rust dependencies 2024-02-26 08:14:26 +01:00
Lord-McSweeney 11d5a8f7df avm2: Resolve reviews (no functional changes) 2024-02-25 21:52:24 -08:00
Lord-McSweeney 8542edf10c avm2: Handle lazy multinames in optimizer 2024-02-25 21:52:24 -08:00
Lord-McSweeney b637e5f108 avm2: Add a `popn` function to `Stack` and use it 2024-02-25 21:52:24 -08:00
Lord-McSweeney 4d8c98af0d avm2: Don't use a `Class`'s first `ClassObject` for its VTable if more than one `ClassObject` had been constructed for the class 2024-02-25 21:52:24 -08:00
Lord-McSweeney a763842b1b avm2: Extract optimizer logic into a different file 2024-02-25 21:52:24 -08:00
Lord-McSweeney ba9a975685 avm2: Add `push_raw` for faster stack pushes 2024-02-25 21:52:24 -08:00
Lord-McSweeney b07c0a99ea avm2: Also optimize `CallProperty` to `CallMethod` when possible 2024-02-25 21:52:24 -08:00
Lord-McSweeney 22117e3eb5 avm2: Add more ops to optimizer and let it use resolved argument types 2024-02-25 21:52:24 -08:00
Lord-McSweeney 4da708edb8 chore: appease clippy 2024-02-25 21:52:24 -08:00
Lord-McSweeney e227576093 chore: cleanup 2024-02-25 21:52:24 -08:00
Lord-McSweeney d7cebd020b avm2: Support type inference for chained `GetProperty`s 2024-02-25 21:52:24 -08:00
Lord-McSweeney 8b19012123 avm2: Handle more ops in abstract optimizer 2024-02-25 21:52:24 -08:00
Lord-McSweeney 0cb0d4a6da avm2: More advanced optimizer 2024-02-25 21:52:24 -08:00
renovate[bot] 6b89737093 fix(deps): update rust dependencies 2024-02-19 11:32:22 +01:00
Crowdin Bot 29821e9c84 chore: Update translations from Crowdin 2024-02-19 10:38:26 +01:00
Tom Schuster ba7c9a4e31 avm2: Always serialize as ECMAArray, which produces an AMF0 MixedArray 2024-02-19 10:13:18 +01:00
Adrian Wielgosik fe2ed81d8a avm2: Implement JS->AS3 Object deserialization 2024-02-16 15:25:55 +01:00
renovate[bot] 1651b7a5b0 desktop: chore: Update `egui` to 0.26.2 2024-02-16 01:52:41 +01:00
Aaron Hill 1a1ce91e98 core: Only report socket connected just before we fire 'connect'
Platform Racing 3 relies on 'Socket.connected' reporting 'false'
immediately after calling 'Socket.connect' - it internally buffers
data made when 'Socket.connected' is false
2024-02-16 01:10:57 +01:00
Tom Schuster 49b3b9d7de avm2: Stub all flash.sampler methods 2024-02-14 14:10:41 +01:00
svitkin b55db7083c tests: Add test for flash.net.navigateToURL 2024-02-12 17:14:11 +01:00
svitkin 5028f66608 avm2: parse data for flash.net.navigateToURL (closes #13898) 2024-02-12 17:14:11 +01:00
Marco Bartoli 50a8815a50
avm2: Deserialize AMF dictionary (#15169) 2024-02-09 00:06:08 +01:00
Aaron Hill 71f828a3fd avm2: Use playerglobals domain as parent for `new ApplicationDomain()`
We were incorrectly using the stage domain as the parent, which caused
classes to be incorrectly shared between domains.
2024-02-07 20:13:23 -05:00
Tom Schuster d7c7716c34 avm2: Implement TextField::getLineText 2024-02-07 20:34:43 +01:00
David Wendt d7583289c9 avm1: Make `NetConnection.isConnected`'s stub more functional 2024-02-07 19:46:39 +01:00
Tom Schuster cadae9303f avm2: Verify the URLRequest method 2024-02-06 17:52:08 +01:00
sleepycatcoding 4c6f2ba973 avm2: Fix `in` operator not handling attributes in XML object 2024-02-05 21:09:39 +01:00
Tom Schuster ecda68b81c avm2: has_property should do proto.has_property instead of
has_own_property
2024-02-05 19:34:09 +01:00
TÖRÖK Attila 28c380cfac desktop: Update egui to 0.26.0 2024-02-05 19:05:10 +01:00
renovate[bot] 477440d387 fix(deps): update rust dependencies 2024-02-05 07:56:07 +01:00
Kamil Jarosz f3f8a4522e text: Add support for relative font sizes in HTML 2024-02-04 22:01:32 +01:00
_Mads b5d0c965f0
avm2: Implement TimerEvent.toString 2024-02-03 21:54:52 +00:00
Kamil Jarosz 50b5f29c0a text: Make enter add a new line in multiline fields 2024-02-03 13:40:07 +01:00
Aaron Hill b02a96373b debug_ui: Show ClassObjects for domain class
This re-uses our existing infrastructure for displaying
AVM2 Class objector. One minor limitation of this approach
is the inability to view a `Class` that hasn't yet had its
`ClassObject` created - however, this should be rare in practice.

We show a collapsing header with all of the ClassObjects associated
with the given Class.
2024-02-02 19:24:36 -08:00
Lord-McSweeney 603a76bab0 avm2: Add fast path for `Value::abstract_lt`-ing two integers 2024-02-01 17:03:57 -08:00
Nathan Adams 71c9de410d core: Clarify CPU vs GPU branch in BitmapData.draw 2024-02-02 00:59:45 +01:00
Nathan Adams bac78442fc core: Don't do bmd.draw() on cpu if it exists on gpu 2024-02-02 00:59:45 +01:00
Nathan Adams 70fbb4a7ac render: Move away from SyncHandle.retrieve_offscreen_texture to RenderBackend::resolve_sync_handle 2024-02-02 00:59:45 +01:00
Marco Bartoli 5ae3be3ac9
avm2: Ignore version marks in non-playerglobal namespaces 2024-02-01 21:50:26 +00:00
Kamil Jarosz 4154a0945d text: Implement advanced horizontal text controls for EditText 2024-02-01 20:18:29 +01:00
Kamil Jarosz 0657d2daa2 text: Add advanced horizontal text control codes 2024-02-01 20:18:29 +01:00
Kamil Jarosz b39919951b wstr: Add UTF-8/UTF-16 index mapping
Methods `utf8_index` and `utf16_index` from `WStrToUtf8`
may be used to map code unit indices between UTF-8 (str)
and UTF-16 (WStr) strings.
2024-02-01 20:18:29 +01:00
Nathan Adams 50dedc3cb9 avm1: Invalidate cacheAsBitmaps when using Color API 2024-02-01 19:27:33 +01:00
Lord-McSweeney 2ccad62378
core: Implement `focusIn` `FocusEvent` for AVM2 (#14723) 2024-02-01 08:22:36 +00:00
Aaron Hill 78873e3670 avm2: Add new 'stub-report' binary crate
This writes the AVM2 stub report to the specified path.
2024-01-31 20:22:06 -05:00
Nathan Adams 25b5c7b4e2 avm2: Track progress of avm2 and generate an implementation.json 2024-01-31 20:22:06 -05:00
Robert Setter abc8815445 avm1: Match random behaviour to avm2 2024-02-01 00:19:21 +01:00
Lord-McSweeney e656ebf6ac avm2: Stub `flash.system::MessageChannel` 2024-01-31 09:24:42 -08:00
Adrian Wielgosik 4971f5be2d avm2: Prevent chained dependent strings 2024-01-30 23:21:37 +01:00
Adrian Wielgosik ecbb0f92f1 avm2: Add small string store to interner, expand use 2024-01-30 23:21:37 +01:00
Adrian Wielgosik 7aa95fe463 avm2: Dependent strings POC 2024-01-30 23:21:37 +01:00
Aaron Hill 12c47047b8 debug_ui: Display 'Movie' button on 'Class Info' panel 2024-01-30 17:26:05 +01:00
renovate[bot] 3737725a21 fix(deps): update rust dependencies 2024-01-30 09:23:15 +01:00
Lord-McSweeney dbc1015ef5 avm2: Resolve review comments and fix verifier brokenness 2024-01-29 22:48:00 -08:00
Lord-McSweeney 8b29ceaafa avm2: Write a `make_error_1032` function and use it 2024-01-29 22:48:00 -08:00
Lord-McSweeney c1c3351654 avm2: `Op::Coerce` should not accept a 0-index `Multiname` 2024-01-29 22:48:00 -08:00
Lord-McSweeney fcf83d7dd9 avm2: Properly verify constant pool lookups for `Op::Coerce` and `Op::AsType` 2024-01-29 22:48:00 -08:00
Lord-McSweeney 442391ea60 avm2: Fix a minor bug where `CoerceD` was removed after `Inc`/`DecLocal` 2024-01-29 22:48:00 -08:00
Lord-McSweeney 7b853a8cd9 avm2: One more lazy multiname fix 2024-01-29 22:48:00 -08:00
Lord-McSweeney ce41362b1e avm2: Fix some potentially-failing unwraps and broken code in the verifier 2024-01-29 22:48:00 -08:00
Lord-McSweeney 50b752c35b avm2: Add longer comment to logic to determine register types 2024-01-29 22:48:00 -08:00
Lord-McSweeney dd35e4862f avm2: Fix crash when `Coerce`/`AsType` used a lazy multiname 2024-01-29 22:48:00 -08:00
Lord-McSweeney dd82126448 avm2: Optimize unnecessary `Coerce` when it comes after `PushString`, `NewArray`, and `NewFunction` 2024-01-29 22:48:00 -08:00
Lord-McSweeney f99c5621ee avm2: Add more ops that are guaranteed to not throw errors to `verify::ops_can_throw_error`
This requires a minor change to `Activation::op_lookup_switch`
2024-01-29 22:48:00 -08:00
Lord-McSweeney 6be4918d77 avm2: Resolve reviews 2024-01-29 22:48:00 -08:00
Lord-McSweeney e6c5ba51e4 avm2: Optimize `Coerce` out when it comes right after another `Coerce` pointing to the same cpool entry 2024-01-29 22:48:00 -08:00
Lord-McSweeney 28edee498b avm2: Make `verify_code_starting_from` use a worklist instead of running recursively
This fixes a stack overflow on one test.
2024-01-29 22:48:00 -08:00
Lord-McSweeney b4f016c1cd avm2: Add `CoerceU` op optimizations 2024-01-29 22:48:00 -08:00
Lord-McSweeney 30f99bcd19 avm2: Add optimizations for `Coerce` and `AsType` after `PushNull`, fix `optimize` panicking when out-of-bounds local registers are mentioned 2024-01-29 22:48:00 -08:00
Lord-McSweeney 3f76b248e9 avm2: Remove `Label` op since it is only relevant to the verifier, inline `CoerceA` and `Nop` 2024-01-29 22:48:00 -08:00
Lord-McSweeney 8e997f0131 avm2: Optimize a GetProperty after a GetLocal0 to GetSlot or CallMethod 2024-01-29 22:48:00 -08:00
Lord-McSweeney 8d3847b216 avm2: Add default xml namespace handling opcodes since several SWFs mention them but don't actually use them 2024-01-29 22:48:00 -08:00
Lord-McSweeney c4a3b3f49f avm2: Implement simple Op::CoerceX optimizations 2024-01-29 22:48:00 -08:00
Lord-McSweeney f9fb739460 avm2: Record all possible jump targets, remove Convert-B/D/I/U opcodes since those are equivalent to the corresponding CoerceX opcodes 2024-01-29 22:48:00 -08:00
Lord-McSweeney 2022321a03 avm2: Add an `Op` enum to AVM2; pre-pool double/uint/ints for `pushX` opcodes 2024-01-29 22:48:00 -08:00
Lord-McSweeney 65848104a6 avm2: Implement verifier based off Adrian's initial work 2024-01-29 22:48:00 -08:00
Aaron Hill 1cf669c75e avm2: Convert invalid rectangle to zero rectangle in getBounds 2024-01-29 13:25:16 -05:00
Aaron Hill f31d9bc491 avm2: Make Math.random() more closely match Flash Player
See the comments for details. Our previous implementation
was 'too good', and broke Bloons Tower Defense 5 by
generating `Number`s that Flash Player would never generate.
2024-01-28 22:46:19 -05:00
Fancy2209 f2880975ba
avm2: Report OS as Windows instead of Linux for now (#14985) 2024-01-28 22:10:54 +00:00
Aaron Hill 5b685d411f chore: Fix nightly Clippy lints 2024-01-28 16:03:29 -05:00
Tom Schuster b8d8aafe89 avm2: Implement the remaining flash.net.FileReference properties 2024-01-28 17:14:10 +01:00
Adrian Wielgosik 4981cbd89b avm2: Avoid double lookup in setPropertyIsEnumerable 2024-01-27 16:51:17 +01:00
Crowdin Bot 4769a45999 chore: Update translations from Crowdin 2024-01-26 22:54:04 +01:00
Tom Schuster 7a73dd0661 avm2: Only use embedded CFF fonts for TLF 2024-01-26 21:57:48 +01:00
sleepycatcoding 36fc30e283 debug_ui: Do not render container as collapsible if it has no children 2024-01-26 20:34:49 +01:00
Moulins ac7086528f avm1: Implement proper behavior for Gradient***Filter array setters
Among other things:
- resizing `colors` should also resize `alphas` and `ratios`
- shrinking `ratios` should also shrink `colors` and `alphas`, but
  growing it doesn't change the size
2024-01-26 18:40:06 +01:00
Moulins 19ff294e60 avm1: Follow FP 32 (not FP 11) behavior for ColorMatrix/ConvolutionFilter 2024-01-26 18:40:06 +01:00
Moulins bd2165bd0f swf: Properly read/write ConvolutionFilters; these contain f32s, not Fixed16s 2024-01-26 18:40:06 +01:00
Moulins 659917bff2 avm1: Fix inaccuracies in DisplacementMapFilter
- `mode` should reject non-lowercased values
- `mapPoint` should reset to `(0, 0)` when set to an invalid value
2024-01-26 18:40:06 +01:00
Moulins 5ef911abc9 avm1: Don't overwrite alpha when setting the color field on BitmapFilters 2024-01-26 18:40:06 +01:00
Kamil Jarosz ec345d20a5 core: Improve HTML handling for EditText and add support for SWF 6,7
This patch improves the logic of parsing and formatting HTML
for EditText, and adds support for SWF versions 6 and 7.

Examples of bugs fixed:
* invalid HTML: When generating HTML, Ruffle sometimes generated
  mismatched tags, e.g. tried to close a tag which was never opened.
* text outside of tags: sometimes, especially in case of multiline
  fields with multiple paragraphs, Ruffle generated proper tags,
  but the text was placed outside of them.
* BR/SBR closing issues: When opened, Ruffle waited for a close tag
  and ignored every other closing tag. BR/SBR do not need to be closed,
  so Ruffle often waited indefinitely.
* P/LI behavior: P and LI have a very peculiar behavior, but a very
  important one, because it influences the number of paragraphs/bullets
  and thus newlines for multiline fields.

Support for SWF 6,7:
* whitespace in SWF 6,7: SWF versions 6,7 ignore witespace-only text.
  This significantly influences the behavior of newlines and paragraphs.
* kerning in SWF 6,7: Enabling kerning in `<font>` works only for SWF 8+.
* multiline in SWF 6: FP 6 defines the `multiline` property, but it
  completely ignores it, and the field behaves as if it's always multiline.
2024-01-26 18:20:06 +01:00
Kamil Jarosz 5422792eb7 core: Add font and style structures for TextSpan
They make operating on text spans more natural, e.g. easy comparison.
2024-01-26 18:20:06 +01:00
Daniel Jacobs 119a093c27
web: Add allowFullscreen embed/object option (part of #4258) 2024-01-26 10:06:29 +00:00
Kamil Jarosz 62a46c7b60 core: Ignore font style in default TextFormat for HTML fields
It seems that font styles in the default text format
are ignored when dealing with an HTML field.

This patch revisits the fix from feacbdc1 (#13615),
which assumed that `<font>` resets font style.
That does not seem to be the case, but rather the bug
was caused by the invalid default text format,
which forced the text to be bold, due to the bold
variant of the font being linked to the text field.

This patch reverts 2f84d468 (#1201), which assumed that
the default color for a text span has 100% alpha.
The test added here contradicts it and it seems that
the default color is in fact rgba(0,0,0,0).
Testing the original SWF suggests that the underlying problem
has been fixed since that time.
2024-01-26 08:37:24 +01:00
David Wendt 4031659c9e core: Use the last processed tag time for stream time in case of buffer underruns. 2024-01-25 23:24:09 -07:00
David Wendt 56c14be708 core: Buffer overruns should not pause the stream unless we are actually at the end of the video. 2024-01-25 23:24:09 -07:00
David Wendt 14dec5dcce avm1: `bytesTotal` should actually get `bytesTotal` 2024-01-25 23:24:09 -07:00
David Wendt 092e20a1be core: Adding data to the buffer should reactivate the stream. 2024-01-25 23:24:09 -07:00
David Wendt 899e02fd82 core: Inform `NetStream` of the expected stream length.
`NetStream` uses this information to reserve stream buffer capacity. It also exposes this information to AVM via `bytesTotal`.
2024-01-25 23:24:09 -07:00
David Wendt 006c3af4b8 core: Add backend method for getting the expected length of a response. 2024-01-25 23:24:09 -07:00
David Wendt 08ee3ea638 core: Load all `NetStream` data in chunks. 2024-01-25 23:24:09 -07:00
David Wendt 91dd9563bb core: Add method to read downloads in chunks instead of all-at-once. 2024-01-25 23:24:09 -07:00
David Wendt 06eb2e1ee8 core: `Request` is now a trait. Body download is deferred to a second async method. 2024-01-25 23:24:09 -07:00
TÖRÖK Attila 36210c9f20 avm2: Add AIR-only constant `flash.ui.KeyLocation.D_PAD` 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 67674ba089 avm2: Add constant `flash.ui.GameInputDevice.MAX_BUFFER_SIZE` 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 8b9e490d2d avm2: Add remaining `StageVideoEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 6f5cf27d55 avm2: Add undocumented `IOErrorEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila c7b7f24a19 avm2: Add remaining, AIR-only `IOErrorEvent` constants 2024-01-25 22:44:41 +01:00
TÖRÖK Attila bb0c30a686 avm2: Add `flash.events.ActivityEvent.ACTIVITY` constant 2024-01-25 22:44:41 +01:00
TÖRÖK Attila 97c5394600 avm2: Add remaining `ClipboardFormats` constants 2024-01-25 22:44:41 +01:00
moulins 727a9a8334
avm2: Don't forget to set the state in `Avm2Button::set_state`
Fixes #14922. Also removes a redundant line. These regressed in #14820.
2024-01-25 21:20:25 +00:00
Tom Schuster 499dfc8990 avm2: Partially implement FileReferenceList with a single FileReference 2024-01-25 19:10:56 +01:00
Aaron Hill bb9e7c04f7 avm2: Fix handling of Loader.loadBytes for images
I've switched back to the original code for creating
the bitmap/bitmapdata, rather than relying on custom
initialization logic that we only used in loader.

To make sure that the Bitmap/BitmapData are only exposed
to ActionScript at the correct time, I've added a new flag
to control when 'LoaderInfo.content' becomes non-null
2024-01-25 10:35:28 -05:00
Lord-McSweeney 38d58552f2 nit: Fix some minor capitalization mistakes 2024-01-25 08:05:48 +01:00
Aaron Hill 820e7e828a wgpu: Allow Stage3D texture upload where source is smaller than dest
Fancy Pants World 4 relies on this behavior.
2024-01-25 00:30:10 +01:00
Aaron Hill 1cb24b41b0 render: Support PixelBender ByteArray/Vector.<Number> input/output
When ActionScript uses a ByteArray/Vector.<Number> as a shader input
or target, we create a temporary Rgba32Float texture, and copy the
input float32 bytes to/from the texture.

Unfortunately, wgpu doesn't seem to support an Rgb32Float (3-channel)
texture. When the shader uses 3 channels, we use a Rgba32Float
(4-channel) texture, and manually insert/remove padding for the
alpha channels. This isn't very efficient, but it's the simplest
solution.

The temporary textures themselves aren't cached anywhere - if this
becomes a performance issue, we could look into using some of our
existing wgpu texture/buffer pooling code.
2024-01-24 08:31:52 -05:00
Moulins 5f83b45692 avm2: Add `Avm2Button::all_state_children` to centralize button child ordering 2024-01-23 22:43:13 +01:00
Moulins e014d7c023 avm2: Use inner mutability instead of `GcCell` in `Avm2Button` 2024-01-23 22:43:13 +01:00
Moulins d1cbe46e25 avm1: Use inner mutability instead of `GcCell` in `Avm1Button` 2024-01-23 22:43:13 +01:00
Tom Schuster 07afb04896 avm2: Fix FileFilter description getter 2024-01-23 18:43:36 +01:00
Tom Schuster 3ddf0aec28 avm2: Implement FileReference save 2024-01-23 18:43:36 +01:00
Tom Schuster 9101ab322e avm2: Implement flash.net.FileReference size 2024-01-23 18:43:36 +01:00
Tom Schuster c73be131f0 avm2: Implement flash.net.FileReference name 2024-01-23 18:43:36 +01:00
Tom Schuster fff841a22e avm2: Implement FileReference browse 2024-01-23 18:43:36 +01:00
Tom Schuster e7b8b75d07 avm2: Basic FileReference object boilerplate 2024-01-23 18:43:36 +01:00
Aaron Hill dbcefd060f debug_ui: Add 'Show Domains' menu to view domains and classes
This opens a searchable list (similar to what we have for display
objects), which shows a tree of Domains and their associated classes.

Currently, clicking on the domain/class buttons doesn't do anything.
In a follow-up, I'm planning to add additional windows to display
information about a class.
2024-01-23 11:34:14 +01:00
Lv Yitian bebadb450f
avm2: Make `flash.system.Capabilities#playerType` return "Desktop" within the AIR runtime
Unless the SWF is loaded by an HTML page.
2024-01-23 07:45:11 +00:00
Aaron Hill c1fce1106f swf: Parse string as Vec<u8> instead of String in SWF
Some obfuscated SWFs may have invalid strings in their constant
pool - trying to immediately parse them as a utf-8 String throws
away information. Instead, we now store a `Vec<u8>`, which we
then use to construct an `AvmString` (or with `String::from_utf8_lossy`
for debug printing).
2024-01-22 21:50:45 -05:00
Aaron Hill 8dbcfe26f9 core: Display image load when using Loader.loadBytes
The handling of images in Loader.loaderBytes is similar to
the handling of SWFs - some of the data is exposed immediately
following the 'Loader.loadBytes' call, but the DisplayObject isn't
loaded until later.
2024-01-22 19:35:08 -05:00
Tom Schuster 173efbb77a avm2: Stub flash.desktop.Clipboard 2024-01-22 23:37:22 +01:00
sleepycatcoding 1804c23b93 avm2: Fix `Error.toString` regression
This was introduced by #14897, and to make sure this won't happen again I added a test.

Fixes #14901.
2024-01-22 19:34:12 +01:00
sleepycatcoding 2057417824 avm2: Implement `Error.prototype.toString`
And remove `ErrorObject::to_string` implementation. This fixes a few avmplus tests.
2024-01-22 15:09:55 +01:00
renovate[bot] 262dff83a4 fix(deps): update rust dependencies 2024-01-22 03:09:33 +01:00
cmdocmd c6331113ed
avm2: Stub `flash.text.engine.TextLine.getAtomIndexAtCharIndex` 2024-01-21 22:09:39 +01:00
Tom Schuster ab99eb3e09 avm2: Only lookup own properties in flash.net.getClassByAlias 2024-01-21 17:23:29 +01:00
cmdocmd 5cf9e00f9c
avm2: Stub XML::inScopeNamespaces 2024-01-20 14:27:27 -08:00
nosamu 379bed891f core: Invalidate cached bitmap on state change in AVM2Button 2024-01-20 11:53:19 +01:00
nosamu 284489b721 avm2: Stub Stage colorCorrection and colorCorrectionSupport 2024-01-20 11:35:28 +01:00
Tom Schuster c9c1326d13 avm2: Allow TLF to use embedded fonts when requested 2024-01-19 23:14:58 +01:00
Tom Schuster 0a6cf92a53 core: Implement DefineFont4 2024-01-19 23:14:58 +01:00
Tom Schuster e0f5b8906d desktop: Support device font with a non-zero index 2024-01-19 19:21:48 +01:00
Adrian Wielgosik 11fe70ab65 avm2: Fix possible overflow in address calculations 2024-01-18 23:35:03 +01:00
Tom Schuster 28b20322f0 avm2: Assume we have the default public namespace when matching XML names 2024-01-18 16:31:00 +01:00
TÖRÖK Attila 9aff953163 core: Make `Player::mutate_with_update_context` public 2024-01-18 09:00:40 +01:00
TÖRÖK Attila d153290fd6 nits: Fix a whole bunch of typos all over the place 2024-01-17 23:59:19 +01:00
Daniel Jacobs 8f2292c2c7 core: Add error for loading invalid SWF files and display as appropriate 2024-01-17 17:38:47 -05:00
Daniel Jacobs 5765177ba7 web: Properly panic when loading invalid SWF files (fix #14665) 2024-01-17 17:38:47 -05:00
Aaron Hill 97f868b8d5 avm2: Don't hold GcCell read ref open for Loader.loadBytes
We were holding this open while dispatching an event,
leading to a panic if anything attempted to modify the
ByteArray.
2024-01-17 17:05:52 -05:00
Tom Schuster b54a807b37 avm2: Handle explicitly imported/used namespace for XML lookup
Fixes #14792
2024-01-17 21:11:25 +01:00
Aaron Hill 6c420fa5d5 avm2: Run most of Loader.loadBytes immediately
This requires moving `set_root_movie` into `UpdateContext`.

Now, we preload the entire movieclip immediately - Flash Player
does this regardless of the size of the SWF.
The 'Loader::load_complete' is delayed to the end of the frame
(which is when the root class is constructed for the loaded clip).
2024-01-17 00:53:08 +01:00
Nathan Adams f65060e8c9 desktop: Update winit to 0.29.10 and egui to 0.25.0 2024-01-16 21:10:36 +01:00
zhenghaoz 5169d9db3d avm2: Fix multiply with overflow in `string_to_f64` 2024-01-15 23:44:14 -05:00
Lord-McSweeney 9637682216 avm1: Correctly access topmost `LoaderDisplay` or `Stage` instead of accessing the parent of `avm1_root`
This fixes a case where `lockRoot` is involved.
2024-01-15 17:15:36 -08:00
Tom Schuster 1b5eb2e8e2 avm2: Stub XML::namespaceDeclarations
Improves #14734
2024-01-15 19:50:09 -05:00
renovate[bot] 3c115238fd fix(deps): update rust dependencies 2024-01-16 01:13:38 +01:00
sleepycatcoding 5b19ecec97 avm2: Implement XML.setLocalName 2024-01-15 23:53:17 +01:00
renovate[bot] e0a22b56ce fix(deps): update wasm-bindgen 2024-01-15 17:24:02 -05:00
Abiel Deneke df3a033b77 avm2: Stub Accelerometer.isSupported 2024-01-15 22:10:58 +01:00
Kamil Jarosz 5bd643cd4f core: Improve caret blinking behavior
Caret now blinks only when idle.
2024-01-15 08:20:22 +01:00
nosamu a638715bd8 avm2: Throw null param error in navigateToURL
Fixes #14733
2024-01-14 20:17:31 +01:00
Aaron Hill 3cbfbdd4a6 avm2: Add weird parse-as-uint special case to Object keys
When handling dynamic properties, avmplus will always try to
parse the string key name as a uint. If it succeeds, then the
key will be stored internally as a integer (via Atom), which is
observable by property iteration. The intention appears to have
been to support `obj[25] = someVal`, but it causes `obj["25"]`
and `obj[25]` to map to the same key (though iterating over the
object's keys will always produce a `number`).
2024-01-13 19:47:58 -05:00
TÖRÖK Attila 55cdfab3d3 avm2: Add API versioning to DisplayObjectContainer 2024-01-13 19:35:54 +01:00
TÖRÖK Attila 4c1d59c4a3 avm2: Cleanup: Make `Domain::get_class` not return a `Result`
As it was always the `Ok` variant anyway.
2024-01-13 11:53:35 -05:00
Aaron Hill 195822885e avm2: Stub all remaining TextField methods and properties 2024-01-12 20:42:18 -05:00
Aaron Hill 639d17d259 Apply 'xml["@myattr"]' logic when setting/deleting properties
We previously only applied this when getting properties.
2024-01-12 19:13:35 -05:00
sleepycatcoding 2775c917bf avm2: Correctly handle `@*` in string_to_multiname 2024-01-13 00:27:28 +02:00
Tom Schuster 79c5112f45 core: Provide a better fallback for Ming typefaces 2024-01-12 21:59:20 +01:00
Kamil Jarosz 70486465e8 core: Support TextField.restrict when pasting 2024-01-11 23:22:49 +01:00
Kamil Jarosz 2ef63d3a61 avm2: Implement TextField.restrict 2024-01-11 23:22:49 +01:00
Kamil Jarosz 1c15cd55b9 avm1: Implement TextField.restrict 2024-01-11 23:22:49 +01:00
Kamil Jarosz 43d4c26b77 core: Implement restrict for EditText
EditTextRestrict models the `restrict` property, which is used
to specify which characters the user is allowed to type.
2024-01-11 23:22:49 +01:00
Kamil Jarosz 5ece6981ce core: Fix caret and selection rendering
This commit fixes issues with caret and selection rendering:
1. They had the wrong height and were rendered lower than expected
   for some fonts and sizes.
2. The caret was not being rendered at all when there was no text,
   but only when the text was set earlier and then deleted.
3. The selection was rendered with translate_x=-1,
   which caused overlap over some glyphs.
2024-01-11 23:04:02 +01:00
Nathan Adams e993f5ce46 core: Support F13..F24 keys 2024-01-11 22:40:37 +01:00
Tom Schuster 7498ed51d8 core: Font kerning is in points not pixels 2024-01-11 21:39:17 +01:00
Tom Schuster ae8c0148c2 core: Use sans instead of serif when missing a font 2024-01-11 10:35:47 +01:00
Kamil Jarosz 5feafb2ca3 avm1: Add support for onSetFocus & onKillFocus
Methods `onSetFocus` & `onKillFocus` are invoked when focus is changed
for `TextField`, `Button`, and `MovieClip`.
Multiple SWFs use these methods to listen to a focus change,
e.g. in order to implement placeholders for text fields.
2024-01-10 21:59:25 -05:00
Aaron Hill c01ab53d2e avm2: Stub flash.text.engine.GraphicElement 2024-01-10 21:29:33 -05:00
Aaron Hill db623a90e8 avm2: Stub TextField.getCharBoundaries 2024-01-10 20:35:29 -05:00
sleepycatcoding aeedec19fa avm2: Implement XML.normalize 2024-01-11 01:30:47 +01:00
Tom Schuster 82ce40af82 avm2: Optimize op_get_property index access on array-like 2024-01-10 23:18:40 +01:00
Tom Schuster 532279b4e6 avm2: Inline Avm2::peek 2024-01-10 23:18:40 +01:00
Nathan Adams d89e4536b3 core: Support Japanese font defaults 2024-01-10 23:15:26 +01:00
Aaron Hill 9a96941de9 avm2: Improve Graphics.drawGraphicsData stubs
We now produce stubs or clearer errors for unsupported argument
combinations, instead of unclear `RustError`s
2024-01-10 01:53:27 +01:00
Tom Schuster ba3d1bbf66 core: Don't treat known aliases as default fonts before trying to load them as device fonts 2024-01-10 00:41:31 +01:00
Tom Schuster b34d3c9ad2 core: Explicitly match and use default fonts, before loading device fonts 2024-01-08 23:00:18 +01:00
Nathan Adams 7e4ac986f2 core: Add FontFace struct, for loading a Font from a file binary 2024-01-08 23:00:18 +01:00
Aaron Hill 6c2e28a08f Correctly handle zero-frame MovieClip
A MovieClip with zero frames can still have a child added
through ActionScript, which ticks normally.
2024-01-08 08:19:17 -05:00
renovate[bot] a328deab11 fix(deps): update rust dependencies 2024-01-08 02:59:04 +01:00
Aaron Hill 47db84473a avm2: Improve handling of Stage3D profile
We now validate the passed in profile, and return the selected profile
from 'Context3D.profile'. We don't yet alter the available
registers/textures based on the profile.
2024-01-07 22:34:33 +01:00
Aaron Hill 3156bf31ce avm2: Throw correct errors in Graphics.[drawPath,drawGraphicsData]
This is pretty straightforward, except for the fact that Flash
completely ignores the provided commands when the 'data' vector
is empty (if 'data' has even a single entry, then Flash will validate
that all of the commands have the correct amount of data to run).

One SWF that I tested relies on this behavior.
2024-01-07 19:57:47 +01:00
Tom Schuster e0abe72da4 avm2: Stub more TextField getLine methods 2024-01-07 12:29:26 -05:00
nosamu 95ad0f103f avm2: Stub flash.globalization.DateTimeFormatter
Closes #14577
2024-01-06 23:41:53 -05:00
Aaron Hill b96cfed6c7 avm2: Stub TextField.getCharIndexAtPoint 2024-01-06 23:11:43 -05:00
TÖRÖK Attila f0ed5c7211 chore: Upgrade gc-arena to 0.5.0 2024-01-06 09:45:35 +01:00
Tom Schuster 7da3411fd0 avm2: Revert XML get_property_local to using has_explicit_namespace
This partly reverts #13966. No new test failure, but makes the add test
for `xml["@attr"]` pass.
2024-01-06 09:16:04 +01:00
Tom Schuster 79e0e8b2ae avm2: XML::name() needs to mark attributes as such 2024-01-06 09:16:04 +01:00
Kamil Jarosz 47deaf50a2 core: Fix non-ASCII characters input in EditText
Casting the character to u8 and back to char caused some non-ASCII
non-control characters to be treated as control characters.
For instance the letter "ą" (U+0105) after casting to u8 and back
became ENQ (U+0005) which is a control character.
Some other letters worked, for instance the letter "ł" (U+0142)
became "B" (U+0042) and was not classified as a control character.

The test edittext_input was added to verify this behavior.
2024-01-05 13:03:43 -08:00
TÖRÖK Attila 217585daa8 chore: Delegate `[lints]` in `Cargo.toml` of all packages to the workspace 2024-01-05 11:28:19 +01:00
Lord-McSweeney 89b7f7a6b8 avm2: Use correct null parameter error in `registerClassAlias` 2024-01-04 21:34:21 +01:00
Tom Schuster dd53b4e06b avm2: Reduce the size of Op on 64bit 2024-01-04 21:15:09 +01:00
Lord-McSweeney a7716bb744 avm2: Implement FP's logic for parsing XML with multiple nodes 2024-01-03 15:14:11 +01:00
Tom Schuster 8b414c48c7 avm2: Optimize Avm2::push/pop slightly 2024-01-02 20:37:05 +01:00
Tom Schuster c8901d43a4 avm2: Force inlining of do_next_opcode 2024-01-02 20:37:05 +01:00
renovate[bot] c47962fc71 fix(deps): update rust crate syn to 2.0.44 2024-01-01 04:29:05 +01:00
renovate[bot] 6a0a35c370 fix(deps): update rust dependencies 2024-01-01 02:44:40 +01:00
renovate[bot] 91d0520a43 fix(deps): update rust dependencies 2024-01-01 02:03:54 +01:00
Lord-McSweeney 9f8c6bb703 avm1: Correctly handle a missing name when trying to lookup child of `ChildContainer` by that name 2023-12-31 07:06:08 +03:00
Daniel Jacobs 51254e16d1 web: Use unwrap_or_default for the PlayerRuntime instead or map_err 2023-12-30 17:58:36 -05:00
Daniel Jacobs 27849b5cdc web: Add playerRuntime option to config for air or flashPlayer 2023-12-30 17:58:36 -05:00
Aaron Hill 583327ff62 avm2: Properly set LoaderInfo.contentType from sniffed type 2023-12-29 18:40:25 -05:00
sleepycatcoding 41fb30a6a9 avm2: Do not set dispatched flag if dispatcher does not have a listener 2023-12-29 07:31:53 +03:00
Tom Schuster 28a3c7178a avm2: Check the text.engine.FontDescription properties before setting 2023-12-26 23:16:27 +01:00
Tom Schuster 973a81a40e avm2: Support more ElementFormat font options in TextBlock 2023-12-26 19:19:58 +03:00
Tom Schuster b44eed8350 avm2: Micro-optimize coerce_to_i32/u32 2023-12-26 18:50:08 +03:00
TÖRÖK Attila 2647c192d9 chore: Stop allowing, and fix lint `clippy::explicit_auto_deref` 2023-12-25 19:20:53 -05:00
TÖRÖK Attila badac4176c chore: Stop allowing previously buggy lint `clippy::extra_unused_type_parameters`
The corresponding Clippy issue was fixed long ago.
2023-12-25 19:20:53 -05:00
Aaron Hill f60ba00240 avm2: Show FunctionObject name in Debug impl 2023-12-25 12:49:32 -05:00
renovate[bot] 216a8f3b14 fix(deps): update rust dependencies 2023-12-25 10:09:07 +01:00
Lord-McSweeney a7145380ac avm2/core: Implement basic SWF-local `LocalConnection`
Also implement `LocalConnection.isSupported` (namespace versioned to SWFv10+)
2023-12-23 15:46:03 -05:00
Crowdin Bot 9523022cdd chore: Update translations from Crowdin 2023-12-23 13:26:37 +01:00
TÖRÖK Attila 1569ecfeae chore: Fix a beta clippy lint in avm2: `clippy::ptr-arg` 2023-12-23 13:06:47 +01:00
Tom Schuster 704bd7502e core: Do exact matching for device fonts first, because we might be able to load bold/italic variants 2023-12-22 13:47:48 +01:00
Tom Schuster e3d8a279ad core: load_device_font register function must be &mut 2023-12-22 13:47:48 +01:00
nosamu 4f62e7de47 avm1: Implement String.charCodeAt() SWFv5 behavior 2023-12-20 10:38:17 -08:00
nosamu 95851e6e9a avm1: Implement undocumented SWFv5 string split behavior 2023-12-20 10:38:17 -08:00
nosamu d443bd9def avm1: Correctly handle undefined delimiter in String.split() 2023-12-20 10:38:17 -08:00
Aaron Hill 5c37533761 avm2: Avoid marking interface method definitions with VM_INTERNAL
Our asc.jar doesn't seem to apply a version suffix to namespaces for
interface method definitions. This was causing these methods to
get marked as VM_INTERNAL when we loaded playerglobals, preventing SWF
from invoking these methods through the interface (e.g. having a
variable of type `IEventDispatcher`, and calling `dispatchEvent` on it)
2023-12-18 21:50:34 +01:00
nosamu 98ebc339b4 core: Use i32 for font ascent and descent 2023-12-18 09:31:53 +01:00
renovate[bot] 0e5ef32654 fix(deps): update rust dependencies 2023-12-18 08:16:28 +01:00
Lord-McSweeney ecfb3b1c4c core/avm1: Improve some stubs
Add `Avm1Constructor` stub and use it in `NetConnection`; only log a stub warning in `run_inner_goto_frame` if movie is AVM2
2023-12-17 13:01:23 -08:00
zhenghaoz e89f458df8 avm2: Add missing property objectEncoding to SharedObject 2023-12-17 13:23:06 +01:00
Aaron Hill 287ca8801a avm2: Implement AIR playerglobal versioning
This builds on our existing playerglobal versioning support
to add in AIR versioning. We closely follow the avmplus implementation:

* When an SWF is loaded, we chose either a FlashPlayer or AIR
APIVersion for its SWF version, based on our configured player runtime.
* When loading playerglobals, we look at the player runtime. In AIR
  mode, we map FlashPlayer-versioned definitions to the closest AIR
  version. This ensures that all runtime APIVersions are in the
  same series (either AIR or FlashPlayer). In FlashPlayer mode,
  all AIR-versioned definitions get mapped to VM_INTERNAL, hiding
  them from user code.

Part of our existing api versioning code was implemented incorrectly.
Within playerglobals, we need to treat all unmarked namespaces as
VM_INTERNAL - this allows things like playerglobal script
initializer "initproperty" opcodes to see any VM_INTERNAL AIR
definitions (when we run under FlashPlayer mode). Previously, we
were using AllVersions, which would result in those VM_INTERNAL
definitions being hidden from other playerglobal code, which is
not correct.

Using this support, I've added a stub for the AIR-only
'flash.net.DatagramSocket'. I've also extended the test framework
with a new 'player_options.runtime' config option, which can be
set to "AIR" or "FlashPlayer" to configure the test runtime mode.

I've also added two new tests:
* 'air_hidden_lookup' runs under the FlashPlayer runtime, and verifies
  that a list of classes (currently just "DatagramSocket" are
  inacessible).
* 'air_datagram_socket', which uses `player_options.runtime = "AIR"`
  to construct an instance of `flash.net.DatagramSocket`. We can
  extend this test once we implement more of `DatagramSocket`

With this commit, we have all of the needed infrastructure to start
implementing and testing AIR-only classes and methods.
2023-12-16 19:11:50 -05:00
Lord-McSweeney 375c99e601 core: More mixed AVM fixes, improve test
This commit breaks mixed AVM without #13889.
2023-12-16 19:40:57 +01:00
Lord-McSweeney 7461c03049 core: More fixes for mixed AVM 2023-12-16 19:40:57 +01:00
Robin Allen f427cd58bb
core: Fix mouse coords reported to ActionScript (#14243)
The order in which Flash Player concatenates matrices causes reported
mouse coords to often be rounded.
2023-12-15 23:37:52 +00:00
sleepycatcoding d21be2091b avm2: Remove ArrayObject `to_string` impl
This was causing the `Object.prototype.toString` to throw error 1050,
instead of returning `[object Array]`, which was causing quite a few avmplus test failures.
2023-12-15 23:36:33 +01:00
MrCheeze 0f6dae56b5 core: Improve spacing of device font letters (close #14185) 2023-12-15 20:14:08 +01:00
Tom Schuster c43f76eb2b avm2: Stub InteractiveObject needsSoftKeyboard and softKeyboardInputAreaOfInterest 2023-12-14 23:13:18 +01:00
TÖRÖK Attila 906433e049 core: Clean up Timers::remove, remove Timer::is_alive
Now that we have BinaryHeap::retain, stable since Rust 1.70.
2023-12-14 18:47:39 +01:00
TÖRÖK Attila bf9cf92af8 render/wgpu: Update wgpu to 0.18.0, naga to 0.14.1, naga_oil to 0.11.0, egui to 0.24.1 2023-12-14 01:36:42 +01:00
michiel2005 f28270376f avm1: Implement TextField.maxChars and fix pasting behavior 2023-12-12 14:06:14 -05:00
renovate[bot] 3a033f0f28 fix(deps): update rust dependencies 2023-12-11 15:51:12 +01:00
renovate[bot] e196a544dd fix(deps): update rust crate bitstream-io to v2 2023-12-11 11:25:12 +01:00
Matt Trescott 06646bc4b8 avm1: Support FLV date conversion
Fixes Riva Web Player crash (rivavx.de)
2023-12-10 22:30:39 -07:00
TÖRÖK Attila 512a03815d core/avm1: Stub NetConnection 2023-12-10 15:56:54 -07:00
David Wendt 9c3d197e2f core: FLV must always backseek after finding our target otherwise we miss the keyframe. 2023-12-09 12:19:10 -07:00
David Wendt f1a1299707 core: Don't execute no-op seeks. 2023-12-09 12:19:10 -07:00
sleepycatcoding 742ccaf705 avm2: Correctly set the return type of AS defined native methods
Previously, the return type of ActionScript defined native methods was always incorrectly set to the any (`*`) type.
2023-12-09 18:32:31 +01:00
Lord-McSweeney 8096146a0d avm1: Correctly mark unloaded movies as unloaded instead of relying on depth 2023-12-09 00:29:37 +01:00
Tom Schuster 8688d4da21 avm2: Stub flash.text.engine.FontDescription::isFontCompatible 2023-12-08 16:16:15 -05:00
Tom Schuster 06e33c104d avm2: Implement TextLine::textWidth and TextLine::textHeight 2023-12-08 19:15:01 +01:00
renovate[bot] 40b92e69f7 fix(deps): update rust dependencies 2023-12-05 21:08:16 +01:00
renovate[bot] a0c33382bf fix(deps): update wasm-bindgen 2023-12-04 12:08:22 +01:00
TÖRÖK Attila 82d61faa2c avm2: Use explicitly wrapping integer arithmetic operations 2023-12-03 16:34:27 +01:00
Aaron Hill 19c3df7cb6 avm2: Perform early allocation and exposing of SimpleButton object
The allocated-but-unconstructed object should be set on
the parent field before we construct the 'up state' object - this
is observable by ActionScript
2023-11-30 12:49:32 -08:00
MrCheeze 9f6ab2b7c6 core: Allow default fonts to use bold/italic fonts 2023-11-30 21:04:41 +01:00
Lord-McSweeney 1ce3ec636a avm2: Prevent `AVM1Movie`s from being moved around in the DO hierarchy 2023-11-30 07:12:37 -08:00
Lord-McSweeney 889c13f7c6 core: Remove leftover `avm2_avm1movie` 2023-11-30 07:12:37 -08:00
Lord-McSweeney 24c9f9386f core: Resolve review comments (no functional changes) 2023-11-30 07:12:37 -08:00
Lord-McSweeney f458a391fc avm2: Use caller movie when creating a `Bitmap` 2023-11-30 07:12:37 -08:00
Lord-McSweeney 7e145d7c7c core: Don't run DoABC(2) tags when the root movie is AVM1
KOF vs DNF relies on this.
2023-11-30 07:12:37 -08:00
Lord-McSweeney 8e1f145aba core: Use correct movie version for `Bitmap` DOs 2023-11-30 07:12:37 -08:00
Lord-McSweeney 5c04925ebc core/avm1: Remove usage of `context.stage` in a few places 2023-11-30 07:12:37 -08:00
Lord-McSweeney 23f7291a52 core: Immediately post-instantiate an AVM1 MovieClip being loaded by AVM2 2023-11-30 07:12:37 -08:00
Lord-McSweeney a71bfe777c avm2: Fix building after rebase, fix `AVM1Movie`, use `Avm2Activation::caller_movie_or_root` where appropriate 2023-11-30 07:12:37 -08:00
Lord-McSweeney fb8bde252f core/avm2: Hook up AVM1Movie 2023-11-30 07:12:37 -08:00
Lord-McSweeney 7eb3c3be0c core: Remove NotAvm2 AVM2 mouse pick enum option since it is equivalent to Miss 2023-11-30 07:12:37 -08:00
Lord-McSweeney cdbb08b4ee core: Remove context.is_action_script_3 2023-11-30 07:12:37 -08:00
Lord-McSweeney 58f33b6b94 core: Provide global domain for loading movies without avm2_data. 2023-11-30 07:12:37 -08:00
Lord-McSweeney 6eba8a6444 core: Use current movie instead of root movie in Avm1Button.event_dispatch 2023-11-30 07:12:37 -08:00
Lord-McSweeney 2553b1acdb core: Set movie of Stage's ChildContainer when Stage's movie is set 2023-11-30 07:12:37 -08:00
Lord-McSweeney 45f6dfdbd4 core: Remove some uses of context.swf 2023-11-30 07:12:37 -08:00
Lord-McSweeney fd538915b3 core: Change some uses of Avm1Activation::from_stub to from_nothing 2023-11-30 07:12:37 -08:00
Lord-McSweeney 43fdd30fc1 core: Improve mouse picking for mixed AVM 2023-11-30 07:12:37 -08:00
Lord-McSweeney 9e2b49f857 core: Remove most uses of context.is_action_script_3() 2023-11-30 07:12:37 -08:00
David Wendt 6d77fea750 avm1, avm2: Convert Object to AVM values as well 2023-11-28 18:53:01 -07:00
David Wendt 204bdbf74c avm1: Implement strict array conversion for AVM1, too. 2023-11-28 18:53:01 -07:00
Lord-McSweeney 0a4d1449fc avm2: Implement StrictArray conversion for FLV script data 2023-11-28 18:53:01 -07:00
David Wendt ab02e89b3b core: FLV's Strict Array type holds values, not key/value pairs.
*draws a zero on the 'days since last misdocumented feature' sign*
2023-11-28 18:53:01 -07:00
renovate[bot] 6da223a875 fix(deps): update rust dependencies 2023-11-27 09:44:47 +01:00
Aaron Hill 24aa9b8fe4 avm2: Copy data for async loadCompressedTextureFromByteArray
The caller might modify the ByteArray immediately after the call,
so we need to copy the ByteArray.
2023-11-25 19:11:54 -08:00
TÖRÖK Attila 941f87ca8e core/audio: Remove the now unused clip_frame parameter of start_stream 2023-11-26 03:51:28 +01:00
TÖRÖK Attila 8ce95d76fe core/audio: Remove the now unused stream_handle parameter of start_stream 2023-11-26 03:51:28 +01:00
TÖRÖK Attila 23960883f8 core/audio: Remove the now dummy is_loading_complete 2023-11-26 03:51:28 +01:00
TÖRÖK Attila ca8de7b791 core/avm2: Add sampledataevent to globals 2023-11-26 03:51:28 +01:00
Aaron Hill 993d8d9f9b core: Add PlayerRuntime::{FlashPlayer, AIR} for Adobe AIR support
We've now had two different bug reports involving Adobe AIR
SWFs, so I'm going to go ahead and start adding a framework
for AIR support.

This commit just adds a command-line option
`--player-runtime <flash-player|air>` (defaulting to `flash-player`),
and passes it along to the `Player`. The actual value is currently
unused - in a follow-up PR, I'm going to implement namespace versioning
for AIR.
2023-11-25 19:05:51 -05:00
Aaron Hill e0998642f6 core: Divide by 255 in blend_over calculation
This prevents the value from being changed when blending a
source pixel of 0x0 over a destination pixel (with alpha).
2023-11-25 22:29:30 +01:00
Lord-McSweeney f41059a60a avm2: Version-gate `JSON` to SWFv13 and above 2023-11-25 13:15:42 -08:00
Aaron Hill f12f457f5d avm2: Fix handling of public indices with nested iteration
This more closely aligns our code with the corresponding avmplus code.
A user-supplied index of '0' is special-cased, and we correctly
resume iteration when a public index mismatch is detected.
2023-11-25 21:34:48 +01:00
Tom Schuster a2021cd3e2 avm2: Remove dead init_display_object fn 2023-11-25 11:38:08 -05:00
MrCheeze 5920a6426e core: Allow Regular/Bold/Italic device fonts to be registered separately 2023-11-24 17:08:35 +01:00
Tom Schuster 96059a8e25 avm2: Implement flash.system.Security pageDomain 2023-11-23 19:55:32 +01:00
Lord-McSweeney d3489ef1f3 avm2: Implement URLLoader for VARIABLES data format 2023-11-23 19:40:28 +01:00
sleepycatcoding 7be2eae4b8 avm2: Implement QName enumeration 2023-11-23 19:25:08 +01:00
Aaron Hill c920ceba51 avm2: Set RUNNING_CONSTRUCT_FRAME flag inside DisplayObject ctor
This ensures that this flag is set regardless of whether the
object is constructed by the timeline or from ActionScript
(it was previously only set when constructed by the timeline).
2023-11-23 10:36:37 -05:00
Robin Allen cad162121b
core: Fix MorphShape inaccuracy on complex paths (#14089)
* core: Fix MorphShape inaccuracy on complex paths

It's inaccurate to interpolate the moveTo/lineTo deltas individually
because on complex paths they're often small integers, which won't
interpolate smoothly.

Instead, interpolate absolute positions.
2023-11-21 12:41:45 +00:00
MrCheeze d23d16cb11 avm2: Report ProgressEvent when a sound is loaded (close #8932) 2023-11-20 16:14:03 -08:00
Robin Allen 1ce772befa core: fix lerp_twips sometimes being off-by-one due to FP error 2023-11-20 13:21:32 +01:00
renovate[bot] 7757d060ff fix(deps): update rust dependencies to v2 2023-11-20 09:03:08 +01:00
Aaron Hill 92a50d37f0 avm2: Mark MovieClip as initialized in 'on_construction_complete'
This ensures that a re-entrant 'construct_frame' call (e.g. due
to a goto or AVM2 button) does not end up marking a MovieClip as
initialized too early.

This issue was causing us to run 'fire_init_and_complete_events' too
early, firing Loader events before we had actually finished (and
before the SWF had registered the relevant listeners).
2023-11-19 20:52:23 -05:00
Lord-McSweeney 23a65c50f2 avm2: Add `Activation::caller_movie_or_root` to default to root movie and use it 2023-11-19 11:50:50 -08:00
Lord-McSweeney 5be2eb499a avm1: Copy `Activation`'s local register set when running a `catch` 2023-11-19 10:15:36 -08:00
sleepycatcoding a78a67ee24 avm2: Implement [[HasProperty]] for XMLList 2023-11-16 16:09:37 -05:00
Daniel Jacobs 117a4ea0bf avm2: Add ContextMenu clipboard related properties 2023-11-16 15:53:10 -05:00
Daniel Jacobs 75923e5568 avm2: Make MouseEvent isRelatedPropertyInaccessible a getter/setter 2023-11-16 18:33:26 +01:00
Nathan Adams d6f16b0be5 tests: Make tests use a virtual filesystem, which currently maps to the regular physical FS rooted in a test directory 2023-11-13 22:28:10 +01:00
Tom Schuster 1e5e80aa2c avm2: GroupElement TLF improvements 2023-11-13 21:59:29 +01:00
Nathan Adams f2b02acf44 chore: Appease clippy-beta 2023-11-13 20:26:50 +01:00
renovate[bot] 32c65e6460 fix(deps): update rust dependencies 2023-11-13 09:10:26 +01:00
TÖRÖK Attila 11c5a68452 avm2: nit: Fix typo: explict_namespace -> explicit_namespace
Spotted by @Lord-McSweeney.
2023-11-12 14:58:32 -08:00
TÖRÖK Attila 660cdd9477 core: nit: Fixed a typo and a double space in comments. 2023-11-12 14:58:32 -08:00
Aaron Hill 1501a858f6 avm2: Improve E4XNode::matches_name
Avmplus constructs a full `QName`, and uses the normal
Multiname matching logic. This would be a large refactor,
so I've just modified the existing method to properly
handle multiple namespaces.

I've also included a closely related fix - we should only treat
a multiname with the literal local name "@foo" as an attribute
when the namespace is the empty public namespace. We were incorrectly
reparsing multinames that contained multiple namespaces.
2023-11-12 17:38:56 -05:00
Tom Schuster 451e4bad10 amv2: Simplify XmlObject get_enumerant_name 2023-11-12 22:03:52 +01:00
Lord-McSweeney 576c7e1b14 avm2: Add `AccessibilityImplementation.accDoDefaultAction` 2023-11-12 06:52:51 -08:00
Aaron Hill de4d58630a avm2: Add stub for Graphics uvt parameter 2023-11-12 15:19:47 +01:00
Aaron Hill c360d45729 avm2: Use 'has_own_property' to check for prop in 'resolve_definition'
If Actionscript explicitly sets the property to 'undefined', we
should still succeed.
2023-11-12 00:38:35 +01:00
Lord-McSweeney 3cc9915076 avm2: TLF EditTexts should not be selectable 2023-11-11 06:53:18 -08:00
Lord-McSweeney fdb2a06ad8 avm2: Fix TLF text getting cut off vertically 2023-11-11 06:53:18 -08:00
Lord-McSweeney 1bb2422595
avm2: Correctness fixes to AMF serialization (#13537)
Fixes some cases where `amf::serialize_value` returns `None`
---------

Co-authored-by: Lord-McSweeney <Lord-McSweeney@github.com>
2023-11-10 17:59:26 -08:00
Lord-McSweeney 172b76d01f avm2: `DataEvent` fixes
- `DataEvent.data` should delegate to the superclass's `TextEvent.text`
- `DataEvent.clone` implementation was wrong
2023-11-10 15:09:28 -08:00
Aaron Hill b056e12f4b avm2: Re-use same AMFValue for the same Object ptr
This preserves object identity across a serialization
round-trip. Unfortunately, we don't currently implement this
correctly in flash_lso, so I've added a stub message.

Once flash_lso is fixed, this code will start working. For now,
it just allows us to detect (via the stub) if this is actually
used by an SWF.
2023-11-10 17:52:47 -05:00
sleepycatcoding e8ccbf4e2c avm2: Support enumeration for XML objects
Previously, iterating the XML object would iterate the prototype. This broke filtering expressions on XML objects, which should work.
2023-11-10 22:50:19 +01:00
Nathan Adams f03b6307a8 core: Don't invalidate when setting filters to the same value 2023-11-10 22:24:45 +01:00
Nathan Adams bce0608e1f tests: Move all wgpu code out of test framework, make it abstract over any/no renderer, and make wgpu option if imgtests isn't enabled 2023-11-10 22:02:18 +01:00
Lord-McSweeney 2f5166790c chore: Update flash-lso 2023-11-10 18:26:02 +01:00
Lord-McSweeney d51cfff03d chore: Remove leftover `println!` 2023-11-09 22:38:09 -05:00
Aaron Hill c821d0564e avm2: Use class aliases to serialize Vector type
This allows us to round-trip `Vector.<CustomType>` when
`CustomType` has an alias registered.
2023-11-09 22:01:59 -05:00
Aaron Hill 7110be920c Suport uploading ATFTextureData::CompressedRawAlpha
Fortunately, this is very simple - we can just take
the DXT5 data and upload it directly to the wgpu texture.
2023-11-10 02:00:40 +01:00
Aaron Hill 2cb1efca8c avm2: Improve AVM2 button construction handling
An Avm2 button appears to run a 'nested frame' during construction -
the same type of 'nested frame' performed by a goto. This will
run framescripts for all objects in the display hierarchy (including
orphans), resulting in an unusual child->parent framescript execution
order that DeathVsMonstars_decrypted.swf depends on.
2023-11-10 01:33:07 +01:00
Mike Welsh 5232854f00 avm1: Implement `MovieClip.scale9Grid` 2023-11-09 21:38:53 +01:00
Mike Welsh aacc67b096 avm2: Implement `DisplayObject.scale9Grid` 2023-11-09 21:38:53 +01:00
Mike Welsh cc6320a2dc core: Add `DisplayObject::scaling_grid` 2023-11-09 21:38:53 +01:00
Richy McGregor 10ebc60a7d core: Always redraw text in relayout 2023-11-09 21:20:10 +01:00
Richy McGregor 924e5ef632 core: Store EditText requested height and width (close #13026)
remove now unused EditTextStatic bounds
2023-11-09 21:20:10 +01:00
Richy McGregor 4c819b5fca core: Make set_width & set_height call relayout
this requires an UpdateContext to be passed into both methods
2023-11-09 21:20:10 +01:00
Richy McGregor fcc0d14188 core: Derive Debug for AutoSizeMode 2023-11-09 21:20:10 +01:00
Richy McGregor dd083dd502 chore: Fix typos 2023-11-09 21:20:10 +01:00
Nathan Adams 6061186c0f core: Fix formatting texts when they start with any amount of <br>s 2023-11-09 20:52:16 +01:00