Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avm2: Support reading metadata through flash.utils.describeType #11275

Merged

Conversation

Lord-McSweeney
Copy link
Collaborator

@Lord-McSweeney Lord-McSweeney commented May 29, 2023

This caught a bug in swf: swf would parse key-value pairs for metadata incorrectly.
Progresses New Club Penguin (#8330), and also anything else that uses the Robotlegs or SwiftSuspenders frameworks.

Unfortunately this doesn't progress #10403, even though I've confirmed that the class that was being checked has the same describeType output in FP and in Ruffle (so I would assume something's breaking with Robotlegs).

@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch from de6925d to ef43e3a Compare June 1, 2023 01:26
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch from ef43e3a to 9fc1a29 Compare June 2, 2023 23:07
core/src/avm2/traits.rs Outdated Show resolved Hide resolved
core/src/avm2/vtable.rs Outdated Show resolved Hide resolved
@@ -222,6 +335,7 @@ impl<'gc> Trait<'gc> {
disp_id: *disp_id,
method: unit.load_method(*method, false, activation)?,
},
metadata: metadata_from_abc_trait(activation, unit, abc_trait.metadata.clone())?,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we wanted these to be loaded lazily (at describeType() time) from the TU, rather than eagerly? Most metadata is not used so we'd prefer to just store the index and forget about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be resolved to None very quickly if there's no metadata

core/src/avm2/traits.rs Outdated Show resolved Hide resolved
core/src/avm2/traits.rs Show resolved Hide resolved
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch 4 times, most recently from c7f1500 to b71f3c5 Compare June 7, 2023 19:39
@Lord-McSweeney Lord-McSweeney requested a review from adrian17 June 7, 2023 20:36
@Lord-McSweeney Lord-McSweeney added the waiting-on-review Waiting on review from a Ruffle team member label Jun 8, 2023
core/src/avm2/traits.rs Outdated Show resolved Hide resolved
core/src/avm2/globals/flash/utils.rs Outdated Show resolved Hide resolved
core/src/avm2/traits.rs Outdated Show resolved Hide resolved
core/src/avm2/vtable.rs Outdated Show resolved Hide resolved
@Dinnerbone Dinnerbone added waiting-on-author Waiting on the PR author to make the requested changes and removed waiting-on-review Waiting on review from a Ruffle team member labels Jul 17, 2023
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch 2 times, most recently from d846f47 to 187e3d0 Compare July 18, 2023 18:39
@Lord-McSweeney Lord-McSweeney requested a review from adrian17 July 18, 2023 18:40
@Lord-McSweeney Lord-McSweeney added waiting-on-review Waiting on review from a Ruffle team member and removed waiting-on-author Waiting on the PR author to make the requested changes labels Jul 18, 2023
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch from 187e3d0 to 693a433 Compare July 18, 2023 18:42
core/src/avm2/traits.rs Outdated Show resolved Hide resolved
@@ -287,6 +305,10 @@ impl<'gc> Trait<'gc> {
&self.kind
}

pub fn metadata(&self) -> Option<Box<[Metadata<'gc>]>> {
self.metadata.clone()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(still wish we didn't do copying here, but I guess it's not that big of a deal...
Hopefully maybe some future class refactor might allow us to squash the duplication.)

core/src/avm2/vtable.rs Outdated Show resolved Hide resolved
core/src/avm2/globals/flash/utils.rs Outdated Show resolved Hide resolved
…in describeType; parse ABC metadata key-value pairs correctly; add test
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-describeType-improved branch from dcfecc1 to f8b3309 Compare July 19, 2023 09:46
@Lord-McSweeney Lord-McSweeney requested a review from adrian17 July 19, 2023 09:58
@adrian17 adrian17 merged commit 5975714 into ruffle-rs:master Jul 19, 2023
@Lord-McSweeney Lord-McSweeney removed the waiting-on-review Waiting on review from a Ruffle team member label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants